@capgo/capacitor-launch-navigator 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'CapgoCapacitorLaunchNavigator'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.license = package['license']
10
+ s.homepage = package['repository']['url']
11
+ s.author = package['author']
12
+ s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
+ s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
14
+ s.ios.deployment_target = '14.0'
15
+ s.dependency 'Capacitor'
16
+ s.swift_version = '5.1'
17
+ end
package/Package.swift ADDED
@@ -0,0 +1,28 @@
1
+ // swift-tools-version: 5.9
2
+ import PackageDescription
3
+
4
+ let package = Package(
5
+ name: "CapgoCapacitorLaunchNavigator",
6
+ platforms: [.iOS(.v14)],
7
+ products: [
8
+ .library(
9
+ name: "CapgoCapacitorLaunchNavigator",
10
+ targets: ["LaunchNavigatorPlugin"])
11
+ ],
12
+ dependencies: [
13
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0")
14
+ ],
15
+ targets: [
16
+ .target(
17
+ name: "LaunchNavigatorPlugin",
18
+ dependencies: [
19
+ .product(name: "Capacitor", package: "capacitor-swift-pm"),
20
+ .product(name: "Cordova", package: "capacitor-swift-pm")
21
+ ],
22
+ path: "ios/Sources/LaunchNavigatorPlugin"),
23
+ .testTarget(
24
+ name: "LaunchNavigatorPluginTests",
25
+ dependencies: ["LaunchNavigatorPlugin"],
26
+ path: "ios/Tests/LaunchNavigatorPluginTests")
27
+ ]
28
+ )
package/README.md ADDED
@@ -0,0 +1,316 @@
1
+ # @capgo/capacitor-launch-navigator
2
+ <a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
3
+
4
+ <div align="center">
5
+ <h2><a href="https://capgo.app/?ref=plugin"> ➡️ Get Instant updates for your App with Capgo</a></h2>
6
+ <h2><a href="https://capgo.app/consulting/?ref=plugin"> Missing a feature? We’ll build the plugin for you 💪</a></h2>
7
+ </div>
8
+
9
+ Capacitor plugin for launching navigation apps to navigate to a destination.
10
+
11
+ This plugin is a Capacitor port of the popular phonegap-launch-navigator plugin, supporting navigation with latitude/longitude coordinates only (no address support - use [@capgo/capacitor-nativegeocoder](https://github.com/Cap-go/capacitor-nativegeocoder) for address geocoding).
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install @capgo/capacitor-launch-navigator
17
+ npx cap sync
18
+ ```
19
+
20
+ ## iOS Setup
21
+
22
+ Add URL schemes to your `Info.plist` to detect installed navigation apps:
23
+
24
+ ```xml
25
+ <key>LSApplicationQueriesSchemes</key>
26
+ <array>
27
+ <string>comgooglemaps</string>
28
+ <string>waze</string>
29
+ <string>citymapper</string>
30
+ <string>navigon</string>
31
+ <string>transit</string>
32
+ <string>yandexnavi</string>
33
+ <string>uber</string>
34
+ <string>tomtomgo</string>
35
+ <string>com.sygic.aura</string>
36
+ <string>here-route</string>
37
+ <string>moovit</string>
38
+ <string>lyft</string>
39
+ <string>mapsme</string>
40
+ <string>cabify</string>
41
+ <string>baidumap</string>
42
+ <string>iosamap</string>
43
+ <string>99app</string>
44
+ </array>
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ ```typescript
50
+ import { LaunchNavigator, IOSNavigationApp, AndroidNavigationApp, TransportMode } from '@capgo/capacitor-launch-navigator';
51
+
52
+ // Navigate to a location using default app
53
+ await LaunchNavigator.navigate({
54
+ destination: [37.7749, -122.4194] // San Francisco coordinates
55
+ });
56
+
57
+ // Navigate with options
58
+ await LaunchNavigator.navigate({
59
+ destination: [37.7749, -122.4194],
60
+ options: {
61
+ start: [37.7849, -122.4094], // Starting point
62
+ app: 'google_maps', // Specific app to use
63
+ transportMode: TransportMode.DRIVING
64
+ }
65
+ });
66
+
67
+ // Check if an app is available
68
+ const { available } = await LaunchNavigator.isAppAvailable({
69
+ app: IOSNavigationApp.GOOGLE_MAPS
70
+ });
71
+
72
+ // Get list of available navigation apps
73
+ const { apps } = await LaunchNavigator.getAvailableApps();
74
+ apps.forEach(app => {
75
+ console.log(`${app.name} is ${app.available ? 'available' : 'not installed'}`);
76
+ });
77
+ ```
78
+
79
+ ## Important Notes
80
+
81
+ - **Coordinates Only**: This plugin only accepts latitude/longitude coordinates for navigation. Address strings are not supported.
82
+ - **Address Geocoding**: If you need to convert addresses to coordinates, use [@capgo/capacitor-nativegeocoder](https://github.com/Cap-go/capacitor-nativegeocoder).
83
+
84
+ ## Supported Navigation Apps
85
+
86
+ ### iOS
87
+ - Apple Maps
88
+ - Google Maps
89
+ - Waze
90
+ - Citymapper
91
+ - Garmin Navigon
92
+ - Transit App
93
+ - Yandex Navigator
94
+ - Uber
95
+ - TomTom
96
+ - Sygic
97
+ - HERE Maps
98
+ - Moovit
99
+ - Lyft
100
+ - MAPS.ME
101
+ - Cabify
102
+ - Baidu Maps
103
+ - Gaode Maps
104
+ - 99 Taxi
105
+
106
+ ### Android
107
+ - Google Maps
108
+ - Waze
109
+ - Citymapper
110
+ - Uber
111
+ - Yandex Navigator
112
+ - Sygic
113
+ - HERE Maps
114
+ - Moovit
115
+ - Lyft
116
+ - MAPS.ME
117
+ - Cabify
118
+ - Baidu Maps
119
+ - Gaode Maps
120
+
121
+ ## API
122
+
123
+ <docgen-index>
124
+
125
+ * [`navigate(...)`](#navigate)
126
+ * [`isAppAvailable(...)`](#isappavailable)
127
+ * [`getAvailableApps()`](#getavailableapps)
128
+ * [`getSupportedApps()`](#getsupportedapps)
129
+ * [`getDefaultApp()`](#getdefaultapp)
130
+ * [Interfaces](#interfaces)
131
+ * [Type Aliases](#type-aliases)
132
+ * [Enums](#enums)
133
+
134
+ </docgen-index>
135
+
136
+ <docgen-api>
137
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
138
+
139
+ Main plugin interface
140
+
141
+ ### navigate(...)
142
+
143
+ ```typescript
144
+ navigate(options: { destination: [number, number]; options?: NavigateOptions; }) => Promise<void>
145
+ ```
146
+
147
+ Navigate to a location using latitude and longitude
148
+
149
+ | Param | Type | Description |
150
+ | ------------- | --------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
151
+ | **`options`** | <code>{ destination: [number, number]; options?: <a href="#navigateoptions">NavigateOptions</a>; }</code> | Navigation options with destination coordinates |
152
+
153
+ --------------------
154
+
155
+
156
+ ### isAppAvailable(...)
157
+
158
+ ```typescript
159
+ isAppAvailable(options: { app: IOSNavigationApp | AndroidNavigationApp | string; }) => Promise<{ available: boolean; }>
160
+ ```
161
+
162
+ Check if a specific navigation app is available
163
+
164
+ | Param | Type | Description |
165
+ | ------------- | ----------------------------- | --------------------------------- |
166
+ | **`options`** | <code>{ app: string; }</code> | Options containing app identifier |
167
+
168
+ **Returns:** <code>Promise&lt;{ available: boolean; }&gt;</code>
169
+
170
+ --------------------
171
+
172
+
173
+ ### getAvailableApps()
174
+
175
+ ```typescript
176
+ getAvailableApps() => Promise<{ apps: AvailableApp[]; }>
177
+ ```
178
+
179
+ Get list of available navigation apps on the device
180
+
181
+ **Returns:** <code>Promise&lt;{ apps: AvailableApp[]; }&gt;</code>
182
+
183
+ --------------------
184
+
185
+
186
+ ### getSupportedApps()
187
+
188
+ ```typescript
189
+ getSupportedApps() => Promise<{ apps: string[]; }>
190
+ ```
191
+
192
+ Get list of supported apps for the current platform
193
+
194
+ **Returns:** <code>Promise&lt;{ apps: string[]; }&gt;</code>
195
+
196
+ --------------------
197
+
198
+
199
+ ### getDefaultApp()
200
+
201
+ ```typescript
202
+ getDefaultApp() => Promise<{ app: string; }>
203
+ ```
204
+
205
+ Get the name of the default app for navigation
206
+
207
+ **Returns:** <code>Promise&lt;{ app: string; }&gt;</code>
208
+
209
+ --------------------
210
+
211
+
212
+ ### Interfaces
213
+
214
+
215
+ #### NavigateOptions
216
+
217
+ Options for navigation
218
+
219
+ | Prop | Type | Description |
220
+ | --------------------- | ------------------------------------------------------------ | --------------------------------------------------------------------- |
221
+ | **`start`** | <code>[number, number]</code> | Starting location coordinates [latitude, longitude] |
222
+ | **`startName`** | <code>string</code> | Starting location name |
223
+ | **`destinationName`** | <code>string</code> | Destination name (will be ignored since we only support coordinates) |
224
+ | **`transportMode`** | <code><a href="#transportmode">TransportMode</a></code> | Transport mode |
225
+ | **`app`** | <code>string</code> | Specific app to launch (if not specified, will use default or prompt) |
226
+ | **`launchMode`** | <code><a href="#launchmode">LaunchMode</a></code> | Launch mode |
227
+ | **`extras`** | <code><a href="#record">Record</a>&lt;string, any&gt;</code> | Additional parameters specific to certain apps |
228
+ | **`enableDebug`** | <code>boolean</code> | Enable debug logging |
229
+
230
+
231
+ #### AvailableApp
232
+
233
+ Result of checking app availability
234
+
235
+ | Prop | Type | Description |
236
+ | --------------- | -------------------- | ------------------------------------------ |
237
+ | **`app`** | <code>string</code> | App identifier |
238
+ | **`name`** | <code>string</code> | Display name of the app |
239
+ | **`available`** | <code>boolean</code> | Whether the app is available on the device |
240
+
241
+
242
+ ### Type Aliases
243
+
244
+
245
+ #### Record
246
+
247
+ Construct a type with a set of properties K of type T
248
+
249
+ <code>{
250
  [P in K]: T;
1
251
  }</code>
252
+
253
+
254
+ ### Enums
255
+
256
+
257
+ #### TransportMode
258
+
259
+ | Members | Value |
260
+ | --------------- | ------------------------ |
261
+ | **`DRIVING`** | <code>'driving'</code> |
262
+ | **`WALKING`** | <code>'walking'</code> |
263
+ | **`BICYCLING`** | <code>'bicycling'</code> |
264
+ | **`TRANSIT`** | <code>'transit'</code> |
265
+
266
+
267
+ #### IOSNavigationApp
268
+
269
+ | Members | Value |
270
+ | ---------------------- | ----------------------------- |
271
+ | **`APPLE_MAPS`** | <code>'apple_maps'</code> |
272
+ | **`GOOGLE_MAPS`** | <code>'google_maps'</code> |
273
+ | **`WAZE`** | <code>'waze'</code> |
274
+ | **`CITYMAPPER`** | <code>'citymapper'</code> |
275
+ | **`GARMIN_NAVIGON`** | <code>'garmin_navigon'</code> |
276
+ | **`TRANSIT_APP`** | <code>'transit_app'</code> |
277
+ | **`YANDEX_NAVIGATOR`** | <code>'yandex'</code> |
278
+ | **`UBER`** | <code>'uber'</code> |
279
+ | **`TOMTOM`** | <code>'tomtom'</code> |
280
+ | **`SYGIC`** | <code>'sygic'</code> |
281
+ | **`HERE_MAPS`** | <code>'here'</code> |
282
+ | **`MOOVIT`** | <code>'moovit'</code> |
283
+ | **`LYFT`** | <code>'lyft'</code> |
284
+ | **`MAPS_ME`** | <code>'mapsme'</code> |
285
+ | **`CABIFY`** | <code>'cabify'</code> |
286
+ | **`BAIDU`** | <code>'baidu'</code> |
287
+ | **`GAODE`** | <code>'gaode'</code> |
288
+ | **`TAXI_99`** | <code>'99taxi'</code> |
289
+
290
+
291
+ #### AndroidNavigationApp
292
+
293
+ | Members | Value |
294
+ | ----------------- | -------------------------- |
295
+ | **`GOOGLE_MAPS`** | <code>'google_maps'</code> |
296
+ | **`WAZE`** | <code>'waze'</code> |
297
+ | **`CITYMAPPER`** | <code>'citymapper'</code> |
298
+ | **`UBER`** | <code>'uber'</code> |
299
+ | **`YANDEX`** | <code>'yandex'</code> |
300
+ | **`SYGIC`** | <code>'sygic'</code> |
301
+ | **`HERE_MAPS`** | <code>'here'</code> |
302
+ | **`MOOVIT`** | <code>'moovit'</code> |
303
+ | **`LYFT`** | <code>'lyft'</code> |
304
+ | **`MAPS_ME`** | <code>'mapsme'</code> |
305
+ | **`CABIFY`** | <code>'cabify'</code> |
306
+ | **`BAIDU`** | <code>'baidu'</code> |
307
+ | **`GAODE`** | <code>'gaode'</code> |
308
+
309
+
310
+ #### LaunchMode
311
+
312
+ | Members | Value |
313
+ | ------------------ | --------------------------- |
314
+ | **`MAPS`** | <code>'maps'</code> |
315
+ | **`TURN_BY_TURN`** | <code>'turn_by_turn'</code> |
316
+ | **`GEO`** | <code>'geo'</code> |
317
+
318
+ </docgen-api>
@@ -0,0 +1,58 @@
1
+ ext {
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.0'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.2.1'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'
6
+ }
7
+
8
+ buildscript {
9
+ repositories {
10
+ google()
11
+ mavenCentral()
12
+ }
13
+ dependencies {
14
+ classpath 'com.android.tools.build:gradle:8.7.2'
15
+ }
16
+ }
17
+
18
+ apply plugin: 'com.android.library'
19
+
20
+ android {
21
+ namespace "app.capgo.plugin.launch_navigator"
22
+ compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 35
23
+ defaultConfig {
24
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 23
25
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 35
26
+ versionCode 1
27
+ versionName "1.0"
28
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
29
+ }
30
+ buildTypes {
31
+ release {
32
+ minifyEnabled false
33
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
34
+ }
35
+ }
36
+ lintOptions {
37
+ abortOnError false
38
+ }
39
+ compileOptions {
40
+ sourceCompatibility JavaVersion.VERSION_21
41
+ targetCompatibility JavaVersion.VERSION_21
42
+ }
43
+ }
44
+
45
+ repositories {
46
+ google()
47
+ mavenCentral()
48
+ }
49
+
50
+
51
+ dependencies {
52
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
53
+ implementation project(':capacitor-android')
54
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
55
+ testImplementation "junit:junit:$junitVersion"
56
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
57
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
58
+ }
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>