@capgo/capacitor-updater 5.0.0-alpha.0 → 7.0.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/CapgoCapacitorUpdater.podspec +1 -1
- package/LICENCE +373 -661
- package/README.md +339 -75
- package/android/build.gradle +13 -12
- package/android/src/main/AndroidManifest.xml +4 -2
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleInfo.java +205 -121
- package/android/src/main/java/ee/forgr/capacitor_updater/BundleStatus.java +32 -24
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +1041 -441
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1217 -536
- package/android/src/main/java/ee/forgr/capacitor_updater/CryptoCipher.java +153 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayCondition.java +62 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/DelayUntilNext.java +14 -0
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadService.java +126 -0
- package/dist/docs.json +727 -171
- package/dist/esm/definitions.d.ts +234 -45
- package/dist/esm/definitions.js +5 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +9 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +12 -6
- package/dist/esm/web.js +64 -20
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +70 -23
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +70 -23
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/BundleInfo.swift +38 -19
- package/ios/Plugin/BundleStatus.swift +11 -4
- package/ios/Plugin/CapacitorUpdater.swift +520 -192
- package/ios/Plugin/CapacitorUpdaterPlugin.m +8 -1
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +447 -190
- package/ios/Plugin/CryptoCipher.swift +240 -0
- package/ios/Plugin/DelayCondition.swift +74 -0
- package/ios/Plugin/DelayUntilNext.swift +30 -0
- package/ios/Plugin/UserDefaultsExtension.swift +48 -0
- package/package.json +26 -20
- package/ios/Plugin/ObjectPreferences.swift +0 -97
package/dist/plugin.cjs.js
CHANGED
|
@@ -1,63 +1,110 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var core = require('@capacitor/core');
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/*
|
|
6
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
7
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
8
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
9
|
+
*/
|
|
10
|
+
const CapacitorUpdater = core.registerPlugin("CapacitorUpdater", {
|
|
11
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorUpdaterWeb()),
|
|
9
12
|
});
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
/*
|
|
15
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
16
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
17
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
18
|
+
*/
|
|
19
|
+
const BUNDLE_BUILTIN = {
|
|
20
|
+
status: "success",
|
|
21
|
+
version: "",
|
|
22
|
+
downloaded: "1970-01-01T00:00:00.000Z",
|
|
23
|
+
id: "builtin",
|
|
24
|
+
checksum: "",
|
|
25
|
+
};
|
|
12
26
|
class CapacitorUpdaterWeb extends core.WebPlugin {
|
|
13
27
|
async download(options) {
|
|
14
|
-
console.warn(
|
|
28
|
+
console.warn("Cannot download version in web", options);
|
|
15
29
|
return BUNDLE_BUILTIN;
|
|
16
30
|
}
|
|
17
31
|
async next(options) {
|
|
18
|
-
console.warn(
|
|
32
|
+
console.warn("Cannot set next version in web", options);
|
|
19
33
|
return BUNDLE_BUILTIN;
|
|
20
34
|
}
|
|
21
35
|
async isAutoUpdateEnabled() {
|
|
22
|
-
console.warn(
|
|
36
|
+
console.warn("Cannot get isAutoUpdateEnabled in web");
|
|
23
37
|
return { enabled: false };
|
|
24
38
|
}
|
|
25
39
|
async set(options) {
|
|
26
|
-
console.warn(
|
|
40
|
+
console.warn("Cannot set active bundle in web", options);
|
|
27
41
|
return;
|
|
28
42
|
}
|
|
29
|
-
async
|
|
30
|
-
console.warn(
|
|
31
|
-
return {
|
|
43
|
+
async getDeviceId() {
|
|
44
|
+
console.warn("Cannot get ID in web");
|
|
45
|
+
return { deviceId: "default" };
|
|
32
46
|
}
|
|
33
47
|
async getPluginVersion() {
|
|
34
|
-
console.warn(
|
|
35
|
-
return { version:
|
|
48
|
+
console.warn("Cannot get plugin version in web");
|
|
49
|
+
return { version: "default" };
|
|
36
50
|
}
|
|
37
51
|
async delete(options) {
|
|
38
|
-
console.warn(
|
|
52
|
+
console.warn("Cannot delete bundle in web", options);
|
|
39
53
|
}
|
|
40
54
|
async list() {
|
|
41
|
-
console.warn(
|
|
55
|
+
console.warn("Cannot list bundles in web");
|
|
42
56
|
return { bundles: [] };
|
|
43
57
|
}
|
|
44
58
|
async reset(options) {
|
|
45
|
-
console.warn(
|
|
59
|
+
console.warn("Cannot reset version in web", options);
|
|
46
60
|
}
|
|
47
61
|
async current() {
|
|
48
|
-
console.warn(
|
|
49
|
-
return { bundle: BUNDLE_BUILTIN, native:
|
|
62
|
+
console.warn("Cannot get current bundle in web");
|
|
63
|
+
return { bundle: BUNDLE_BUILTIN, native: "0.0.0" };
|
|
50
64
|
}
|
|
51
65
|
async reload() {
|
|
52
|
-
console.warn(
|
|
66
|
+
console.warn("Cannot reload current bundle in web");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
async getLatest() {
|
|
70
|
+
console.warn("Cannot getLatest current bundle in web");
|
|
71
|
+
return {
|
|
72
|
+
version: "0.0.0",
|
|
73
|
+
message: "Cannot getLatest current bundle in web",
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
async setChannel(options) {
|
|
77
|
+
console.warn("Cannot setChannel in web", options);
|
|
78
|
+
return {
|
|
79
|
+
status: "error",
|
|
80
|
+
error: "Cannot setChannel in web",
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async setCustomId(options) {
|
|
84
|
+
console.warn("Cannot setCustomId in web", options);
|
|
53
85
|
return;
|
|
54
86
|
}
|
|
87
|
+
async getChannel() {
|
|
88
|
+
console.warn("Cannot getChannel in web");
|
|
89
|
+
return {
|
|
90
|
+
status: "error",
|
|
91
|
+
error: "Cannot getChannel in web",
|
|
92
|
+
};
|
|
93
|
+
}
|
|
55
94
|
async notifyAppReady() {
|
|
56
|
-
console.warn(
|
|
95
|
+
console.warn("Cannot notify App Ready in web");
|
|
57
96
|
return BUNDLE_BUILTIN;
|
|
58
97
|
}
|
|
59
|
-
async
|
|
60
|
-
console.warn(
|
|
98
|
+
async setMultiDelay(options) {
|
|
99
|
+
console.warn("Cannot setMultiDelay in web", options === null || options === void 0 ? void 0 : options.delayConditions);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
async setDelay(option) {
|
|
103
|
+
console.warn("Cannot setDelay in web", option);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
async cancelDelay() {
|
|
107
|
+
console.warn("Cannot cancelDelay in web");
|
|
61
108
|
return;
|
|
62
109
|
}
|
|
63
110
|
}
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["
|
|
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 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 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 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 notifyAppReady() {\n console.warn(\"Cannot notify App Ready in web\");\n return 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}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AAEK,MAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;AAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;AACvE,CAAC;;ACRD;AACA;AACA;AACA;AACA;AAEA,MAAM,cAAc,GAAG;AACvB,IAAI,MAAM,EAAE,SAAS;AACrB,IAAI,OAAO,EAAE,EAAE;AACf,IAAI,UAAU,EAAE,0BAA0B;AAC1C,IAAI,EAAE,EAAE,SAAS;AACjB,IAAI,QAAQ,EAAE,EAAE;AAChB,CAAC,CAAC;AACK,MAAM,mBAAmB,SAASC,cAAS,CAAC;AACnD,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;AAChE,QAAQ,OAAO,cAAc,CAAC;AAC9B,KAAK;AACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;AAChE,QAAQ,OAAO,cAAc,CAAC;AAC9B,KAAK;AACL,IAAI,MAAM,mBAAmB,GAAG;AAChC,QAAQ,OAAO,C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AC,wBAAwB,EAAE,MAAM,CAAC,CAAC;AACvD,QAAQ,OAAO;AACf,KAAK;AACL,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;AAClD,QAAQ,OAAO;AACf,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,60 +1,109 @@
|
|
|
1
1
|
var capacitorCapacitorUpdater = (function (exports, core) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/*
|
|
5
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
6
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
7
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
8
|
+
*/
|
|
9
|
+
const CapacitorUpdater = core.registerPlugin("CapacitorUpdater", {
|
|
10
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapacitorUpdaterWeb()),
|
|
6
11
|
});
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
/*
|
|
14
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
15
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
16
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
17
|
+
*/
|
|
18
|
+
const BUNDLE_BUILTIN = {
|
|
19
|
+
status: "success",
|
|
20
|
+
version: "",
|
|
21
|
+
downloaded: "1970-01-01T00:00:00.000Z",
|
|
22
|
+
id: "builtin",
|
|
23
|
+
checksum: "",
|
|
24
|
+
};
|
|
9
25
|
class CapacitorUpdaterWeb extends core.WebPlugin {
|
|
10
26
|
async download(options) {
|
|
11
|
-
console.warn(
|
|
27
|
+
console.warn("Cannot download version in web", options);
|
|
12
28
|
return BUNDLE_BUILTIN;
|
|
13
29
|
}
|
|
14
30
|
async next(options) {
|
|
15
|
-
console.warn(
|
|
31
|
+
console.warn("Cannot set next version in web", options);
|
|
16
32
|
return BUNDLE_BUILTIN;
|
|
17
33
|
}
|
|
18
34
|
async isAutoUpdateEnabled() {
|
|
19
|
-
console.warn(
|
|
35
|
+
console.warn("Cannot get isAutoUpdateEnabled in web");
|
|
20
36
|
return { enabled: false };
|
|
21
37
|
}
|
|
22
38
|
async set(options) {
|
|
23
|
-
console.warn(
|
|
39
|
+
console.warn("Cannot set active bundle in web", options);
|
|
24
40
|
return;
|
|
25
41
|
}
|
|
26
|
-
async
|
|
27
|
-
console.warn(
|
|
28
|
-
return {
|
|
42
|
+
async getDeviceId() {
|
|
43
|
+
console.warn("Cannot get ID in web");
|
|
44
|
+
return { deviceId: "default" };
|
|
29
45
|
}
|
|
30
46
|
async getPluginVersion() {
|
|
31
|
-
console.warn(
|
|
32
|
-
return { version:
|
|
47
|
+
console.warn("Cannot get plugin version in web");
|
|
48
|
+
return { version: "default" };
|
|
33
49
|
}
|
|
34
50
|
async delete(options) {
|
|
35
|
-
console.warn(
|
|
51
|
+
console.warn("Cannot delete bundle in web", options);
|
|
36
52
|
}
|
|
37
53
|
async list() {
|
|
38
|
-
console.warn(
|
|
54
|
+
console.warn("Cannot list bundles in web");
|
|
39
55
|
return { bundles: [] };
|
|
40
56
|
}
|
|
41
57
|
async reset(options) {
|
|
42
|
-
console.warn(
|
|
58
|
+
console.warn("Cannot reset version in web", options);
|
|
43
59
|
}
|
|
44
60
|
async current() {
|
|
45
|
-
console.warn(
|
|
46
|
-
return { bundle: BUNDLE_BUILTIN, native:
|
|
61
|
+
console.warn("Cannot get current bundle in web");
|
|
62
|
+
return { bundle: BUNDLE_BUILTIN, native: "0.0.0" };
|
|
47
63
|
}
|
|
48
64
|
async reload() {
|
|
49
|
-
console.warn(
|
|
65
|
+
console.warn("Cannot reload current bundle in web");
|
|
50
66
|
return;
|
|
51
67
|
}
|
|
68
|
+
async getLatest() {
|
|
69
|
+
console.warn("Cannot getLatest current bundle in web");
|
|
70
|
+
return {
|
|
71
|
+
version: "0.0.0",
|
|
72
|
+
message: "Cannot getLatest current bundle in web",
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async setChannel(options) {
|
|
76
|
+
console.warn("Cannot setChannel in web", options);
|
|
77
|
+
return {
|
|
78
|
+
status: "error",
|
|
79
|
+
error: "Cannot setChannel in web",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async setCustomId(options) {
|
|
83
|
+
console.warn("Cannot setCustomId in web", options);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
async getChannel() {
|
|
87
|
+
console.warn("Cannot getChannel in web");
|
|
88
|
+
return {
|
|
89
|
+
status: "error",
|
|
90
|
+
error: "Cannot getChannel in web",
|
|
91
|
+
};
|
|
92
|
+
}
|
|
52
93
|
async notifyAppReady() {
|
|
53
|
-
console.warn(
|
|
94
|
+
console.warn("Cannot notify App Ready in web");
|
|
54
95
|
return BUNDLE_BUILTIN;
|
|
55
96
|
}
|
|
56
|
-
async
|
|
57
|
-
console.warn(
|
|
97
|
+
async setMultiDelay(options) {
|
|
98
|
+
console.warn("Cannot setMultiDelay in web", options === null || options === void 0 ? void 0 : options.delayConditions);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
async setDelay(option) {
|
|
102
|
+
console.warn("Cannot setDelay in web", option);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
async cancelDelay() {
|
|
106
|
+
console.warn("Cannot cancelDelay in web");
|
|
58
107
|
return;
|
|
59
108
|
}
|
|
60
109
|
}
|
|
@@ -66,8 +115,6 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
66
115
|
|
|
67
116
|
exports.CapacitorUpdater = CapacitorUpdater;
|
|
68
117
|
|
|
69
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
70
|
-
|
|
71
118
|
return exports;
|
|
72
119
|
|
|
73
120
|
})({}, capacitorExports);
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["
|
|
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 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 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 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 notifyAppReady() {\n console.warn(\"Cannot notify App Ready in web\");\n return 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}\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,CAAC;IACK,MAAM,mBAAmB,SAASC,cAAS,CAAC;IACnD,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;IAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CA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ACjC,QAAQ,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC/H,QAAQ,OAAO;IACf,KAAK;IACL,IAAI,MAAM,QAAQ,CAAC,MAAM,EAAE;IAC3B,QAAQ,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;IACvD,QAAQ,OAAO;IACf,KAAK;IACL,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAClD,QAAQ,OAAO;IACf,KAAK;IACL;;;;;;;;;;;;;;;"}
|
|
@@ -1,54 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
1
6
|
|
|
2
7
|
import Foundation
|
|
3
8
|
|
|
4
|
-
|
|
5
9
|
@objc public class BundleInfo: NSObject, Decodable, Encodable {
|
|
6
10
|
public static let ID_BUILTIN: String = "builtin"
|
|
7
|
-
public static let
|
|
11
|
+
public static let VERSION_UNKNOWN: String = "unknown"
|
|
8
12
|
public static let DOWNLOADED_BUILTIN: String = "1970-01-01T00:00:00.000Z"
|
|
9
13
|
|
|
10
14
|
private let downloaded: String
|
|
11
15
|
private let id: String
|
|
12
16
|
private let version: String
|
|
17
|
+
private let checksum: String
|
|
13
18
|
private let status: BundleStatus
|
|
14
|
-
|
|
15
|
-
convenience init(id: String, version: String, status: BundleStatus, downloaded: Date) {
|
|
16
|
-
self.init(id: id, version: version, status: status, downloaded: downloaded.iso8601withFractionalSeconds)
|
|
19
|
+
|
|
20
|
+
convenience init(id: String, version: String, status: BundleStatus, downloaded: Date, checksum: String) {
|
|
21
|
+
self.init(id: id, version: version, status: status, downloaded: downloaded.iso8601withFractionalSeconds, checksum: checksum)
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
init(id: String, version: String, status: BundleStatus, downloaded: String = BundleInfo.DOWNLOADED_BUILTIN) {
|
|
24
|
+
init(id: String, version: String, status: BundleStatus, downloaded: String = BundleInfo.DOWNLOADED_BUILTIN, checksum: String) {
|
|
20
25
|
self.downloaded = downloaded.trim()
|
|
21
26
|
self.id = id
|
|
22
27
|
self.version = version
|
|
28
|
+
self.checksum = checksum
|
|
23
29
|
self.status = status
|
|
24
30
|
}
|
|
25
|
-
|
|
31
|
+
|
|
26
32
|
enum CodingKeys: String, CodingKey {
|
|
27
|
-
case downloaded, id, version, status
|
|
33
|
+
case downloaded, id, version, status, checksum
|
|
28
34
|
}
|
|
29
|
-
|
|
35
|
+
|
|
30
36
|
public func isBuiltin() -> Bool {
|
|
31
37
|
return BundleInfo.ID_BUILTIN == self.id
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
public func isUnknown() -> Bool {
|
|
35
|
-
return BundleInfo.
|
|
41
|
+
return BundleInfo.VERSION_UNKNOWN == self.id
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
public func isErrorStatus() -> Bool {
|
|
39
45
|
return BundleStatus.ERROR == self.status
|
|
40
46
|
}
|
|
41
47
|
|
|
48
|
+
public func isDeleted() -> Bool {
|
|
49
|
+
return BundleStatus.DELETED == self.status
|
|
50
|
+
}
|
|
51
|
+
|
|
42
52
|
public func isDownloaded() -> Bool {
|
|
43
|
-
return !self.isBuiltin() && self.downloaded != "" && self.downloaded
|
|
53
|
+
return !self.isBuiltin() && self.downloaded != "" && self.downloaded != BundleInfo.DOWNLOADED_BUILTIN && !self.isDeleted()
|
|
44
54
|
}
|
|
45
55
|
|
|
46
56
|
public func getDownloaded() -> String {
|
|
47
57
|
return self.isBuiltin() ? BundleInfo.DOWNLOADED_BUILTIN : self.downloaded
|
|
48
58
|
}
|
|
49
|
-
|
|
59
|
+
|
|
60
|
+
public func getChecksum() -> String {
|
|
61
|
+
return self.isBuiltin() ? "" : self.checksum
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public func setChecksum(checksum: String) -> BundleInfo {
|
|
65
|
+
return BundleInfo(id: self.id, version: self.version, status: self.status, downloaded: self.downloaded, checksum: checksum)
|
|
66
|
+
}
|
|
67
|
+
|
|
50
68
|
public func setDownloaded(downloaded: Date) -> BundleInfo {
|
|
51
|
-
return BundleInfo(id: self.id, version: self.version, status: self.status, downloaded: downloaded)
|
|
69
|
+
return BundleInfo(id: self.id, version: self.version, status: self.status, downloaded: downloaded, checksum: self.checksum)
|
|
52
70
|
}
|
|
53
71
|
|
|
54
72
|
public func getId() -> String {
|
|
@@ -56,15 +74,15 @@ import Foundation
|
|
|
56
74
|
}
|
|
57
75
|
|
|
58
76
|
public func setId(id: String) -> BundleInfo {
|
|
59
|
-
return BundleInfo(id: id, version: self.version, status: self.status, downloaded: self.downloaded)
|
|
77
|
+
return BundleInfo(id: id, version: self.version, status: self.status, downloaded: self.downloaded, checksum: self.checksum)
|
|
60
78
|
}
|
|
61
79
|
|
|
62
80
|
public func getVersionName() -> String {
|
|
63
|
-
return self.version
|
|
81
|
+
return self.version.isEmpty ? BundleInfo.ID_BUILTIN : self.version
|
|
64
82
|
}
|
|
65
83
|
|
|
66
84
|
public func setVersionName(version: String) -> BundleInfo {
|
|
67
|
-
return BundleInfo(id: self.id, version: version, status: self.status, downloaded: self.downloaded)
|
|
85
|
+
return BundleInfo(id: self.id, version: version, status: self.status, downloaded: self.downloaded, checksum: self.checksum)
|
|
68
86
|
}
|
|
69
87
|
|
|
70
88
|
public func getStatus() -> String {
|
|
@@ -72,7 +90,7 @@ import Foundation
|
|
|
72
90
|
}
|
|
73
91
|
|
|
74
92
|
public func setStatus(status: String) -> BundleInfo {
|
|
75
|
-
return BundleInfo(id: self.id, version: self.version, status: BundleStatus(localizedString: status)!, downloaded: self.downloaded)
|
|
93
|
+
return BundleInfo(id: self.id, version: self.version, status: BundleStatus(localizedString: status)!, downloaded: self.downloaded, checksum: self.checksum)
|
|
76
94
|
}
|
|
77
95
|
|
|
78
96
|
public func toJSON() -> [String: String] {
|
|
@@ -80,7 +98,8 @@ import Foundation
|
|
|
80
98
|
"id": self.getId(),
|
|
81
99
|
"version": self.getVersionName(),
|
|
82
100
|
"downloaded": self.getDownloaded(),
|
|
83
|
-
"
|
|
101
|
+
"checksum": self.getChecksum(),
|
|
102
|
+
"status": self.getStatus()
|
|
84
103
|
]
|
|
85
104
|
}
|
|
86
105
|
|
|
@@ -89,6 +108,6 @@ import Foundation
|
|
|
89
108
|
}
|
|
90
109
|
|
|
91
110
|
public func toString() -> String {
|
|
92
|
-
return "{ \"
|
|
111
|
+
return "{ \"id\": \"\(self.getId())\", \"version\": \"\(self.getVersionName())\", \"downloaded\": \"\(self.getDownloaded())\", \"checksum\": \"\(self.getChecksum())\", \"status\": \"\(self.getStatus())\"}"
|
|
93
112
|
}
|
|
94
113
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
import Foundation
|
|
2
8
|
|
|
3
9
|
struct LocalizedString: ExpressibleByStringLiteral, Equatable {
|
|
@@ -10,7 +16,7 @@ struct LocalizedString: ExpressibleByStringLiteral, Equatable {
|
|
|
10
16
|
init(localized: String) {
|
|
11
17
|
self.v = localized
|
|
12
18
|
}
|
|
13
|
-
init(stringLiteral value:String) {
|
|
19
|
+
init(stringLiteral value: String) {
|
|
14
20
|
self.init(key: value)
|
|
15
21
|
}
|
|
16
22
|
init(extendedGraphemeClusterLiteral value: String) {
|
|
@@ -21,7 +27,7 @@ struct LocalizedString: ExpressibleByStringLiteral, Equatable {
|
|
|
21
27
|
}
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
func ==(lhs:LocalizedString, rhs:LocalizedString) -> Bool {
|
|
30
|
+
func ==(lhs: LocalizedString, rhs: LocalizedString) -> Bool {
|
|
25
31
|
return lhs.v == rhs.v
|
|
26
32
|
}
|
|
27
33
|
|
|
@@ -29,12 +35,13 @@ enum BundleStatus: LocalizedString, Decodable, Encodable {
|
|
|
29
35
|
case SUCCESS = "success"
|
|
30
36
|
case ERROR = "error"
|
|
31
37
|
case PENDING = "pending"
|
|
32
|
-
case
|
|
38
|
+
case DELETED = "deleted"
|
|
39
|
+
case DOWNLOADING = "downloading"
|
|
33
40
|
|
|
34
41
|
var localizedString: String {
|
|
35
42
|
return self.rawValue.v
|
|
36
43
|
}
|
|
37
|
-
|
|
44
|
+
|
|
38
45
|
init?(localizedString: String) {
|
|
39
46
|
self.init(rawValue: LocalizedString(localized: localizedString))
|
|
40
47
|
}
|