@capgo/capacitor-launch-navigator 8.0.20 → 8.0.22

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.
package/README.md CHANGED
@@ -52,9 +52,14 @@ Add URL schemes to your `Info.plist` to detect installed navigation apps:
52
52
  <string>moovit</string>
53
53
  <string>lyft</string>
54
54
  <string>mapsme</string>
55
+ <string>guru</string>
56
+ <string>om</string>
57
+ <string>yandexmaps</string>
58
+ <string>dgis</string>
55
59
  <string>cabify</string>
56
60
  <string>baidumap</string>
57
61
  <string>iosamap</string>
62
+ <string>tesla</string>
58
63
  <string>99app</string>
59
64
  </array>
60
65
  ```
@@ -82,9 +87,17 @@ The following navigation apps are declared in the plugin's manifest:
82
87
  <package android:name="com.tranzmate" />
83
88
  <package android:name="me.lyft.android" />
84
89
  <package android:name="com.mapswithme.maps.pro" />
90
+ <package android:name="com.tomtom.gplay.navapp" />
91
+ <package android:name="com.bodunov.galileo" />
92
+ <package android:name="com.bodunov.GalileoPro" />
93
+ <package android:name="app.organicmaps" />
94
+ <package android:name="ru.yandex.yandexmaps" />
95
+ <package android:name="cz.seznam.mapy" />
96
+ <package android:name="ru.dublgis.dgismobile" />
85
97
  <package android:name="com.cabify.rider" />
86
98
  <package android:name="com.baidu.BaiduMap" />
87
99
  <package android:name="com.autonavi.minimap" />
100
+ <package android:name="com.teslamotors.tesla" />
88
101
  </queries>
89
102
  ```
90
103
 
@@ -126,12 +139,32 @@ const { apps } = await LaunchNavigator.getAvailableApps();
126
139
  apps.forEach(app => {
127
140
  console.log(`${app.name} is ${app.available ? 'available' : 'not installed'}`);
128
141
  });
