@capgo/capacitor-updater 4.0.1 → 4.2.0
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 +13 -13
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +3 -3
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +3 -3
- package/dist/docs.json +1 -1
- package/dist/esm/definitions.d.ts +1 -1
- package/ios/Plugin/CapacitorUpdater.swift +10 -4
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,19 +28,6 @@ Create account in [capgo.app](https://capgo.app) and get your [API key](https://
|
|
|
28
28
|
- Add app with CLI `npx @capgo/cli@latest add`
|
|
29
29
|
- Upload app to channel production `npx @capgo/cli@latest upload -c production`
|
|
30
30
|
- Set channel production public `npx @capgo/cli@latest set -c production -s public`
|
|
31
|
-
- Edit your `capacitor.config.json` like below, set `autoUpdate` to true.
|
|
32
|
-
```json
|
|
33
|
-
// capacitor.config.json
|
|
34
|
-
{
|
|
35
|
-
"appId": "**.***.**",
|
|
36
|
-
"appName": "Name",
|
|
37
|
-
"plugins": {
|
|
38
|
-
"CapacitorUpdater": {
|
|
39
|
-
"autoUpdate": true,
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
31
|
- Add to your main code
|
|
45
32
|
```javascript
|
|
46
33
|
import { CapacitorUpdater } from '@capgo/capacitor-updater'
|
|
@@ -60,6 +47,19 @@ https://github.com/Cap-go/capacitor-updater/wiki) documentation.
|
|
|
60
47
|
|
|
61
48
|
Download update distribution zipfiles from a custom url. Manually control the entire update process.
|
|
62
49
|
|
|
50
|
+
- Edit your `capacitor.config.json` like below, set `autoUpdate` to true.
|
|
51
|
+
```json
|
|
52
|
+
// capacitor.config.json
|
|
53
|
+
{
|
|
54
|
+
"appId": "**.***.**",
|
|
55
|
+
"appName": "Name",
|
|
56
|
+
"plugins": {
|
|
57
|
+
"CapacitorUpdater": {
|
|
58
|
+
"autoUpdate": false,
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
63
|
- Add to your main code
|
|
64
64
|
```javascript
|
|
65
65
|
import { CapacitorUpdater } from '@capgo/capacitor-updater'
|
|
@@ -47,7 +47,7 @@ public class CapacitorUpdater {
|
|
|
47
47
|
private static final String bundleDirectory = "versions";
|
|
48
48
|
|
|
49
49
|
public static final String TAG = "Capacitor-updater";
|
|
50
|
-
public static final String pluginVersion = "4.0
|
|
50
|
+
public static final String pluginVersion = "4.2.0";
|
|
51
51
|
|
|
52
52
|
public SharedPreferences.Editor editor;
|
|
53
53
|
public SharedPreferences prefs;
|
|
@@ -261,7 +261,7 @@ public class CapacitorUpdater {
|
|
|
261
261
|
|
|
262
262
|
public Boolean delete(final String id, final Boolean removeInfo) throws IOException {
|
|
263
263
|
final BundleInfo deleted = this.getBundleInfo(id);
|
|
264
|
-
if (deleted.isBuiltin() || this.getCurrentBundleId()
|
|
264
|
+
if (deleted.isBuiltin() || this.getCurrentBundleId().equals(id)) {
|
|
265
265
|
Log.e(TAG, "Cannot delete " + id);
|
|
266
266
|
return false;
|
|
267
267
|
}
|
|
@@ -425,7 +425,7 @@ public class CapacitorUpdater {
|
|
|
425
425
|
new Response.ErrorListener(){
|
|
426
426
|
@Override
|
|
427
427
|
public void onErrorResponse(VolleyError error) {
|
|
428
|
-
Log.i(TAG, "
|
|
428
|
+
Log.i(TAG, "Error sending stats: " + error);
|
|
429
429
|
}
|
|
430
430
|
});
|
|
431
431
|
this.requestQueue.add(request);
|
|
@@ -97,7 +97,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
97
97
|
this.autoDeleteFailed = this.getConfig().getBoolean("autoDeleteFailed", true);
|
|
98
98
|
this.autoDeletePrevious = this.getConfig().getBoolean("autoDeletePrevious", true);
|
|
99
99
|
this.updateUrl = this.getConfig().getString("updateUrl", updateUrlDefault);
|
|
100
|
-
this.autoUpdate = this.getConfig().getBoolean("autoUpdate",
|
|
100
|
+
this.autoUpdate = this.getConfig().getBoolean("autoUpdate", true);
|
|
101
101
|
this.appReadyTimeout = this.getConfig().getInt("appReadyTimeout", 10000);
|
|
102
102
|
this.resetWhenUpdate = this.getConfig().getBoolean("resetWhenUpdate", true);
|
|
103
103
|
|
|
@@ -460,7 +460,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
460
460
|
|
|
461
461
|
private void _checkCancelDelay(Boolean killed) {
|
|
462
462
|
final String delayUpdate = this.prefs.getString(DELAY_UPDATE, "");
|
|
463
|
-
if ("".equals(delayUpdate)) {
|
|
463
|
+
if (!"".equals(delayUpdate)) {
|
|
464
464
|
if ("background".equals(delayUpdate) && !killed) {
|
|
465
465
|
this._cancelDelay("background check");
|
|
466
466
|
} else if ("kill".equals(delayUpdate) && killed) {
|
|
@@ -557,7 +557,7 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
557
557
|
return;
|
|
558
558
|
}
|
|
559
559
|
|
|
560
|
-
if (!res.has("url") || CapacitorUpdaterPlugin.this.isValidURL((String)res.get("url"))) {
|
|
560
|
+
if (!res.has("url") || !CapacitorUpdaterPlugin.this.isValidURL((String)res.get("url"))) {
|
|
561
561
|
Log.e(CapacitorUpdater.TAG, "Error no url or wrong format");
|
|
562
562
|
final JSObject retNoNeed = new JSObject();
|
|
563
563
|
retNoNeed.put("bundle", current.toJSON());
|
package/dist/docs.json
CHANGED
|
@@ -146,7 +146,7 @@ extension CustomError: LocalizedError {
|
|
|
146
146
|
|
|
147
147
|
public let TAG = "✨ Capacitor-updater:";
|
|
148
148
|
public let CAP_SERVER_PATH = "serverBasePath"
|
|
149
|
-
public let pluginVersion = "4.0
|
|
149
|
+
public let pluginVersion = "4.2.0"
|
|
150
150
|
public var statsUrl = ""
|
|
151
151
|
public var appId = ""
|
|
152
152
|
public var deviceID = UIDevice.current.identifierForVendor?.uuidString ?? ""
|
|
@@ -463,10 +463,16 @@ extension CustomError: LocalizedError {
|
|
|
463
463
|
"plugin_version": self.pluginVersion,
|
|
464
464
|
"app_id": self.appId
|
|
465
465
|
]
|
|
466
|
-
|
|
467
466
|
DispatchQueue.global(qos: .background).async {
|
|
468
|
-
let
|
|
469
|
-
|
|
467
|
+
let request = AF.request(self.statsUrl, method: .post,parameters: parameters, encoder: JSONParameterEncoder.default)
|
|
468
|
+
request.responseData { response in
|
|
469
|
+
switch response.result {
|
|
470
|
+
case .success():
|
|
471
|
+
print("\(self.TAG) Stats send for \(action), version \(versionName)")
|
|
472
|
+
case .failure(error):
|
|
473
|
+
print("\(self.TAG) Error sending stats: ", error )
|
|
474
|
+
}
|
|
475
|
+
}
|
|
470
476
|
}
|
|
471
477
|
}
|
|
472
478
|
|
|
@@ -33,7 +33,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
33
33
|
autoDeleteFailed = getConfig().getBoolean("autoDeleteFailed", true)
|
|
34
34
|
autoDeletePrevious = getConfig().getBoolean("autoDeletePrevious", true)
|
|
35
35
|
updateUrl = getConfig().getString("updateUrl") ?? CapacitorUpdaterPlugin.updateUrlDefault
|
|
36
|
-
autoUpdate = getConfig().getBoolean("autoUpdate",
|
|
36
|
+
autoUpdate = getConfig().getBoolean("autoUpdate", true)
|
|
37
37
|
appReadyTimeout = getConfig().getInt("appReadyTimeout", 10000)
|
|
38
38
|
resetWhenUpdate = getConfig().getBoolean("resetWhenUpdate", true)
|
|
39
39
|
|