@capgo/capacitor-launch-navigator 8.0.20 → 8.0.21

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.
@@ -10,13 +10,13 @@ import com.getcapacitor.annotation.CapacitorPlugin;
10
10
  @CapacitorPlugin(name = "LaunchNavigator")
11
11
  public class LaunchNavigatorPlugin extends Plugin {
12
12
 
13
- private final String pluginVersion = "8.0.20";
13
+ private final String pluginVersion = "8.0.21";
14
14
 
15
15
  private LaunchNavigator implementation;
16
16
 
17
17
  @Override
18
18
  public void load() {
19
- implementation = new LaunchNavigator(getContext());
19
+ implementation = new LaunchNavigator(getContext(), getBridge());
20
20
  }
21
21
 
22
22
  @PluginMethod
@@ -104,6 +104,66 @@ public class LaunchNavigatorPlugin extends Plugin {
104
104
  call.resolve(ret);
105
105
  }
106
106
 
107
+ @PluginMethod
108
+ public void getAppIcons(PluginCall call) {
109
+ JSObject options = new JSObject();
110
+ try {
111
+ options = new JSObject(call.getData().toString());
112
+ } catch (Exception e) {
113
+ call.reject("Invalid icon options: " + e.getMessage());
114
+ return;
115
+ }
116
+
117
+ JSObject finalOptions = options;
118
+ execute(() -> {
119
+ try {
120
+ call.resolve(implementation.getAppIcons(finalOptions));
121
+ } catch (Exception e) {
122
+ call.reject("Could not get app icons: " + e.getMessage(), e);
123
+ }
124
+ });
125
+ }
126
+
127
+ @PluginMethod
128
+ public void refreshAppIcons(PluginCall call) {
129
+ JSObject options = new JSObject();
130
+ try {
131
+ options = new JSObject(call.getData().toString());
132
+ } catch (Exception e) {
133
+ call.reject("Invalid icon options: " + e.getMessage());
134
+ return;
135
+ }
136
+
137
+ JSObject finalOptions = options;
138
+ execute(() -> {
139
+ try {
140
+ call.resolve(implementation.refreshAppIcons(finalOptions));
141
+ } catch (Exception e) {
142
+ call.reject("Could not refresh app icons: " + e.getMessage(), e);
143
+ }
144
+ });
145
+ }
146
+
147
+ @PluginMethod
148
+ public void clearIconCache(PluginCall call) {
149
+ JSObject options = new JSObject();
150
+ try {
151
+ options = new JSObject(call.getData().toString());
152
+ } catch (Exception e) {
153
+ call.reject("Invalid icon cache options: " + e.getMessage());
154
+ return;
155
+ }
156
+
157
+ JSObject finalOptions = options;
158
+ execute(() -> {
159
+ try {
160
+ call.resolve(implementation.clearIconCache(finalOptions));
161
+ } catch (Exception e) {
162
+ call.reject("Could not clear icon cache: " + e.getMessage(), e);
163
+ }
164
+ });
165
+ }
166
+
107
167
  @PluginMethod
108
168
  public void getPluginVersion(final PluginCall call) {
109
169
  try {
package/dist/docs.json CHANGED
@@ -84,6 +84,62 @@
84
84
  "complexTypes": [],
85
85
  "slug": "getdefaultapp"
86
86
  },
87
+ {
88
+ "name": "getAppIcons",
89
+ "signature": "(options?: GetAppIconsOptions | undefined) => Promise<ProviderIconsResult>",
90
+ "parameters": [
91
+ {
92
+ "name": "options",
93
+ "docs": "",
94
+ "type": "GetAppIconsOptions | undefined"
95
+ }
96
+ ],
97
+ "returns": "Promise<ProviderIconsResult>",
98
+ "tags": [],
99
+ "docs": "Fetch provider icons and cache them locally.\n\nThe native implementations revalidate cached icons after 24 hours by default.\nPass `forceRefresh: true` to bypass the cache when an icon must be repaired.",
100
+ "complexTypes": [
101
+ "ProviderIconsResult",
102
+ "GetAppIconsOptions"
103
+ ],
104
+ "slug": "getappicons"
105
+ },
106
+ {
107
+ "name": "refreshAppIcons",
108
+ "signature": "(options?: GetAppIconsOptions | undefined) => Promise<ProviderIconsResult>",
109
+ "parameters": [
110
+ {
111
+ "name": "options",
112
+ "docs": "",
113
+ "type": "GetAppIconsOptions | undefined"
114
+ }
115
+ ],
116
+ "returns": "Promise<ProviderIconsResult>",
117
+ "tags": [],
118
+ "docs": "Refresh provider icons, ignoring the cache age.",
119
+ "complexTypes": [
120
+ "ProviderIconsResult",
121
+ "GetAppIconsOptions"
122
+ ],
123
+ "slug": "refreshappicons"
124
+ },
125
+ {
126
+ "name": "clearIconCache",
127
+ "signature": "(options?: ClearIconCacheOptions | undefined) => Promise<{ cleared: number; }>",
128
+ "parameters": [
129
+ {
130
+ "name": "options",
131
+ "docs": "",
132
+ "type": "ClearIconCacheOptions | undefined"
133
+ }
134
+ ],
135
+ "returns": "Promise<{ cleared: number; }>",
136
+ "tags": [],
137
+ "docs": "Clear cached provider icons.",
138
+ "complexTypes": [
139
+ "ClearIconCacheOptions"
140
+ ],
141
+ "slug": "cleariconcache"
142
+ },
87
143
  {
88
144
  "name": "getPluginVersion",
89
145
  "signature": "() => Promise<{ version: string; }>",
@@ -210,6 +266,236 @@
210
266
  "type": "boolean"
211
267
  }
212
268
  ]
269
+ },
270
+ {
271
+ "name": "ProviderIconsResult",
272
+ "slug": "providericonsresult",
273
+ "docs": "Result of fetching provider icons.",
274
+ "tags": [],
275
+ "methods": [],
276
+ "properties": [
277
+ {
278
+ "name": "icons",
279
+ "tags": [],
280
+ "docs": "Icons available from cache or freshly downloaded",
281
+ "complexTypes": [
282
+ "ProviderIcon"
283
+ ],
284
+ "type": "ProviderIcon[]"
285
+ },
286
+ {
287
+ "name": "failures",
288
+ "tags": [],
289
+ "docs": "Providers that could not be fetched and had no cached fallback",
290
+ "complexTypes": [
291
+ "ProviderIconFailure"
292
+ ],
293
+ "type": "ProviderIconFailure[]"
294
+ }
295
+ ]
296
+ },
297
+ {
298
+ "name": "ProviderIcon",
299
+ "slug": "providericon",
300
+ "docs": "Cached icon for a navigation provider.",
301
+ "tags": [],
302
+ "methods": [],
303
+ "properties": [
304
+ {
305
+ "name": "app",
306
+ "tags": [],
307
+ "docs": "Navigation app identifier",
308
+ "complexTypes": [],
309
+ "type": "string"
310
+ },
311
+ {
312
+ "name": "name",
313
+ "tags": [],
314
+ "docs": "Display name for the provider",
315
+ "complexTypes": [],
316
+ "type": "string | undefined"
317
+ },
318
+ {
319
+ "name": "localUrl",
320
+ "tags": [],
321
+ "docs": "URL that can be used directly in an image element inside the WebView.",
322
+ "complexTypes": [],
323
+ "type": "string"
324
+ },
325
+ {
326
+ "name": "sourceUrl",
327
+ "tags": [],
328
+ "docs": "Web URL used to download the cached image",
329
+ "complexTypes": [],
330
+ "type": "string"
331
+ },
332
+ {
333
+ "name": "mimeType",
334
+ "tags": [],
335
+ "docs": "MIME type reported for the cached image, when known",
336
+ "complexTypes": [],
337
+ "type": "string | undefined"
338
+ },
339
+ {
340
+ "name": "fetchedAt",
341
+ "tags": [],
342
+ "docs": "Unix timestamp in milliseconds when the icon was last fetched",
343
+ "complexTypes": [],
344
+ "type": "number"
345
+ },
346
+ {
347
+ "name": "fromCache",
348
+ "tags": [],
349
+ "docs": "Whether the icon came from the local cache without a network refresh",
350
+ "complexTypes": [],
351
+ "type": "boolean"
352
+ },
353
+ {
354
+ "name": "stale",
355
+ "tags": [],
356
+ "docs": "Whether a stale cached icon was returned because refresh failed",
357
+ "complexTypes": [],
358
+ "type": "boolean"
359
+ }
360
+ ]
361
+ },
362
+ {
363
+ "name": "ProviderIconFailure",
364
+ "slug": "providericonfailure",
365
+ "docs": "Icon fetch failure for a provider.",
366
+ "tags": [],
367
+ "methods": [],
368
+ "properties": [
369
+ {
370
+ "name": "app",
371
+ "tags": [],
372
+ "docs": "Navigation app identifier",
373
+ "complexTypes": [],
374
+ "type": "string"
375
+ },
376
+ {
377
+ "name": "name",
378
+ "tags": [],
379
+ "docs": "Display name for the provider",
380
+ "complexTypes": [],
381
+ "type": "string | undefined"
382
+ },
383
+ {
384
+ "name": "sourceUrl",
385
+ "tags": [],
386
+ "docs": "Web URL that failed, when known",
387
+ "complexTypes": [],
388
+ "type": "string | undefined"
389
+ },
390
+ {
391
+ "name": "message",
392
+ "tags": [],
393
+ "docs": "Failure message",
394
+ "complexTypes": [],
395
+ "type": "string"
396
+ }
397
+ ]
398
+ },
399
+ {
400
+ "name": "GetAppIconsOptions",
401
+ "slug": "getappiconsoptions",
402
+ "docs": "Options for fetching navigation provider icons.",
403
+ "tags": [],
404
+ "methods": [],
405
+ "properties": [
406
+ {
407
+ "name": "apps",
408
+ "tags": [],
409
+ "docs": "App identifiers to fetch. Defaults to all built-in providers for the current platform.",
410
+ "complexTypes": [
411
+ "IOSNavigationApp",
412
+ "AndroidNavigationApp"
413
+ ],
414
+ "type": "string[] | undefined"
415
+ },
416
+ {
417
+ "name": "providers",
418
+ "tags": [],
419
+ "docs": "Provider definitions to fetch or override built-in provider websites.",
420
+ "complexTypes": [
421
+ "IconProvider"
422
+ ],
423
+ "type": "IconProvider[] | undefined"
424
+ },
425
+ {
426
+ "name": "maxAgeMs",
427
+ "tags": [],
428
+ "docs": "Cache revalidation interval in milliseconds. Defaults to 24 hours.",
429
+ "complexTypes": [],
430
+ "type": "number | undefined"
431
+ },
432
+ {
433
+ "name": "forceRefresh",
434
+ "tags": [],
435
+ "docs": "Ignore the current cache and fetch icons again.",
436
+ "complexTypes": [],
437
+ "type": "boolean | undefined"
438
+ }
439
+ ]
440
+ },
441
+ {
442
+ "name": "IconProvider",
443
+ "slug": "iconprovider",
444
+ "docs": "Web source used to discover or download a provider icon.",
445
+ "tags": [],
446
+ "methods": [],
447
+ "properties": [
448
+ {
449
+ "name": "app",
450
+ "tags": [],
451
+ "docs": "Navigation app identifier",
452
+ "complexTypes": [
453
+ "IOSNavigationApp",
454
+ "AndroidNavigationApp"
455
+ ],
456
+ "type": "string"
457
+ },
458
+ {
459
+ "name": "name",
460
+ "tags": [],
461
+ "docs": "Display name for the provider",
462
+ "complexTypes": [],
463
+ "type": "string | undefined"
464
+ },
465
+ {
466
+ "name": "url",
467
+ "tags": [],
468
+ "docs": "Provider website used to discover favicon metadata",
469
+ "complexTypes": [],
470
+ "type": "string | undefined"
471
+ },
472
+ {
473
+ "name": "iconUrl",
474
+ "tags": [],
475
+ "docs": "Direct image URL. When provided, the plugin downloads this URL instead of discovering a favicon from `url`.",
476
+ "complexTypes": [],
477
+ "type": "string | undefined"
478
+ }
479
+ ]
480
+ },
481
+ {
482
+ "name": "ClearIconCacheOptions",
483
+ "slug": "cleariconcacheoptions",
484
+ "docs": "Options for clearing cached provider icons.",
485
+ "tags": [],
486
+ "methods": [],
487
+ "properties": [
488
+ {
489
+ "name": "apps",
490
+ "tags": [],
491
+ "docs": "App identifiers to clear. Defaults to all cached icons.",
492
+ "complexTypes": [
493
+ "IOSNavigationApp",
494
+ "AndroidNavigationApp"
495
+ ],
496
+ "type": "string[] | undefined"
497
+ }
498
+ ]
213
499
  }