142
+
143
+ // Fetch local provider icons for display
144
+ const { icons, failures } = await LaunchNavigator.getAppIcons({
145
+ apps: ['google_maps', 'waze']
146
+ });
147
+
148
+ icons.forEach(icon => {
149
+ const image = document.querySelector<HTMLImageElement>(`img[data-app="${icon.app}"]`);
150
+ if (image) {
151
+ image.src = icon.localUrl; // Uses the local cache after the first fetch
152
+ }
153
+ });
154
+
155
+ // Force a refresh when an icon needs to be repaired
156
+ await LaunchNavigator.refreshAppIcons({
157
+ apps: ['waze']
158
+ });
159
+
160
+ console.log('Icon failures:', failures);
129
161
  ```
130
162
 
131
163
  ## Important Notes
132
164
 
133
165
  - **Coordinates Only**: This plugin only accepts latitude/longitude coordinates for navigation. Address strings are not supported.
134
166
  - **Address Geocoding**: If you need to convert addresses to coordinates, use [@capgo/capacitor-nativegeocoder](https://github.com/Cap-go/capacitor-nativegeocoder).
167
+ - **Tesla**: `app: 'tesla'` shares a Google Maps position text to the Tesla app. Android targets the Tesla app directly; iOS opens the native share sheet because iOS does not allow selecting another app's share extension programmatically.
135
168
 
136
169
  ## Supported Navigation Apps
137
170
 
@@ -150,9 +183,14 @@ apps.forEach(app => {
150
183
  - Moovit
151
184
  - Lyft
152
185
  - MAPS.ME
186
+ - Guru Maps
187
+ - Organic Maps
188
+ - Yandex Maps
189
+ - 2GIS
153
190
  - Cabify
154
191
  - Baidu Maps
155
192
  - Gaode Maps
193
+ - Tesla
156
194
  - 99 Taxi
157
195
 
158
196
  ### Android
@@ -166,9 +204,16 @@ apps.forEach(app => {
166
204
  - Moovit
167
205
  - Lyft
168
206
  - MAPS.ME
207
+ - TomTom GO
208
+ - Guru Maps
209
+ - Organic Maps
210
+ - Yandex Maps
211
+ - Mapy.com
212
+ - 2GIS
169
213
  - Cabify
170
214
  - Baidu Maps
171
215
  - Gaode Maps
216
+ - Tesla
172
217
 
173
218
  ## API
174
219
 
@@ -179,6 +224,9 @@ apps.forEach(app => {
179
224
  * [`getAvailableApps()`](#getavailableapps)
180
225
  * [`getSupportedApps()`](#getsupportedapps)
181
226
  * [`getDefaultApp()`](#getdefaultapp)
227
+ * [`getAppIcons(...)`](#getappicons)
228
+ * [`refreshAppIcons(...)`](#refreshappicons)
229
+ * [`clearIconCache(...)`](#cleariconcache)
182
230
  * [`getPluginVersion()`](#getpluginversion)
183
231
  * [Interfaces](#interfaces)
184
232
  * [Type Aliases](#type-aliases)
@@ -262,6 +310,60 @@ Get the name of the default app for navigation
262
310
  --------------------
263
311
 
264
312
 
313
+ ### getAppIcons(...)
314
+
315
+ ```typescript
316
+ getAppIcons(options?: GetAppIconsOptions | undefined) => Promise<ProviderIconsResult>
317
+ ```
318
+
319
+ Fetch provider icons and cache them locally.
320
+
321
+ The native implementations revalidate cached icons after 24 hours by default.
322
+ Pass `forceRefresh: true` to bypass the cache when an icon must be repaired.
323
+
324
+ | Param | Type |
325
+ | ------------- | ----------------------------------------------------------------- |
326
+ | **`options`** | <code><a href="#getappiconsoptions">GetAppIconsOptions</a></code> |
327
+
328
+ **Returns:** <code>Promise&lt;<a href="#providericonsresult">ProviderIconsResult</a>&gt;</code>
329
+
330
+ --------------------
331
+
332
+
333
+ ### refreshAppIcons(...)
334
+
335
+ ```typescript
336
+ refreshAppIcons(options?: GetAppIconsOptions | undefined) => Promise<ProviderIconsResult>
337
+ ```
338
+
339
+ Refresh provider icons, ignoring the cache age.
340
+
341
+ | Param | Type |
342
+ | ------------- | ----------------------------------------------------------------- |
343
+ | **`options`** | <code><a href="#getappiconsoptions">GetAppIconsOptions</a></code> |
344
+
345
+ **Returns:** <code>Promise&lt;<a href="#providericonsresult">ProviderIconsResult</a>&gt;</code>
346
+
347
+ --------------------
348
+
349
+
350
+ ### clearIconCache(...)
351
+
352
+ ```typescript
353
+ clearIconCache(options?: ClearIconCacheOptions | undefined) => Promise<{ cleared: number; }>
354
+ ```
355
+
356
+ Clear cached provider icons.
357
+
358
+ | Param | Type |
359
+ | ------------- | ----------------------------------------------------------------------- |
360
+ | **`options`** | <code><a href="#cleariconcacheoptions">ClearIconCacheOptions</a></code> |
361
+
362
+ **Returns:** <code>Promise&lt;{ cleared: number; }&gt;</code>
363
+
364
+ --------------------
365
+
366
+
265
367
  ### getPluginVersion()
266
368
 
267
369
  ```typescript
@@ -305,6 +407,77 @@ Result of checking app availability
305
407
  | **`available`** | <code>boolean</code> | Whether the app is available on the device |
306
408
 
307
409
 
