@capgo/capacitor-updater 4.0.0-alpha.12 → 4.0.0-alpha.17
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 +23 -4
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +1 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +60 -12
- package/dist/docs.json +66 -3
- package/dist/esm/definitions.d.ts +13 -1
- package/dist/esm/web.d.ts +4 -2
- package/dist/esm/web.js +5 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +5 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +5 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorUpdater.swift +1 -1
- package/ios/Plugin/CapacitorUpdaterPlugin.m +1 -0
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +61 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -127,6 +127,7 @@ 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
|
+
* [`cancelDelay()`](#canceldelay)
|
|
130
131
|
* [`getLatest(...)`](#getlatest)
|
|
131
132
|
* [`addListener('download', ...)`](#addlistenerdownload)
|
|
132
133
|
* [`addListener('downloadComplete', ...)`](#addlistenerdownloadcomplete)
|
|
@@ -277,14 +278,27 @@ Reload the view
|
|
|
277
278
|
### setDelay(...)
|
|
278
279
|
|
|
279
280
|
```typescript
|
|
280
|
-
setDelay(options: {
|
|
281
|
+
setDelay(options: { kind: DelayUntilNext; value?: string; }) => Promise<void>
|
|
281
282
|
```
|
|
282
283
|
|
|
283
284
|
Set delay to skip updates in the next time the app goes into the background
|
|
284
285
|
|
|
285
|
-
| Param | Type
|
|
286
|
-
| ------------- |
|
|
287
|
-
| **`options`** | <code>{
|
|
286
|
+
| Param | Type |
|
|
287
|
+
| ------------- | ------------------------------------------------------------------------------------ |
|
|
288
|
+
| **`options`** | <code>{ kind: <a href="#delayuntilnext">DelayUntilNext</a>; value?: string; }</code> |
|
|
289
|
+
|
|
290
|
+
**Since:** 4.0.0
|
|
291
|
+
|
|
292
|
+
--------------------
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
### cancelDelay()
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
cancelDelay() => Promise<void>
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Cancel delay to updates as usual
|
|
288
302
|
|
|
289
303
|
**Since:** 4.0.0
|
|
290
304
|
|
|
@@ -522,6 +536,11 @@ removeAllListeners() => Promise<void>
|
|
|
522
536
|
<code>'success' | 'error' | 'pending' | 'downloading'</code>
|
|
523
537
|
|
|
524
538
|
|
|
539
|
+
#### DelayUntilNext
|
|
540
|
+
|
|
541
|
+
<code>'background' | 'kill' | 'nativeVersion' | 'date'</code>
|
|
542
|
+
|
|
543
|
+
|
|
525
544
|
#### DownloadChangeListener
|
|
526
545
|
|
|
527
546
|
<code>(state: <a href="#downloadevent">DownloadEvent</a>): void</code>
|
|
@@ -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.
|
|
49
|
+
public static final String pluginVersion = "4.0.0-alpha.17";
|
|
50
50
|
|
|
51
51
|
public SharedPreferences.Editor editor;
|
|
52
52
|
public SharedPreferences prefs;
|
|
@@ -28,6 +28,8 @@ import io.github.g00fy2.versioncompare.Version;
|
|
|
28
28
|
import org.json.JSONException;
|
|
29
29
|
|
|
30
30
|
import java.io.IOException;
|
|
31
|
+
import java.text.SimpleDateFormat;
|
|
32
|
+
import java.util.Date;
|
|
31
33
|
import java.util.Iterator;
|
|
32
34
|
import java.util.List;
|
|
33
35
|
|
|
@@ -36,6 +38,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
36
38
|
private static final String updateUrlDefault = "https://xvwzpoazmxkqosrdewyv.functions.supabase.co/updates";
|
|
37
39
|
private static final String statsUrlDefault = "https://xvwzpoazmxkqosrdewyv.functions.supabase.co/stats";
|
|
38
40
|
private static final String DELAY_UPDATE = "delayUpdate";
|
|
41
|
+
private static final String DELAY_UPDATE_VAL = "delayUpdateVal";
|
|
39
42
|
|
|
40
43
|
private SharedPreferences.Editor editor;
|
|
41
44
|
private SharedPreferences prefs;
|
|
@@ -98,8 +101,8 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
98
101
|
}
|
|
99
102
|
final Application application = (Application) this.getContext().getApplicationContext();
|
|
100
103
|
application.registerActivityLifecycleCallbacks(this);
|
|
101
|
-
|
|
102
104
|
this.onActivityStarted(this.getActivity());
|
|
105
|
+
this._checkCancelDelay(true);
|
|
103
106
|
}
|
|
104
107
|
|
|
105
108
|
private void cleanupObsoleteVersions() {
|
|
@@ -382,9 +385,17 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
382
385
|
@PluginMethod
|
|
383
386
|
public void delayUpdate(final PluginCall call) {
|
|
384
387
|
try {
|
|
385
|
-
|
|
386
|
-
|
|
388
|
+
final String kind = call.getString("kind");
|
|
389
|
+
final String value = call.getString("value");
|
|
390
|
+
if (kind == null) {
|
|
391
|
+
Log.e(CapacitorUpdater.TAG, "setDelay called without kind");
|
|
392
|
+
call.reject("setDelay called without kind");
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
this.editor.putString(DELAY_UPDATE, kind);
|
|
396
|
+
this.editor.putString(DELAY_UPDATE_VAL, value);
|
|
387
397
|
this.editor.commit();
|
|
398
|
+
Log.i(CapacitorUpdater.TAG, "Delay update saved");
|
|
388
399
|
call.resolve();
|
|
389
400
|
}
|
|
390
401
|
catch(final Exception e) {
|
|
@@ -393,13 +404,12 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
393
404
|
}
|
|
394
405
|
}
|
|
395
406
|
|
|
396
|
-
|
|
397
|
-
public void cancelDelay(final PluginCall call) {
|
|
407
|
+
private boolean _cancelDelay() {
|
|
398
408
|
try {
|
|
399
|
-
|
|
400
|
-
this.editor.
|
|
409
|
+
this.editor.remove(DELAY_UPDATE);
|
|
410
|
+
this.editor.remove(DELAY_UPDATE_VAL);
|
|
401
411
|
this.editor.commit();
|
|
402
|
-
|
|
412
|
+
Log.i(CapacitorUpdater.TAG, "delay Canceled");
|
|
403
413
|
}
|
|
404
414
|
catch(final Exception e) {
|
|
405
415
|
Log.e(CapacitorUpdater.TAG, "Failed to cancel update delay", e);
|
|
@@ -407,6 +417,46 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
407
417
|
}
|
|
408
418
|
}
|
|
409
419
|
|
|
420
|
+
@PluginMethod
|
|
421
|
+
public void cancelDelay(final PluginCall call) {
|
|
422
|
+
this._cancelDelay();
|
|
423
|
+
call.resolve();
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
private void _checkCancelDelay(Boolean killed) {
|
|
427
|
+
final String delayUpdate = this.prefs.getString(DELAY_UPDATE, "");
|
|
428
|
+
if ("".equals(delayUpdate)) {
|
|
429
|
+
if ("background".equals(delayUpdate) && !killed) {
|
|
430
|
+
this._cancelDelay();
|
|
431
|
+
} else if ("kill".equals(delayUpdate) && killed) {
|
|
432
|
+
this._cancelDelay();
|
|
433
|
+
}
|
|
434
|
+
final String delayVal = this.prefs.getString(DELAY_UPDATE_VAL, "");
|
|
435
|
+
if (delayVal == null) {
|
|
436
|
+
this._cancelDelay();
|
|
437
|
+
} else if ("date".equals(delayUpdate)) {
|
|
438
|
+
try {
|
|
439
|
+
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
|
|
440
|
+
Date date = sdf.parse(delayVal);
|
|
441
|
+
Date today = new Date();
|
|
442
|
+
if (date.compareTo(today) > 0) {
|
|
443
|
+
this._cancelDelay();
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
catch(final Exception e) {
|
|
447
|
+
Log.e(CapacitorUpdater.TAG, "Failed to parse delay date", e);
|
|
448
|
+
this._cancelDelay();
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
} else if ("nativeVersion".equals(delayUpdate)) {
|
|
452
|
+
final Version versionLimit = new Version(delayVal);
|
|
453
|
+
if (this.currentVersionNative.isAtLeast(versionLimit)) {
|
|
454
|
+
this._cancelDelay();
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
410
460
|
private Boolean _isAutoUpdateEnabled() {
|
|
411
461
|
return CapacitorUpdaterPlugin.this.autoUpdate && !"".equals(CapacitorUpdaterPlugin.this.updateUrl);
|
|
412
462
|
}
|
|
@@ -506,10 +556,8 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
506
556
|
public void onActivityStopped(@NonNull final Activity activity) {
|
|
507
557
|
Log.i(CapacitorUpdater.TAG, "Checking for pending update");
|
|
508
558
|
try {
|
|
509
|
-
final Boolean delayUpdate = this.prefs.
|
|
510
|
-
this.
|
|
511
|
-
this.editor.commit();
|
|
512
|
-
|
|
559
|
+
final Boolean delayUpdate = this.prefs.getString(DELAY_UPDATE, false);
|
|
560
|
+
this._checkCancelDelay(false);
|
|
513
561
|
if (delayUpdate) {
|
|
514
562
|
Log.i(CapacitorUpdater.TAG, "Update delayed to next backgrounding");
|
|
515
563
|
return;
|
package/dist/docs.json
CHANGED
|
@@ -242,12 +242,12 @@
|
|
|
242
242
|
},
|
|
243
243
|
{
|
|
244
244
|
"name": "setDelay",
|
|
245
|
-
"signature": "(options: {
|
|
245
|
+
"signature": "(options: { kind: DelayUntilNext; value?: string; }) => Promise<void>",
|
|
246
246
|
"parameters": [
|
|
247
247
|
{
|
|
248
248
|
"name": "options",
|
|
249
249
|
"docs": "",
|
|
250
|
-
"type": "{
|
|
250
|
+
"type": "{ kind: DelayUntilNext; value?: string | undefined; }"
|
|
251
251
|
}
|
|
252
252
|
],
|
|
253
253
|
"returns": "Promise<void>",
|
|
@@ -256,6 +256,14 @@
|
|
|
256
256
|
"name": "returns",
|
|
257
257
|
"text": "an Promise resolved directly"
|
|
258
258
|
},
|
|
259
|
+
{
|
|
260
|
+
"name": "param",
|
|
261
|
+
"text": "kind is the kind of delay to set"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"name": "param",
|
|
265
|
+
"text": "value is the delay value acording to the type"
|
|
266
|
+
},
|
|
259
267
|
{
|
|
260
268
|
"name": "throws",
|
|
261
269
|
"text": "An error if the something went wrong"
|
|
@@ -266,9 +274,34 @@
|
|
|
266
274
|
}
|
|
267
275
|
],
|
|
268
276
|
"docs": "Set delay to skip updates in the next time the app goes into the background",
|
|
269
|
-
"complexTypes": [
|
|
277
|
+
"complexTypes": [
|
|
278
|
+
"DelayUntilNext"
|
|
279
|
+
],
|
|
270
280
|
"slug": "setdelay"
|
|
271
281
|
},
|
|
282
|
+
{
|
|
283
|
+
"name": "cancelDelay",
|
|
284
|
+
"signature": "() => Promise<void>",
|
|
285
|
+
"parameters": [],
|
|
286
|
+
"returns": "Promise<void>",
|
|
287
|
+
"tags": [
|
|
288
|
+
{
|
|
289
|
+
"name": "returns",
|
|
290
|
+
"text": "an Promise resolved directly"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"name": "throws",
|
|
294
|
+
"text": "An error if the something went wrong"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"name": "since",
|
|
298
|
+
"text": "4.0.0"
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
"docs": "Cancel delay to updates as usual",
|
|
302
|
+
"complexTypes": [],
|
|
303
|
+
"slug": "canceldelay"
|
|
304
|
+
},
|
|
272
305
|
{
|
|
273
306
|
"name": "getLatest",
|
|
274
307
|
"signature": "(options: { delay: boolean; }) => Promise<latestVersion>",
|
|
@@ -518,6 +551,7 @@
|
|
|
518
551
|
"latestVersion",
|
|
519
552
|
"BundleInfo",
|
|
520
553
|
"BundleStatus",
|
|
554
|
+
"DelayUntilNext",
|
|
521
555
|
"DownloadChangeListener",
|
|
522
556
|
"DownloadCompleteListener",
|
|
523
557
|
"MajorAvailableListener",
|
|
@@ -572,6 +606,7 @@
|
|
|
572
606
|
"UpdateFailedEvent",
|
|
573
607
|
"latestVersion",
|
|
574
608
|
"BundleStatus",
|
|
609
|
+
"DelayUntilNext",
|
|
575
610
|
"DownloadChangeListener",
|
|
576
611
|
"DownloadCompleteListener",
|
|
577
612
|
"MajorAvailableListener",
|
|
@@ -636,6 +671,7 @@
|
|
|
636
671
|
"UpdateFailedEvent",
|
|
637
672
|
"BundleInfo",
|
|
638
673
|
"BundleStatus",
|
|
674
|
+
"DelayUntilNext",
|
|
639
675
|
"DownloadChangeListener",
|
|
640
676
|
"DownloadCompleteListener",
|
|
641
677
|
"MajorAvailableListener",
|
|
@@ -709,6 +745,7 @@
|
|
|
709
745
|
"latestVersion",
|
|
710
746
|
"BundleInfo",
|
|
711
747
|
"BundleStatus",
|
|
748
|
+
"DelayUntilNext",
|
|
712
749
|
"DownloadChangeListener",
|
|
713
750
|
"DownloadCompleteListener",
|
|
714
751
|
"MajorAvailableListener",
|
|
@@ -747,6 +784,7 @@
|
|
|
747
784
|
"latestVersion",
|
|
748
785
|
"BundleInfo",
|
|
749
786
|
"BundleStatus",
|
|
787
|
+
"DelayUntilNext",
|
|
750
788
|
"DownloadChangeListener",
|
|
751
789
|
"DownloadCompleteListener",
|
|
752
790
|
"MajorAvailableListener",
|
|
@@ -783,6 +821,7 @@
|
|
|
783
821
|
"latestVersion",
|
|
784
822
|
"BundleInfo",
|
|
785
823
|
"BundleStatus",
|
|
824
|
+
"DelayUntilNext",
|
|
786
825
|
"DownloadChangeListener",
|
|
787
826
|
"DownloadCompleteListener",
|
|
788
827
|
"MajorAvailableListener",
|
|
@@ -821,6 +860,7 @@
|
|
|
821
860
|
"latestVersion",
|
|
822
861
|
"BundleInfo",
|
|
823
862
|
"BundleStatus",
|
|
863
|
+
"DelayUntilNext",
|
|
824
864
|
"DownloadChangeListener",
|
|
825
865
|
"DownloadCompleteListener",
|
|
826
866
|
"MajorAvailableListener",
|
|
@@ -854,6 +894,29 @@
|
|
|
854
894
|
}
|
|
855
895
|
]
|
|
856
896
|
},
|
|
897
|
+
{
|
|
898
|
+
"name": "DelayUntilNext",
|
|
899
|
+
"slug": "delayuntilnext",
|
|
900
|
+
"docs": "",
|
|
901
|
+
"types": [
|
|
902
|
+
{
|
|
903
|
+
"text": "'background'",
|
|
904
|
+
"complexTypes": []
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
"text": "'kill'",
|
|
908
|
+
"complexTypes": []
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
"text": "'nativeVersion'",
|
|
912
|
+
"complexTypes": []
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
"text": "'date'",
|
|
916
|
+
"complexTypes": []
|
|
917
|
+
}
|
|
918
|
+
]
|
|
919
|
+
},
|
|
857
920
|
{
|
|
858
921
|
"name": "DownloadChangeListener",
|
|
859
922
|
"slug": "downloadchangelistener",
|
|
@@ -123,6 +123,7 @@ export interface BundleInfo {
|
|
|
123
123
|
status: BundleStatus;
|
|
124
124
|
}
|
|
125
125
|
export declare type BundleStatus = 'success' | 'error' | 'pending' | 'downloading';
|
|
126
|
+
export declare type DelayUntilNext = 'background' | 'kill' | 'nativeVersion' | 'date';
|
|
126
127
|
export declare type DownloadChangeListener = (state: DownloadEvent) => void;
|
|
127
128
|
export declare type DownloadCompleteListener = (state: DownloadCompleteEvent) => void;
|
|
128
129
|
export declare type MajorAvailableListener = (state: MajorAvailableEvent) => void;
|
|
@@ -217,12 +218,23 @@ export interface CapacitorUpdaterPlugin {
|
|
|
217
218
|
* Set delay to skip updates in the next time the app goes into the background
|
|
218
219
|
*
|
|
219
220
|
* @returns {Promise<void>} an Promise resolved directly
|
|
221
|
+
* @param kind is the kind of delay to set
|
|
222
|
+
* @param value is the delay value acording to the type
|
|
220
223
|
* @throws An error if the something went wrong
|
|
221
224
|
* @since 4.0.0
|
|
222
225
|
*/
|
|
223
226
|
setDelay(options: {
|
|
224
|
-
|
|
227
|
+
kind: DelayUntilNext;
|
|
228
|
+
value?: string;
|
|
225
229
|
}): Promise<void>;
|
|
230
|
+
/**
|
|
231
|
+
* Cancel delay to updates as usual
|
|
232
|
+
*
|
|
233
|
+
* @returns {Promise<void>} an Promise resolved directly
|
|
234
|
+
* @throws An error if the something went wrong
|
|
235
|
+
* @since 4.0.0
|
|
236
|
+
*/
|
|
237
|
+
cancelDelay(): Promise<void>;
|
|
226
238
|
/**
|
|
227
239
|
* Get Latest version available from update Url
|
|
228
240
|
*
|
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, latestVersion, DelayUntilNext } from './definitions';
|
|
3
3
|
export declare class CapacitorUpdaterWeb extends WebPlugin implements CapacitorUpdaterPlugin {
|
|
4
4
|
download(options: {
|
|
5
5
|
url: string;
|
|
@@ -37,6 +37,8 @@ export declare class CapacitorUpdaterWeb extends WebPlugin implements CapacitorU
|
|
|
37
37
|
getLatest(): Promise<latestVersion>;
|
|
38
38
|
notifyAppReady(): Promise<BundleInfo>;
|
|
39
39
|
setDelay(options: {
|
|
40
|
-
|
|
40
|
+
kind: DelayUntilNext;
|
|
41
|
+
value: string;
|
|
41
42
|
}): Promise<void>;
|
|
43
|
+
cancelDelay(): Promise<void>;
|
|
42
44
|
}
|
package/dist/esm/web.js
CHANGED
|
@@ -55,7 +55,11 @@ export class CapacitorUpdaterWeb extends WebPlugin {
|
|
|
55
55
|
return BUNDLE_BUILTIN;
|
|
56
56
|
}
|
|
57
57
|
async setDelay(options) {
|
|
58
|
-
console.warn('Cannot setDelay
|
|
58
|
+
console.warn('Cannot setDelay in web', options);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
async cancelDelay() {
|
|
62
|
+
console.warn('Cannot cancelDelay in web');
|
|
59
63
|
return;
|
|
60
64
|
}
|
|
61
65
|
}
|
package/dist/esm/web.js.map
CHANGED
|
@@ -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,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CAAC,IAAI,CAAC,6BAA6B,EAAE,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,SAAS;QACb,OAAO,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;QACvD,OAAO;YACL,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,wCAAwC;SAClD,CAAA;IACH,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,OAAgD;QAC7D,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC;QAChD,OAAO;IACT,CAAC;IACD,KAAK,CAAC,WAAW;QACf,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAC1C,OAAO;IACT,CAAC;CACF"}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -64,7 +64,11 @@ class CapacitorUpdaterWeb extends core.WebPlugin {
|
|
|
64
64
|
return BUNDLE_BUILTIN;
|
|
65
65
|
}
|
|
66
66
|
async setDelay(options) {
|
|
67
|
-
console.warn('Cannot setDelay
|
|
67
|
+
console.warn('Cannot setDelay in web', options);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
async cancelDelay() {
|
|
71
|
+
console.warn('Cannot cancelDelay in web');
|
|
68
72
|
return;
|
|
69
73
|
}
|
|
70
74
|
}
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -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
|
|
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 in web', options);\n return;\n }\n async cancelDelay() {\n console.warn('Cannot cancelDelay in web');\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,CAA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,11 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
61
61
|
return BUNDLE_BUILTIN;
|
|
62
62
|
}
|
|
63
63
|
async setDelay(options) {
|
|
64
|
-
console.warn('Cannot setDelay
|
|
64
|
+
console.warn('Cannot setDelay in web', options);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
async cancelDelay() {
|
|
68
|
+
console.warn('Cannot cancelDelay in web');
|
|
65
69
|
return;
|
|
66
70
|
}
|
|
67
71
|
}
|
package/dist/plugin.js.map
CHANGED
|
@@ -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
|
|
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 in web', options);\n return;\n }\n async cancelDelay() {\n console.warn('Cannot cancelDelay in web');\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,OAAO,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;IAC9D,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAClC,KAAK;IACL,IAAI,MAAM,GAAG,CAAC,OAAO,EAAE;IACvB,QAAQ,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE,OAAO,CAAC,CAAC;IACjE,QAAQ,OAAO;IACf,KAAK;IACL,IAAI,MAAM,KAAK,GAAG;IAClB,QAAQ,OAAO,CAAC,IAAI,CAAC,s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C;IACvD,QAAQ,OAAO,cAAc,CAAC;IAC9B,KAAK;IACL,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;IAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC;IACxD,QAAQ,OAAO;IACf,KAAK;IACL,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAClD,QAAQ,OAAO;IACf,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
|
@@ -148,7 +148,7 @@ extension CustomError: LocalizedError {
|
|
|
148
148
|
|
|
149
149
|
public let TAG = "✨ Capacitor-updater:";
|
|
150
150
|
public let CAP_SERVER_PATH = "serverBasePath"
|
|
151
|
-
public let pluginVersion = "4.0.0-alpha.
|
|
151
|
+
public let pluginVersion = "4.0.0-alpha.17"
|
|
152
152
|
public var statsUrl = ""
|
|
153
153
|
public var appId = ""
|
|
154
154
|
public var deviceID = UIDevice.current.identifierForVendor?.uuidString ?? ""
|
|
@@ -13,6 +13,7 @@ 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(cancelDelay, CAPPluginReturnPromise);
|
|
16
17
|
CAP_PLUGIN_METHOD(getLatest, CAPPluginReturnPromise);
|
|
17
18
|
CAP_PLUGIN_METHOD(getDeviceId, CAPPluginReturnPromise);
|
|
18
19
|
CAP_PLUGIN_METHOD(getPluginVersion, CAPPluginReturnPromise);
|
|
@@ -11,7 +11,8 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
11
11
|
private var implementation = CapacitorUpdater()
|
|
12
12
|
static let updateUrlDefault = "https://xvwzpoazmxkqosrdewyv.functions.supabase.co/updates"
|
|
13
13
|
static let statsUrlDefault = "https://xvwzpoazmxkqosrdewyv.functions.supabase.co/stats"
|
|
14
|
-
|
|
14
|
+
let DELAY_UPDATE = "delayUpdate"
|
|
15
|
+
let DELAY_UPDATE_VAL = "delayUpdateVal"
|
|
15
16
|
private var updateUrl = ""
|
|
16
17
|
private var statsUrl = ""
|
|
17
18
|
private var currentVersionNative: Version = "0.0.0"
|
|
@@ -49,6 +50,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
49
50
|
let nc = NotificationCenter.default
|
|
50
51
|
nc.addObserver(self, selector: #selector(appMovedToBackground), name: UIApplication.didEnterBackgroundNotification, object: nil)
|
|
51
52
|
nc.addObserver(self, selector: #selector(appMovedToForeground), name: UIApplication.willEnterForegroundNotification, object: nil)
|
|
53
|
+
self._checkCancelDelay(killed: true)
|
|
52
54
|
self.appMovedToForeground()
|
|
53
55
|
}
|
|
54
56
|
|
|
@@ -224,7 +226,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
224
226
|
let bundle: BundleInfo = self.implementation.getCurrentBundle()
|
|
225
227
|
call.resolve([
|
|
226
228
|
"bundle": bundle.toJSON(),
|
|
227
|
-
"native": self.currentVersionNative
|
|
229
|
+
"native": self.currentVersionNative.description
|
|
228
230
|
])
|
|
229
231
|
}
|
|
230
232
|
|
|
@@ -236,15 +238,63 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
236
238
|
}
|
|
237
239
|
|
|
238
240
|
@objc func setDelay(_ call: CAPPluginCall) {
|
|
239
|
-
guard let
|
|
240
|
-
print("\(self.implementation.TAG) setDelay called without
|
|
241
|
-
call.reject("setDelay called without
|
|
241
|
+
guard let kind = call.getString("kind") else {
|
|
242
|
+
print("\(self.implementation.TAG) setDelay called without kind")
|
|
243
|
+
call.reject("setDelay called without kind")
|
|
242
244
|
return
|
|
243
245
|
}
|
|
244
|
-
|
|
246
|
+
let val = call.getString("value") ?? ""
|
|
247
|
+
UserDefaults.standard.set(kind, forKey: DELAY_UPDATE)
|
|
248
|
+
UserDefaults.standard.set(val, forKey: DELAY_UPDATE_VAL)
|
|
249
|
+
UserDefaults.standard.synchronize()
|
|
250
|
+
print("\(self.implementation.TAG) Delay update saved.")
|
|
245
251
|
call.resolve()
|
|
246
252
|
}
|
|
247
|
-
|
|
253
|
+
|
|
254
|
+
private func _cancelDelay() -> Void {
|
|
255
|
+
print("\(self.implementation.TAG) delay Canceled")
|
|
256
|
+
UserDefaults.standard.removeObject(forKey: DELAY_UPDATE)
|
|
257
|
+
UserDefaults.standard.removeObject(forKey: DELAY_UPDATE_VAL)
|
|
258
|
+
UserDefaults.standard.synchronize()
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
@objc func cancelDelay(_ call: CAPPluginCall) {
|
|
262
|
+
self._cancelDelay()
|
|
263
|
+
call.resolve()
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
private func _checkCancelDelay(killed: Bool) -> Void {
|
|
267
|
+
let delayUpdate = UserDefaults.standard.string(forKey: DELAY_UPDATE)
|
|
268
|
+
if (delayUpdate != nil) {
|
|
269
|
+
if (delayUpdate == "background" && !killed) {
|
|
270
|
+
self._cancelDelay()
|
|
271
|
+
} else if (delayUpdate == "kill" && killed) {
|
|
272
|
+
self._cancelDelay()
|
|
273
|
+
}
|
|
274
|
+
let delayVal = UserDefaults.standard.string(forKey: DELAY_UPDATE_VAL)
|
|
275
|
+
if (delayVal == nil) {
|
|
276
|
+
self._cancelDelay()
|
|
277
|
+
} else if (delayUpdate == "date") {
|
|
278
|
+
let dateFormatter = ISO8601DateFormatter()
|
|
279
|
+
let date = dateFormatter.date(from: delayVal!)!
|
|
280
|
+
let toDay = Date()
|
|
281
|
+
if (toDay < date) {
|
|
282
|
+
self._cancelDelay()
|
|
283
|
+
}
|
|
284
|
+
} else if (delayUpdate == "nativeVersion") {
|
|
285
|
+
do {
|
|
286
|
+
let versionLimit = try Version(delayVal!)
|
|
287
|
+
if (self.currentVersionNative >= versionLimit) {
|
|
288
|
+
self._cancelDelay()
|
|
289
|
+
}
|
|
290
|
+
} catch {
|
|
291
|
+
self._cancelDelay()
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
UserDefaults.standard.synchronize()
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
248
298
|
private func _isAutoUpdateEnabled() -> Bool {
|
|
249
299
|
return self.autoUpdate && self.updateUrl != ""
|
|
250
300
|
}
|
|
@@ -339,10 +389,10 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
339
389
|
|
|
340
390
|
@objc func appMovedToBackground() {
|
|
341
391
|
print("\(self.implementation.TAG) Check for waiting update")
|
|
342
|
-
let delayUpdate = UserDefaults.standard.
|
|
343
|
-
|
|
344
|
-
if (delayUpdate) {
|
|
345
|
-
print("\(self.implementation.TAG) Update delayed
|
|
392
|
+
let delayUpdate = UserDefaults.standard.string(forKey: DELAY_UPDATE)
|
|
393
|
+
self._checkCancelDelay(killed: false)
|
|
394
|
+
if (delayUpdate != nil) {
|
|
395
|
+
print("\(self.implementation.TAG) Update delayed")
|
|
346
396
|
return
|
|
347
397
|
}
|
|
348
398
|
|