214
500
  ],
215
501
  "enums": [
@@ -331,6 +617,30 @@
331
617
  "tags": [],
332
618
  "docs": ""
333
619
  },
620
+ {
621
+ "name": "GURU_MAPS",
622
+ "value": "'guru_maps'",
623
+ "tags": [],
624
+ "docs": ""
625
+ },
626
+ {
627
+ "name": "ORGANIC_MAPS",
628
+ "value": "'organic_maps'",
629
+ "tags": [],
630
+ "docs": ""
631
+ },
632
+ {
633
+ "name": "YANDEX_MAPS",
634
+ "value": "'yandex_maps'",
635
+ "tags": [],
636
+ "docs": ""
637
+ },
638
+ {
639
+ "name": "TWO_GIS",
640
+ "value": "'2gis'",
641
+ "tags": [],
642
+ "docs": ""
643
+ },
334
644
  {
335
645
  "name": "CABIFY",
336
646
  "value": "'cabify'",
@@ -349,6 +659,12 @@
349
659
  "tags": [],
350
660
  "docs": ""
351
661
  },
662
+ {
663
+ "name": "TESLA",
664
+ "value": "'tesla'",
665
+ "tags": [],
666
+ "docs": ""
667
+ },
352
668
  {
353
669
  "name": "TAXI_99",
354
670
  "value": "'99taxi'",
@@ -421,6 +737,42 @@
421
737
  "tags": [],
422
738
  "docs": ""
423
739
  },
