@capgo/capacitor-updater 7.16.0 → 7.17.1
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/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +41 -13
- package/dist/esm/web.js +0 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +0 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +0 -1
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +40 -10
- package/package.json +1 -1
|
@@ -60,7 +60,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
60
60
|
private static final String statsUrlDefault = "https://plugin.capgo.app/stats";
|
|
61
61
|
private static final String channelUrlDefault = "https://plugin.capgo.app/channel_self";
|
|
62
62
|
|
|
63
|
-
private final String PLUGIN_VERSION = "7.
|
|
63
|
+
private final String PLUGIN_VERSION = "7.17.1";
|
|
64
64
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
65
65
|
|
|
66
66
|
private SharedPreferences.Editor editor;
|
|
@@ -1198,7 +1198,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1198
1198
|
}
|
|
1199
1199
|
|
|
1200
1200
|
private void endBackGroundTaskWithNotif(String msg, String latestVersionName, BundleInfo current, Boolean error) {
|
|
1201
|
-
endBackGroundTaskWithNotif(msg, latestVersionName, current, error, false);
|
|
1201
|
+
endBackGroundTaskWithNotif(msg, latestVersionName, current, error, false, "download_fail", "downloadFailed");
|
|
1202
1202
|
}
|
|
1203
1203
|
|
|
1204
1204
|
private void endBackGroundTaskWithNotif(
|
|
@@ -1207,6 +1207,18 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1207
1207
|
BundleInfo current,
|
|
1208
1208
|
Boolean error,
|
|
1209
1209
|
Boolean isDirectUpdate
|
|
1210
|
+
) {
|
|
1211
|
+
endBackGroundTaskWithNotif(msg, latestVersionName, current, error, isDirectUpdate, "download_fail", "downloadFailed");
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
private void endBackGroundTaskWithNotif(
|
|
1215
|
+
String msg,
|
|
1216
|
+
String latestVersionName,
|
|
1217
|
+
BundleInfo current,
|
|
1218
|
+
Boolean error,
|
|
1219
|
+
Boolean isDirectUpdate,
|
|
1220
|
+
String failureAction,
|
|
1221
|
+
String failureEvent
|
|
1210
1222
|
) {
|
|
1211
1223
|
if (error) {
|
|
1212
1224
|
logger.info(
|
|
@@ -1217,10 +1229,10 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1217
1229
|
"latestVersionName: " +
|
|
1218
1230
|
latestVersionName
|
|
1219
1231
|
);
|
|
1220
|
-
this.implementation.sendStats(
|
|
1232
|
+
this.implementation.sendStats(failureAction, current.getVersionName());
|
|
1221
1233
|
final JSObject ret = new JSObject();
|
|
1222
1234
|
ret.put("version", latestVersionName);
|
|
1223
|
-
this.notifyListeners(
|
|
1235
|
+
this.notifyListeners(failureEvent, ret);
|
|
1224
1236
|
}
|
|
1225
1237
|
final JSObject ret = new JSObject();
|
|
1226
1238
|
ret.put("bundle", mapToJSObject(current.toJSONMap()));
|
|
@@ -1245,13 +1257,26 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1245
1257
|
if (jsRes.has("error")) {
|
|
1246
1258
|
String error = jsRes.getString("error");
|
|
1247
1259
|
logger.error("getLatest failed with error: " + error);
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1260
|
+
String latestVersion = jsRes.has("version") ? jsRes.getString("version") : current.getVersionName();
|
|
1261
|
+
if ("response_error".equals(error)) {
|
|
1262
|
+
CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
|
|
1263
|
+
"Network error: " + error,
|
|
1264
|
+
latestVersion,
|
|
1265
|
+
current,
|
|
1266
|
+
true,
|
|
1267
|
+
shouldDirectUpdate
|
|
1268
|
+
);
|
|
1269
|
+
} else {
|
|
1270
|
+
CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
|
|
1271
|
+
error,
|
|
1272
|
+
latestVersion,
|
|
1273
|
+
current,
|
|
1274
|
+
true,
|
|
1275
|
+
shouldDirectUpdate,
|
|
1276
|
+
"backend_refusal",
|
|
1277
|
+
"backendRefused"
|
|
1278
|
+
);
|
|
1279
|
+
}
|
|
1255
1280
|
return;
|
|
1256
1281
|
}
|
|
1257
1282
|
|
|
@@ -1263,12 +1288,15 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1263
1288
|
majorAvailable.put("version", jsRes.getString("version"));
|
|
1264
1289
|
CapacitorUpdaterPlugin.this.notifyListeners("majorAvailable", majorAvailable);
|
|
1265
1290
|
}
|
|
1291
|
+
String latestVersion = jsRes.has("version") ? jsRes.getString("version") : current.getVersionName();
|
|
1266
1292
|
CapacitorUpdaterPlugin.this.endBackGroundTaskWithNotif(
|
|
1267
1293
|
jsRes.getString("message"),
|
|
1268
|
-
|
|
1294
|
+
latestVersion,
|
|
1269
1295
|
current,
|
|
1270
1296
|
true,
|
|
1271
|
-
shouldDirectUpdate
|
|
1297
|
+
shouldDirectUpdate,
|
|
1298
|
+
"backend_refusal",
|
|
1299
|
+
"backendRefused"
|
|
1272
1300
|
);
|
|
1273
1301
|
return;
|
|
1274
1302
|
}
|
package/dist/esm/web.js
CHANGED
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAgC5C,MAAM,cAAc,GAAe;IACjC,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,EAAE;IACX,UAAU,EAAE,0BAA0B;IACtC,EAAE,EAAE,SAAS;IACb,QAAQ,EAA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Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\n\nimport { WebPlugin } from '@capacitor/core';\n\nimport type {\n AppReadyResult,\n AutoUpdateEnabled,\n BundleId,\n BundleInfo,\n BundleListResult,\n CapacitorUpdaterPlugin,\n ChannelRes,\n ChannelUrl,\n CurrentBundleResult,\n DelayCondition,\n DeviceId,\n DownloadOptions,\n GetChannelRes,\n LatestVersion,\n ListChannelsResult,\n MultiDelayConditions,\n PluginVersion,\n ResetOptions,\n SetChannelOptions,\n SetCustomIdOptions,\n StatsUrl,\n UnsetChannelOptions,\n UpdateUrl,\n BuiltinVersion,\n AutoUpdateAvailable,\n SetShakeMenuOptions,\n ShakeMenuEnabled,\n} from './definitions';\n\nconst BUNDLE_BUILTIN: BundleInfo = {\n status: 'success',\n version: '',\n downloaded: '1970-01-01T00:00:00.000Z',\n id: 'builtin',\n checksum: '',\n};\n\nexport class CapacitorUpdaterWeb extends WebPlugin implements CapacitorUpdaterPlugin {\n async setStatsUrl(options: StatsUrl): Promise<void> {\n console.warn('Cannot setStatsUrl in web', options);\n return;\n }\n\n async setUpdateUrl(options: UpdateUrl): Promise<void> {\n console.warn('Cannot setUpdateUrl in web', options);\n return;\n }\n\n async setChannelUrl(options: ChannelUrl): Promise<void> {\n console.warn('Cannot setChannelUrl in web', options);\n return;\n }\n\n async download(options: DownloadOptions): Promise<BundleInfo> {\n console.warn('Cannot download version in web', options);\n return BUNDLE_BUILTIN;\n }\n\n async next(options: BundleId): Promise<BundleInfo> {\n console.warn('Cannot set next version in web', options);\n return BUNDLE_BUILTIN;\n }\n\n async isAutoUpdateEnabled(): Promise<AutoUpdateEnabled> {\n console.warn('Cannot get isAutoUpdateEnabled in web');\n return { enabled: false };\n }\n\n async set(options: BundleId): Promise<void> {\n console.warn('Cannot set active bundle in web', options);\n return;\n }\n\n async getDeviceId(): Promise<DeviceId> {\n console.warn('Cannot get ID in web');\n return { deviceId: 'default' };\n }\n\n async getBuiltinVersion(): Promise<BuiltinVersion> {\n console.warn('Cannot get version in web');\n return { version: 'default' };\n }\n\n async getPluginVersion(): Promise<PluginVersion> {\n console.warn('Cannot get plugin version in web');\n return { version: 'default' };\n }\n\n async delete(options: BundleId): Promise<void> {\n console.warn('Cannot delete bundle in web', options);\n }\n\n async list(): Promise<BundleListResult> {\n console.warn('Cannot list bundles in web');\n return { bundles: [] };\n }\n\n async reset(options?: ResetOptions): Promise<void> {\n console.warn('Cannot reset version in web', options);\n }\n\n async current(): Promise<CurrentBundleResult> {\n console.warn('Cannot get current bundle in web');\n return { bundle: BUNDLE_BUILTIN, native: '0.0.0' };\n }\n\n async reload(): Promise<void> {\n console.warn('Cannot reload current bundle in web');\n return;\n }\n\n async getLatest(): Promise<LatestVersion> {\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\n async setChannel(options: SetChannelOptions): Promise<ChannelRes> {\n console.warn('Cannot setChannel in web', options);\n return {\n status: 'error',\n error: 'Cannot setChannel in web',\n };\n }\n\n async unsetChannel(options: UnsetChannelOptions): Promise<void> {\n console.warn('Cannot unsetChannel in web', options);\n return;\n }\n\n async setCustomId(options: SetCustomIdOptions): Promise<void> {\n console.warn('Cannot setCustomId in web', options);\n return;\n }\n\n async getChannel(): Promise<GetChannelRes> {\n console.warn('Cannot getChannel in web');\n return {\n status: 'error',\n error: 'Cannot getChannel in web',\n };\n }\n\n async listChannels(): Promise<ListChannelsResult> {\n console.warn('Cannot listChannels in web');\n throw {\n message: 'Cannot listChannels in web',\n error: 'platform_not_supported',\n };\n }\n\n async notifyAppReady(): Promise<AppReadyResult> {\n return { bundle: BUNDLE_BUILTIN };\n }\n\n async setMultiDelay(options: MultiDelayConditions): Promise<void> {\n console.warn('Cannot setMultiDelay in web', options?.delayConditions);\n return;\n }\n\n async setDelay(option: DelayCondition): Promise<void> {\n console.warn('Cannot setDelay in web', option);\n return;\n }\n\n async cancelDelay(): Promise<void> {\n console.warn('Cannot cancelDelay in web');\n return;\n }\n\n async isAutoUpdateAvailable(): Promise<AutoUpdateAvailable> {\n console.warn('Cannot isAutoUpdateAvailable in web');\n return { available: false };\n }\n\n async getCurrentBundle(): Promise<BundleInfo> {\n console.warn('Cannot get current bundle in web');\n return BUNDLE_BUILTIN;\n }\n\n async getNextBundle(): Promise<BundleInfo | null> {\n return Promise.resolve(null);\n }\n\n async setShakeMenu(_options: SetShakeMenuOptions): Promise<void> {\n throw this.unimplemented('Shake menu not available on web platform');\n }\n\n async isShakeMenuEnabled(): Promise<ShakeMenuEnabled> {\n return Promise.resolve({ enabled: false });\n }\n\n async getAppId(): Promise<{ appId: string }> {\n console.warn('Cannot getAppId in web');\n return { appId: 'default' };\n }\n\n async setAppId(options: { appId: string }): Promise<void> {\n console.warn('Cannot setAppId in web', options);\n return;\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport { 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","/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport { WebPlugin } from '@capacitor/core';\nconst BUNDLE_BUILTIN = {\n status: 'success',\n version: '',\n downloaded: '1970-01-01T00:00:00.000Z',\n id: 'builtin',\n checksum: '',\n};\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async setStatsUrl(options) {\n console.warn('Cannot setStatsUrl in web', options);\n return;\n }\n async setUpdateUrl(options) {\n console.warn('Cannot setUpdateUrl in web', options);\n return;\n }\n async setChannelUrl(options) {\n console.warn('Cannot setChannelUrl in web', options);\n return;\n }\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 getDeviceId() {\n console.warn('Cannot get ID in web');\n return { deviceId: 'default' };\n }\n async getBuiltinVersion() {\n console.warn('Cannot get version in web');\n return { version: '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 setChannel(options) {\n console.warn('Cannot setChannel in web', options);\n return {\n status: 'error',\n error: 'Cannot setChannel in web',\n };\n }\n async unsetChannel(options) {\n console.warn('Cannot unsetChannel in web', options);\n return;\n }\n async setCustomId(options) {\n console.warn('Cannot setCustomId in web', options);\n return;\n }\n async getChannel() {\n console.warn('Cannot getChannel in web');\n return {\n status: 'error',\n error: 'Cannot getChannel in web',\n };\n }\n async listChannels() {\n console.warn('Cannot listChannels in web');\n throw {\n message: 'Cannot listChannels in web',\n error: 'platform_not_supported',\n };\n }\n async notifyAppReady() {\n
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport { 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","/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport { WebPlugin } from '@capacitor/core';\nconst BUNDLE_BUILTIN = {\n status: 'success',\n version: '',\n downloaded: '1970-01-01T00:00:00.000Z',\n id: 'builtin',\n checksum: '',\n};\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async setStatsUrl(options) {\n console.warn('Cannot setStatsUrl in web', options);\n return;\n }\n async setUpdateUrl(options) {\n console.warn('Cannot setUpdateUrl in web', options);\n return;\n }\n async setChannelUrl(options) {\n console.warn('Cannot setChannelUrl in web', options);\n return;\n }\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 getDeviceId() {\n console.warn('Cannot get ID in web');\n return { deviceId: 'default' };\n }\n async getBuiltinVersion() {\n console.warn('Cannot get version in web');\n return { version: '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 setChannel(options) {\n console.warn('Cannot setChannel in web', options);\n return {\n status: 'error',\n error: 'Cannot setChannel in web',\n };\n }\n async unsetChannel(options) {\n console.warn('Cannot unsetChannel in web', options);\n return;\n }\n async setCustomId(options) {\n console.warn('Cannot setCustomId in web', options);\n return;\n }\n async getChannel() {\n console.warn('Cannot getChannel in web');\n return {\n status: 'error',\n error: 'Cannot getChannel in web',\n };\n }\n async listChannels() {\n console.warn('Cannot listChannels in web');\n throw {\n message: 'Cannot listChannels in web',\n error: 'platform_not_supported',\n };\n }\n async notifyAppReady() {\n return { bundle: BUNDLE_BUILTIN };\n }\n async setMultiDelay(options) {\n console.warn('Cannot setMultiDelay in web', options === null || options === void 0 ? void 0 : options.delayConditions);\n return;\n }\n async setDelay(option) {\n console.warn('Cannot setDelay in web', option);\n return;\n }\n async cancelDelay() {\n console.warn('Cannot cancelDelay in web');\n return;\n }\n async isAutoUpdateAvailable() {\n console.warn('Cannot isAutoUpdateAvailable in web');\n return { available: false };\n }\n async getCurrentBundle() {\n console.warn('Cannot get current bundle in web');\n return BUNDLE_BUILTIN;\n }\n async getNextBundle() {\n return Promise.resolve(null);\n }\n async setShakeMenu(_options) {\n throw this.unimplemented('Shake menu not available on web platform');\n }\n async isShakeMenuEnabled() {\n return Promise.resolve({ enabled: false });\n }\n async getAppId() {\n console.warn('Cannot getAppId in web');\n return { appId: 'default' };\n }\n async setAppId(options) {\n console.warn('Cannot setAppId in web', options);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AAEK,MAAC,gBAA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AQ;AACR,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport { 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","/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport { WebPlugin } from '@capacitor/core';\nconst BUNDLE_BUILTIN = {\n status: 'success',\n version: '',\n downloaded: '1970-01-01T00:00:00.000Z',\n id: 'builtin',\n checksum: '',\n};\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async setStatsUrl(options) {\n console.warn('Cannot setStatsUrl in web', options);\n return;\n }\n async setUpdateUrl(options) {\n console.warn('Cannot setUpdateUrl in web', options);\n return;\n }\n async setChannelUrl(options) {\n console.warn('Cannot setChannelUrl in web', options);\n return;\n }\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 getDeviceId() {\n console.warn('Cannot get ID in web');\n return { deviceId: 'default' };\n }\n async getBuiltinVersion() {\n console.warn('Cannot get version in web');\n return { version: '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 setChannel(options) {\n console.warn('Cannot setChannel in web', options);\n return {\n status: 'error',\n error: 'Cannot setChannel in web',\n };\n }\n async unsetChannel(options) {\n console.warn('Cannot unsetChannel in web', options);\n return;\n }\n async setCustomId(options) {\n console.warn('Cannot setCustomId in web', options);\n return;\n }\n async getChannel() {\n console.warn('Cannot getChannel in web');\n return {\n status: 'error',\n error: 'Cannot getChannel in web',\n };\n }\n async listChannels() {\n console.warn('Cannot listChannels in web');\n throw {\n message: 'Cannot listChannels in web',\n error: 'platform_not_supported',\n };\n }\n async notifyAppReady() {\n
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport { 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","/*\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at https://mozilla.org/MPL/2.0/.\n */\nimport { WebPlugin } from '@capacitor/core';\nconst BUNDLE_BUILTIN = {\n status: 'success',\n version: '',\n downloaded: '1970-01-01T00:00:00.000Z',\n id: 'builtin',\n checksum: '',\n};\nexport class CapacitorUpdaterWeb extends WebPlugin {\n async setStatsUrl(options) {\n console.warn('Cannot setStatsUrl in web', options);\n return;\n }\n async setUpdateUrl(options) {\n console.warn('Cannot setUpdateUrl in web', options);\n return;\n }\n async setChannelUrl(options) {\n console.warn('Cannot setChannelUrl in web', options);\n return;\n }\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 getDeviceId() {\n console.warn('Cannot get ID in web');\n return { deviceId: 'default' };\n }\n async getBuiltinVersion() {\n console.warn('Cannot get version in web');\n return { version: '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 setChannel(options) {\n console.warn('Cannot setChannel in web', options);\n return {\n status: 'error',\n error: 'Cannot setChannel in web',\n };\n }\n async unsetChannel(options) {\n console.warn('Cannot unsetChannel in web', options);\n return;\n }\n async setCustomId(options) {\n console.warn('Cannot setCustomId in web', options);\n return;\n }\n async getChannel() {\n console.warn('Cannot getChannel in web');\n return {\n status: 'error',\n error: 'Cannot getChannel in web',\n };\n }\n async listChannels() {\n console.warn('Cannot listChannels in web');\n throw {\n message: 'Cannot listChannels in web',\n error: 'platform_not_supported',\n };\n }\n async notifyAppReady() {\n return { bundle: BUNDLE_BUILTIN };\n }\n async setMultiDelay(options) {\n console.warn('Cannot setMultiDelay in web', options === null || options === void 0 ? void 0 : options.delayConditions);\n return;\n }\n async setDelay(option) {\n console.warn('Cannot setDelay in web', option);\n return;\n }\n async cancelDelay() {\n console.warn('Cannot cancelDelay in web');\n return;\n }\n async isAutoUpdateAvailable() {\n console.warn('Cannot isAutoUpdateAvailable in web');\n return { available: false };\n }\n async getCurrentBundle() {\n console.warn('Cannot get current bundle in web');\n return BUNDLE_BUILTIN;\n }\n async getNextBundle() {\n return Promise.resolve(null);\n }\n async setShakeMenu(_options) {\n throw this.unimplemented('Shake menu not available on web platform');\n }\n async isShakeMenuEnabled() {\n return Promise.resolve({ enabled: false });\n }\n async getAppId() {\n console.warn('Cannot getAppId in web');\n return { appId: 'default' };\n }\n async setAppId(options) {\n console.warn('Cannot setAppId in web', options);\n return;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;IACA;IACA;AAEK,UAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;IAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;IACvE,CAAC;;ICRD;IACA;IACA;IACA;IACA;IAEA,MAAM,cAAc,GAAG;IACvB,IAAI,MAAM,EAAE,SAAS;IACrB,IAAI,OAAO,EAAE,EAAE;IACf,IAAI,UAAU,EAAE,0BAA0B;IAC1C,IAAI,EAAE,EAAE,SAAS;IACjB,IAAI,QAAQ,EAAE,EAAE;IAChB,CAAC;IACM,MAAM,mBAAmB,SAASC,cAAS,CAAC;IACnD,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;IAC/B,QAAQ,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,OAAO,CAAC;IAC1D,QAA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AAG;IAC7B,QAAQ,OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC;IACxD,QAAQ,OAAO,cAAc;IAC7B,IAAI;IACJ,IAAI,MAAM,aAAa,GAAG;IAC1B,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;IACpC,IAAI;IACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC;IAC5E,IAAI;IACJ,IAAI,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAClD,IAAI;IACJ,IAAI,MAAM,QAAQ,GAAG;IACrB,QAAQ,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC;IAC9C,QAAQ,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE;IACnC,IAAI;IACJ,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;IAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC;IACvD,QAAQ;IACR,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -50,7 +50,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
50
50
|
CAPPluginMethod(name: "isShakeMenuEnabled", returnType: CAPPluginReturnPromise)
|
|
51
51
|
]
|
|
52
52
|
public var implementation = CapgoUpdater()
|
|
53
|
-
private let PLUGIN_VERSION: String = "7.
|
|
53
|
+
private let PLUGIN_VERSION: String = "7.17.1"
|
|
54
54
|
static let updateUrlDefault = "https://plugin.capgo.app/updates"
|
|
55
55
|
static let statsUrlDefault = "https://plugin.capgo.app/stats"
|
|
56
56
|
static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
|
|
@@ -882,10 +882,17 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
882
882
|
}
|
|
883
883
|
}
|
|
884
884
|
|
|
885
|
-
func endBackGroundTaskWithNotif(
|
|
885
|
+
func endBackGroundTaskWithNotif(
|
|
886
|
+
msg: String,
|
|
887
|
+
latestVersionName: String,
|
|
888
|
+
current: BundleInfo,
|
|
889
|
+
error: Bool = true,
|
|
890
|
+
failureAction: String = "download_fail",
|
|
891
|
+
failureEvent: String = "downloadFailed"
|
|
892
|
+
) {
|
|
886
893
|
if error {
|
|
887
|
-
self.implementation.sendStats(action:
|
|
888
|
-
self.notifyListeners(
|
|
894
|
+
self.implementation.sendStats(action: failureAction, versionName: current.getVersionName())
|
|
895
|
+
self.notifyListeners(failureEvent, data: ["version": latestVersionName])
|
|
889
896
|
}
|
|
890
897
|
self.notifyListeners("noNeedUpdate", data: ["bundle": current.toJSON()])
|
|
891
898
|
self.sendReadyToJs(current: current, msg: msg)
|
|
@@ -910,18 +917,41 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
910
917
|
let current = self.implementation.getCurrentBundle()
|
|
911
918
|
|
|
912
919
|
// Handle network errors and other failures first
|
|
913
|
-
if res.error
|
|
914
|
-
self.logger.error("getLatest failed with error: \(
|
|
915
|
-
|
|
920
|
+
if let backendError = res.error, !backendError.isEmpty {
|
|
921
|
+
self.logger.error("getLatest failed with error: \(backendError)")
|
|
922
|
+
if backendError == "response_error" {
|
|
923
|
+
self.endBackGroundTaskWithNotif(
|
|
924
|
+
msg: "Network error: \(backendError)",
|
|
925
|
+
latestVersionName: res.version,
|
|
926
|
+
current: current,
|
|
927
|
+
error: true
|
|
928
|
+
)
|
|
929
|
+
} else {
|
|
930
|
+
self.endBackGroundTaskWithNotif(
|
|
931
|
+
msg: backendError,
|
|
932
|
+
latestVersionName: res.version,
|
|
933
|
+
current: current,
|
|
934
|
+
error: true,
|
|
935
|
+
failureAction: "backend_refusal",
|
|
936
|
+
failureEvent: "backendRefused"
|
|
937
|
+
)
|
|
938
|
+
}
|
|
916
939
|
return
|
|
917
940
|
}
|
|
918
941
|
|
|
919
|
-
if
|
|
920
|
-
self.logger.info("API message: \(
|
|
942
|
+
if let message = res.message, !message.isEmpty {
|
|
943
|
+
self.logger.info("API message: \(message)")
|
|
921
944
|
if res.major == true {
|
|
922
945
|
self.notifyListeners("majorAvailable", data: ["version": res.version])
|
|
923
946
|
}
|
|
924
|
-
self.endBackGroundTaskWithNotif(
|
|
947
|
+
self.endBackGroundTaskWithNotif(
|
|
948
|
+
msg: message,
|
|
949
|
+
latestVersionName: res.version,
|
|
950
|
+
current: current,
|
|
951
|
+
error: true,
|
|
952
|
+
failureAction: "backend_refusal",
|
|
953
|
+
failureEvent: "backendRefused"
|
|
954
|
+
)
|
|
925
955
|
return
|
|
926
956
|
}
|
|
927
957
|
if res.version == "builtin" {
|