@capgo/capacitor-updater 4.0.0-alpha.10 → 4.0.0-alpha.2

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
@@ -127,7 +127,6 @@ Capacitor Updator works by unzipping a compiled app bundle to the native device
127
127
  * [`current()`](#current)
128
128
  * [`reload()`](#reload)
129
129
  * [`setDelay(...)`](#setdelay)
130
- * [`getLatest(...)`](#getlatest)
131
130
  * [`addListener('download', ...)`](#addlistenerdownload)
132
131
  * [`addListener('downloadComplete', ...)`](#addlistenerdownloadcomplete)
133
132
  * [`addListener('majorAvailable', ...)`](#addlistenermajoravailable)
@@ -286,27 +285,6 @@ Set delay to skip updates in the next time the app goes into the background
286
285
  | ------------- | -------------------------------- |
287
286
  | **`options`** | <code>{ delay: boolean; }</code> |
288
287
 
289
- **Since:** 4.0.0
290
-
291
- --------------------
292
-
293
-
294
- ### getLatest(...)
295
-
296
- ```typescript
297
- getLatest(options: { delay: boolean; }) => Promise<latestVersion>
298
- ```
299
-
300
- Get Latest version available from update Url
301
-
302
- | Param | Type |
303
- | ------------- | -------------------------------- |
304
- | **`options`** | <code>{ delay: boolean; }</code> |
305
-
306
- **Returns:** <code>Promise&lt;<a href="#latestversion">latestVersion</a>&gt;</code>
307
-
308
- **Since:** 4.0.0
309
-
310
288
  --------------------
311
289
 
312
290
 
@@ -467,17 +445,6 @@ removeAllListeners() => Promise<void>
467
445
  | **`status`** | <code><a href="#bundlestatus">BundleStatus</a></code> |
468
446
 
469
447
 
470
- #### latestVersion
471
-
472
- | Prop | Type | Description | Since |
473
- | ------------- | -------------------- | ----------------------- | ----- |
474
- | **`version`** | <code>string</code> | Res of getLatest method | 4.0.0 |
475
- | **`major`** | <code>boolean</code> | | |
476
- | **`message`** | <code>string</code> | | |
477
- | **`old`** | <code>string</code> | | |
478
- | **`url`** | <code>string</code> | | |
479
-
480
-
481
448
  #### PluginListenerHandle
482
449
 
483
450
  | Prop | Type |
@@ -46,7 +46,7 @@ public class CapacitorUpdater {
46
46
  private static final String bundleDirectory = "versions";
47
47
 
48
48
  public static final String TAG = "Capacitor-updater";
49
- public static final String pluginVersion = "4.0.0-alpha.10";
49
+ public static final String pluginVersion = "4.0.0-alpha.2";
50
50
 
51
51
  public SharedPreferences.Editor editor;
52
52
  public SharedPreferences prefs;
@@ -255,7 +255,7 @@ public class CapacitorUpdater {
255
255
  return true;
256
256
  }
257
257
  Log.e(TAG, "Directory not removed: " + bundle.getPath());
258
- this.sendStats("delete", deleted.getVersionName());
258
+ this.sendStats("delete", deleted);
259
259
  return false;
260
260
  }
261
261
 
@@ -263,11 +263,11 @@ public class CapacitorUpdater {
263
263
  return new File(this.documentsDir, bundleDirectory + "/" + id);
264
264
  }
265
265
 
266
- private boolean bundleExists(final String id) {
267
- final File bundle = this.getBundleDirectory(id);
266
+ private boolean bundleExists(final File bundle) {
268
267
  if(bundle == null || !bundle.exists()) {
269
268
  return false;
270
269
  }
270
+
271
271
  return new File(bundle.getPath(), "/index.html").exists();
272
272
  }
273
273
 
@@ -277,17 +277,17 @@ public class CapacitorUpdater {
277
277
 
278
278
  public Boolean set(final String id) {
279
279
 
280
- final BundleInfo newBundle = this.getBundleInfo(id);
280
+ final BundleInfo existing = this.getBundleInfo(id);
281
281
  final File bundle = this.getBundleDirectory(id);
282
282
 
283
- Log.i(TAG, "Setting next active bundle: " + id);
284
- if (this.bundleExists(id)) {
283
+ Log.i(TAG, "Setting next active bundle: " + existing);
284
+ if (this.bundleExists(bundle)) {
285
285
  this.setCurrentBundle(bundle);
286
286
  this.setBundleStatus(id, BundleStatus.PENDING);
287
- this.sendStats("set", newBundle.getVersionName());
287
+ this.sendStats("set", existing);
288
288
  return true;
289
289
  }
290
- this.sendStats("set_fail", newBundle.getVersionName());
290
+ this.sendStats("set_fail", existing);
291
291
  return false;
292
292
  }
293
293
 
@@ -309,7 +309,7 @@ public class CapacitorUpdater {
309
309
  this.setFallbackVersion(null);
310
310
  this.setNextVersion(null);
311
311
  if(!internal) {
312
- this.sendStats("reset", this.getCurrentBundle().getVersionName());
312
+ this.sendStats("reset", this.getCurrentBundle());
313
313
  }
314
314
  }
315
315
 
@@ -356,7 +356,7 @@ public class CapacitorUpdater {
356
356
  }
357
357
  }
358
358
 
359
- public void sendStats(final String action, final String versionName) {
359
+ public void sendStats(final String action, final BundleInfo bundle) {
360
360
  String statsUrl = this.statsUrl;
361
361
  if (statsUrl == null || "".equals(statsUrl) || statsUrl.length() == 0) { return; }
362
362
  try {
@@ -367,7 +367,7 @@ public class CapacitorUpdater {
367
367
  json.put("version_build", this.versionBuild);
368
368
  json.put("version_code", this.versionCode);
369
369
  json.put("version_os", this.versionOs);
370
- json.put("version_name", versionName);
370
+ json.put("version_name", bundle.getVersionName());
371
371
  json.put("plugin_version", pluginVersion);
372
372
  json.put("action", action);
373
373
 
@@ -379,13 +379,13 @@ public class CapacitorUpdater {
379
379
  new Response.Listener<JSONObject>() {
380
380
  @Override
381
381
  public void onResponse(JSONObject response) {
382
- Log.i(TAG, "Stats send for \"" + action + "\", version " + versionName);
382
+ Log.i(TAG, "Stats send for \"" + action + "\", version " + bundle.getVersionName());
383
383
  }
384
384
  },
385
385
  new Response.ErrorListener(){
386
386
  @Override
387
387
  public void onErrorResponse(VolleyError error) {
388
- Log.i(TAG, "Stats send for \"" + action + "\", version " + versionName);
388
+ Log.i(TAG, "Stats send for \"" + action + "\", version " + bundle.getVersionName());
389
389
  }
390
390
  });
391
391
  this.requestQueue.add(request);
@@ -515,9 +515,11 @@ public class CapacitorUpdater {
515
515
  if (next == null) {
516
516
  this.editor.remove(NEXT_VERSION);
517
517
  } else {
518
- if (!this.bundleExists(next)) {
518
+ final File bundle = this.getBundleDirectory(next);
519
+ if (!this.bundleExists(bundle)) {
519
520
  return false;
520
521
  }
522
+
521
523
  this.editor.putString(NEXT_VERSION, next);
522
524
  this.setBundleStatus(next, BundleStatus.PENDING);
523
525
  }
@@ -28,12 +28,11 @@ import io.github.g00fy2.versioncompare.Version;
28
28
  import org.json.JSONException;
29
29
 
30
30
  import java.io.IOException;
31
- import java.util.Iterator;
32
31
  import java.util.List;
33
32
 
34
33
  @CapacitorPlugin(name = "CapacitorUpdater")
35
34
  public class CapacitorUpdaterPlugin extends Plugin implements Application.ActivityLifecycleCallbacks {
36
- private static final String updateUrlDefault = "https://xvwzpoazmxkqosrdewyv.functions.supabase.co/updates";
35
+ private static final String autoUpdateUrlDefault = "https://xvwzpoazmxkqosrdewyv.functions.supabase.co/updates";
37
36
  private static final String statsUrlDefault = "https://xvwzpoazmxkqosrdewyv.functions.supabase.co/stats";
38
37
  private static final String DELAY_UPDATE = "delayUpdate";
39
38
 
@@ -45,7 +44,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
45
44
  private Boolean autoDeleteFailed = true;
46
45
  private Boolean autoDeletePrevious = true;
47
46
  private Boolean autoUpdate = false;
48
- private String updateUrl = "";
47
+ private String autoUpdateUrl = "";
49
48
  private Version currentVersionNative;
50
49
  private Boolean resetWhenUpdate = true;
51
50
 
@@ -88,7 +87,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
88
87
 
89
88
  this.autoDeleteFailed = this.getConfig().getBoolean("autoDeleteFailed", true);
90
89
  this.autoDeletePrevious = this.getConfig().getBoolean("autoDeletePrevious", true);
91
- this.updateUrl = this.getConfig().getString("updateUrl", updateUrlDefault);
90
+ this.autoUpdateUrl = this.getConfig().getString("autoUpdateUrl", autoUpdateUrlDefault);
92
91
  this.autoUpdate = this.getConfig().getBoolean("autoUpdate", false);
93
92
  this.appReadyTimeout = this.getConfig().getInt("appReadyTimeout", 10000);
94
93
  this.resetWhenUpdate = this.getConfig().getBoolean("resetWhenUpdate", true);
@@ -134,7 +133,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
134
133
  try {
135
134
  final JSObject ret = new JSObject();
136
135
  ret.put("percent", percent);
137
- JSObject bundle = this.implementation.getBundleInfo(id).toJSON();
136
+ var bundle = this.implementation.getBundleInfo(id).toJSON();
138
137
  ret.put("bundle", bundle);
139
138
  this.notifyListeners("download", ret);
140
139
  if (percent == 100) {
@@ -297,30 +296,6 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
297
296
  }
298
297
  }
299
298
 
300
- @PluginMethod
301
- public void getLatest(final PluginCall call) {
302
- new Thread(new Runnable(){
303
- @Override
304
- public void run() {
305
- CapacitorUpdaterPlugin.this.implementation.getLatest(CapacitorUpdaterPlugin.this.updateUrl, (res) -> {
306
- final JSObject ret = new JSObject();
307
- Iterator<String> keys = res.keys();
308
- while(keys.hasNext()) {
309
- String key = keys.next();
310
- if (res.has(key)) {
311
- try {
312
- ret.put(key, res.get(key));
313
- } catch (JSONException e) {
314
- e.printStackTrace();
315
- }
316
- }
317
- }
318
- call.resolve(ret);
319
- });
320
- }
321
- });
322
- }
323
-
324
299
  private boolean _reset(final Boolean toLastSuccessful) {
325
300
  final BundleInfo fallback = this.implementation.getFallbackVersion();
326
301
  this.implementation.reset();
@@ -408,7 +383,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
408
383
  }
409
384
 
410
385
  private Boolean _isAutoUpdateEnabled() {
411
- return CapacitorUpdaterPlugin.this.autoUpdate && !"".equals(CapacitorUpdaterPlugin.this.updateUrl);
386
+ return CapacitorUpdaterPlugin.this.autoUpdate && !"".equals(CapacitorUpdaterPlugin.this.autoUpdateUrl);
412
387
  }
413
388
 
414
389
  @PluginMethod
@@ -442,8 +417,8 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
442
417
  @Override
443
418
  public void run() {
444
419
 
445
- Log.i(CapacitorUpdater.TAG, "Check for update via: " + CapacitorUpdaterPlugin.this.updateUrl);
446
- CapacitorUpdaterPlugin.this.implementation.getLatest(CapacitorUpdaterPlugin.this.updateUrl, (res) -> {
420
+ Log.i(CapacitorUpdater.TAG, "Check for update via: " + CapacitorUpdaterPlugin.this.autoUpdateUrl);
421
+ CapacitorUpdaterPlugin.this.implementation.getLatest(CapacitorUpdaterPlugin.this.autoUpdateUrl, (res) -> {
447
422
  try {
448
423
  if (res.has("message")) {
449
424
  Log.i(CapacitorUpdater.TAG, "message: " + res.get("message"));
@@ -548,7 +523,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
548
523
  final JSObject ret = new JSObject();
549
524
  ret.put("bundle", current);
550
525
  this.notifyListeners("updateFailed", ret);
551
- this.implementation.sendStats("update_fail", current.getVersionName());
526
+ this.implementation.sendStats("revert", current);
552
527
  if (!fallback.isBuiltin() && !fallback.equals(current)) {
553
528
  final Boolean res = this.implementation.set(fallback);
554
529
  if (res && this._reload()) {
package/dist/docs.json CHANGED
@@ -259,47 +259,12 @@
259
259
  {
260
260
  "name": "throws",
261
261
  "text": "An error if the something went wrong"
262
- },
263
- {
264
- "name": "since",
265
- "text": "4.0.0"
266
262
  }
267
263
  ],
268
264
  "docs": "Set delay to skip updates in the next time the app goes into the background",
269
265
  "complexTypes": [],
270
266
  "slug": "setdelay"
271
267
  },
272
- {
273
- "name": "getLatest",
274
- "signature": "(options: { delay: boolean; }) => Promise<latestVersion>",
275
- "parameters": [
276
- {
277
- "name": "options",
278
- "docs": "",
279
- "type": "{ delay: boolean; }"
280
- }
281
- ],
282
- "returns": "Promise<latestVersion>",
283
- "tags": [
284
- {
285
- "name": "returns",
286
- "text": "an Promise resolved when url is loaded"
287
- },
288
- {
289
- "name": "throws",
290
- "text": "An error if the something went wrong"
291
- },
292
- {
293
- "name": "since",
294
- "text": "4.0.0"
295
- }
296
- ],
297
- "docs": "Get Latest version available from update Url",
298
- "complexTypes": [
299
- "latestVersion"
300
- ],
301
- "slug": "getlatest"
302
- },
303
268
  {
304
269
  "name": "addListener",
305
270
  "signature": "(eventName: 'download', listenerFunc: DownloadChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle",
@@ -515,7 +480,6 @@
515
480
  "MajorAvailableEvent",
516
481
  "DownloadCompleteEvent",
517
482
  "UpdateFailedEvent",
518
- "latestVersion",
519
483
  "BundleInfo",
520
484
  "BundleStatus",
521
485
  "DownloadChangeListener",
@@ -570,71 +534,6 @@
570
534
  "MajorAvailableEvent",
571
535
  "DownloadCompleteEvent",
572
536
  "UpdateFailedEvent",
573
- "latestVersion",
574
- "BundleStatus",
575
- "DownloadChangeListener",
576
- "DownloadCompleteListener",
577
- "MajorAvailableListener",
578
- "UpdateFailedListener",
579
- "CapacitorUpdaterPlugin"
580
- ]
581
- },
582
- {
583
- "name": "latestVersion",
584
- "slug": "latestversion",
585
- "docs": "",
586
- "tags": [],
587
- "methods": [],
588
- "properties": [
589
- {
590
- "name": "version",
591
- "tags": [
592
- {
593
- "text": "4.0.0",
594
- "name": "since"
595
- }
596
- ],
597
- "docs": "Res of getLatest method",
598
- "complexTypes": [],
599
- "type": "string"
600
- },
601
- {
602
- "name": "major",
603
- "tags": [],
604
- "docs": "",
605
- "complexTypes": [],
606
- "type": "boolean | undefined"
607
- },
608
- {
609
- "name": "message",
610
- "tags": [],
611
- "docs": "",
612
- "complexTypes": [],
613
- "type": "string | undefined"
614
- },
615
- {
616
- "name": "old",
617
- "tags": [],
618
- "docs": "",
619
- "complexTypes": [],
620
- "type": "string | undefined"
621
- },
622
- {
623
- "name": "url",
624
- "tags": [],
625
- "docs": "",
626
- "complexTypes": [],
627
- "type": "string | undefined"
628
- }
629
- ],
630
- "importObject": [
631
- "PluginListenerHandle",
632
- "\"@capacitor/cli\"",
633
- "DownloadEvent",
634
- "MajorAvailableEvent",
635
- "DownloadCompleteEvent",
636
- "UpdateFailedEvent",
637
- "BundleInfo",
638
537
  "BundleStatus",
639
538
  "DownloadChangeListener",
640
539
  "DownloadCompleteListener",
@@ -706,7 +605,6 @@
706
605
  "MajorAvailableEvent",
707
606
  "DownloadCompleteEvent",
708
607
  "UpdateFailedEvent",
709
- "latestVersion",
710
608
  "BundleInfo",
711
609
  "BundleStatus",
712
610
  "DownloadChangeListener",
@@ -744,7 +642,6 @@
744
642
  "DownloadEvent",
745
643
  "MajorAvailableEvent",
746
644
  "UpdateFailedEvent",
747
- "latestVersion",
748
645
  "BundleInfo",
749
646
  "BundleStatus",
750
647
  "DownloadChangeListener",
@@ -780,7 +677,6 @@
780
677
  "DownloadEvent",
781
678
  "DownloadCompleteEvent",
782
679
  "UpdateFailedEvent",
783
- "latestVersion",
784
680
  "BundleInfo",
785
681
  "BundleStatus",
786
682
  "DownloadChangeListener",
@@ -818,7 +714,6 @@
818
714
  "DownloadEvent",
819
715
  "MajorAvailableEvent",
820
716
  "DownloadCompleteEvent",
821
- "latestVersion",
822
717
  "BundleInfo",
823
718
  "BundleStatus",
824
719
  "DownloadChangeListener",
@@ -977,7 +872,7 @@
977
872
  "type": "boolean | undefined"
978
873
  },
979
874
  {
980
- "name": "updateUrl",
875
+ "name": "autoUpdateUrl",
981
876
  "tags": [
982
877
  {
983
878
  "text": "https://capgo.app/api/auto_update",
@@ -49,7 +49,7 @@ declare module '@capacitor/cli' {
49
49
  * @default https://capgo.app/api/auto_update
50
50
  * @example https://example.com/api/auto_update
51
51
  */
52
- updateUrl?: string;
52
+ autoUpdateUrl?: string;
53
53
  /**
54
54
  * Automatically delete previous downloaded bundles when a newer native app version is installed to the device.
55
55
  *
@@ -104,18 +104,6 @@ export interface UpdateFailedEvent {
104
104
  */
105
105
  bundle: BundleInfo;
106
106
  }
107
- export interface latestVersion {
108
- /**
109
- * Res of getLatest method
110
- *
111
- * @since 4.0.0
112
- */
113
- version: string;
114
- major?: boolean;
115
- message?: string;
116
- old?: string;
117
- url?: string;
118
- }
119
107
  export interface BundleInfo {
120
108
  id: string;
121
109
  version: string;
@@ -131,7 +119,7 @@ export interface CapacitorUpdaterPlugin {
131
119
  /**
132
120
  * Notify Capacitor Updater that the current bundle is working (a rollback will occur of this method is not called on every app launch)
133
121
  *
134
- * @returns {Promise<BundleInfo>} an Promise resolved directly
122
+ * @returns {Promise<void>} an Promise resolved directly
135
123
  * @throws An error if the something went wrong
136
124
  */
137
125
  notifyAppReady(): Promise<BundleInfo>;
@@ -199,7 +187,7 @@ export interface CapacitorUpdaterPlugin {
199
187
  /**
200
188
  * Get the current bundle, if none are set it returns `builtin`, currentNative is the original bundle installed on the device
201
189
  *
202
- * @returns {Promise<{ bundle: BundleInfo, native: string }>} an Promise with the current bundle info
190
+ * @returns {Promise<{ current: string, currentNative: string }>} an Promise with the current bundle info
203
191
  * @throws An error if the something went wrong
204
192
  */
205
193
  current(): Promise<{
@@ -218,21 +206,10 @@ export interface CapacitorUpdaterPlugin {
218
206
  *
219
207
  * @returns {Promise<void>} an Promise resolved directly
220
208
  * @throws An error if the something went wrong
221
- * @since 4.0.0
222
209
  */
223
210
  setDelay(options: {
224
211
  delay: boolean;
225
212
  }): Promise<void>;
226
- /**
227
- * Get Latest version available from update Url
228
- *
229
- * @returns {Promise<latestVersion>} an Promise resolved when url is loaded
230
- * @throws An error if the something went wrong
231
- * @since 4.0.0
232
- */
233
- getLatest(options: {
234
- delay: boolean;
235
- }): Promise<latestVersion>;
236
213
  /**
237
214
  * Listen for download event in the App, let you know when the download is started, loading and finished
238
215
  *
package/dist/esm/web.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { CapacitorUpdaterPlugin, BundleInfo, latestVersion } from './definitions';
2
+ import type { CapacitorUpdaterPlugin, BundleInfo } from './definitions';
3
3
  export declare class CapacitorUpdaterWeb extends WebPlugin implements CapacitorUpdaterPlugin {
4
4
  download(options: {
5
5
  url: string;
@@ -34,7 +34,6 @@ export declare class CapacitorUpdaterWeb extends WebPlugin implements CapacitorU
34
34
  native: string;
35
35
  }>;
36
36
  reload(): Promise<void>;
37
- getLatest(): Promise<latestVersion>;
38
37
  notifyAppReady(): Promise<BundleInfo>;
39
38
  setDelay(options: {
40
39
  delay: boolean;
package/dist/esm/web.js CHANGED
@@ -43,13 +43,6 @@ export class CapacitorUpdaterWeb extends WebPlugin {
43
43
  console.warn('Cannot reload current bundle in web');
44
44
  return;
45
45
  }
46
- async getLatest() {
47
- console.warn('Cannot getLatest current bundle in web');
48
- return {
49
- version: "0.0.0",
50
- message: "Cannot getLatest current bundle in web",
51
- };
52
- }
53
46
  async notifyAppReady() {
54
47
  console.warn('Cannot notify App Ready in web');
55
48
  return BUNDLE_BUILTIN;
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,cAAc,GAAe,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,0BAA0B,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;AAE7H,MAAM,OAAO,mBACX,SAAQ,SAAS;IAEjB,KAAK,CAAC,QAAQ,CAAC,OAA0C;QACvD,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;QACxD,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAAuB;QAChC,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;QACxD,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,OAAO,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;QACtD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,OAAuB;QAC/B,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;QACzD,OAAO;IACT,CAAC;IACD,KAAK,CAAC,KAAK;QACT,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACrC,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IAC3B,CAAC;IACD,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QACjD,OAAO,EAA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E,OAAO,CAAC,CAAC;IACvD,CAAC;IACD,KAAK,CAAC,OAAO;QACX,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;QACjD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IACrD,CAAC;IACD,KAAK,CAAC,MAAM;QACV,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;QACpD,OAAO;IACT,CAAC;IACD,KAAK,CAAC,cAAc;QAClB,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAC/C,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,KAAK,CAAC,QAAQ,CAAC,OAA2B;QACxC,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,OAAO,CAAC,CAAC;QAC7D,OAAO;IACT,CAAC;CACF"}
@@ -52,13 +52,6 @@ class CapacitorUpdaterWeb extends core.WebPlugin {
52
52
  console.warn('Cannot reload current bundle in web');
53
53
  return;
54
54
  }
55
- async getLatest() {
56
- console.warn('Cannot getLatest current bundle in web');
57
- return {
58
- version: "0.0.0",
59
- message: "Cannot getLatest current bundle in web",
60
- };
61
- }
62
55
  async notifyAppReady() {
63
56
  console.warn('Cannot notify App Ready in web');
64
57
  return BUNDLE_BUILTIN;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorUpdater = registerPlugin('CapacitorUpdater', {\n web: () => import('./web').then(m => new m.CapacitorUpdaterWeb()),\n});\nexport * from './definitions';\nexport { CapacitorUpdater };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst BUNDLE_BUILTIN = { status: 'success', version: '', downloaded: '1970-01-01T00:00:00.000Z', id: 'builtin' };\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async download(options) {\n console.warn('Cannot download version in web', options);\n return BUNDLE_BUILTIN;\n }\n async next(options) {\n console.warn('Cannot set next version in web', options);\n return BUNDLE_BUILTIN;\n }\n async isAutoUpdateEnabled() {\n console.warn('Cannot get isAutoUpdateEnabled in web');\n return { enabled: false };\n }\n async set(options) {\n console.warn('Cannot set active bundle in web', options);\n return;\n }\n async getId() {\n console.warn('Cannot get ID in web');\n return { id: 'default' };\n }\n async getPluginVersion() {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n async delete(options) {\n console.warn('Cannot delete bundle in web', options);\n }\n async list() {\n console.warn('Cannot list bundles in web');\n return { bundles: [] };\n }\n async reset(options) {\n console.warn('Cannot reset version in web', options);\n }\n async current() {\n console.warn('Cannot get current bundle in web');\n return { bundle: BUNDLE_BUILTIN, native: '0.0.0' };\n }\n async reload() {\n console.warn('Cannot reload current bundle in web');\n return;\n }\n async getLatest() {\n console.warn('Cannot getLatest current bundle in web');\n return {\n version: \"0.0.0\",\n message: \"Cannot getLatest current bundle in web\",\n };\n }\n async notifyAppReady() {\n console.warn('Cannot notify App Ready in web');\n return BUNDLE_BUILTIN;\n }\n async setDelay(options) {\n console.warn('Cannot setDelay delay update in web', options);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;AAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;AACrE,CAAC;;ACFD,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,0BAA0B,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;AAC1G,MAAM,mBAAmB,SAASC,cAAS,CAAC;AACnD,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;AAChE,QAAQ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;AACpB,QAAQ,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;AACzD,QAAQ,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC3D,KAAK;AACL,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;AAC5D,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,OAAO,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;AAC/D,QAAQ,OAAO;AACf,YAAY,OAAO,EAAE,OAAO;AAC5B,YAAY,OAAO,EAAE,wCAAwC;AAC7D,SAAS,CAAC;AACV,KAAK;AACL,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AACvD,QAAQ,OAAO,cAAc,CAAC;AAC9B,KAAK;AACL,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,OAAO,CAAC,CAAC;AACrE,QAAQ,OAAO;AACf,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorUpdater = registerPlugin('CapacitorUpdater', {\n web: () => import('./web').then(m => new m.CapacitorUpdaterWeb()),\n});\nexport * from './definitions';\nexport { CapacitorUpdater };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst BUNDLE_BUILTIN = { status: 'success', version: '', downloaded: '1970-01-01T00:00:00.000Z', id: 'builtin' };\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async download(options) {\n console.warn('Cannot download version in web', options);\n return BUNDLE_BUILTIN;\n }\n async next(options) {\n console.warn('Cannot set next version in web', options);\n return BUNDLE_BUILTIN;\n }\n async isAutoUpdateEnabled() {\n console.warn('Cannot get isAutoUpdateEnabled in web');\n return { enabled: false };\n }\n async set(options) {\n console.warn('Cannot set active bundle in web', options);\n return;\n }\n async getId() {\n console.warn('Cannot get ID in web');\n return { id: 'default' };\n }\n async getPluginVersion() {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n async delete(options) {\n console.warn('Cannot delete bundle in web', options);\n }\n async list() {\n console.warn('Cannot list bundles in web');\n return { bundles: [] };\n }\n async reset(options) {\n console.warn('Cannot reset version in web', options);\n }\n async current() {\n console.warn('Cannot get current bundle in web');\n return { bundle: BUNDLE_BUILTIN, native: '0.0.0' };\n }\n async reload() {\n console.warn('Cannot reload current bundle in web');\n return;\n }\n async notifyAppReady() {\n console.warn('Cannot notify App Ready in web');\n return BUNDLE_BUILTIN;\n }\n async setDelay(options) {\n console.warn('Cannot setDelay delay update in web', options);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;AAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;AACrE,CAAC;;ACFD,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,0BAA0B,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;AAC1G,MAAM,mBAAmB,SAASC,cAAS,CAAC;AACnD,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;AAChE,QAAQ,OAAO,cAAc,CAAC;AAC9B,KAAK;AACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAA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3D,KAAK;AACL,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;AAC5D,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,cAAc,GAAG;AAC3B,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;AACvD,QAAQ,OAAO,cAAc,CAAC;AAC9B,KAAK;AACL,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,OAAO,CAAC,CAAC;AACrE,QAAQ,OAAO;AACf,KAAK;AACL;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -49,13 +49,6 @@ var capacitorCapacitorUpdater = (function (exports, core) {
49
49
  console.warn('Cannot reload current bundle in web');
50
50
  return;
51
51
  }
52
- async getLatest() {
53
- console.warn('Cannot getLatest current bundle in web');
54
- return {
55
- version: "0.0.0",
56
- message: "Cannot getLatest current bundle in web",
57
- };
58
- }
59
52
  async notifyAppReady() {
60
53
  console.warn('Cannot notify App Ready in web');
61
54
  return BUNDLE_BUILTIN;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorUpdater = registerPlugin('CapacitorUpdater', {\n web: () => import('./web').then(m => new m.CapacitorUpdaterWeb()),\n});\nexport * from './definitions';\nexport { CapacitorUpdater };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst BUNDLE_BUILTIN = { status: 'success', version: '', downloaded: '1970-01-01T00:00:00.000Z', id: 'builtin' };\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async download(options) {\n console.warn('Cannot download version in web', options);\n return BUNDLE_BUILTIN;\n }\n async next(options) {\n console.warn('Cannot set next version in web', options);\n return BUNDLE_BUILTIN;\n }\n async isAutoUpdateEnabled() {\n console.warn('Cannot get isAutoUpdateEnabled in web');\n return { enabled: false };\n }\n async set(options) {\n console.warn('Cannot set active bundle in web', options);\n return;\n }\n async getId() {\n console.warn('Cannot get ID in web');\n return { id: 'default' };\n }\n async getPluginVersion() {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n async delete(options) {\n console.warn('Cannot delete bundle in web', options);\n }\n async list() {\n console.warn('Cannot list bundles in web');\n return { bundles: [] };\n }\n async reset(options) {\n console.warn('Cannot reset version in web', options);\n }\n async current() {\n console.warn('Cannot get current bundle in web');\n return { bundle: BUNDLE_BUILTIN, native: '0.0.0' };\n }\n async reload() {\n console.warn('Cannot reload current bundle in web');\n return;\n }\n async getLatest() {\n console.warn('Cannot getLatest current bundle in web');\n return {\n version: \"0.0.0\",\n message: \"Cannot getLatest current bundle in web\",\n };\n }\n async notifyAppReady() {\n console.warn('Cannot notify App Ready in web');\n return BUNDLE_BUILTIN;\n }\n async setDelay(options) {\n console.warn('Cannot setDelay delay update in web', options);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;IAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;IACrE,CAAC;;ICFD,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,0BAA0B,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IAC1G,MAAM,mBAAmB,SAASC,cAAS,CAAC;IACnD,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;IAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IAChE,QAAQ,OAAO,cAAc,CAAC;IAC9B,KAAK;IACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,C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,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC3D,KAAK;IACL,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;IAC5D,QAAQ,OAAO;IACf,KAAK;IACL,IAAI,MAAM,SAAS,GAAG;IACtB,QAAQ,OAAO,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;IAC/D,QAAQ,OAAO;IACf,YAAY,OAAO,EAAE,OAAO;IAC5B,YAAY,OAAO,EAAE,wCAAwC;IAC7D,SAAS,CAAC;IACV,KAAK;IACL,IAAI,MAAM,cAAc,GAAG;IAC3B,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IACvD,QAAQ,OAAO,cAAc,CAAC;IAC9B,KAAK;IACL,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;IAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,OAAO,CAAC,CAAC;IACrE,QAAQ,OAAO;IACf,KAAK;IACL;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorUpdater = registerPlugin('CapacitorUpdater', {\n web: () => import('./web').then(m => new m.CapacitorUpdaterWeb()),\n});\nexport * from './definitions';\nexport { CapacitorUpdater };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nconst BUNDLE_BUILTIN = { status: 'success', version: '', downloaded: '1970-01-01T00:00:00.000Z', id: 'builtin' };\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async download(options) {\n console.warn('Cannot download version in web', options);\n return BUNDLE_BUILTIN;\n }\n async next(options) {\n console.warn('Cannot set next version in web', options);\n return BUNDLE_BUILTIN;\n }\n async isAutoUpdateEnabled() {\n console.warn('Cannot get isAutoUpdateEnabled in web');\n return { enabled: false };\n }\n async set(options) {\n console.warn('Cannot set active bundle in web', options);\n return;\n }\n async getId() {\n console.warn('Cannot get ID in web');\n return { id: 'default' };\n }\n async getPluginVersion() {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n async delete(options) {\n console.warn('Cannot delete bundle in web', options);\n }\n async list() {\n console.warn('Cannot list bundles in web');\n return { bundles: [] };\n }\n async reset(options) {\n console.warn('Cannot reset version in web', options);\n }\n async current() {\n console.warn('Cannot get current bundle in web');\n return { bundle: BUNDLE_BUILTIN, native: '0.0.0' };\n }\n async reload() {\n console.warn('Cannot reload current bundle in web');\n return;\n }\n async notifyAppReady() {\n console.warn('Cannot notify App Ready in web');\n return BUNDLE_BUILTIN;\n }\n async setDelay(options) {\n console.warn('Cannot setDelay delay update in web', options);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;IAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;IACrE,CAAC;;ICFD,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,0BAA0B,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IAC1G,MAAM,mBAAmB,SAASC,cAAS,CAAC;IACnD,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;IAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IAChE,QAAQ,OAAO,cAAc,CAAC;IAC9B,KAAK;IACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IAChE,QAAQ,OAAO,cAAc,CAAC;IAC9B,KAAK;IACL,IAAI,MAAM,mBAAmB,GAAG;IAChC,QAAQ,OA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C;IAC5D,QAAQ,OAAO;IACf,KAAK;IACL,IAAI,MAAM,cAAc,GAAG;IAC3B,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;IACvD,QAAQ,OAAO,cAAc,CAAC;IAC9B,KAAK;IACL,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;IAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,OAAO,CAAC,CAAC;IACrE,QAAQ,OAAO;IACf,KAAK;IACL;;;;;;;;;;;;;;;;;"}
@@ -27,20 +27,6 @@ public class AppVersion: NSObject {
27
27
  var message: String?
28
28
  var major: Bool?
29
29
  }
30
-
31
- extension AppVersion {
32
- func toDict() -> [String:Any] {
33
- var dict = [String:Any]()
34
- let otherSelf = Mirror(reflecting: self)
35
- for child in otherSelf.children {
36
- if let key = child.label {
37
- dict[key] = child.value
38
- }
39
- }
40
- return dict
41
- }
42
- }
43
-
44
30
  extension OperatingSystemVersion {
45
31
  func getFullVersion(separator: String = ".") -> String {
46
32
  return "\(majorVersion)\(separator)\(minorVersion)\(separator)\(patchVersion)"
@@ -148,7 +134,7 @@ extension CustomError: LocalizedError {
148
134
 
149
135
  public let TAG = "✨ Capacitor-updater:";
150
136
  public let CAP_SERVER_PATH = "serverBasePath"
151
- public let pluginVersion = "4.0.0-alpha.10"
137
+ public let pluginVersion = "4.0.0-alpha.2"
152
138
  public var statsUrl = ""
153
139
  public var appId = ""
154
140
  public var deviceID = UIDevice.current.identifierForVendor?.uuidString ?? ""
@@ -346,7 +332,7 @@ extension CustomError: LocalizedError {
346
332
  return false
347
333
  }
348
334
  self.removeBundleInfo(id: id)
349
- self.sendStats(action: "delete", versionName: deleted.getVersionName())
335
+ self.sendStats(action: "delete", bundle: deleted)
350
336
  return true
351
337
  }
352
338
 
@@ -358,28 +344,21 @@ extension CustomError: LocalizedError {
358
344
  return self.set(id: bundle.getId());
359
345
  }
360
346
 
361
- private func bundleExists(id: String) -> Bool {
347
+ public func set(id: String) -> Bool {
362
348
  let destHot = self.getPathHot(id: id)
363
349
  let destHotPersist = self.getPathPersist(id: id)
364
350
  let indexHot = destHot.appendingPathComponent("index.html")
365
351
  let indexPersist = destHotPersist.appendingPathComponent("index.html")
366
- let url: URL = self.getBundleDirectory(id: id)
367
- if(url.isDirectory && destHotPersist.isDirectory && indexHot.exist && indexPersist.exist) {
368
- return true;
369
- }
370
- return false;
371
- }
372
-
373
- public func set(id: String) -> Bool {
374
- let newBundle: BundleInfo = self.getBundleInfo(id: id)
375
- if (bundleExists(id: id)) {
376
- let url: URL = self.getBundleDirectory(id: id)
377
- self.setCurrentBundle(bundle: String(url.path.suffix(10)))
352
+ let existing: BundleInfo = self.getBundleInfo(id: id)
353
+ let bundle: URL = self.getBundleDirectory(id: id)
354
+ print("bundle", bundle.path)
355
+ if (bundle.isDirectory && destHotPersist.isDirectory && indexHot.exist && indexPersist.exist) {
356
+ self.setCurrentBundle(bundle: String(bundle.path.suffix(10)))
378
357
  self.setBundleStatus(id: id, status: BundleStatus.PENDING)
379
- sendStats(action: "set", versionName: newBundle.getVersionName())
358
+ sendStats(action: "set", bundle: existing)
380
359
  return true
381
360
  }
382
- sendStats(action: "set_fail", versionName: newBundle.getVersionName())
361
+ sendStats(action: "set_fail", bundle: existing)
383
362
  return false
384
363
  }
385
364
 
@@ -401,7 +380,7 @@ extension CustomError: LocalizedError {
401
380
  let _ = self.setNextVersion(next: Optional<String>.none)
402
381
  UserDefaults.standard.synchronize()
403
382
  if(!isInternal) {
404
- sendStats(action: "reset", versionName: self.getCurrentBundle().getVersionName())
383
+ sendStats(action: "reset", bundle: self.getCurrentBundle())
405
384
  }
406
385
  }
407
386
 
@@ -414,13 +393,13 @@ extension CustomError: LocalizedError {
414
393
  self.setBundleStatus(id: bundle.getId(), status: BundleStatus.ERROR);
415
394
  }
416
395
 
417
- func sendStats(action: String, versionName: String) {
396
+ func sendStats(action: String, bundle: BundleInfo) {
418
397
  if (statsUrl == "") { return }
419
398
  let parameters: [String: String] = [
420
399
  "platform": "ios",
421
400
  "action": action,
422
401
  "device_id": self.deviceID,
423
- "version_name": versionName,
402
+ "version_name": bundle.getVersionName(),
424
403
  "version_build": self.versionBuild,
425
404
  "version_code": self.versionCode,
426
405
  "version_os": self.versionOs,
@@ -430,7 +409,7 @@ extension CustomError: LocalizedError {
430
409
 
431
410
  DispatchQueue.global(qos: .background).async {
432
411
  let _ = AF.request(self.statsUrl, method: .post,parameters: parameters, encoder: JSONParameterEncoder.default)
433
- print("\(self.TAG) Stats send for \(action), version \(versionName)")
412
+ print("\(self.TAG) Stats send for \(action), version \(bundle.getVersionName())")
434
413
  }
435
414
  }
436
415
 
@@ -13,7 +13,6 @@ CAP_PLUGIN(CapacitorUpdaterPlugin, "CapacitorUpdater",
13
13
  CAP_PLUGIN_METHOD(reload, CAPPluginReturnPromise);
14
14
  CAP_PLUGIN_METHOD(notifyAppReady, CAPPluginReturnPromise);
15
15
  CAP_PLUGIN_METHOD(setDelay, CAPPluginReturnPromise);
16
- CAP_PLUGIN_METHOD(getLatest, CAPPluginReturnPromise);
17
16
  CAP_PLUGIN_METHOD(getId, CAPPluginReturnPromise);
18
17
  CAP_PLUGIN_METHOD(getPluginVersion, CAPPluginReturnPromise);
19
18
  CAP_PLUGIN_METHOD(next, CAPPluginReturnPromise);
@@ -9,10 +9,10 @@ import Version
9
9
  @objc(CapacitorUpdaterPlugin)
10
10
  public class CapacitorUpdaterPlugin: CAPPlugin {
11
11
  private var implementation = CapacitorUpdater()
12
- static let updateUrlDefault = "https://xvwzpoazmxkqosrdewyv.functions.supabase.co/updates"
12
+ static let autoUpdateUrlDefault = "https://xvwzpoazmxkqosrdewyv.functions.supabase.co/updates"
13
13
  static let statsUrlDefault = "https://xvwzpoazmxkqosrdewyv.functions.supabase.co/stats"
14
14
  static let DELAY_UPDATE = "delayUpdate"
15
- private var updateUrl = ""
15
+ private var autoUpdateUrl = ""
16
16
  private var statsUrl = ""
17
17
  private var currentVersionNative: Version = "0.0.0"
18
18
  private var autoUpdate = false
@@ -30,7 +30,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
30
30
  }
31
31
  autoDeleteFailed = getConfigValue("autoDeleteFailed") as? Bool ?? false
32
32
  autoDeletePrevious = getConfigValue("autoDeletePrevious") as? Bool ?? false
33
- updateUrl = getConfigValue("updateUrl") as? String ?? CapacitorUpdaterPlugin.updateUrlDefault
33
+ autoUpdateUrl = getConfigValue("autoUpdateUrl") as? String ?? CapacitorUpdaterPlugin.autoUpdateUrlDefault
34
34
  autoUpdate = getConfigValue("autoUpdate") as? Bool ?? false
35
35
  appReadyTimeout = getConfigValue("appReadyTimeout") as? Int ?? 10000
36
36
  resetWhenUpdate = getConfigValue("resetWhenUpdate") as? Bool ?? true
@@ -60,7 +60,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
60
60
  print("\(self.implementation.TAG) Cannot get version native \(currentVersionNative)")
61
61
  }
62
62
  if (LatestVersionNative != "0.0.0" && currentVersionNative.major > LatestVersionNative.major) {
63
- _ = self._reset(toLastSuccessful: false)
63
+ _ = self._reset(toAutoUpdate: false)
64
64
  UserDefaults.standard.set("", forKey: "LatestVersionAutoUpdate")
65
65
  UserDefaults.standard.set("", forKey: "LatestVersionNameAutoUpdate")
66
66
  let res = implementation.list()
@@ -188,21 +188,18 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
188
188
  ])
189
189
  }
190
190
 
191
- @objc func getLatest(_ call: CAPPluginCall) {
192
- let res = self.implementation.getLatest(url: URL(string: self.updateUrl)!)
193
- call.resolve((res?.toDict())!)
194
- }
195
-
196
- @objc func _reset(toLastSuccessful: Bool) -> Bool {
191
+ @objc func _reset(toAutoUpdate: Bool) -> Bool {
197
192
  guard let bridge = self.bridge else { return false }
198
-
199
193
  if let vc = bridge.viewController as? CAPBridgeViewController {
200
- let fallback: BundleInfo = self.implementation.getFallbackVersion()
201
- if (toLastSuccessful && !fallback.isBuiltin()) {
202
- print("\(self.implementation.TAG) Resetting to: \(fallback.toString())")
203
- return self.implementation.set(bundle: fallback) && self._reload()
204
- }
205
194
  self.implementation.reset()
195
+
196
+ let LatestVersionAutoUpdate = UserDefaults.standard.string(forKey: "LatestVersionAutoUpdate") ?? ""
197
+ let LatestVersionNameAutoUpdate = UserDefaults.standard.string(forKey: "LatestVersionNameAutoUpdate") ?? ""
198
+ if(toAutoUpdate && LatestVersionAutoUpdate != "" && LatestVersionNameAutoUpdate != "") {
199
+ let res = implementation.set(id: LatestVersionNameAutoUpdate)
200
+ return res && self._reload()
201
+ }
202
+ implementation.reset()
206
203
  vc.setServerBasePath(path: "")
207
204
  DispatchQueue.main.async {
208
205
  vc.loadView()
@@ -215,8 +212,8 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
215
212
  }
216
213
 
217
214
  @objc func reset(_ call: CAPPluginCall) {
218
- let toLastSuccessful = call.getBool("toLastSuccessful") ?? false
219
- if (self._reset(toLastSuccessful: toLastSuccessful)) {
215
+ let toAutoUpdate = call.getBool("toAutoUpdate") ?? false
216
+ if (self._reset(toAutoUpdate: toAutoUpdate)) {
220
217
  return call.resolve()
221
218
  }
222
219
  call.reject("\(self.implementation.TAG) Reset failed")
@@ -248,7 +245,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
248
245
  }
249
246
 
250
247
  private func _isAutoUpdateEnabled() -> Bool {
251
- return self.autoUpdate && self.updateUrl != ""
248
+ return self.autoUpdate && self.autoUpdateUrl != ""
252
249
  }
253
250
 
254
251
  @objc func isAutoUpdateEnabled(_ call: CAPPluginCall) {
@@ -277,7 +274,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
277
274
  if(BundleStatus.SUCCESS.localizedString != current.getStatus()) {
278
275
  print("\(self.implementation.TAG) notifyAppReady was not called, roll back current bundle: \(current.toString())")
279
276
  self.implementation.rollback(bundle: current)
280
- let res = self._reset(toLastSuccessful: true)
277
+ let res = self._reset(toAutoUpdate: true)
281
278
  if (!res) {
282
279
  return
283
280
  }
@@ -290,24 +287,20 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
290
287
  @objc func appMovedToForeground() {
291
288
  if (self._isAutoUpdateEnabled()) {
292
289
  DispatchQueue.global(qos: .background).async {
293
- print("\(self.implementation.TAG) Check for update via \(self.updateUrl)")
294
- let url = URL(string: self.updateUrl)!
290
+ print("\(self.implementation.TAG) Check for update via \(self.autoUpdateUrl)")
291
+ let url = URL(string: self.autoUpdateUrl)!
295
292
  let res = self.implementation.getLatest(url: url)
296
293
  if (res == nil) {
297
- print("\(self.implementation.TAG) No result found in \(self.updateUrl)")
294
+ print("\(self.implementation.TAG) No result found in \(self.autoUpdateUrl)")
298
295
  return
299
296
  }
300
- if ((res?.message) != nil) {
301
- print("\(self.implementation.TAG) message \(res!.message ?? "")")
297
+ guard let downloadUrl = URL(string: res?.url ?? "") else {
298
+ print("\(self.implementation.TAG) Error \(res?.message ?? "Unknow error")")
302
299
  if (res?.major == true) {
303
300
  self.notifyListeners("majorAvailable", data: ["version": res?.version ?? "0.0.0"])
304
301
  }
305
302
  return
306
303
  }
307
- guard let downloadUrl = URL(string: res?.url ?? "") else {
308
- print("\(self.implementation.TAG) Error no url or wrong format")
309
- return
310
- }
311
304
  let current = self.implementation.getCurrentBundle()
312
305
  let latestVersionName = res?.version
313
306
  if (latestVersionName != nil && latestVersionName != "" && current.getVersionName() != latestVersionName) {
@@ -381,7 +374,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
381
374
  self.notifyListeners("updateFailed", data: [
382
375
  "bundle": current.toJSON()
383
376
  ])
384
- self.implementation.sendStats(action: "fail_update", versionName: current.getVersionName())
377
+ self.implementation.sendStats(action: "revert", bundle: current)
385
378
  if (!fallback.isBuiltin() && !(fallback == current)) {
386
379
  let res = self.implementation.set(bundle: fallback)
387
380
  if (res && self._reload()) {
@@ -390,7 +383,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
390
383
  print("\(self.implementation.TAG) Revert to bundle: \(fallback.toString()) Failed!")
391
384
  }
392
385
  } else {
393
- if (self._reset(toLastSuccessful: false)) {
386
+ if (self._reset(toAutoUpdate: false)) {
394
387
  print("\(self.implementation.TAG) Reverted to 'builtin' bundle.")
395
388
  }
396
389
  }
@@ -38,4 +38,60 @@ extension UserDefaults: ObjectSavable {
38
38
  throw ObjectSavableError.unableToDecode
39
39
  }
40
40
  }
41
- }
41
+ }
42
+
43
+ //
44
+ //// MARK: - Methods
45
+ //public extension UserDefaults {
46
+ // /// SwifterSwift: get object from UserDefaults by using subscript.
47
+ // ///
48
+ // /// - Parameter key: key in the current user's defaults database.
49
+ // subscript(key: String) -> Any? {
50
+ // get {
51
+ // return object(forKey: key)
52
+ // }
53
+ // set {
54
+ // set(newValue, forKey: key)
55
+ // }
56
+ // }
57
+ //
58
+ // /// SwifterSwift: Float from UserDefaults.
59
+ // ///
60
+ // /// - Parameter key: key to find float for.
61
+ // /// - Returns: Float object for key (if exists).
62
+ // func float(forKey key: String) -> Float? {
63
+ // return object(forKey: key) as? Float
64
+ // }
65
+ //
66
+ // /// SwifterSwift: Date from UserDefaults.
67
+ // ///
68
+ // /// - Parameter key: key to find date for.
69
+ // /// - Returns: Date object for key (if exists).
70
+ // func date(forKey key: String) -> Date? {
71
+ // return object(forKey: key) as? Date
72
+ // }
73
+ //
74
+ // /// SwifterSwift: Retrieves a Codable object from UserDefaults.
75
+ // ///
76
+ // /// - Parameters:
77
+ // /// - type: Class that conforms to the Codable protocol.
78
+ // /// - key: Identifier of the object.
79
+ // /// - decoder: Custom JSONDecoder instance. Defaults to `JSONDecoder()`.
80
+ // /// - Returns: Codable object for key (if exists).
81
+ // func object<T: Codable>(_ type: T.Type, with key: String, usingDecoder decoder: JSONDecoder = JSONDecoder()) -> T? {
82
+ // guard let data = value(forKey: key) as? Data else { return nil }
83
+ // return try? decoder.decode(type.self, from: data)
84
+ // }
85
+ //
86
+ // /// SwifterSwift: Allows storing of Codable objects to UserDefaults.
87
+ // ///
88
+ // /// - Parameters:
89
+ // /// - object: Codable object to store.
90
+ // /// - key: Identifier of the object.
91
+ // /// - encoder: Custom JSONEncoder instance. Defaults to `JSONEncoder()`.
92
+ // func set<T: Codable>(object: T, forKey key: String, usingEncoder encoder: JSONEncoder = JSONEncoder()) {
93
+ // let data = try? encoder.encode(object)
94
+ // set(data, forKey: key)
95
+ // }
96
+ //}
97
+ //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "4.0.0-alpha.10",
3
+ "version": "4.0.0-alpha.2",
4
4
  "license": "AGPL-3.0-only",
5
5
  "description": "OTA update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",