740
+ {
741
+ "name": "TOMTOM",
742
+ "value": "'tomtom'",
743
+ "tags": [],
744
+ "docs": ""
745
+ },
746
+ {
747
+ "name": "GURU_MAPS",
748
+ "value": "'guru_maps'",
749
+ "tags": [],
750
+ "docs": ""
751
+ },
752
+ {
753
+ "name": "ORGANIC_MAPS",
754
+ "value": "'organic_maps'",
755
+ "tags": [],
756
+ "docs": ""
757
+ },
758
+ {
759
+ "name": "YANDEX_MAPS",
760
+ "value": "'yandex_maps'",
761
+ "tags": [],
762
+ "docs": ""
763
+ },
764
+ {
765
+ "name": "MAPY",
766
+ "value": "'mapy'",
767
+ "tags": [],
768
+ "docs": ""
769
+ },
770
+ {
771
+ "name": "TWO_GIS",
772
+ "value": "'2gis'",
773
+ "tags": [],
774
+ "docs": ""
775
+ },
424
776
  {
425
777
  "name": "CABIFY",
426
778
  "value": "'cabify'",
@@ -438,6 +790,12 @@
438
790
  "value": "'gaode'",
439
791
  "tags": [],
440
792
  "docs": ""
793
+ },
794
+ {
795
+ "name": "TESLA",
796
+ "value": "'tesla'",
797
+ "tags": [],
798
+ "docs": ""
441
799
  }
