@capgo/capacitor-updater 4.10.0 → 4.10.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 +0 -27
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +97 -95
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +214 -208
- package/dist/docs.json +1 -466
- package/dist/esm/definitions.d.ts +13 -13
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +0 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +0 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorUpdater.swift +19 -19
- package/package.json +15 -12
package/README.md
CHANGED
|
@@ -151,8 +151,6 @@ Capacitor Updator works by unzipping a compiled app bundle to the native device
|
|
|
151
151
|
* [`getDeviceId()`](#getdeviceid)
|
|
152
152
|
* [`getPluginVersion()`](#getpluginversion)
|
|
153
153
|
* [`isAutoUpdateEnabled()`](#isautoupdateenabled)
|
|
154
|
-
* [`addListener(string, ...)`](#addlistenerstring)
|
|
155
|
-
* [`removeAllListeners()`](#removealllisteners)
|
|
156
154
|
* [Interfaces](#interfaces)
|
|
157
155
|
* [Type Aliases](#type-aliases)
|
|
158
156
|
|
|
@@ -602,31 +600,6 @@ Get the state of auto update config. This will return `false` in manual mode.
|
|
|
602
600
|
--------------------
|
|
603
601
|
|
|
604
602
|
|
|
605
|
-
### addListener(string, ...)
|
|
606
|
-
|
|
607
|
-
```typescript
|
|
608
|
-
addListener(eventName: string, listenerFunc: (...args: any[]) => any) => Promise<PluginListenerHandle>
|
|
609
|
-
```
|
|
610
|
-
|
|
611
|
-
| Param | Type |
|
|
612
|
-
| ------------------ | --------------------------------------- |
|
|
613
|
-
| **`eventName`** | <code>string</code> |
|
|
614
|
-
| **`listenerFunc`** | <code>(...args: any[]) => any</code> |
|
|
615
|
-
|
|
616
|
-
**Returns:** <code>Promise<<a href="#pluginlistenerhandle">PluginListenerHandle</a>></code>
|
|
617
|
-
|
|
618
|
-
--------------------
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
### removeAllListeners()
|
|
622
|
-
|
|
623
|
-
```typescript
|
|
624
|
-
removeAllListeners() => Promise<void>
|
|
625
|
-
```
|
|
626
|
-
|
|
627
|
-
--------------------
|
|
628
|
-
|
|
629
|
-
|
|
630
603
|
### Interfaces
|
|
631
604
|
|
|
632
605
|
|
|
@@ -52,7 +52,7 @@ public class CapacitorUpdater {
|
|
|
52
52
|
private static final String bundleDirectory = "versions";
|
|
53
53
|
|
|
54
54
|
public static final String TAG = "Capacitor-updater";
|
|
55
|
-
public static final String pluginVersion = "4.10.
|
|
55
|
+
public static final String pluginVersion = "4.10.2";
|
|
56
56
|
|
|
57
57
|
public SharedPreferences.Editor editor;
|
|
58
58
|
public SharedPreferences prefs;
|
|
@@ -83,23 +83,25 @@ public class CapacitorUpdater {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
private boolean isEmulator() {
|
|
86
|
-
return (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
86
|
+
return (
|
|
87
|
+
(Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic")) ||
|
|
88
|
+
Build.FINGERPRINT.startsWith("generic") ||
|
|
89
|
+
Build.FINGERPRINT.startsWith("unknown") ||
|
|
90
|
+
Build.HARDWARE.contains("goldfish") ||
|
|
91
|
+
Build.HARDWARE.contains("ranchu") ||
|
|
92
|
+
Build.MODEL.contains("google_sdk") ||
|
|
93
|
+
Build.MODEL.contains("Emulator") ||
|
|
94
|
+
Build.MODEL.contains("Android SDK built for x86") ||
|
|
95
|
+
Build.MANUFACTURER.contains("Genymotion") ||
|
|
96
|
+
Build.PRODUCT.contains("sdk_google") ||
|
|
97
|
+
Build.PRODUCT.contains("google_sdk") ||
|
|
98
|
+
Build.PRODUCT.contains("sdk") ||
|
|
99
|
+
Build.PRODUCT.contains("sdk_x86") ||
|
|
100
|
+
Build.PRODUCT.contains("sdk_gphone64_arm64") ||
|
|
101
|
+
Build.PRODUCT.contains("vbox86p") ||
|
|
102
|
+
Build.PRODUCT.contains("emulator") ||
|
|
103
|
+
Build.PRODUCT.contains("simulator")
|
|
104
|
+
);
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
private int calcTotalPercent(final int percent, final int min, final int max) {
|
|
@@ -137,7 +139,7 @@ public class CapacitorUpdater {
|
|
|
137
139
|
|
|
138
140
|
if (!canonicalPath.startsWith(canonicalDir)) {
|
|
139
141
|
throw new FileNotFoundException(
|
|
140
|
-
|
|
142
|
+
"SecurityException, Failed to ensure directory is the start path : " + canonicalDir + " of " + canonicalPath
|
|
141
143
|
);
|
|
142
144
|
}
|
|
143
145
|
|
|
@@ -406,21 +408,21 @@ public class CapacitorUpdater {
|
|
|
406
408
|
Log.i(CapacitorUpdater.TAG, "Auto-update parameters: " + json);
|
|
407
409
|
// Building a request
|
|
408
410
|
JsonObjectRequest request = new JsonObjectRequest(
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
},
|
|
418
|
-
new Response.ErrorListener() {
|
|
419
|
-
@Override
|
|
420
|
-
public void onErrorResponse(VolleyError error) {
|
|
421
|
-
Log.e(TAG, "Error getting Latest", error);
|
|
422
|
-
}
|
|
411
|
+
Request.Method.POST,
|
|
412
|
+
updateUrl,
|
|
413
|
+
json,
|
|
414
|
+
new Response.Listener<JSONObject>() {
|
|
415
|
+
@Override
|
|
416
|
+
public void onResponse(JSONObject response) {
|
|
417
|
+
callback.callback(response);
|
|
423
418
|
}
|
|
419
|
+
},
|
|
420
|
+
new Response.ErrorListener() {
|
|
421
|
+
@Override
|
|
422
|
+
public void onErrorResponse(VolleyError error) {
|
|
423
|
+
Log.e(TAG, "Error getting Latest", error);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
424
426
|
);
|
|
425
427
|
this.requestQueue.add(request);
|
|
426
428
|
} catch (JSONException ex) {
|
|
@@ -440,34 +442,34 @@ public class CapacitorUpdater {
|
|
|
440
442
|
|
|
441
443
|
// Building a request
|
|
442
444
|
JsonObjectRequest request = new JsonObjectRequest(
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}
|
|
445
|
+
Request.Method.POST,
|
|
446
|
+
channelUrl,
|
|
447
|
+
json,
|
|
448
|
+
new Response.Listener<JSONObject>() {
|
|
449
|
+
@Override
|
|
450
|
+
public void onResponse(JSONObject res) {
|
|
451
|
+
final JSObject ret = new JSObject();
|
|
452
|
+
Iterator<String> keys = res.keys();
|
|
453
|
+
while (keys.hasNext()) {
|
|
454
|
+
String key = keys.next();
|
|
455
|
+
if (res.has(key)) {
|
|
456
|
+
try {
|
|
457
|
+
ret.put(key, res.get(key));
|
|
458
|
+
} catch (JSONException e) {
|
|
459
|
+
e.printStackTrace();
|
|
459
460
|
}
|
|
460
461
|
}
|
|
461
|
-
Log.i(TAG, "Channel set to \"" + channel);
|
|
462
|
-
callback.callback(ret);
|
|
463
|
-
}
|
|
464
|
-
},
|
|
465
|
-
new Response.ErrorListener() {
|
|
466
|
-
@Override
|
|
467
|
-
public void onErrorResponse(VolleyError error) {
|
|
468
|
-
Log.e(TAG, "Error set channel: " + error);
|
|
469
462
|
}
|
|
463
|
+
Log.i(TAG, "Channel set to \"" + channel);
|
|
464
|
+
callback.callback(ret);
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
new Response.ErrorListener() {
|
|
468
|
+
@Override
|
|
469
|
+
public void onErrorResponse(VolleyError error) {
|
|
470
|
+
Log.e(TAG, "Error set channel: " + error);
|
|
470
471
|
}
|
|
472
|
+
}
|
|
471
473
|
);
|
|
472
474
|
this.requestQueue.add(request);
|
|
473
475
|
} catch (JSONException ex) {
|
|
@@ -486,34 +488,34 @@ public class CapacitorUpdater {
|
|
|
486
488
|
|
|
487
489
|
// Building a request
|
|
488
490
|
JsonObjectRequest request = new JsonObjectRequest(
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
}
|
|
491
|
+
Request.Method.PUT,
|
|
492
|
+
channelUrl,
|
|
493
|
+
json,
|
|
494
|
+
new Response.Listener<JSONObject>() {
|
|
495
|
+
@Override
|
|
496
|
+
public void onResponse(JSONObject res) {
|
|
497
|
+
final JSObject ret = new JSObject();
|
|
498
|
+
Iterator<String> keys = res.keys();
|
|
499
|
+
while (keys.hasNext()) {
|
|
500
|
+
String key = keys.next();
|
|
501
|
+
if (res.has(key)) {
|
|
502
|
+
try {
|
|
503
|
+
ret.put(key, res.get(key));
|
|
504
|
+
} catch (JSONException e) {
|
|
505
|
+
e.printStackTrace();
|
|
505
506
|
}
|
|
506
507
|
}
|
|
507
|
-
Log.i(TAG, "Channel get to \"" + ret);
|
|
508
|
-
callback.callback(ret);
|
|
509
|
-
}
|
|
510
|
-
},
|
|
511
|
-
new Response.ErrorListener() {
|
|
512
|
-
@Override
|
|
513
|
-
public void onErrorResponse(VolleyError error) {
|
|
514
|
-
Log.e(TAG, "Error get channel: " + error);
|
|
515
508
|
}
|
|
509
|
+
Log.i(TAG, "Channel get to \"" + ret);
|
|
510
|
+
callback.callback(ret);
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
new Response.ErrorListener() {
|
|
514
|
+
@Override
|
|
515
|
+
public void onErrorResponse(VolleyError error) {
|
|
516
|
+
Log.e(TAG, "Error get channel: " + error);
|
|
516
517
|
}
|
|
518
|
+
}
|
|
517
519
|
);
|
|
518
520
|
this.requestQueue.add(request);
|
|
519
521
|
} catch (JSONException ex) {
|
|
@@ -533,21 +535,21 @@ public class CapacitorUpdater {
|
|
|
533
535
|
|
|
534
536
|
// Building a request
|
|
535
537
|
JsonObjectRequest request = new JsonObjectRequest(
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
}
|
|
538
|
+
Request.Method.POST,
|
|
539
|
+
statsUrl,
|
|
540
|
+
json,
|
|
541
|
+
new Response.Listener<JSONObject>() {
|
|
542
|
+
@Override
|
|
543
|
+
public void onResponse(JSONObject response) {
|
|
544
|
+
Log.i(TAG, "Stats send for \"" + action + "\", version " + versionName);
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
new Response.ErrorListener() {
|
|
548
|
+
@Override
|
|
549
|
+
public void onErrorResponse(VolleyError error) {
|
|
550
|
+
Log.e(TAG, "Error sending stats: " + error);
|
|
550
551
|
}
|
|
552
|
+
}
|
|
551
553
|
);
|
|
552
554
|
this.requestQueue.add(request);
|
|
553
555
|
} catch (JSONException ex) {
|