@capgo/capacitor-updater 4.17.47 → 4.21.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
CHANGED
|
@@ -38,24 +38,11 @@ npx cap sync
|
|
|
38
38
|
|
|
39
39
|
## Auto-update setup
|
|
40
40
|
|
|
41
|
-
Create account in [capgo.app](https://capgo.app) and get your [API key](https://capgo.app/app/apikeys)
|
|
42
|
-
- Login to CLI `npx @capgo/cli@latest
|
|
43
|
-
|
|
44
|
-
- Upload app to channel production `npx @capgo/cli@latest upload -c production`
|
|
45
|
-
- Set channel production public `npx @capgo/cli@latest set -c production -s public`
|
|
46
|
-
- Add to your main code
|
|
47
|
-
```javascript
|
|
48
|
-
import { CapacitorUpdater } from '@capgo/capacitor-updater'
|
|
49
|
-
CapacitorUpdater.notifyAppReady()
|
|
50
|
-
```
|
|
51
|
-
This tells Capacitor Updator that the current update bundle has loaded succesfully. Failing to call this method will cause your application to be rolled back to the previously successful version (or built-in bundle).
|
|
52
|
-
|
|
53
|
-
- Do `npm run build && npx cap copy` to copy the build to capacitor.
|
|
54
|
-
- Run the app and see app auto update after each backgrounding.
|
|
55
|
-
- Failed updates will automatically roll back to the last successful version.
|
|
41
|
+
Create your account in [capgo.app](https://capgo.app) and get your [API key](https://capgo.app/app/apikeys)
|
|
42
|
+
- Login to CLI `npx @capgo/cli@latest init API_KEY`
|
|
43
|
+
And follow the steps by step to setup your app.
|
|
56
44
|
|
|
57
|
-
See more there in the [Auto update](
|
|
58
|
-
https://github.com/Cap-go/capacitor-updater/wiki) documentation.
|
|
45
|
+
See more there in the [Auto update documentation](https://docs.capgo.app/plugin/auto-update).
|
|
59
46
|
|
|
60
47
|
|
|
61
48
|
## Manual setup
|
|
@@ -55,7 +55,7 @@ public class CapacitorUpdaterPlugin
|
|
|
55
55
|
private static final String channelUrlDefault =
|
|
56
56
|
"https://api.capgo.app/channel_self";
|
|
57
57
|
|
|
58
|
-
private final String PLUGIN_VERSION = "4.
|
|
58
|
+
private final String PLUGIN_VERSION = "4.21.0";
|
|
59
59
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
60
60
|
|
|
61
61
|
private SharedPreferences.Editor editor;
|
|
@@ -110,7 +110,8 @@ public class CapacitorUpdaterPlugin
|
|
|
110
110
|
this.implementation.versionCode = Integer.toString(pInfo.versionCode);
|
|
111
111
|
this.implementation.requestQueue =
|
|
112
112
|
Volley.newRequestQueue(this.getContext());
|
|
113
|
-
this.currentVersionNative =
|
|
113
|
+
this.currentVersionNative =
|
|
114
|
+
new Version(this.getConfig().getString("version", pInfo.versionName));
|
|
114
115
|
} catch (final PackageManager.NameNotFoundException e) {
|
|
115
116
|
Log.e(CapacitorUpdater.TAG, "Error instantiating implementation", e);
|
|
116
117
|
return;
|
|
@@ -1226,9 +1227,8 @@ public class CapacitorUpdaterPlugin
|
|
|
1226
1227
|
|
|
1227
1228
|
private boolean isMainActivity() {
|
|
1228
1229
|
Context mContext = this.getContext();
|
|
1229
|
-
ActivityManager activityManager =
|
|
1230
|
-
Context.ACTIVITY_SERVICE
|
|
1231
|
-
);
|
|
1230
|
+
ActivityManager activityManager =
|
|
1231
|
+
(ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
|
|
1232
1232
|
List<ActivityManager.AppTask> runningTasks = activityManager.getAppTasks();
|
|
1233
1233
|
ActivityManager.RecentTaskInfo runningTask = runningTasks
|
|
1234
1234
|
.get(0)
|
package/dist/docs.json
CHANGED
|
@@ -1475,6 +1475,22 @@
|
|
|
1475
1475
|
"docs": "Configure the private key for end to end live update encryption.\n\nOnly available for Android and iOS.",
|
|
1476
1476
|
"complexTypes": [],
|
|
1477
1477
|
"type": "string | undefined"
|
|
1478
|
+
},
|
|
1479
|
+
{
|
|
1480
|
+
"name": "version",
|
|
1481
|
+
"tags": [
|
|
1482
|
+
{
|
|
1483
|
+
"text": "undefined",
|
|
1484
|
+
"name": "default"
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
"text": "4.17.48",
|
|
1488
|
+
"name": "since"
|
|
1489
|
+
}
|
|
1490
|
+
],
|
|
1491
|
+
"docs": "Configure the current version of the app. This will be used for the first update request.\nIf not set, the plugin will get the version from the native code.\n\nOnly available for Android and iOS.",
|
|
1492
|
+
"complexTypes": [],
|
|
1493
|
+
"type": "string | undefined"
|
|
1478
1494
|
}
|
|
1479
1495
|
],
|
|
1480
1496
|
"docs": "These configuration values are available:"
|
|
@@ -76,6 +76,16 @@ declare module "@capacitor/cli" {
|
|
|
76
76
|
* @default undefined
|
|
77
77
|
*/
|
|
78
78
|
privateKey?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Configure the current version of the app. This will be used for the first update request.
|
|
81
|
+
* If not set, the plugin will get the version from the native code.
|
|
82
|
+
*
|
|
83
|
+
* Only available for Android and iOS.
|
|
84
|
+
*
|
|
85
|
+
* @default undefined
|
|
86
|
+
* @since 4.17.48
|
|
87
|
+
*/
|
|
88
|
+
version?: string;
|
|
79
89
|
};
|
|
80
90
|
}
|
|
81
91
|
}
|
|
@@ -15,7 +15,7 @@ import Version
|
|
|
15
15
|
@objc(CapacitorUpdaterPlugin)
|
|
16
16
|
public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
17
17
|
private var implementation = CapacitorUpdater()
|
|
18
|
-
private let PLUGIN_VERSION: String = "4.
|
|
18
|
+
private let PLUGIN_VERSION: String = "4.21.0"
|
|
19
19
|
static let updateUrlDefault = "https://api.capgo.app/updates"
|
|
20
20
|
static let statsUrlDefault = "https://api.capgo.app/stats"
|
|
21
21
|
static let channelUrlDefault = "https://api.capgo.app/channel_self"
|
|
@@ -37,7 +37,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
37
37
|
override public func load() {
|
|
38
38
|
print("\(self.implementation.TAG) init for device \(self.implementation.deviceID)")
|
|
39
39
|
do {
|
|
40
|
-
currentVersionNative = try Version(Bundle.main.versionName ?? "0.0.0")
|
|
40
|
+
currentVersionNative = try Version(getConfig().getString("version", Bundle.main.versionName ?? "0.0.0")!)
|
|
41
41
|
} catch {
|
|
42
42
|
print("\(self.implementation.TAG) Cannot get version native \(currentVersionNative)")
|
|
43
43
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/capacitor-updater",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"packageManager": "pnpm@7.30.
|
|
3
|
+
"version": "4.21.0",
|
|
4
|
+
"packageManager": "pnpm@7.30.3",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"description": "Live update for capacitor apps",
|
|
7
7
|
"main": "dist/plugin.cjs.js",
|
|
@@ -53,23 +53,23 @@
|
|
|
53
53
|
"prepublishOnly": "npm run build"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@capacitor/android": "^4.
|
|
57
|
-
"@capacitor/cli": "^4.
|
|
58
|
-
"@capacitor/core": "^4.
|
|
59
|
-
"@capacitor/docgen": "^0.2.
|
|
60
|
-
"@capacitor/ios": "^4.
|
|
56
|
+
"@capacitor/android": "^4.7.1",
|
|
57
|
+
"@capacitor/cli": "^4.7.1",
|
|
58
|
+
"@capacitor/core": "^4.7.1",
|
|
59
|
+
"@capacitor/docgen": "^0.2.1",
|
|
60
|
+
"@capacitor/ios": "^4.7.1",
|
|
61
61
|
"@ionic/eslint-config": "^0.3.0",
|
|
62
62
|
"@ionic/prettier-config": "^2.0.0",
|
|
63
63
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
64
|
-
"@types/node": "^18.
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
66
|
-
"@typescript-eslint/parser": "^5.
|
|
67
|
-
"eslint": "^8.
|
|
64
|
+
"@types/node": "^18.15.7",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^5.56.0",
|
|
66
|
+
"@typescript-eslint/parser": "^5.56.0",
|
|
67
|
+
"eslint": "^8.36.0",
|
|
68
68
|
"eslint-plugin-import": "^2.27.5",
|
|
69
|
-
"prettier": "^2.8.
|
|
70
|
-
"prettier-plugin-java": "^2.
|
|
71
|
-
"rimraf": "^4.
|
|
72
|
-
"rollup": "^3.
|
|
69
|
+
"prettier": "^2.8.7",
|
|
70
|
+
"prettier-plugin-java": "^2.1.0",
|
|
71
|
+
"rimraf": "^4.4.1",
|
|
72
|
+
"rollup": "^3.20.2",
|
|
73
73
|
"swiftlint": "^1.0.1",
|
|
74
74
|
"typescript": "^4.9.5"
|
|
75
75
|
},
|