410
+ #### ProviderIconsResult
411
+
412
+ Result of fetching provider icons.
413
+
414
+ | Prop | Type | Description |
415
+ | -------------- | ---------------------------------- | -------------------------------------------------------------- |
416
+ | **`icons`** | <code>ProviderIcon[]</code> | Icons available from cache or freshly downloaded |
417
+ | **`failures`** | <code>ProviderIconFailure[]</code> | Providers that could not be fetched and had no cached fallback |
418
+
419
+
420
+ #### ProviderIcon
421
+
422
+ Cached icon for a navigation provider.
423
+
424
+ | Prop | Type | Description |
425
+ | --------------- | -------------------- | --------------------------------------------------------------------- |
426
+ | **`app`** | <code>string</code> | Navigation app identifier |
427
+ | **`name`** | <code>string</code> | Display name for the provider |
428
+ | **`localUrl`** | <code>string</code> | URL that can be used directly in an image element inside the WebView. |
429
+ | **`sourceUrl`** | <code>string</code> | Web URL used to download the cached image |
430
+ | **`mimeType`** | <code>string</code> | MIME type reported for the cached image, when known |
431
+ | **`fetchedAt`** | <code>number</code> | Unix timestamp in milliseconds when the icon was last fetched |
432
+ | **`fromCache`** | <code>boolean</code> | Whether the icon came from the local cache without a network refresh |
433
+ | **`stale`** | <code>boolean</code> | Whether a stale cached icon was returned because refresh failed |
434
+
435
+
436
+ #### ProviderIconFailure
437
+
438
+ Icon fetch failure for a provider.
439
+
440
+ | Prop | Type | Description |
441
+ | --------------- | ------------------- | ------------------------------- |
442
+ | **`app`** | <code>string</code> | Navigation app identifier |
443
+ | **`name`** | <code>string</code> | Display name for the provider |
444
+ | **`sourceUrl`** | <code>string</code> | Web URL that failed, when known |
445
+ | **`message`** | <code>string</code> | Failure message |
446
+
447
+
448
+ #### GetAppIconsOptions
449
+
450
+ Options for fetching navigation provider icons.
451
+
452
+ | Prop | Type | Description |
453
+ | ------------------ | --------------------------- | -------------------------------------------------------------------------------------- |
454
+ | **`apps`** | <code>string[]</code> | App identifiers to fetch. Defaults to all built-in providers for the current platform. |
455
+ | **`providers`** | <code>IconProvider[]</code> | Provider definitions to fetch or override built-in provider websites. |
456
+ | **`maxAgeMs`** | <code>number</code> | Cache revalidation interval in milliseconds. Defaults to 24 hours. |
457
+ | **`forceRefresh`** | <code>boolean</code> | Ignore the current cache and fetch icons again. |
458
+
459
+
460
+ #### IconProvider
461
+
462
+ Web source used to discover or download a provider icon.
463
+
464
+ | Prop | Type | Description |
465
+ | ------------- | ------------------- | ----------------------------------------------------------------------------------------------------------- |
466
+ | **`app`** | <code>string</code> | Navigation app identifier |
467
+ | **`name`** | <code>string</code> | Display name for the provider |
468
+ | **`url`** | <code>string</code> | Provider website used to discover favicon metadata |
469
+ | **`iconUrl`** | <code>string</code> | Direct image URL. When provided, the plugin downloads this URL instead of discovering a favicon from `url`. |
470
+
471
+
472
+ #### ClearIconCacheOptions
473
+
474
+ Options for clearing cached provider icons.
475
+
476
+ | Prop | Type | Description |
477
+ | ---------- | --------------------- | ------------------------------------------------------- |
478
+ | **`apps`** | <code>string[]</code> | App identifiers to clear. Defaults to all cached icons. |
479
+
480
+
308
481
  ### Type Aliases
309
482
 
310
483
 
@@ -346,29 +519,41 @@ Construct a type with a set of properties K of type T
346
519
  | **`MOOVIT`** | <code>'moovit'</code> |
347
520
  | **`LYFT`** | <code>'lyft'</code> |
348
521
  | **`MAPS_ME`** | <code>'mapsme'</code> |
522
+ | **`GURU_MAPS`** | <code>'guru_maps'</code> |
523
+ | **`ORGANIC_MAPS`** | <code>'organic_maps'</code> |
524
+ | **`YANDEX_MAPS`** | <code>'yandex_maps'</code> |
525
+ | **`TWO_GIS`** | <code>'2gis'</code> |
349
526
  | **`CABIFY`** | <code>'cabify'</code> |
350
527
  | **`BAIDU`** | <code>'baidu'</code> |
