@capgo/capacitor-updater 4.4.9 → 4.4.11
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 +7 -7
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +1 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +4 -0
- package/dist/docs.json +10 -10
- package/dist/esm/definitions.d.ts +10 -10
- package/ios/Plugin/CapacitorUpdater.swift +1 -1
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -177,7 +177,7 @@ Notify Capacitor Updater that the current bundle is working (a rollback will occ
|
|
|
177
177
|
download(options: { url: string; version: string; }) => Promise<BundleInfo>
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
-
Download a new
|
|
180
|
+
Download a new bundle from the provided URL, it should be a zip file, with files inside or with a unique id inside with all your files
|
|
181
181
|
|
|
182
182
|
| Param | Type |
|
|
183
183
|
| ------------- | ---------------------------------------------- |
|
|
@@ -241,7 +241,7 @@ Delete bundle in storage
|
|
|
241
241
|
list() => Promise<{ bundles: BundleInfo[]; }>
|
|
242
242
|
```
|
|
243
243
|
|
|
244
|
-
Get all available
|
|
244
|
+
Get all available bundles
|
|
245
245
|
|
|
246
246
|
**Returns:** <code>Promise<{ bundles: BundleInfo[]; }></code>
|
|
247
247
|
|
|
@@ -254,7 +254,7 @@ Get all available versions
|
|
|
254
254
|
reset(options?: { toLastSuccessful?: boolean | undefined; } | undefined) => Promise<void>
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
Set the `builtin`
|
|
257
|
+
Set the `builtin` bundle (the one sent to Apple store / Google play store ) as current bundle
|
|
258
258
|
|
|
259
259
|
| Param | Type |
|
|
260
260
|
| ------------- | -------------------------------------------- |
|
|
@@ -340,7 +340,7 @@ Cancel delay to updates as usual
|
|
|
340
340
|
getLatest() => Promise<latestVersion>
|
|
341
341
|
```
|
|
342
342
|
|
|
343
|
-
Get Latest
|
|
343
|
+
Get Latest bundle available from update Url
|
|
344
344
|
|
|
345
345
|
**Returns:** <code>Promise<<a href="#latestversion">latestVersion</a>></code>
|
|
346
346
|
|
|
@@ -644,9 +644,9 @@ removeAllListeners() => Promise<void>
|
|
|
644
644
|
|
|
645
645
|
#### MajorAvailableEvent
|
|
646
646
|
|
|
647
|
-
| Prop | Type | Description
|
|
648
|
-
| ------------- | ------------------- |
|
|
649
|
-
| **`version`** | <code>string</code> | Emit when a new major
|
|
647
|
+
| Prop | Type | Description | Since |
|
|
648
|
+
| ------------- | ------------------- | ------------------------------------------ | ----- |
|
|
649
|
+
| **`version`** | <code>string</code> | Emit when a new major bundle is available. | 4.0.0 |
|
|
650
650
|
|
|
651
651
|
|
|
652
652
|
#### UpdateFailedEvent
|
|
@@ -45,7 +45,7 @@ public class CapacitorUpdater {
|
|
|
45
45
|
private static final String bundleDirectory = "versions";
|
|
46
46
|
|
|
47
47
|
public static final String TAG = "Capacitor-updater";
|
|
48
|
-
public static final String pluginVersion = "4.4.
|
|
48
|
+
public static final String pluginVersion = "4.4.11";
|
|
49
49
|
|
|
50
50
|
public SharedPreferences.Editor editor;
|
|
51
51
|
public SharedPreferences prefs;
|
|
@@ -207,6 +207,8 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
207
207
|
final JSObject ret = new JSObject();
|
|
208
208
|
ret.put("version", version);
|
|
209
209
|
CapacitorUpdaterPlugin.this.notifyListeners("downloadFailed", ret);
|
|
210
|
+
final BundleInfo current = CapacitorUpdaterPlugin.this.implementation.getCurrentBundle();
|
|
211
|
+
CapacitorUpdaterPlugin.this.implementation.sendStats("download_fail", current.getVersionName());
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
214
|
}
|
|
@@ -713,6 +715,8 @@ public class CapacitorUpdaterPlugin extends Plugin implements Application.Activi
|
|
|
713
715
|
final JSObject ret = new JSObject();
|
|
714
716
|
ret.put("version", latestVersionName);
|
|
715
717
|
CapacitorUpdaterPlugin.this.notifyListeners("downloadFailed", ret);
|
|
718
|
+
final BundleInfo current = CapacitorUpdaterPlugin.this.implementation.getCurrentBundle();
|
|
719
|
+
CapacitorUpdaterPlugin.this.implementation.sendStats("download_fail", current.getVersionName());
|
|
716
720
|
final JSObject retNoNeed = new JSObject();
|
|
717
721
|
retNoNeed.put("bundle", current.toJSON());
|
|
718
722
|
CapacitorUpdaterPlugin.this.notifyListeners("noNeedUpdate", retNoNeed);
|
package/dist/docs.json
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"tags": [
|
|
41
41
|
{
|
|
42
42
|
"name": "returns",
|
|
43
|
-
"text": "The {@link BundleInfo} for the specified
|
|
43
|
+
"text": "The {@link BundleInfo} for the specified bundle."
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
"name": "param",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"text": "https://example.com/versions/{version}/dist.zip"
|
|
56
56
|
}
|
|
57
57
|
],
|
|
58
|
-
"docs": "Download a new
|
|
58
|
+
"docs": "Download a new bundle from the provided URL, it should be a zip file, with files inside or with a unique id inside with all your files",
|
|
59
59
|
"complexTypes": [
|
|
60
60
|
"BundleInfo"
|
|
61
61
|
],
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
"name": "throws",
|
|
86
|
-
"text": "An error if there are is no index.html file inside the
|
|
86
|
+
"text": "An error if there are is no index.html file inside the bundle folder."
|
|
87
87
|
}
|
|
88
88
|
],
|
|
89
89
|
"docs": "Set the next bundle to be used when the app is reloaded.",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
116
|
"name": "throws",
|
|
117
|
-
"text": "An error if there are is no index.html file inside the
|
|
117
|
+
"text": "An error if there are is no index.html file inside the bundle folder."
|
|
118
118
|
}
|
|
119
119
|
],
|
|
120
120
|
"docs": "Set the current bundle and immediately reloads the app.",
|
|
@@ -158,14 +158,14 @@
|
|
|
158
158
|
"tags": [
|
|
159
159
|
{
|
|
160
160
|
"name": "returns",
|
|
161
|
-
"text": "an Promise witht the
|
|
161
|
+
"text": "an Promise witht the bundles list"
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
164
|
"name": "throws",
|
|
165
165
|
"text": "An error if the something went wrong"
|
|
166
166
|
}
|
|
167
167
|
],
|
|
168
|
-
"docs": "Get all available
|
|
168
|
+
"docs": "Get all available bundles",
|
|
169
169
|
"complexTypes": [
|
|
170
170
|
"BundleInfo"
|
|
171
171
|
],
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
"text": "An error if the something went wrong"
|
|
197
197
|
}
|
|
198
198
|
],
|
|
199
|
-
"docs": "Set the `builtin`
|
|
199
|
+
"docs": "Set the `builtin` bundle (the one sent to Apple store / Google play store ) as current bundle",
|
|
200
200
|
"complexTypes": [],
|
|
201
201
|
"slug": "reset"
|
|
202
202
|
},
|
|
@@ -368,7 +368,7 @@
|
|
|
368
368
|
"text": "4.0.0"
|
|
369
369
|
}
|
|
370
370
|
],
|
|
371
|
-
"docs": "Get Latest
|
|
371
|
+
"docs": "Get Latest bundle available from update Url",
|
|
372
372
|
"complexTypes": [
|
|
373
373
|
"latestVersion"
|
|
374
374
|
],
|
|
@@ -1163,7 +1163,7 @@
|
|
|
1163
1163
|
"name": "since"
|
|
1164
1164
|
}
|
|
1165
1165
|
],
|
|
1166
|
-
"docs": "Emit when a new major
|
|
1166
|
+
"docs": "Emit when a new major bundle is available.",
|
|
1167
1167
|
"complexTypes": [],
|
|
1168
1168
|
"type": "string"
|
|
1169
1169
|
}
|
|
@@ -1518,7 +1518,7 @@
|
|
|
1518
1518
|
"name": "example"
|
|
1519
1519
|
}
|
|
1520
1520
|
],
|
|
1521
|
-
"docs": "Automatically delete previous downloaded bundles when a newer native app
|
|
1521
|
+
"docs": "Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device.\n\nOnly available for Android and iOS.",
|
|
1522
1522
|
"complexTypes": [],
|
|
1523
1523
|
"type": "boolean | undefined"
|
|
1524
1524
|
},
|
|
@@ -42,7 +42,7 @@ declare module '@capacitor/cli' {
|
|
|
42
42
|
*/
|
|
43
43
|
autoUpdate?: boolean;
|
|
44
44
|
/**
|
|
45
|
-
* Automatically delete previous downloaded bundles when a newer native app
|
|
45
|
+
* Automatically delete previous downloaded bundles when a newer native app bundle is installed to the device.
|
|
46
46
|
*
|
|
47
47
|
* Only available for Android and iOS.
|
|
48
48
|
*
|
|
@@ -98,7 +98,7 @@ export interface DownloadEvent {
|
|
|
98
98
|
}
|
|
99
99
|
export interface MajorAvailableEvent {
|
|
100
100
|
/**
|
|
101
|
-
* Emit when a new major
|
|
101
|
+
* Emit when a new major bundle is available.
|
|
102
102
|
*
|
|
103
103
|
* @since 4.0.0
|
|
104
104
|
*/
|
|
@@ -174,9 +174,9 @@ export interface CapacitorUpdaterPlugin {
|
|
|
174
174
|
*/
|
|
175
175
|
notifyAppReady(): Promise<BundleInfo>;
|
|
176
176
|
/**
|
|
177
|
-
* Download a new
|
|
177
|
+
* Download a new bundle from the provided URL, it should be a zip file, with files inside or with a unique id inside with all your files
|
|
178
178
|
*
|
|
179
|
-
* @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified
|
|
179
|
+
* @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle.
|
|
180
180
|
* @param url The URL of the bundle zip file (e.g: dist.zip) to be downloaded. (This can be any URL. E.g: Amazon S3, a github tag, any other place you've hosted your bundle.)
|
|
181
181
|
* @param version set the version code/name of this bundle/version
|
|
182
182
|
* @example https://example.com/versions/{version}/dist.zip
|
|
@@ -190,7 +190,7 @@ export interface CapacitorUpdaterPlugin {
|
|
|
190
190
|
*
|
|
191
191
|
* @returns {Promise<BundleInfo>} The {@link BundleInfo} for the specified bundle id.
|
|
192
192
|
* @param id The bundle id to set as current, next time the app is reloaded. See {@link BundleInfo.id}
|
|
193
|
-
* @throws An error if there are is no index.html file inside the
|
|
193
|
+
* @throws An error if there are is no index.html file inside the bundle folder.
|
|
194
194
|
*/
|
|
195
195
|
next(options: {
|
|
196
196
|
id: string;
|
|
@@ -200,7 +200,7 @@ export interface CapacitorUpdaterPlugin {
|
|
|
200
200
|
*
|
|
201
201
|
* @param id The bundle id to set as current. See {@link BundleInfo.id}
|
|
202
202
|
* @returns {Promise<Void>} An empty promise.
|
|
203
|
-
* @throws An error if there are is no index.html file inside the
|
|
203
|
+
* @throws An error if there are is no index.html file inside the bundle folder.
|
|
204
204
|
*/
|
|
205
205
|
set(options: {
|
|
206
206
|
id: string;
|
|
@@ -216,16 +216,16 @@ export interface CapacitorUpdaterPlugin {
|
|
|
216
216
|
id: string;
|
|
217
217
|
}): Promise<void>;
|
|
218
218
|
/**
|
|
219
|
-
* Get all available
|
|
219
|
+
* Get all available bundles
|
|
220
220
|
*
|
|
221
|
-
* @returns {Promise<{
|
|
221
|
+
* @returns {Promise<{bundles: BundleInfo[]}>} an Promise witht the bundles list
|
|
222
222
|
* @throws An error if the something went wrong
|
|
223
223
|
*/
|
|
224
224
|
list(): Promise<{
|
|
225
225
|
bundles: BundleInfo[];
|
|
226
226
|
}>;
|
|
227
227
|
/**
|
|
228
|
-
* Set the `builtin`
|
|
228
|
+
* Set the `builtin` bundle (the one sent to Apple store / Google play store ) as current bundle
|
|
229
229
|
*
|
|
230
230
|
* @returns {Promise<void>} an empty Promise
|
|
231
231
|
* @param toLastSuccessful [false] if yes it reset to to the last successfully loaded bundle instead of `builtin`
|
|
@@ -294,7 +294,7 @@ export interface CapacitorUpdaterPlugin {
|
|
|
294
294
|
*/
|
|
295
295
|
cancelDelay(): Promise<void>;
|
|
296
296
|
/**
|
|
297
|
-
* Get Latest
|
|
297
|
+
* Get Latest bundle available from update Url
|
|
298
298
|
*
|
|
299
299
|
* @returns {Promise<latestVersion>} an Promise resolved when url is loaded
|
|
300
300
|
* @throws An error if the something went wrong
|
|
@@ -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.4.
|
|
151
|
+
public let pluginVersion = "4.4.11"
|
|
152
152
|
public var statsUrl = ""
|
|
153
153
|
public var appId = ""
|
|
154
154
|
public var deviceID = UIDevice.current.identifierForVendor?.uuidString ?? ""
|
|
@@ -107,11 +107,13 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
107
107
|
let url = URL(string: urlString)
|
|
108
108
|
print("\(self.implementation.TAG) Downloading \(url!)")
|
|
109
109
|
do {
|
|
110
|
-
let res = try implementation.download(url: url!, version: version)
|
|
110
|
+
let res = try self.implementation.download(url: url!, version: version)
|
|
111
111
|
call.resolve(res.toJSON())
|
|
112
112
|
} catch {
|
|
113
113
|
print("\(self.implementation.TAG) Failed to download from: \(url!) \(error.localizedDescription)")
|
|
114
114
|
self.notifyListeners("downloadFailed", data: ["version": version])
|
|
115
|
+
let current: BundleInfo = self.implementation.getCurrentBundle()
|
|
116
|
+
self.implementation.sendStats(action: "download_fail", versionName: current.getVersionName())
|
|
115
117
|
call.reject("Failed to download from: \(url!)", error.localizedDescription)
|
|
116
118
|
}
|
|
117
119
|
}
|
|
@@ -192,7 +194,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
192
194
|
resArr.append(v.toJSON())
|
|
193
195
|
}
|
|
194
196
|
call.resolve([
|
|
195
|
-
"
|
|
197
|
+
"bundles": resArr
|
|
196
198
|
])
|
|
197
199
|
}
|
|
198
200
|
|
|
@@ -480,6 +482,8 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
|
480
482
|
_ = self.implementation.setNextBundle(next: next.getId())
|
|
481
483
|
} catch {
|
|
482
484
|
print("\(self.implementation.TAG) Error downloading file", error.localizedDescription)
|
|
485
|
+
let current: BundleInfo = self.implementation.getCurrentBundle()
|
|
486
|
+
self.implementation.sendStats(action: "download_fail", versionName: current.getVersionName())
|
|
483
487
|
self.notifyListeners("downloadFailed", data: ["version": latestVersionName])
|
|
484
488
|
self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
|
|
485
489
|
}
|