442
800
  ]
443
801
  },
@@ -16,9 +16,14 @@ export declare enum IOSNavigationApp {
16
16
  MOOVIT = "moovit",
17
17
  LYFT = "lyft",
18
18
  MAPS_ME = "mapsme",
19
+ GURU_MAPS = "guru_maps",
20
+ ORGANIC_MAPS = "organic_maps",
21
+ YANDEX_MAPS = "yandex_maps",
22
+ TWO_GIS = "2gis",
19
23
  CABIFY = "cabify",
20
24
  BAIDU = "baidu",
21
25
  GAODE = "gaode",
26
+ TESLA = "tesla",
22
27
  TAXI_99 = "99taxi"
23
28
  }
24
29
  /**
@@ -35,9 +40,16 @@ export declare enum AndroidNavigationApp {
35
40
  MOOVIT = "moovit",
36
41
  LYFT = "lyft",
37
42
  MAPS_ME = "mapsme",
43
+ TOMTOM = "tomtom",
44
+ GURU_MAPS = "guru_maps",
45
+ ORGANIC_MAPS = "organic_maps",
46
+ YANDEX_MAPS = "yandex_maps",
47
+ MAPY = "mapy",
48
+ TWO_GIS = "2gis",
38
49
  CABIFY = "cabify",
39
50
  BAIDU = "baidu",
40
- GAODE = "gaode"
51
+ GAODE = "gaode",
52
+ TESLA = "tesla"
41
53
  }
42
54
  /**
43
55
  * Transport modes
@@ -110,6 +122,128 @@ export interface AvailableApp {
110
122
  */