351
528
  | **`GAODE`** | <code>'gaode'</code> |
529
+ | **`TESLA`** | <code>'tesla'</code> |
352
530
  | **`TAXI_99`** | <code>'99taxi'</code> |
353
531
 
354
532
 
355
533
  #### AndroidNavigationApp
356
534
 
357
- | Members | Value |
358
- | ----------------- | -------------------------- |
359
- | **`GOOGLE_MAPS`** | <code>'google_maps'</code> |
360
- | **`WAZE`** | <code>'waze'</code> |
361
- | **`CITYMAPPER`** | <code>'citymapper'</code> |
362
- | **`UBER`** | <code>'uber'</code> |
363
- | **`YANDEX`** | <code>'yandex'</code> |
364
- | **`SYGIC`** | <code>'sygic'</code> |
365
- | **`HERE_MAPS`** | <code>'here'</code> |
366
- | **`MOOVIT`** | <code>'moovit'</code> |
367
- | **`LYFT`** | <code>'lyft'</code> |
368
- | **`MAPS_ME`** | <code>'mapsme'</code> |
369
- | **`CABIFY`** | <code>'cabify'</code> |
370
- | **`BAIDU`** | <code>'baidu'</code> |
371
- | **`GAODE`** | <code>'gaode'</code> |
535
+ | Members | Value |
536
+ | ------------------ | --------------------------- |
537
+ | **`GOOGLE_MAPS`** | <code>'google_maps'</code> |
538
+ | **`WAZE`** | <code>'waze'</code> |
539
+ | **`CITYMAPPER`** | <code>'citymapper'</code> |
540
+ | **`UBER`** | <code>'uber'</code> |
541
+ | **`YANDEX`** | <code>'yandex'</code> |
542
+ | **`SYGIC`** | <code>'sygic'</code> |
543
+ | **`HERE_MAPS`** | <code>'here'</code> |
544
+ | **`MOOVIT`** | <code>'moovit'</code> |
545
+ | **`LYFT`** | <code>'lyft'</code> |
546
+ | **`MAPS_ME`** | <code>'mapsme'</code> |
547
+ | **`TOMTOM`** | <code>'tomtom'</code> |
548
+ | **`GURU_MAPS`** | <code>'guru_maps'</code> |
549
+ | **`ORGANIC_MAPS`** | <code>'organic_maps'</code> |
550
+ | **`YANDEX_MAPS`** | <code>'yandex_maps'</code> |
551
+ | **`MAPY`** | <code>'mapy'</code> |
552
+ | **`TWO_GIS`** | <code>'2gis'</code> |
553
+ | **`CABIFY`** | <code>'cabify'</code> |
554
+ | **`BAIDU`** | <code>'baidu'</code> |
555
+ | **`GAODE`** | <code>'gaode'</code> |
556
+ | **`TESLA`** | <code>'tesla'</code> |
372
557
 
373
558
 
374
559
  #### LaunchMode
@@ -1,4 +1,6 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <uses-permission android:name="android.permission.INTERNET" />
3
+
2
4
  <queries>
3
5
  <package android:name="com.google.android.apps.maps" />
4
6
  <package android:name="com.waze" />
@@ -10,8 +12,16 @@
10
12
  <package android:name="com.tranzmate" />
11
13
  <package android:name="me.lyft.android" />
12
14
  <package android:name="com.mapswithme.maps.pro" />
15
+ <package android:name="com.tomtom.gplay.navapp" />
16
+ <package android:name="com.bodunov.galileo" />
17
+ <package android:name="com.bodunov.GalileoPro" />
18
+ <package android:name="app.organicmaps" />
19
+ <package android:name="ru.yandex.yandexmaps" />
20
+ <package android:name="cz.seznam.mapy" />
21
+ <package android:name="ru.dublgis.dgismobile" />
13
22
  <package android:name="com.cabify.rider" />
14
23
  <package android:name="com.baidu.BaiduMap" />
15
24
  <package android:name="com.autonavi.minimap" />
25
+ <package android:name="com.teslamotors.tesla" />
16
26
  </queries>
17
27
  </manifest>