@capgo/cordova-updater 8.1.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/LICENSE +373 -0
- package/README.md +82 -0
- package/dist/esm/definitions.d.ts +2684 -0
- package/dist/esm/definitions.js +109 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/exec.d.ts +4 -0
- package/dist/esm/exec.js +25 -0
- package/dist/esm/exec.js.map +1 -0
- package/dist/esm/history.d.ts +1 -0
- package/dist/esm/history.js +283 -0
- package/dist/esm/history.js.map +1 -0
- package/dist/esm/index.d.ts +57 -0
- package/dist/esm/index.js +68 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/plugin.d.ts +57 -0
- package/dist/esm/plugin.js +15 -0
- package/dist/esm/plugin.js.map +1 -0
- package/dist/plugin.cjs.js +217 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +222 -0
- package/dist/plugin.js.map +1 -0
- package/package.json +96 -0
- package/plugin.xml +207 -0
- package/src/android/CordovaUpdaterPlugin.java +5662 -0
- package/src/android/UpdaterPathHandler.java +99 -0
- package/src/android/app/capgo/cordova/updater/AndroidAppExitReporter.java +92 -0
- package/src/android/app/capgo/cordova/updater/AppLifecycleObserver.java +115 -0
- package/src/android/app/capgo/cordova/updater/BundleInfo.java +246 -0
- package/src/android/app/capgo/cordova/updater/BundleStatus.java +45 -0
- package/src/android/app/capgo/cordova/updater/Callback.java +13 -0
- package/src/android/app/capgo/cordova/updater/CapgoUpdater.java +3404 -0
- package/src/android/app/capgo/cordova/updater/CordovaUpdaterConfig.java +56 -0
- package/src/android/app/capgo/cordova/updater/CryptoCipher.java +462 -0
- package/src/android/app/capgo/cordova/updater/DataManager.java +44 -0
- package/src/android/app/capgo/cordova/updater/DelayCondition.java +56 -0
- package/src/android/app/capgo/cordova/updater/DelayUntilNext.java +14 -0
- package/src/android/app/capgo/cordova/updater/DelayUpdateUtils.java +307 -0
- package/src/android/app/capgo/cordova/updater/DeviceIdHelper.java +230 -0
- package/src/android/app/capgo/cordova/updater/DownloadService.java +1219 -0
- package/src/android/app/capgo/cordova/updater/DownloadWorkerManager.java +260 -0
- package/src/android/app/capgo/cordova/updater/InternalUtils.java +54 -0
- package/src/android/app/capgo/cordova/updater/Logger.java +345 -0
- package/src/android/app/capgo/cordova/updater/ShakeDetector.java +72 -0
- package/src/android/app/capgo/cordova/updater/ShakeMenu.java +39 -0
- package/src/android/app/capgo/cordova/updater/ThreeFingerPinchDetector.java +323 -0
- package/src/android/app/capgo/cordova/updater/compat/JSArray.java +9 -0
- package/src/android/app/capgo/cordova/updater/compat/JSObject.java +83 -0
- package/src/android/app/capgo/cordova/updater/compat/PluginCall.java +165 -0
- package/src/android/capgo-cordova-updater.gradle +19 -0
- package/src/android/capgo-updater.xml +3 -0
- package/src/android/test/app/capgo/cordova/updater/CapacitorUpdaterUnitTest.java.skip +3039 -0
- package/src/android/test/app/capgo/cordova/updater/DelayUpdateUtilsTest.java +177 -0
- package/src/android/test/app/capgo/cordova/updater/NativeContractTest.java +105 -0
- package/src/ios/AES.swift +216 -0
- package/src/ios/AppHealthTracker.swift +82 -0
- package/src/ios/BundleInfo.swift +185 -0
- package/src/ios/BundleStatus.swift +127 -0
- package/src/ios/CapgoRawRsa.swift +36 -0
- package/src/ios/CapgoUpdater.swift +3544 -0
- package/src/ios/CordovaCompat.swift +11 -0
- package/src/ios/CordovaPluginCall.swift +190 -0
- package/src/ios/CordovaUpdaterCommands.swift +270 -0
- package/src/ios/CordovaUpdaterPlugin.swift +4706 -0
- package/src/ios/CryptoCipher.swift +326 -0
- package/src/ios/DelayCondition.swift +74 -0
- package/src/ios/DelayUntilNext.swift +30 -0
- package/src/ios/DelayUpdateUtils.swift +257 -0
- package/src/ios/DeviceIdHelper.swift +120 -0
- package/src/ios/Info.plist +28 -0
- package/src/ios/InternalUtils.swift +471 -0
- package/src/ios/Logger.swift +283 -0
- package/src/ios/RSA.swift +96 -0
- package/src/ios/ShakeMenu.swift +52 -0
- package/src/ios/UpdaterSchemeHandler.swift +81 -0
- package/src/ios/UserDefaultsExtension.swift +46 -0
- package/src/ios/WebViewStatsReporter.swift +303 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Maintains navigation history across Capgo-controlled reloads when keepUrlPathAfterReload is enabled.
|
|
3
|
+
*/
|
|
4
|
+
const KEEP_FLAG_KEY = '__capgo_keep_url_path_after_reload';
|
|
5
|
+
const HISTORY_STORAGE_KEY = '__capgo_history_stack__';
|
|
6
|
+
const MAX_STACK_ENTRIES = 100;
|
|
7
|
+
const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof history !== 'undefined';
|
|
8
|
+
if (isBrowser) {
|
|
9
|
+
const win = window;
|
|
10
|
+
if (!win.__capgoHistoryPatched) {
|
|
11
|
+
win.__capgoHistoryPatched = true;
|
|
12
|
+
const isFeatureConfigured = () => {
|
|
13
|
+
try {
|
|
14
|
+
if (win.__capgoKeepUrlPathAfterReload) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
// ignore access issues
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
return window.localStorage.getItem(KEEP_FLAG_KEY) === '1';
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const readStored = () => {
|
|
29
|
+
try {
|
|
30
|
+
const raw = window.sessionStorage.getItem(HISTORY_STORAGE_KEY);
|
|
31
|
+
if (!raw) {
|
|
32
|
+
return { stack: [], index: -1 };
|
|
33
|
+
}
|
|
34
|
+
const parsed = JSON.parse(raw);
|
|
35
|
+
if (!parsed || !Array.isArray(parsed.stack) || typeof parsed.index !== 'number') {
|
|
36
|
+
return { stack: [], index: -1 };
|
|
37
|
+
}
|
|
38
|
+
return parsed;
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
return { stack: [], index: -1 };
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const writeStored = (stack, index) => {
|
|
45
|
+
try {
|
|
46
|
+
window.sessionStorage.setItem(HISTORY_STORAGE_KEY, JSON.stringify({ stack, index }));
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
// Storage might be unavailable; fail silently.
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const clearStored = () => {
|
|
53
|
+
try {
|
|
54
|
+
window.sessionStorage.removeItem(HISTORY_STORAGE_KEY);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
// ignore
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const normalize = (url) => {
|
|
61
|
+
try {
|
|
62
|
+
const base = url !== null && url !== void 0 ? url : window.location.href;
|
|
63
|
+
const parsed = new URL(base instanceof URL ? base.toString() : base, window.location.href);
|
|
64
|
+
return `${parsed.pathname}${parsed.search}${parsed.hash}`;
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const trimStack = (stack, index) => {
|
|
71
|
+
if (stack.length <= MAX_STACK_ENTRIES) {
|
|
72
|
+
return { stack, index };
|
|
73
|
+
}
|
|
74
|
+
const start = stack.length - MAX_STACK_ENTRIES;
|
|
75
|
+
const trimmed = stack.slice(start);
|
|
76
|
+
const adjustedIndex = Math.max(0, index - start);
|
|
77
|
+
return { stack: trimmed, index: adjustedIndex };
|
|
78
|
+
};
|
|
79
|
+
const runWhenReady = (fn) => {
|
|
80
|
+
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
|
81
|
+
fn();
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
window.addEventListener('DOMContentLoaded', fn, { once: true });
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
let featureActive = false;
|
|
88
|
+
let isRestoring = false;
|
|
89
|
+
let restoreScheduled = false;
|
|
90
|
+
const ensureCurrentTracked = () => {
|
|
91
|
+
if (!featureActive) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const stored = readStored();
|
|
95
|
+
const current = normalize();
|
|
96
|
+
if (!current) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (stored.stack.length === 0) {
|
|
100
|
+
stored.stack.push(current);
|
|
101
|
+
stored.index = 0;
|
|
102
|
+
writeStored(stored.stack, stored.index);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (stored.index < 0 || stored.index >= stored.stack.length) {
|
|
106
|
+
stored.index = stored.stack.length - 1;
|
|
107
|
+
}
|
|
108
|
+
if (stored.stack[stored.index] !== current) {
|
|
109
|
+
stored.stack[stored.index] = current;
|
|
110
|
+
writeStored(stored.stack, stored.index);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const record = (url, replace) => {
|
|
114
|
+
if (!featureActive || isRestoring) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const normalized = normalize(url);
|
|
118
|
+
if (!normalized) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
let { stack, index } = readStored();
|
|
122
|
+
if (stack.length === 0) {
|
|
123
|
+
stack.push(normalized);
|
|
124
|
+
index = stack.length - 1;
|
|
125
|
+
}
|
|
126
|
+
else if (replace) {
|
|
127
|
+
if (index < 0 || index >= stack.length) {
|
|
128
|
+
index = stack.length - 1;
|
|
129
|
+
}
|
|
130
|
+
stack[index] = normalized;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
if (index >= stack.length - 1) {
|
|
134
|
+
stack.push(normalized);
|
|
135
|
+
index = stack.length - 1;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
stack = stack.slice(0, index + 1);
|
|
139
|
+
stack.push(normalized);
|
|
140
|
+
index = stack.length - 1;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
({ stack, index } = trimStack(stack, index));
|
|
144
|
+
writeStored(stack, index);
|
|
145
|
+
};
|
|
146
|
+
const restoreHistory = () => {
|
|
147
|
+
if (!featureActive || isRestoring) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const stored = readStored();
|
|
151
|
+
if (stored.stack.length === 0) {
|
|
152
|
+
ensureCurrentTracked();
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const targetIndex = stored.index >= 0 && stored.index < stored.stack.length ? stored.index : stored.stack.length - 1;
|
|
156
|
+
const normalizedCurrent = normalize();
|
|
157
|
+
if (stored.stack.length === 1 && normalizedCurrent === stored.stack[0]) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const firstEntry = stored.stack[0];
|
|
161
|
+
if (!firstEntry) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
isRestoring = true;
|
|
165
|
+
try {
|
|
166
|
+
history.replaceState(history.state, document.title, firstEntry);
|
|
167
|
+
for (let i = 1; i < stored.stack.length; i += 1) {
|
|
168
|
+
history.pushState(history.state, document.title, stored.stack[i]);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
catch (err) {
|
|
172
|
+
isRestoring = false;
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
isRestoring = false;
|
|
176
|
+
const currentIndex = stored.stack.length - 1;
|
|
177
|
+
const offset = targetIndex - currentIndex;
|
|
178
|
+
if (offset !== 0) {
|
|
179
|
+
history.go(offset);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
history.replaceState(history.state, document.title, stored.stack[targetIndex]);
|
|
183
|
+
window.dispatchEvent(new PopStateEvent('popstate'));
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const scheduleRestore = () => {
|
|
187
|
+
if (!featureActive || restoreScheduled) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
restoreScheduled = true;
|
|
191
|
+
runWhenReady(() => {
|
|
192
|
+
restoreScheduled = false;
|
|
193
|
+
restoreHistory();
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
let originalPushState = null;
|
|
197
|
+
let originalReplaceState = null;
|
|
198
|
+
const popstateHandler = () => {
|
|
199
|
+
if (!featureActive || isRestoring) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const normalized = normalize();
|
|
203
|
+
if (!normalized) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const stored = readStored();
|
|
207
|
+
const idx = stored.stack.lastIndexOf(normalized);
|
|
208
|
+
if (idx >= 0) {
|
|
209
|
+
stored.index = idx;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
stored.stack.push(normalized);
|
|
213
|
+
stored.index = stored.stack.length - 1;
|
|
214
|
+
}
|
|
215
|
+
const trimmed = trimStack(stored.stack, stored.index);
|
|
216
|
+
writeStored(trimmed.stack, trimmed.index);
|
|
217
|
+
};
|
|
218
|
+
const patchHistory = () => {
|
|
219
|
+
if (originalPushState && originalReplaceState) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
originalPushState = history.pushState;
|
|
223
|
+
originalReplaceState = history.replaceState;
|
|
224
|
+
history.pushState = function pushStatePatched(state, title, url) {
|
|
225
|
+
const result = originalPushState === null || originalPushState === void 0 ? void 0 : originalPushState.call(history, state, title, url);
|
|
226
|
+
record(url, false);
|
|
227
|
+
return result;
|
|
228
|
+
};
|
|
229
|
+
history.replaceState = function replaceStatePatched(state, title, url) {
|
|
230
|
+
const result = originalReplaceState === null || originalReplaceState === void 0 ? void 0 : originalReplaceState.call(history, state, title, url);
|
|
231
|
+
record(url, true);
|
|
232
|
+
return result;
|
|
233
|
+
};
|
|
234
|
+
window.addEventListener('popstate', popstateHandler);
|
|
235
|
+
};
|
|
236
|
+
const unpatchHistory = () => {
|
|
237
|
+
if (originalPushState) {
|
|
238
|
+
history.pushState = originalPushState;
|
|
239
|
+
originalPushState = null;
|
|
240
|
+
}
|
|
241
|
+
if (originalReplaceState) {
|
|
242
|
+
history.replaceState = originalReplaceState;
|
|
243
|
+
originalReplaceState = null;
|
|
244
|
+
}
|
|
245
|
+
window.removeEventListener('popstate', popstateHandler);
|
|
246
|
+
};
|
|
247
|
+
const setFeatureActive = (enabled) => {
|
|
248
|
+
if (featureActive === enabled) {
|
|
249
|
+
if (featureActive) {
|
|
250
|
+
ensureCurrentTracked();
|
|
251
|
+
scheduleRestore();
|
|
252
|
+
}
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
featureActive = enabled;
|
|
256
|
+
if (featureActive) {
|
|
257
|
+
patchHistory();
|
|
258
|
+
ensureCurrentTracked();
|
|
259
|
+
scheduleRestore();
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
unpatchHistory();
|
|
263
|
+
clearStored();
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
window.addEventListener('CapacitorUpdaterKeepUrlPathAfterReload', (event) => {
|
|
267
|
+
var _a;
|
|
268
|
+
const evt = event;
|
|
269
|
+
const enabled = (_a = evt === null || evt === void 0 ? void 0 : evt.detail) === null || _a === void 0 ? void 0 : _a.enabled;
|
|
270
|
+
if (typeof enabled === 'boolean') {
|
|
271
|
+
win.__capgoKeepUrlPathAfterReload = enabled;
|
|
272
|
+
setFeatureActive(enabled);
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
win.__capgoKeepUrlPathAfterReload = true;
|
|
276
|
+
setFeatureActive(true);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
setFeatureActive(isFeatureConfigured());
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
export {};
|
|
283
|
+
//# sourceMappingURL=history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/history.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,aAAa,GAAG,oCAAoC,CAAC;AAC3D,MAAM,mBAAmB,GAAG,yBAAyB,CAAC;AACtD,MAAM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AAU,EAAE,eAAe,CAAC,CAAC;QAC1D,CAAC,CAAC;QAEF,MAAM,gBAAgB,GAAG,CAAC,OAAgB,EAAE,EAAE;YAC5C,IAAI,aAAa,KAAK,OAAO,EAAE,CAAC;gBAC9B,IAAI,aAAa,EAAE,CAAC;oBAClB,oBAAoB,EAAE,CAAC;oBACvB,eAAe,EAAE,CAAC;gBACpB,CAAC;gBACD,OAAO;YACT,CAAC;YACD,aAAa,GAAG,OAAO,CAAC;YACxB,IAAI,aAAa,EAAE,CAAC;gBAClB,YAAY,EAAE,CAAC;gBACf,oBAAoB,EAAE,CAAC;gBACvB,eAAe,EAAE,CAAC;YACpB,CAAC;iBAAM,CAAC;gBACN,cAAc,EAAE,CAAC;gBACjB,WAAW,EAAE,CAAC;YAChB,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,wCAAwC,EAAE,CAAC,KAAK,EAAE,EAAE;;YAC1E,MAAM,GAAG,GAAG,KAA2C,CAAC;YACxD,MAAM,OAAO,GAAG,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,0CAAE,OAAO,CAAC;YACrC,IAAI,OAAO,OAAO,KAAK,SAAS,EAAE,CAAC;gBACjC,GAAG,CAAC,6BAA6B,GAAG,OAAO,CAAC;gBAC5C,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC5B,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,6BAA6B,GAAG,IAAI,CAAC;gBACzC,gBAAgB,CAAC,IAAI,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,gBAAgB,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC","sourcesContent":["/*\n * Maintains navigation history across Capgo-controlled reloads when keepUrlPathAfterReload is enabled.\n */\n\nconst KEEP_FLAG_KEY = '__capgo_keep_url_path_after_reload';\nconst HISTORY_STORAGE_KEY = '__capgo_history_stack__';\nconst MAX_STACK_ENTRIES = 100;\n\nconst isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof history !== 'undefined';\n\nif (isBrowser) {\n const win = window as typeof window & {\n __capgoHistoryPatched?: boolean;\n __capgoKeepUrlPathAfterReload?: boolean;\n };\n\n if (!win.__capgoHistoryPatched) {\n win.__capgoHistoryPatched = true;\n\n const isFeatureConfigured = (): boolean => {\n try {\n if (win.__capgoKeepUrlPathAfterReload) {\n return true;\n }\n } catch (err) {\n // ignore access issues\n }\n try {\n return window.localStorage.getItem(KEEP_FLAG_KEY) === '1';\n } catch (err) {\n return false;\n }\n };\n\n type StoredHistory = { stack: string[]; index: number };\n\n const readStored = (): StoredHistory => {\n try {\n const raw = window.sessionStorage.getItem(HISTORY_STORAGE_KEY);\n if (!raw) {\n return { stack: [], index: -1 };\n }\n const parsed = JSON.parse(raw) as StoredHistory;\n if (!parsed || !Array.isArray(parsed.stack) || typeof parsed.index !== 'number') {\n return { stack: [], index: -1 };\n }\n return parsed;\n } catch (err) {\n return { stack: [], index: -1 };\n }\n };\n\n const writeStored = (stack: string[], index: number): void => {\n try {\n window.sessionStorage.setItem(HISTORY_STORAGE_KEY, JSON.stringify({ stack, index }));\n } catch (err) {\n // Storage might be unavailable; fail silently.\n }\n };\n\n const clearStored = (): void => {\n try {\n window.sessionStorage.removeItem(HISTORY_STORAGE_KEY);\n } catch (err) {\n // ignore\n }\n };\n\n const normalize = (url?: string | URL | null): string | null => {\n try {\n const base = url ?? window.location.href;\n const parsed = new URL(base instanceof URL ? base.toString() : base, window.location.href);\n return `${parsed.pathname}${parsed.search}${parsed.hash}`;\n } catch (err) {\n return null;\n }\n };\n\n const trimStack = (stack: string[], index: number): StoredHistory => {\n if (stack.length <= MAX_STACK_ENTRIES) {\n return { stack, index };\n }\n const start = stack.length - MAX_STACK_ENTRIES;\n const trimmed = stack.slice(start);\n const adjustedIndex = Math.max(0, index - start);\n return { stack: trimmed, index: adjustedIndex };\n };\n\n const runWhenReady = (fn: () => void): void => {\n if (document.readyState === 'complete' || document.readyState === 'interactive') {\n fn();\n } else {\n window.addEventListener('DOMContentLoaded', fn, { once: true });\n }\n };\n\n let featureActive = false;\n let isRestoring = false;\n let restoreScheduled = false;\n\n const ensureCurrentTracked = () => {\n if (!featureActive) {\n return;\n }\n const stored = readStored();\n const current = normalize();\n if (!current) {\n return;\n }\n if (stored.stack.length === 0) {\n stored.stack.push(current);\n stored.index = 0;\n writeStored(stored.stack, stored.index);\n return;\n }\n if (stored.index < 0 || stored.index >= stored.stack.length) {\n stored.index = stored.stack.length - 1;\n }\n if (stored.stack[stored.index] !== current) {\n stored.stack[stored.index] = current;\n writeStored(stored.stack, stored.index);\n }\n };\n\n const record = (url: string | URL | null | undefined, replace: boolean) => {\n if (!featureActive || isRestoring) {\n return;\n }\n const normalized = normalize(url);\n if (!normalized) {\n return;\n }\n let { stack, index } = readStored();\n if (stack.length === 0) {\n stack.push(normalized);\n index = stack.length - 1;\n } else if (replace) {\n if (index < 0 || index >= stack.length) {\n index = stack.length - 1;\n }\n stack[index] = normalized;\n } else {\n if (index >= stack.length - 1) {\n stack.push(normalized);\n index = stack.length - 1;\n } else {\n stack = stack.slice(0, index + 1);\n stack.push(normalized);\n index = stack.length - 1;\n }\n }\n ({ stack, index } = trimStack(stack, index));\n writeStored(stack, index);\n };\n\n const restoreHistory = () => {\n if (!featureActive || isRestoring) {\n return;\n }\n const stored = readStored();\n if (stored.stack.length === 0) {\n ensureCurrentTracked();\n return;\n }\n const targetIndex =\n stored.index >= 0 && stored.index < stored.stack.length ? stored.index : stored.stack.length - 1;\n const normalizedCurrent = normalize();\n if (stored.stack.length === 1 && normalizedCurrent === stored.stack[0]) {\n return;\n }\n const firstEntry = stored.stack[0];\n if (!firstEntry) {\n return;\n }\n isRestoring = true;\n try {\n history.replaceState(history.state, document.title, firstEntry);\n for (let i = 1; i < stored.stack.length; i += 1) {\n history.pushState(history.state, document.title, stored.stack[i]);\n }\n } catch (err) {\n isRestoring = false;\n return;\n }\n isRestoring = false;\n const currentIndex = stored.stack.length - 1;\n const offset = targetIndex - currentIndex;\n if (offset !== 0) {\n history.go(offset);\n } else {\n history.replaceState(history.state, document.title, stored.stack[targetIndex]);\n window.dispatchEvent(new PopStateEvent('popstate'));\n }\n };\n\n const scheduleRestore = () => {\n if (!featureActive || restoreScheduled) {\n return;\n }\n restoreScheduled = true;\n runWhenReady(() => {\n restoreScheduled = false;\n restoreHistory();\n });\n };\n\n let originalPushState: typeof history.pushState | null = null;\n let originalReplaceState: typeof history.replaceState | null = null;\n\n const popstateHandler = () => {\n if (!featureActive || isRestoring) {\n return;\n }\n const normalized = normalize();\n if (!normalized) {\n return;\n }\n const stored = readStored();\n const idx = stored.stack.lastIndexOf(normalized);\n if (idx >= 0) {\n stored.index = idx;\n } else {\n stored.stack.push(normalized);\n stored.index = stored.stack.length - 1;\n }\n const trimmed = trimStack(stored.stack, stored.index);\n writeStored(trimmed.stack, trimmed.index);\n };\n\n const patchHistory = () => {\n if (originalPushState && originalReplaceState) {\n return;\n }\n originalPushState = history.pushState;\n originalReplaceState = history.replaceState;\n\n history.pushState = function pushStatePatched(state: any, title: string, url?: string | URL | null) {\n const result = originalPushState?.call(history, state, title, url as any);\n record(url, false);\n return result;\n };\n\n history.replaceState = function replaceStatePatched(state: any, title: string, url?: string | URL | null) {\n const result = originalReplaceState?.call(history, state, title, url as any);\n record(url, true);\n return result;\n };\n\n window.addEventListener('popstate', popstateHandler);\n };\n\n const unpatchHistory = () => {\n if (originalPushState) {\n history.pushState = originalPushState;\n originalPushState = null;\n }\n if (originalReplaceState) {\n history.replaceState = originalReplaceState;\n originalReplaceState = null;\n }\n window.removeEventListener('popstate', popstateHandler);\n };\n\n const setFeatureActive = (enabled: boolean) => {\n if (featureActive === enabled) {\n if (featureActive) {\n ensureCurrentTracked();\n scheduleRestore();\n }\n return;\n }\n featureActive = enabled;\n if (featureActive) {\n patchHistory();\n ensureCurrentTracked();\n scheduleRestore();\n } else {\n unpatchHistory();\n clearStored();\n }\n };\n\n window.addEventListener('CapacitorUpdaterKeepUrlPathAfterReload', (event) => {\n const evt = event as CustomEvent<{ enabled?: boolean }>;\n const enabled = evt?.detail?.enabled;\n if (typeof enabled === 'boolean') {\n win.__capgoKeepUrlPathAfterReload = enabled;\n setFeatureActive(enabled);\n } else {\n win.__capgoKeepUrlPathAfterReload = true;\n setFeatureActive(true);\n }\n });\n\n setFeatureActive(isFeatureConfigured());\n }\n}\n\nexport {};\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export * from './definitions';
|
|
2
|
+
export declare const Updater: {
|
|
3
|
+
notifyAppReady: () => Promise<unknown>;
|
|
4
|
+
setUpdateUrl: (options?: unknown) => Promise<unknown>;
|
|
5
|
+
setStatsUrl: (options?: unknown) => Promise<unknown>;
|
|
6
|
+
setChannelUrl: (options?: unknown) => Promise<unknown>;
|
|
7
|
+
download: (options?: unknown) => Promise<unknown>;
|
|
8
|
+
next: (options?: unknown) => Promise<unknown>;
|
|
9
|
+
set: (options?: unknown) => Promise<unknown>;
|
|
10
|
+
startPreviewSession: (options?: unknown) => Promise<unknown>;
|
|
11
|
+
listPreviews: () => Promise<unknown>;
|
|
12
|
+
setPreview: (options?: unknown) => Promise<unknown>;
|
|
13
|
+
resetPreview: () => Promise<unknown>;
|
|
14
|
+
deletePreview: (options?: unknown) => Promise<unknown>;
|
|
15
|
+
checkPreviewUpdate: (options?: unknown) => Promise<unknown>;
|
|
16
|
+
updatePreview: (options?: unknown) => Promise<unknown>;
|
|
17
|
+
delete: (options?: unknown) => Promise<unknown>;
|
|
18
|
+
setBundleError: (options?: unknown) => Promise<unknown>;
|
|
19
|
+
list: () => Promise<unknown>;
|
|
20
|
+
reset: (options?: unknown) => Promise<unknown>;
|
|
21
|
+
current: () => Promise<unknown>;
|
|
22
|
+
reload: () => Promise<unknown>;
|
|
23
|
+
setMultiDelay: (options?: unknown) => Promise<unknown>;
|
|
24
|
+
cancelDelay: () => Promise<unknown>;
|
|
25
|
+
triggerUpdateCheck: () => Promise<unknown>;
|
|
26
|
+
getLatest: (options?: unknown) => Promise<unknown>;
|
|
27
|
+
getMissingBundleFiles: (options?: unknown) => Promise<unknown>;
|
|
28
|
+
getBundleDownloadSize: (options?: unknown) => Promise<unknown>;
|
|
29
|
+
setChannel: (options?: unknown) => Promise<unknown>;
|
|
30
|
+
unsetChannel: () => Promise<unknown>;
|
|
31
|
+
getChannel: () => Promise<unknown>;
|
|
32
|
+
listChannels: (options?: unknown) => Promise<unknown>;
|
|
33
|
+
setCustomId: (options?: unknown) => Promise<unknown>;
|
|
34
|
+
getBuiltinVersion: () => Promise<unknown>;
|
|
35
|
+
getDeviceId: () => Promise<unknown>;
|
|
36
|
+
getPluginVersion: () => Promise<unknown>;
|
|
37
|
+
isAutoUpdateEnabled: () => Promise<unknown>;
|
|
38
|
+
isAutoUpdateAvailable: () => Promise<unknown>;
|
|
39
|
+
getNextBundle: () => Promise<unknown>;
|
|
40
|
+
getFailedUpdate: () => Promise<unknown>;
|
|
41
|
+
setShakeMenu: (options?: unknown) => Promise<unknown>;
|
|
42
|
+
isShakeMenuEnabled: () => Promise<unknown>;
|
|
43
|
+
setShakeChannelSelector: (options?: unknown) => Promise<unknown>;
|
|
44
|
+
isShakeChannelSelectorEnabled: () => Promise<unknown>;
|
|
45
|
+
getAppId: () => Promise<unknown>;
|
|
46
|
+
setAppId: (options?: unknown) => Promise<unknown>;
|
|
47
|
+
getAppUpdateInfo: () => Promise<unknown>;
|
|
48
|
+
openAppStore: () => Promise<unknown>;
|
|
49
|
+
performImmediateUpdate: () => Promise<unknown>;
|
|
50
|
+
startFlexibleUpdate: () => Promise<unknown>;
|
|
51
|
+
completeFlexibleUpdate: () => Promise<unknown>;
|
|
52
|
+
reportWebViewError: (options?: unknown) => Promise<unknown>;
|
|
53
|
+
addListener: (eventName: string, listener: (event: unknown) => void) => Promise<{
|
|
54
|
+
remove: () => Promise<void>;
|
|
55
|
+
}>;
|
|
56
|
+
removeAllListeners: () => Promise<unknown>;
|
|
57
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { exec, normalizeEmptyCordovaResult } from './exec';
|
|
2
|
+
export * from './definitions';
|
|
3
|
+
export const Updater = {
|
|
4
|
+
notifyAppReady: () => exec('notifyAppReady'),
|
|
5
|
+
setUpdateUrl: (options) => exec('setUpdateUrl', [options !== null && options !== void 0 ? options : {}]),
|
|
6
|
+
setStatsUrl: (options) => exec('setStatsUrl', [options !== null && options !== void 0 ? options : {}]),
|
|
7
|
+
setChannelUrl: (options) => exec('setChannelUrl', [options !== null && options !== void 0 ? options : {}]),
|
|
8
|
+
download: (options) => exec('download', [options !== null && options !== void 0 ? options : {}]),
|
|
9
|
+
next: (options) => exec('next', [options !== null && options !== void 0 ? options : {}]),
|
|
10
|
+
set: (options) => exec('set', [options !== null && options !== void 0 ? options : {}]),
|
|
11
|
+
startPreviewSession: (options) => exec('startPreviewSession', [options !== null && options !== void 0 ? options : {}]),
|
|
12
|
+
listPreviews: () => exec('listPreviews'),
|
|
13
|
+
setPreview: (options) => exec('setPreview', [options !== null && options !== void 0 ? options : {}]),
|
|
14
|
+
resetPreview: () => exec('resetPreview'),
|
|
15
|
+
deletePreview: (options) => exec('deletePreview', [options !== null && options !== void 0 ? options : {}]),
|
|
16
|
+
checkPreviewUpdate: (options) => exec('checkPreviewUpdate', [options !== null && options !== void 0 ? options : {}]),
|
|
17
|
+
updatePreview: (options) => exec('updatePreview', [options !== null && options !== void 0 ? options : {}]),
|
|
18
|
+
delete: (options) => exec('delete', [options !== null && options !== void 0 ? options : {}]),
|
|
19
|
+
setBundleError: (options) => exec('setBundleError', [options !== null && options !== void 0 ? options : {}]),
|
|
20
|
+
list: () => exec('list'),
|
|
21
|
+
reset: (options) => exec('reset', [options !== null && options !== void 0 ? options : {}]),
|
|
22
|
+
current: () => exec('current'),
|
|
23
|
+
reload: () => exec('reload'),
|
|
24
|
+
setMultiDelay: (options) => exec('setMultiDelay', [options !== null && options !== void 0 ? options : {}]),
|
|
25
|
+
cancelDelay: () => exec('cancelDelay'),
|
|
26
|
+
triggerUpdateCheck: () => exec('triggerUpdateCheck'),
|
|
27
|
+
getLatest: (options) => exec('getLatest', [options !== null && options !== void 0 ? options : {}]),
|
|
28
|
+
getMissingBundleFiles: (options) => exec('getMissingBundleFiles', [options !== null && options !== void 0 ? options : {}]),
|
|
29
|
+
getBundleDownloadSize: (options) => exec('getBundleDownloadSize', [options !== null && options !== void 0 ? options : {}]),
|
|
30
|
+
setChannel: (options) => exec('setChannel', [options !== null && options !== void 0 ? options : {}]),
|
|
31
|
+
unsetChannel: () => exec('unsetChannel'),
|
|
32
|
+
getChannel: () => exec('getChannel'),
|
|
33
|
+
listChannels: (options) => exec('listChannels', [options !== null && options !== void 0 ? options : {}]),
|
|
34
|
+
setCustomId: (options) => exec('setCustomId', [options !== null && options !== void 0 ? options : {}]),
|
|
35
|
+
getBuiltinVersion: () => exec('getBuiltinVersion'),
|
|
36
|
+
getDeviceId: () => exec('getDeviceId'),
|
|
37
|
+
getPluginVersion: () => exec('getPluginVersion'),
|
|
38
|
+
isAutoUpdateEnabled: () => exec('isAutoUpdateEnabled'),
|
|
39
|
+
isAutoUpdateAvailable: () => exec('isAutoUpdateAvailable'),
|
|
40
|
+
getNextBundle: async () => normalizeEmptyCordovaResult(await exec('getNextBundle')),
|
|
41
|
+
getFailedUpdate: async () => normalizeEmptyCordovaResult(await exec('getFailedUpdate')),
|
|
42
|
+
setShakeMenu: (options) => exec('setShakeMenu', [options !== null && options !== void 0 ? options : {}]),
|
|
43
|
+
isShakeMenuEnabled: () => exec('isShakeMenuEnabled'),
|
|
44
|
+
setShakeChannelSelector: (options) => exec('setShakeChannelSelector', [options !== null && options !== void 0 ? options : {}]),
|
|
45
|
+
isShakeChannelSelectorEnabled: () => exec('isShakeChannelSelectorEnabled'),
|
|
46
|
+
getAppId: () => exec('getAppId'),
|
|
47
|
+
setAppId: (options) => exec('setAppId', [options !== null && options !== void 0 ? options : {}]),
|
|
48
|
+
getAppUpdateInfo: () => exec('getAppUpdateInfo'),
|
|
49
|
+
openAppStore: () => exec('openAppStore'),
|
|
50
|
+
performImmediateUpdate: () => exec('performImmediateUpdate'),
|
|
51
|
+
startFlexibleUpdate: () => exec('startFlexibleUpdate'),
|
|
52
|
+
completeFlexibleUpdate: () => exec('completeFlexibleUpdate'),
|
|
53
|
+
reportWebViewError: (options) => exec('reportWebViewError', [options !== null && options !== void 0 ? options : {}]),
|
|
54
|
+
addListener: (eventName, listener) => {
|
|
55
|
+
const listenerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;
|
|
56
|
+
void exec('addListener', [{ eventName, listenerId }]);
|
|
57
|
+
const handler = (ev) => listener(ev.detail);
|
|
58
|
+
document.addEventListener(`cordova-updater:${eventName}`, handler);
|
|
59
|
+
return Promise.resolve({
|
|
60
|
+
remove: async () => {
|
|
61
|
+
document.removeEventListener(`cordova-updater:${eventName}`, handler);
|
|
62
|
+
await exec('removeListener', [{ listenerId }]);
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
removeAllListeners: () => exec('removeAllListeners'),
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AAC3D,cAAc,eAAe,CAAC;AAE9B,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,cAAc,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC;IAC5C,YAAY,EAAE,CAAC,OAAiB,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC,CAAC;IAC1E,WAAW,EAAE,CAAC,OAAiB,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,EA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E,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QAC3F,KAAK,IAAI,CAAC,aAAa,EAAE,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QACtD,MAAM,OAAO,GAAG,CAAC,EAAS,EAAE,EAAE,CAAC,QAAQ,CAAE,EAAkB,CAAC,MAAM,CAAC,CAAC;QACpE,QAAQ,CAAC,gBAAgB,CAAC,mBAAmB,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;QACnE,OAAO,OAAO,CAAC,OAAO,CAAC;YACrB,MAAM,EAAE,KAAK,IAAI,EAAE;gBACjB,QAAQ,CAAC,mBAAmB,CAAC,mBAAmB,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;gBACtE,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;YACjD,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IACD,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC;CACrD,CAAC","sourcesContent":["import { exec, normalizeEmptyCordovaResult } from './exec';\nexport * from './definitions';\n\nexport const Updater = {\n notifyAppReady: () => exec('notifyAppReady'),\n setUpdateUrl: (options?: unknown) => exec('setUpdateUrl', [options ?? {}]),\n setStatsUrl: (options?: unknown) => exec('setStatsUrl', [options ?? {}]),\n setChannelUrl: (options?: unknown) => exec('setChannelUrl', [options ?? {}]),\n download: (options?: unknown) => exec('download', [options ?? {}]),\n next: (options?: unknown) => exec('next', [options ?? {}]),\n set: (options?: unknown) => exec('set', [options ?? {}]),\n startPreviewSession: (options?: unknown) => exec('startPreviewSession', [options ?? {}]),\n listPreviews: () => exec('listPreviews'),\n setPreview: (options?: unknown) => exec('setPreview', [options ?? {}]),\n resetPreview: () => exec('resetPreview'),\n deletePreview: (options?: unknown) => exec('deletePreview', [options ?? {}]),\n checkPreviewUpdate: (options?: unknown) => exec('checkPreviewUpdate', [options ?? {}]),\n updatePreview: (options?: unknown) => exec('updatePreview', [options ?? {}]),\n delete: (options?: unknown) => exec('delete', [options ?? {}]),\n setBundleError: (options?: unknown) => exec('setBundleError', [options ?? {}]),\n list: () => exec('list'),\n reset: (options?: unknown) => exec('reset', [options ?? {}]),\n current: () => exec('current'),\n reload: () => exec('reload'),\n setMultiDelay: (options?: unknown) => exec('setMultiDelay', [options ?? {}]),\n cancelDelay: () => exec('cancelDelay'),\n triggerUpdateCheck: () => exec('triggerUpdateCheck'),\n getLatest: (options?: unknown) => exec('getLatest', [options ?? {}]),\n getMissingBundleFiles: (options?: unknown) => exec('getMissingBundleFiles', [options ?? {}]),\n getBundleDownloadSize: (options?: unknown) => exec('getBundleDownloadSize', [options ?? {}]),\n setChannel: (options?: unknown) => exec('setChannel', [options ?? {}]),\n unsetChannel: () => exec('unsetChannel'),\n getChannel: () => exec('getChannel'),\n listChannels: (options?: unknown) => exec('listChannels', [options ?? {}]),\n setCustomId: (options?: unknown) => exec('setCustomId', [options ?? {}]),\n getBuiltinVersion: () => exec('getBuiltinVersion'),\n getDeviceId: () => exec('getDeviceId'),\n getPluginVersion: () => exec('getPluginVersion'),\n isAutoUpdateEnabled: () => exec('isAutoUpdateEnabled'),\n isAutoUpdateAvailable: () => exec('isAutoUpdateAvailable'),\n getNextBundle: async () => normalizeEmptyCordovaResult(await exec('getNextBundle')),\n getFailedUpdate: async () => normalizeEmptyCordovaResult(await exec('getFailedUpdate')),\n setShakeMenu: (options?: unknown) => exec('setShakeMenu', [options ?? {}]),\n isShakeMenuEnabled: () => exec('isShakeMenuEnabled'),\n setShakeChannelSelector: (options?: unknown) => exec('setShakeChannelSelector', [options ?? {}]),\n isShakeChannelSelectorEnabled: () => exec('isShakeChannelSelectorEnabled'),\n getAppId: () => exec('getAppId'),\n setAppId: (options?: unknown) => exec('setAppId', [options ?? {}]),\n getAppUpdateInfo: () => exec('getAppUpdateInfo'),\n openAppStore: () => exec('openAppStore'),\n performImmediateUpdate: () => exec('performImmediateUpdate'),\n startFlexibleUpdate: () => exec('startFlexibleUpdate'),\n completeFlexibleUpdate: () => exec('completeFlexibleUpdate'),\n reportWebViewError: (options?: unknown) => exec('reportWebViewError', [options ?? {}]),\n addListener: (eventName: string, listener: (event: unknown) => void) => {\n const listenerId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 11)}`;\n void exec('addListener', [{ eventName, listenerId }]);\n const handler = (ev: Event) => listener((ev as CustomEvent).detail);\n document.addEventListener(`cordova-updater:${eventName}`, handler);\n return Promise.resolve({\n remove: async () => {\n document.removeEventListener(`cordova-updater:${eventName}`, handler);\n await exec('removeListener', [{ listenerId }]);\n },\n });\n },\n removeAllListeners: () => exec('removeAllListeners'),\n};\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
declare const api: {
|
|
2
|
+
notifyAppReady: () => Promise<unknown>;
|
|
3
|
+
setUpdateUrl: (options?: unknown) => Promise<unknown>;
|
|
4
|
+
setStatsUrl: (options?: unknown) => Promise<unknown>;
|
|
5
|
+
setChannelUrl: (options?: unknown) => Promise<unknown>;
|
|
6
|
+
download: (options?: unknown) => Promise<unknown>;
|
|
7
|
+
next: (options?: unknown) => Promise<unknown>;
|
|
8
|
+
set: (options?: unknown) => Promise<unknown>;
|
|
9
|
+
startPreviewSession: (options?: unknown) => Promise<unknown>;
|
|
10
|
+
listPreviews: () => Promise<unknown>;
|
|
11
|
+
setPreview: (options?: unknown) => Promise<unknown>;
|
|
12
|
+
resetPreview: () => Promise<unknown>;
|
|
13
|
+
deletePreview: (options?: unknown) => Promise<unknown>;
|
|
14
|
+
checkPreviewUpdate: (options?: unknown) => Promise<unknown>;
|
|
15
|
+
updatePreview: (options?: unknown) => Promise<unknown>;
|
|
16
|
+
delete: (options?: unknown) => Promise<unknown>;
|
|
17
|
+
setBundleError: (options?: unknown) => Promise<unknown>;
|
|
18
|
+
list: () => Promise<unknown>;
|
|
19
|
+
reset: (options?: unknown) => Promise<unknown>;
|
|
20
|
+
current: () => Promise<unknown>;
|
|
21
|
+
reload: () => Promise<unknown>;
|
|
22
|
+
setMultiDelay: (options?: unknown) => Promise<unknown>;
|
|
23
|
+
cancelDelay: () => Promise<unknown>;
|
|
24
|
+
triggerUpdateCheck: () => Promise<unknown>;
|
|
25
|
+
getLatest: (options?: unknown) => Promise<unknown>;
|
|
26
|
+
getMissingBundleFiles: (options?: unknown) => Promise<unknown>;
|
|
27
|
+
getBundleDownloadSize: (options?: unknown) => Promise<unknown>;
|
|
28
|
+
setChannel: (options?: unknown) => Promise<unknown>;
|
|
29
|
+
unsetChannel: () => Promise<unknown>;
|
|
30
|
+
getChannel: () => Promise<unknown>;
|
|
31
|
+
listChannels: (options?: unknown) => Promise<unknown>;
|
|
32
|
+
setCustomId: (options?: unknown) => Promise<unknown>;
|
|
33
|
+
getBuiltinVersion: () => Promise<unknown>;
|
|
34
|
+
getDeviceId: () => Promise<unknown>;
|
|
35
|
+
getPluginVersion: () => Promise<unknown>;
|
|
36
|
+
isAutoUpdateEnabled: () => Promise<unknown>;
|
|
37
|
+
isAutoUpdateAvailable: () => Promise<unknown>;
|
|
38
|
+
getNextBundle: () => Promise<unknown>;
|
|
39
|
+
getFailedUpdate: () => Promise<unknown>;
|
|
40
|
+
setShakeMenu: (options?: unknown) => Promise<unknown>;
|
|
41
|
+
isShakeMenuEnabled: () => Promise<unknown>;
|
|
42
|
+
setShakeChannelSelector: (options?: unknown) => Promise<unknown>;
|
|
43
|
+
isShakeChannelSelectorEnabled: () => Promise<unknown>;
|
|
44
|
+
getAppId: () => Promise<unknown>;
|
|
45
|
+
setAppId: (options?: unknown) => Promise<unknown>;
|
|
46
|
+
getAppUpdateInfo: () => Promise<unknown>;
|
|
47
|
+
openAppStore: () => Promise<unknown>;
|
|
48
|
+
performImmediateUpdate: () => Promise<unknown>;
|
|
49
|
+
startFlexibleUpdate: () => Promise<unknown>;
|
|
50
|
+
completeFlexibleUpdate: () => Promise<unknown>;
|
|
51
|
+
reportWebViewError: (options?: unknown) => Promise<unknown>;
|
|
52
|
+
addListener: (eventName: string, listener: (event: unknown) => void) => Promise<{
|
|
53
|
+
remove: () => Promise<void>;
|
|
54
|
+
}>;
|
|
55
|
+
removeAllListeners: () => Promise<unknown>;
|
|
56
|
+
};
|
|
57
|
+
export { api as Updater };
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
import { Updater } from './index';
|
|
7
|
+
const api = Object.assign({}, Updater);
|
|
8
|
+
document.addEventListener('deviceready', () => {
|
|
9
|
+
const win = window;
|
|
10
|
+
win.cordova = win.cordova || {};
|
|
11
|
+
win.cordova.plugins = win.cordova.plugins || {};
|
|
12
|
+
win.cordova.plugins.Updater = api;
|
|
13
|
+
});
|
|
14
|
+
export { api as Updater };
|
|
15
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,GAAG,qBAAQ,OAAO,CAAE,CAAC;AAE3B,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,GAAG,EAAE;IAC5C,MAAM,GAAG,GAAG,MAEX,CAAC;IACF,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;IAChC,GAAG,CAAC,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;IAChD,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC;AACpC,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC","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 { Updater } from './index';\n\nconst api = { ...Updater };\n\ndocument.addEventListener('deviceready', () => {\n const win = window as Window & {\n cordova?: { plugins?: Record<string, unknown> };\n };\n win.cordova = win.cordova || {};\n win.cordova.plugins = win.cordova.plugins || {};\n win.cordova.plugins.Updater = api;\n});\n\nexport { api as Updater };\n"]}
|