111
123
  available: boolean;
112
124
  }
125
+ /**
126
+ * Web source used to discover or download a provider icon.
127
+ */
128
+ export interface IconProvider {
129
+ /**
130
+ * Navigation app identifier
131
+ */
132
+ app: IOSNavigationApp | AndroidNavigationApp | string;
133
+ /**
134
+ * Display name for the provider
135
+ */
136
+ name?: string;
137
+ /**
138
+ * Provider website used to discover favicon metadata
139
+ */
140
+ url?: string;
141
+ /**
142
+ * Direct image URL. When provided, the plugin downloads this URL instead of discovering a favicon from `url`.
143
+ */
144
+ iconUrl?: string;
145
+ }
146
+ /**
147
+ * Options for fetching navigation provider icons.
148
+ */
149
+ export interface GetAppIconsOptions {
150
+ /**
151
+ * App identifiers to fetch. Defaults to all built-in providers for the current platform.
152
+ */
153
+ apps?: (IOSNavigationApp | AndroidNavigationApp | string)[];
154
+ /**
155
+ * Provider definitions to fetch or override built-in provider websites.
156
+ */
157
+ providers?: IconProvider[];
158
+ /**
159
+ * Cache revalidation interval in milliseconds. Defaults to 24 hours.
160
+ */
161
+ maxAgeMs?: number;
162
+ /**
163
+ * Ignore the current cache and fetch icons again.
164
+ */
165
+ forceRefresh?: boolean;
166
+ }
167
+ /**
168
+ * Cached icon for a navigation provider.
169
+ */
170
+ export interface ProviderIcon {
171
+ /**
172
+ * Navigation app identifier
173
+ */
174
+ app: string;
175
+ /**
176
+ * Display name for the provider
177
+ */
178
+ name?: string;
179
+ /**
180
+ * URL that can be used directly in an image element inside the WebView.
181
+ */
182
+ localUrl: string;
183
+ /**
184
+ * Web URL used to download the cached image
185
+ */
186
+ sourceUrl: string;
187
+ /**
188
+ * MIME type reported for the cached image, when known
189
+ */
190
+ mimeType?: string;
191
+ /**
192
+ * Unix timestamp in milliseconds when the icon was last fetched
193
+ */
194
+ fetchedAt: number;
195
+ /**
196
+ * Whether the icon came from the local cache without a network refresh
197
+ */
198
+ fromCache: boolean;
199
+ /**
200
+ * Whether a stale cached icon was returned because refresh failed
201
+ */
202
+ stale: boolean;
203
+ }
204
+ /**
205
+ * Icon fetch failure for a provider.
206
+ */
207
+ export interface ProviderIconFailure {
208
+ /**
209
+ * Navigation app identifier
210
+ */
211
+ app: string;
212
+ /**
213
+ * Display name for the provider
214
+ */
215
+ name?: string;
216
+ /**
217
+ * Web URL that failed, when known
218
+ */
219
+ sourceUrl?: string;
220
+ /**
221
+ * Failure message
222
+ */
223
+ message: string;
224
+ }
225
+ /**
226
+ * Result of fetching provider icons.
227
+ */
228
+ export interface ProviderIconsResult {
229
+ /**
230
+ * Icons available from cache or freshly downloaded
231
+ */
232
+ icons: ProviderIcon[];
233
+ /**
234
+ * Providers that could not be fetched and had no cached fallback
235
+ */
236
+ failures: ProviderIconFailure[];
237
+ }
238
+ /**
239
+ * Options for clearing cached provider icons.
240
+ */
241
+ export interface ClearIconCacheOptions {
242
+ /**
243
+ * App identifiers to clear. Defaults to all cached icons.
244
+ */
245
+ apps?: (IOSNavigationApp | AndroidNavigationApp | string)[];
246
+ }
113
247
  /**
114
248
  * Main plugin interface
115
249
  */
@@ -170,6 +304,26 @@ export interface LaunchNavigatorPlugin {
170
304
  */
171
305
  app: string;
172
306
  }>;
307
+ /**
308
+ * Fetch provider icons and cache them locally.
309
+ *
310
+ * The native implementations revalidate cached icons after 24 hours by default.
311
+ * Pass `forceRefresh: true` to bypass the cache when an icon must be repaired.
312
+ */
313
+ getAppIcons?(options?: GetAppIconsOptions): Promise<ProviderIconsResult>;
314
+ /**
315
+ * Refresh provider icons, ignoring the cache age.
316
+ */
317
+ refreshAppIcons?(options?: GetAppIconsOptions): Promise<ProviderIconsResult>;
318
+ /**
319
+ * Clear cached provider icons.
320
+ */
321
+ clearIconCache?(options?: ClearIconCacheOptions): Promise<{
322
+ /**
323
+ * Number of cached icon files removed
324
+ */
325
+ cleared: number;
326
+ }>;
173
327
  /**
174
328
  * Get the native Capacitor plugin version
175
329
  *
@@ -180,3 +334,28 @@ export interface LaunchNavigatorPlugin {
180
334
  version: string;
181
335
  }>;
182
336
  }
337
+ /**
338
+ * Required icon cache helpers exposed by the bundled plugin export.
339
+ */
340
+ export interface LaunchNavigatorPluginIcons {
341
+ /**
342
+ * Fetch provider icons and cache them locally.
343
+ *
344
+ * The native implementations revalidate cached icons after 24 hours by default.
345
+ * Pass `forceRefresh: true` to bypass the cache when an icon must be repaired.
346
+ */
347
+ getAppIcons(options?: GetAppIconsOptions): Promise<ProviderIconsResult>;
348
+ /**
349
+ * Refresh provider icons, ignoring the cache age.
350
+ */
351
+ refreshAppIcons(options?: GetAppIconsOptions): Promise<ProviderIconsResult>;
352
+ /**
353
+ * Clear cached provider icons.
354
+ */
355
+ clearIconCache(options?: ClearIconCacheOptions): Promise<{
356
+ /**
357
+ * Number of cached icon files removed
358
+ */
359
+ cleared: number;
360
+ }>;
361
+ }