@capgo/capacitor-updater 7.20.0 → 7.20.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 +23 -2
- 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 +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/plugin.cjs.js +282 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +282 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +28 -1
- package/package.json +1 -1
|
@@ -63,12 +63,13 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
63
63
|
private static final String updateUrlDefault = "https://plugin.capgo.app/updates";
|
|
64
64
|
private static final String statsUrlDefault = "https://plugin.capgo.app/stats";
|
|
65
65
|
private static final String channelUrlDefault = "https://plugin.capgo.app/channel_self";
|
|
66
|
+
private static final String KEEP_URL_FLAG_KEY = "__capgo_keep_url_path_after_reload";
|
|
66
67
|
private static final String CUSTOM_ID_PREF_KEY = "CapacitorUpdater.customId";
|
|
67
68
|
private static final String UPDATE_URL_PREF_KEY = "CapacitorUpdater.updateUrl";
|
|
68
69
|
private static final String STATS_URL_PREF_KEY = "CapacitorUpdater.statsUrl";
|
|
69
70
|
private static final String CHANNEL_URL_PREF_KEY = "CapacitorUpdater.channelUrl";
|
|
70
71
|
|
|
71
|
-
private final String PLUGIN_VERSION = "7.20.
|
|
72
|
+
private final String PLUGIN_VERSION = "7.20.1";
|
|
72
73
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
73
74
|
|
|
74
75
|
private SharedPreferences.Editor editor;
|
|
@@ -288,6 +289,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
288
289
|
this.autoUpdate = this.getConfig().getBoolean("autoUpdate", true);
|
|
289
290
|
this.appReadyTimeout = this.getConfig().getInt("appReadyTimeout", 10000);
|
|
290
291
|
this.keepUrlPathAfterReload = this.getConfig().getBoolean("keepUrlPathAfterReload", false);
|
|
292
|
+
this.syncKeepUrlPathFlag(this.keepUrlPathAfterReload);
|
|
291
293
|
this.autoSplashscreen = this.getConfig().getBoolean("autoSplashscreen", false);
|
|
292
294
|
this.autoSplashscreenLoader = this.getConfig().getBoolean("autoSplashscreenLoader", false);
|
|
293
295
|
int splashscreenTimeoutValue = this.getConfig().getInt("autoSplashscreenTimeout", 10000);
|
|
@@ -943,8 +945,25 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
943
945
|
}
|
|
944
946
|
}
|
|
945
947
|
|
|
948
|
+
private void syncKeepUrlPathFlag(final boolean enabled) {
|
|
949
|
+
if (this.bridge == null || this.bridge.getWebView() == null) {
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
final String script = enabled
|
|
953
|
+
? "(function(){try{localStorage.setItem('" +
|
|
954
|
+
KEEP_URL_FLAG_KEY +
|
|
955
|
+
"','1');}catch(e){}window.__capgoKeepUrlPathAfterReload=true;var evt;try{evt=new CustomEvent('CapacitorUpdaterKeepUrlPathAfterReload',{detail:{enabled:true}});}catch(err){evt=document.createEvent('CustomEvent');evt.initCustomEvent('CapacitorUpdaterKeepUrlPathAfterReload',false,false,{enabled:true});}window.dispatchEvent(evt);})();"
|
|
956
|
+
: "(function(){try{localStorage.removeItem('" +
|
|
957
|
+
KEEP_URL_FLAG_KEY +
|
|
958
|
+
"');}catch(e){}delete window.__capgoKeepUrlPathAfterReload;var evt;try{evt=new CustomEvent('CapacitorUpdaterKeepUrlPathAfterReload',{detail:{enabled:false}});}catch(err){evt=document.createEvent('CustomEvent');evt.initCustomEvent('CapacitorUpdaterKeepUrlPathAfterReload',false,false,{enabled:false});}window.dispatchEvent(evt);})();";
|
|
959
|
+
this.bridge.getWebView().post(() -> this.bridge.getWebView().evaluateJavascript(script, null));
|
|
960
|
+
}
|
|
961
|
+
|
|
946
962
|
protected boolean _reload() {
|
|
947
963
|
final String path = this.implementation.getCurrentBundlePath();
|
|
964
|
+
if (this.keepUrlPathAfterReload) {
|
|
965
|
+
this.syncKeepUrlPathFlag(true);
|
|
966
|
+
}
|
|
948
967
|
this.semaphoreUp();
|
|
949
968
|
logger.info("Reloading: " + path);
|
|
950
969
|
|
|
@@ -1003,7 +1022,9 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
1003
1022
|
URL finalUrl1 = finalUrl;
|
|
1004
1023
|
this.bridge.getWebView().post(() -> {
|
|
1005
1024
|
this.bridge.getWebView().loadUrl(finalUrl1.toString());
|
|
1006
|
-
this.
|
|
1025
|
+
if (!this.keepUrlPathAfterReload) {
|
|
1026
|
+
this.bridge.getWebView().clearHistory();
|
|
1027
|
+
}
|
|
1007
1028
|
});
|
|
1008
1029
|
} catch (MalformedURLException e) {
|
|
1009
1030
|
logger.error("Cannot get finalUrl from capacitor bridge " + e.getMessage());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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.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.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,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,OAAO,KAAK,WAAW,CAAC;AAErH,IAAI,SAAS,EAAE,CAAC;IACd,MAAM,GAAG,GAAG,MAGX,CAAC;IAEF,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;QAC/B,GAAG,CAAC,qBAAqB,GAAG,IAAI,CAAC;QAEjC,MAAM,mBAAmB,GAAG,GAAY,EAAE;YACxC,IAAI,CAAC;gBACH,IAAI,GAAG,CAAC,6BAA6B,EAAE,CAAC;oBACtC,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,uBAAuB;YACzB,CAAC;YACD,IAAI,CAAC;gBACH,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,GAAG,CAAC;YAC5D,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC,CAAC;QAIF,MAAM,UAAU,GAAG,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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"]}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
5
|
*/
|
|
6
6
|
import { registerPlugin } from '@capacitor/core';
|
|
7
|
+
import './history';
|
|
7
8
|
const CapacitorUpdater = registerPlugin('CapacitorUpdater', {
|
|
8
9
|
web: () => import('./web').then((m) => new m.CapacitorUpdaterWeb()),
|
|
9
10
|
});
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,WAAW,CAAC;AAInB,MAAM,gBAAgB,GAAG,cAAc,CAAyB,kBAAkB,EAAE;IAClF,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;CACpE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,gBAAgB,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 */\n\nimport { registerPlugin } from '@capacitor/core';\nimport './history';\n\nimport type { CapacitorUpdaterPlugin } from './definitions';\n\nconst CapacitorUpdater = registerPlugin<CapacitorUpdaterPlugin>('CapacitorUpdater', {\n web: () => import('./web').then((m) => new m.CapacitorUpdaterWeb()),\n});\n\nexport * from './definitions';\nexport { CapacitorUpdater };\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -2,6 +2,288 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@capacitor/core');
|
|
4
4
|
|
|
5
|
+
/*
|
|
6
|
+
* Maintains navigation history across Capgo-controlled reloads when keepUrlPathAfterReload is enabled.
|
|
7
|
+
*/
|
|
8
|
+
const KEEP_FLAG_KEY = '__capgo_keep_url_path_after_reload';
|
|
9
|
+
const HISTORY_STORAGE_KEY = '__capgo_history_stack__';
|
|
10
|
+
const MAX_STACK_ENTRIES = 100;
|
|
11
|
+
const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof history !== 'undefined';
|
|
12
|
+
if (isBrowser) {
|
|
13
|
+
const win = window;
|
|
14
|
+
if (!win.__capgoHistoryPatched) {
|
|
15
|
+
win.__capgoHistoryPatched = true;
|
|
16
|
+
const isFeatureConfigured = () => {
|
|
17
|
+
try {
|
|
18
|
+
if (win.__capgoKeepUrlPathAfterReload) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
// ignore access issues
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
return window.localStorage.getItem(KEEP_FLAG_KEY) === '1';
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const readStored = () => {
|
|
33
|
+
try {
|
|
34
|
+
const raw = window.sessionStorage.getItem(HISTORY_STORAGE_KEY);
|
|
35
|
+
if (!raw) {
|
|
36
|
+
return { stack: [], index: -1 };
|
|
37
|
+
}
|
|
38
|
+
const parsed = JSON.parse(raw);
|
|
39
|
+
if (!parsed || !Array.isArray(parsed.stack) || typeof parsed.index !== 'number') {
|
|
40
|
+
return { stack: [], index: -1 };
|
|
41
|
+
}
|
|
42
|
+
return parsed;
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
return { stack: [], index: -1 };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const writeStored = (stack, index) => {
|
|
49
|
+
try {
|
|
50
|
+
window.sessionStorage.setItem(HISTORY_STORAGE_KEY, JSON.stringify({ stack, index }));
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
// Storage might be unavailable; fail silently.
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const clearStored = () => {
|
|
57
|
+
try {
|
|
58
|
+
window.sessionStorage.removeItem(HISTORY_STORAGE_KEY);
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
// ignore
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const normalize = (url) => {
|
|
65
|
+
try {
|
|
66
|
+
const base = url !== null && url !== void 0 ? url : window.location.href;
|
|
67
|
+
const parsed = new URL(base instanceof URL ? base.toString() : base, window.location.href);
|
|
68
|
+
return `${parsed.pathname}${parsed.search}${parsed.hash}`;
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const trimStack = (stack, index) => {
|
|
75
|
+
if (stack.length <= MAX_STACK_ENTRIES) {
|
|
76
|
+
return { stack, index };
|
|
77
|
+
}
|
|
78
|
+
const start = stack.length - MAX_STACK_ENTRIES;
|
|
79
|
+
const trimmed = stack.slice(start);
|
|
80
|
+
const adjustedIndex = Math.max(0, index - start);
|
|
81
|
+
return { stack: trimmed, index: adjustedIndex };
|
|
82
|
+
};
|
|
83
|
+
const runWhenReady = (fn) => {
|
|
84
|
+
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
|
85
|
+
fn();
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
window.addEventListener('DOMContentLoaded', fn, { once: true });
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
let featureActive = false;
|
|
92
|
+
let isRestoring = false;
|
|
93
|
+
let restoreScheduled = false;
|
|
94
|
+
const ensureCurrentTracked = () => {
|
|
95
|
+
if (!featureActive) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const stored = readStored();
|
|
99
|
+
const current = normalize();
|
|
100
|
+
if (!current) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (stored.stack.length === 0) {
|
|
104
|
+
stored.stack.push(current);
|
|
105
|
+
stored.index = 0;
|
|
106
|
+
writeStored(stored.stack, stored.index);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (stored.index < 0 || stored.index >= stored.stack.length) {
|
|
110
|
+
stored.index = stored.stack.length - 1;
|
|
111
|
+
}
|
|
112
|
+
if (stored.stack[stored.index] !== current) {
|
|
113
|
+
stored.stack[stored.index] = current;
|
|
114
|
+
writeStored(stored.stack, stored.index);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const record = (url, replace) => {
|
|
118
|
+
if (!featureActive || isRestoring) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const normalized = normalize(url);
|
|
122
|
+
if (!normalized) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
let { stack, index } = readStored();
|
|
126
|
+
if (stack.length === 0) {
|
|
127
|
+
stack.push(normalized);
|
|
128
|
+
index = stack.length - 1;
|
|
129
|
+
}
|
|
130
|
+
else if (replace) {
|
|
131
|
+
if (index < 0 || index >= stack.length) {
|
|
132
|
+
index = stack.length - 1;
|
|
133
|
+
}
|
|
134
|
+
stack[index] = normalized;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
if (index >= stack.length - 1) {
|
|
138
|
+
stack.push(normalized);
|
|
139
|
+
index = stack.length - 1;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
stack = stack.slice(0, index + 1);
|
|
143
|
+
stack.push(normalized);
|
|
144
|
+
index = stack.length - 1;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
({ stack, index } = trimStack(stack, index));
|
|
148
|
+
writeStored(stack, index);
|
|
149
|
+
};
|
|
150
|
+
const restoreHistory = () => {
|
|
151
|
+
if (!featureActive || isRestoring) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const stored = readStored();
|
|
155
|
+
if (stored.stack.length === 0) {
|
|
156
|
+
ensureCurrentTracked();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const targetIndex = stored.index >= 0 && stored.index < stored.stack.length ? stored.index : stored.stack.length - 1;
|
|
160
|
+
const normalizedCurrent = normalize();
|
|
161
|
+
if (stored.stack.length === 1 && normalizedCurrent === stored.stack[0]) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const firstEntry = stored.stack[0];
|
|
165
|
+
if (!firstEntry) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
isRestoring = true;
|
|
169
|
+
try {
|
|
170
|
+
history.replaceState(history.state, document.title, firstEntry);
|
|
171
|
+
for (let i = 1; i < stored.stack.length; i += 1) {
|
|
172
|
+
history.pushState(history.state, document.title, stored.stack[i]);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
isRestoring = false;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
isRestoring = false;
|
|
180
|
+
const currentIndex = stored.stack.length - 1;
|
|
181
|
+
const offset = targetIndex - currentIndex;
|
|
182
|
+
if (offset !== 0) {
|
|
183
|
+
history.go(offset);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
history.replaceState(history.state, document.title, stored.stack[targetIndex]);
|
|
187
|
+
window.dispatchEvent(new PopStateEvent('popstate'));
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const scheduleRestore = () => {
|
|
191
|
+
if (!featureActive || restoreScheduled) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
restoreScheduled = true;
|
|
195
|
+
runWhenReady(() => {
|
|
196
|
+
restoreScheduled = false;
|
|
197
|
+
restoreHistory();
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
let originalPushState = null;
|
|
201
|
+
let originalReplaceState = null;
|
|
202
|
+
const popstateHandler = () => {
|
|
203
|
+
if (!featureActive || isRestoring) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const normalized = normalize();
|
|
207
|
+
if (!normalized) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const stored = readStored();
|
|
211
|
+
const idx = stored.stack.lastIndexOf(normalized);
|
|
212
|
+
if (idx >= 0) {
|
|
213
|
+
stored.index = idx;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
stored.stack.push(normalized);
|
|
217
|
+
stored.index = stored.stack.length - 1;
|
|
218
|
+
}
|
|
219
|
+
const trimmed = trimStack(stored.stack, stored.index);
|
|
220
|
+
writeStored(trimmed.stack, trimmed.index);
|
|
221
|
+
};
|
|
222
|
+
const patchHistory = () => {
|
|
223
|
+
if (originalPushState && originalReplaceState) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
originalPushState = history.pushState;
|
|
227
|
+
originalReplaceState = history.replaceState;
|
|
228
|
+
history.pushState = function pushStatePatched(state, title, url) {
|
|
229
|
+
const result = originalPushState.call(history, state, title, url);
|
|
230
|
+
record(url, false);
|
|
231
|
+
return result;
|
|
232
|
+
};
|
|
233
|
+
history.replaceState = function replaceStatePatched(state, title, url) {
|
|
234
|
+
const result = originalReplaceState.call(history, state, title, url);
|
|
235
|
+
record(url, true);
|
|
236
|
+
return result;
|
|
237
|
+
};
|
|
238
|
+
window.addEventListener('popstate', popstateHandler);
|
|
239
|
+
};
|
|
240
|
+
const unpatchHistory = () => {
|
|
241
|
+
if (originalPushState) {
|
|
242
|
+
history.pushState = originalPushState;
|
|
243
|
+
originalPushState = null;
|
|
244
|
+
}
|
|
245
|
+
if (originalReplaceState) {
|
|
246
|
+
history.replaceState = originalReplaceState;
|
|
247
|
+
originalReplaceState = null;
|
|
248
|
+
}
|
|
249
|
+
window.removeEventListener('popstate', popstateHandler);
|
|
250
|
+
};
|
|
251
|
+
const setFeatureActive = (enabled) => {
|
|
252
|
+
if (featureActive === enabled) {
|
|
253
|
+
if (featureActive) {
|
|
254
|
+
ensureCurrentTracked();
|
|
255
|
+
scheduleRestore();
|
|
256
|
+
}
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
featureActive = enabled;
|
|
260
|
+
if (featureActive) {
|
|
261
|
+
patchHistory();
|
|
262
|
+
ensureCurrentTracked();
|
|
263
|
+
scheduleRestore();
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
unpatchHistory();
|
|
267
|
+
clearStored();
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
window.addEventListener('CapacitorUpdaterKeepUrlPathAfterReload', (event) => {
|
|
271
|
+
var _a;
|
|
272
|
+
const evt = event;
|
|
273
|
+
const enabled = (_a = evt === null || evt === void 0 ? void 0 : evt.detail) === null || _a === void 0 ? void 0 : _a.enabled;
|
|
274
|
+
if (typeof enabled === 'boolean') {
|
|
275
|
+
win.__capgoKeepUrlPathAfterReload = enabled;
|
|
276
|
+
setFeatureActive(enabled);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
win.__capgoKeepUrlPathAfterReload = true;
|
|
280
|
+
setFeatureActive(true);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
setFeatureActive(isFeatureConfigured());
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
5
287
|
/*
|
|
6
288
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
7
289
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
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 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,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;AACM,MAAM,mBAAmB,SAASC,cAAS,CAAC;AACnD,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;AAC/B,QAAQ,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,OAAO,CAAC;AAC1D,QAAQ;AACR,IAAI;AACJ,IAAI,MAAM,YAAY,CAAC,OAAO,EAAE;AAChC,QAAQ,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE,OAAO,CAA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a,GAAG;AAC1B,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;AACpC,IAAI;AACJ,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,0CAA0C,CAAC;AAC5E,IAAI;AACJ,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAClD,IAAI;AACJ,IAAI,MAAM,QAAQ,GAAG;AACrB,QAAQ,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC;AAC9C,QAAQ,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE;AACnC,IAAI;AACJ,IAAI,MAAM,QAAQ,CAAC,OAAO,EAAE;AAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC;AACvD,QAAQ;AACR,IAAI;AACJ;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/history.js","esm/index.js","esm/web.js"],"sourcesContent":["/*\n * Maintains navigation history across Capgo-controlled reloads when keepUrlPathAfterReload is enabled.\n */\nconst KEEP_FLAG_KEY = '__capgo_keep_url_path_after_reload';\nconst HISTORY_STORAGE_KEY = '__capgo_history_stack__';\nconst MAX_STACK_ENTRIES = 100;\nconst isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof history !== 'undefined';\nif (isBrowser) {\n const win = window;\n if (!win.__capgoHistoryPatched) {\n win.__capgoHistoryPatched = true;\n const isFeatureConfigured = () => {\n try {\n if (win.__capgoKeepUrlPathAfterReload) {\n return true;\n }\n }\n catch (err) {\n // ignore access issues\n }\n try {\n return window.localStorage.getItem(KEEP_FLAG_KEY) === '1';\n }\n catch (err) {\n return false;\n }\n };\n const readStored = () => {\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);\n if (!parsed || !Array.isArray(parsed.stack) || typeof parsed.index !== 'number') {\n return { stack: [], index: -1 };\n }\n return parsed;\n }\n catch (err) {\n return { stack: [], index: -1 };\n }\n };\n const writeStored = (stack, index) => {\n try {\n window.sessionStorage.setItem(HISTORY_STORAGE_KEY, JSON.stringify({ stack, index }));\n }\n catch (err) {\n // Storage might be unavailable; fail silently.\n }\n };\n const clearStored = () => {\n try {\n window.sessionStorage.removeItem(HISTORY_STORAGE_KEY);\n }\n catch (err) {\n // ignore\n }\n };\n const normalize = (url) => {\n try {\n const base = url !== null && url !== void 0 ? 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 }\n catch (err) {\n return null;\n }\n };\n const trimStack = (stack, index) => {\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 const runWhenReady = (fn) => {\n if (document.readyState === 'complete' || document.readyState === 'interactive') {\n fn();\n }\n else {\n window.addEventListener('DOMContentLoaded', fn, { once: true });\n }\n };\n let featureActive = false;\n let isRestoring = false;\n let restoreScheduled = false;\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 const record = (url, replace) => {\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 }\n else if (replace) {\n if (index < 0 || index >= stack.length) {\n index = stack.length - 1;\n }\n stack[index] = normalized;\n }\n else {\n if (index >= stack.length - 1) {\n stack.push(normalized);\n index = stack.length - 1;\n }\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 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 = 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 }\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 }\n else {\n history.replaceState(history.state, document.title, stored.stack[targetIndex]);\n window.dispatchEvent(new PopStateEvent('popstate'));\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 let originalPushState = null;\n let originalReplaceState = null;\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 }\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 const patchHistory = () => {\n if (originalPushState && originalReplaceState) {\n return;\n }\n originalPushState = history.pushState;\n originalReplaceState = history.replaceState;\n history.pushState = function pushStatePatched(state, title, url) {\n const result = originalPushState.call(history, state, title, url);\n record(url, false);\n return result;\n };\n history.replaceState = function replaceStatePatched(state, title, url) {\n const result = originalReplaceState.call(history, state, title, url);\n record(url, true);\n return result;\n };\n window.addEventListener('popstate', popstateHandler);\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 const setFeatureActive = (enabled) => {\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 }\n else {\n unpatchHistory();\n clearStored();\n }\n };\n window.addEventListener('CapacitorUpdaterKeepUrlPathAfterReload', (event) => {\n var _a;\n const evt = event;\n const enabled = (_a = evt === null || evt === void 0 ? void 0 : evt.detail) === null || _a === void 0 ? void 0 : _a.enabled;\n if (typeof enabled === 'boolean') {\n win.__capgoKeepUrlPathAfterReload = enabled;\n setFeatureActive(enabled);\n }\n else {\n win.__capgoKeepUrlPathAfterReload = true;\n setFeatureActive(true);\n }\n });\n setFeatureActive(isFeatureConfigured());\n }\n}\nexport {};\n//# sourceMappingURL=history.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 { registerPlugin } from '@capacitor/core';\nimport './history';\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,MAAM,aAAa,GAAG,oCAAoC;AAC1D,MAAM,mBAAmB,GAAG,yBAAyB;AACrD,MAAM,iBAAiB,GAAG,GAAG;AAC7B,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,OAAO,KAAK,WAAW;AACpH,IAAI,SAAS,EAAE;AACf,IAAI,MAAM,GAAG,GAAG,MAAM;AACtB,IAAI,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE;AACpC,QAAQ,GAAG,CAAC,qBAAqB,GAAG,IAAI;AACxC,QAAQ,MAAM,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4
|
+
/*
|
|
5
|
+
* Maintains navigation history across Capgo-controlled reloads when keepUrlPathAfterReload is enabled.
|
|
6
|
+
*/
|
|
7
|
+
const KEEP_FLAG_KEY = '__capgo_keep_url_path_after_reload';
|
|
8
|
+
const HISTORY_STORAGE_KEY = '__capgo_history_stack__';
|
|
9
|
+
const MAX_STACK_ENTRIES = 100;
|
|
10
|
+
const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof history !== 'undefined';
|
|
11
|
+
if (isBrowser) {
|
|
12
|
+
const win = window;
|
|
13
|
+
if (!win.__capgoHistoryPatched) {
|
|
14
|
+
win.__capgoHistoryPatched = true;
|
|
15
|
+
const isFeatureConfigured = () => {
|
|
16
|
+
try {
|
|
17
|
+
if (win.__capgoKeepUrlPathAfterReload) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
// ignore access issues
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
return window.localStorage.getItem(KEEP_FLAG_KEY) === '1';
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const readStored = () => {
|
|
32
|
+
try {
|
|
33
|
+
const raw = window.sessionStorage.getItem(HISTORY_STORAGE_KEY);
|
|
34
|
+
if (!raw) {
|
|
35
|
+
return { stack: [], index: -1 };
|
|
36
|
+
}
|
|
37
|
+
const parsed = JSON.parse(raw);
|
|
38
|
+
if (!parsed || !Array.isArray(parsed.stack) || typeof parsed.index !== 'number') {
|
|
39
|
+
return { stack: [], index: -1 };
|
|
40
|
+
}
|
|
41
|
+
return parsed;
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
return { stack: [], index: -1 };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const writeStored = (stack, index) => {
|
|
48
|
+
try {
|
|
49
|
+
window.sessionStorage.setItem(HISTORY_STORAGE_KEY, JSON.stringify({ stack, index }));
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
// Storage might be unavailable; fail silently.
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const clearStored = () => {
|
|
56
|
+
try {
|
|
57
|
+
window.sessionStorage.removeItem(HISTORY_STORAGE_KEY);
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
// ignore
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const normalize = (url) => {
|
|
64
|
+
try {
|
|
65
|
+
const base = url !== null && url !== void 0 ? url : window.location.href;
|
|
66
|
+
const parsed = new URL(base instanceof URL ? base.toString() : base, window.location.href);
|
|
67
|
+
return `${parsed.pathname}${parsed.search}${parsed.hash}`;
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const trimStack = (stack, index) => {
|
|
74
|
+
if (stack.length <= MAX_STACK_ENTRIES) {
|
|
75
|
+
return { stack, index };
|
|
76
|
+
}
|
|
77
|
+
const start = stack.length - MAX_STACK_ENTRIES;
|
|
78
|
+
const trimmed = stack.slice(start);
|
|
79
|
+
const adjustedIndex = Math.max(0, index - start);
|
|
80
|
+
return { stack: trimmed, index: adjustedIndex };
|
|
81
|
+
};
|
|
82
|
+
const runWhenReady = (fn) => {
|
|
83
|
+
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
|
84
|
+
fn();
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
window.addEventListener('DOMContentLoaded', fn, { once: true });
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
let featureActive = false;
|
|
91
|
+
let isRestoring = false;
|
|
92
|
+
let restoreScheduled = false;
|
|
93
|
+
const ensureCurrentTracked = () => {
|
|
94
|
+
if (!featureActive) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const stored = readStored();
|
|
98
|
+
const current = normalize();
|
|
99
|
+
if (!current) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (stored.stack.length === 0) {
|
|
103
|
+
stored.stack.push(current);
|
|
104
|
+
stored.index = 0;
|
|
105
|
+
writeStored(stored.stack, stored.index);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (stored.index < 0 || stored.index >= stored.stack.length) {
|
|
109
|
+
stored.index = stored.stack.length - 1;
|
|
110
|
+
}
|
|
111
|
+
if (stored.stack[stored.index] !== current) {
|
|
112
|
+
stored.stack[stored.index] = current;
|
|
113
|
+
writeStored(stored.stack, stored.index);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const record = (url, replace) => {
|
|
117
|
+
if (!featureActive || isRestoring) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const normalized = normalize(url);
|
|
121
|
+
if (!normalized) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
let { stack, index } = readStored();
|
|
125
|
+
if (stack.length === 0) {
|
|
126
|
+
stack.push(normalized);
|
|
127
|
+
index = stack.length - 1;
|
|
128
|
+
}
|
|
129
|
+
else if (replace) {
|
|
130
|
+
if (index < 0 || index >= stack.length) {
|
|
131
|
+
index = stack.length - 1;
|
|
132
|
+
}
|
|
133
|
+
stack[index] = normalized;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
if (index >= stack.length - 1) {
|
|
137
|
+
stack.push(normalized);
|
|
138
|
+
index = stack.length - 1;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
stack = stack.slice(0, index + 1);
|
|
142
|
+
stack.push(normalized);
|
|
143
|
+
index = stack.length - 1;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
({ stack, index } = trimStack(stack, index));
|
|
147
|
+
writeStored(stack, index);
|
|
148
|
+
};
|
|
149
|
+
const restoreHistory = () => {
|
|
150
|
+
if (!featureActive || isRestoring) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const stored = readStored();
|
|
154
|
+
if (stored.stack.length === 0) {
|
|
155
|
+
ensureCurrentTracked();
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const targetIndex = stored.index >= 0 && stored.index < stored.stack.length ? stored.index : stored.stack.length - 1;
|
|
159
|
+
const normalizedCurrent = normalize();
|
|
160
|
+
if (stored.stack.length === 1 && normalizedCurrent === stored.stack[0]) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const firstEntry = stored.stack[0];
|
|
164
|
+
if (!firstEntry) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
isRestoring = true;
|
|
168
|
+
try {
|
|
169
|
+
history.replaceState(history.state, document.title, firstEntry);
|
|
170
|
+
for (let i = 1; i < stored.stack.length; i += 1) {
|
|
171
|
+
history.pushState(history.state, document.title, stored.stack[i]);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
catch (err) {
|
|
175
|
+
isRestoring = false;
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
isRestoring = false;
|
|
179
|
+
const currentIndex = stored.stack.length - 1;
|
|
180
|
+
const offset = targetIndex - currentIndex;
|
|
181
|
+
if (offset !== 0) {
|
|
182
|
+
history.go(offset);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
history.replaceState(history.state, document.title, stored.stack[targetIndex]);
|
|
186
|
+
window.dispatchEvent(new PopStateEvent('popstate'));
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
const scheduleRestore = () => {
|
|
190
|
+
if (!featureActive || restoreScheduled) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
restoreScheduled = true;
|
|
194
|
+
runWhenReady(() => {
|
|
195
|
+
restoreScheduled = false;
|
|
196
|
+
restoreHistory();
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
let originalPushState = null;
|
|
200
|
+
let originalReplaceState = null;
|
|
201
|
+
const popstateHandler = () => {
|
|
202
|
+
if (!featureActive || isRestoring) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const normalized = normalize();
|
|
206
|
+
if (!normalized) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const stored = readStored();
|
|
210
|
+
const idx = stored.stack.lastIndexOf(normalized);
|
|
211
|
+
if (idx >= 0) {
|
|
212
|
+
stored.index = idx;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
stored.stack.push(normalized);
|
|
216
|
+
stored.index = stored.stack.length - 1;
|
|
217
|
+
}
|
|
218
|
+
const trimmed = trimStack(stored.stack, stored.index);
|
|
219
|
+
writeStored(trimmed.stack, trimmed.index);
|
|
220
|
+
};
|
|
221
|
+
const patchHistory = () => {
|
|
222
|
+
if (originalPushState && originalReplaceState) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
originalPushState = history.pushState;
|
|
226
|
+
originalReplaceState = history.replaceState;
|
|
227
|
+
history.pushState = function pushStatePatched(state, title, url) {
|
|
228
|
+
const result = originalPushState.call(history, state, title, url);
|
|
229
|
+
record(url, false);
|
|
230
|
+
return result;
|
|
231
|
+
};
|
|
232
|
+
history.replaceState = function replaceStatePatched(state, title, url) {
|
|
233
|
+
const result = originalReplaceState.call(history, state, title, url);
|
|
234
|
+
record(url, true);
|
|
235
|
+
return result;
|
|
236
|
+
};
|
|
237
|
+
window.addEventListener('popstate', popstateHandler);
|
|
238
|
+
};
|
|
239
|
+
const unpatchHistory = () => {
|
|
240
|
+
if (originalPushState) {
|
|
241
|
+
history.pushState = originalPushState;
|
|
242
|
+
originalPushState = null;
|
|
243
|
+
}
|
|
244
|
+
if (originalReplaceState) {
|
|
245
|
+
history.replaceState = originalReplaceState;
|
|
246
|
+
originalReplaceState = null;
|
|
247
|
+
}
|
|
248
|
+
window.removeEventListener('popstate', popstateHandler);
|
|
249
|
+
};
|
|
250
|
+
const setFeatureActive = (enabled) => {
|
|
251
|
+
if (featureActive === enabled) {
|
|
252
|
+
if (featureActive) {
|
|
253
|
+
ensureCurrentTracked();
|
|
254
|
+
scheduleRestore();
|
|
255
|
+
}
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
featureActive = enabled;
|
|
259
|
+
if (featureActive) {
|
|
260
|
+
patchHistory();
|
|
261
|
+
ensureCurrentTracked();
|
|
262
|
+
scheduleRestore();
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
unpatchHistory();
|
|
266
|
+
clearStored();
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
window.addEventListener('CapacitorUpdaterKeepUrlPathAfterReload', (event) => {
|
|
270
|
+
var _a;
|
|
271
|
+
const evt = event;
|
|
272
|
+
const enabled = (_a = evt === null || evt === void 0 ? void 0 : evt.detail) === null || _a === void 0 ? void 0 : _a.enabled;
|
|
273
|
+
if (typeof enabled === 'boolean') {
|
|
274
|
+
win.__capgoKeepUrlPathAfterReload = enabled;
|
|
275
|
+
setFeatureActive(enabled);
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
win.__capgoKeepUrlPathAfterReload = true;
|
|
279
|
+
setFeatureActive(true);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
setFeatureActive(isFeatureConfigured());
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
4
286
|
/*
|
|
5
287
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
6
288
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
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 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,EAA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Q,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAAC;IACjD,QAAQ;IACR,IAAI;IACJ,IAAI,MAAM,qBAAqB,GAAG;IAClC,QAAQ,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC;IAC3D,QAAQ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE;IACnC,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;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;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/history.js","esm/index.js","esm/web.js"],"sourcesContent":["/*\n * Maintains navigation history across Capgo-controlled reloads when keepUrlPathAfterReload is enabled.\n */\nconst KEEP_FLAG_KEY = '__capgo_keep_url_path_after_reload';\nconst HISTORY_STORAGE_KEY = '__capgo_history_stack__';\nconst MAX_STACK_ENTRIES = 100;\nconst isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof history !== 'undefined';\nif (isBrowser) {\n const win = window;\n if (!win.__capgoHistoryPatched) {\n win.__capgoHistoryPatched = true;\n const isFeatureConfigured = () => {\n try {\n if (win.__capgoKeepUrlPathAfterReload) {\n return true;\n }\n }\n catch (err) {\n // ignore access issues\n }\n try {\n return window.localStorage.getItem(KEEP_FLAG_KEY) === '1';\n }\n catch (err) {\n return false;\n }\n };\n const readStored = () => {\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);\n if (!parsed || !Array.isArray(parsed.stack) || typeof parsed.index !== 'number') {\n return { stack: [], index: -1 };\n }\n return parsed;\n }\n catch (err) {\n return { stack: [], index: -1 };\n }\n };\n const writeStored = (stack, index) => {\n try {\n window.sessionStorage.setItem(HISTORY_STORAGE_KEY, JSON.stringify({ stack, index }));\n }\n catch (err) {\n // Storage might be unavailable; fail silently.\n }\n };\n const clearStored = () => {\n try {\n window.sessionStorage.removeItem(HISTORY_STORAGE_KEY);\n }\n catch (err) {\n // ignore\n }\n };\n const normalize = (url) => {\n try {\n const base = url !== null && url !== void 0 ? 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 }\n catch (err) {\n return null;\n }\n };\n const trimStack = (stack, index) => {\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 const runWhenReady = (fn) => {\n if (document.readyState === 'complete' || document.readyState === 'interactive') {\n fn();\n }\n else {\n window.addEventListener('DOMContentLoaded', fn, { once: true });\n }\n };\n let featureActive = false;\n let isRestoring = false;\n let restoreScheduled = false;\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 const record = (url, replace) => {\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 }\n else if (replace) {\n if (index < 0 || index >= stack.length) {\n index = stack.length - 1;\n }\n stack[index] = normalized;\n }\n else {\n if (index >= stack.length - 1) {\n stack.push(normalized);\n index = stack.length - 1;\n }\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 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 = 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 }\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 }\n else {\n history.replaceState(history.state, document.title, stored.stack[targetIndex]);\n window.dispatchEvent(new PopStateEvent('popstate'));\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 let originalPushState = null;\n let originalReplaceState = null;\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 }\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 const patchHistory = () => {\n if (originalPushState && originalReplaceState) {\n return;\n }\n originalPushState = history.pushState;\n originalReplaceState = history.replaceState;\n history.pushState = function pushStatePatched(state, title, url) {\n const result = originalPushState.call(history, state, title, url);\n record(url, false);\n return result;\n };\n history.replaceState = function replaceStatePatched(state, title, url) {\n const result = originalReplaceState.call(history, state, title, url);\n record(url, true);\n return result;\n };\n window.addEventListener('popstate', popstateHandler);\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 const setFeatureActive = (enabled) => {\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 }\n else {\n unpatchHistory();\n clearStored();\n }\n };\n window.addEventListener('CapacitorUpdaterKeepUrlPathAfterReload', (event) => {\n var _a;\n const evt = event;\n const enabled = (_a = evt === null || evt === void 0 ? void 0 : evt.detail) === null || _a === void 0 ? void 0 : _a.enabled;\n if (typeof enabled === 'boolean') {\n win.__capgoKeepUrlPathAfterReload = enabled;\n setFeatureActive(enabled);\n }\n else {\n win.__capgoKeepUrlPathAfterReload = true;\n setFeatureActive(true);\n }\n });\n setFeatureActive(isFeatureConfigured());\n }\n}\nexport {};\n//# sourceMappingURL=history.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 { registerPlugin } from '@capacitor/core';\nimport './history';\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,MAAM,aAAa,GAAG,oC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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;;;;;;;;;;;;;;;"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import Foundation
|
|
8
8
|
import Capacitor
|
|
9
9
|
import UIKit
|
|
10
|
+
import WebKit
|
|
10
11
|
import Version
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -51,10 +52,11 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
51
52
|
CAPPluginMethod(name: "isShakeMenuEnabled", returnType: CAPPluginReturnPromise)
|
|
52
53
|
]
|
|
53
54
|
public var implementation = CapgoUpdater()
|
|
54
|
-
private let PLUGIN_VERSION: String = "7.20.
|
|
55
|
+
private let PLUGIN_VERSION: String = "7.20.1"
|
|
55
56
|
static let updateUrlDefault = "https://plugin.capgo.app/updates"
|
|
56
57
|
static let statsUrlDefault = "https://plugin.capgo.app/stats"
|
|
57
58
|
static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
|
|
59
|
+
private let keepUrlPathFlagKey = "__capgo_keep_url_path_after_reload"
|
|
58
60
|
private let customIdDefaultsKey = "CapacitorUpdater.customId"
|
|
59
61
|
private let updateUrlDefaultsKey = "CapacitorUpdater.updateUrl"
|
|
60
62
|
private let statsUrlDefaultsKey = "CapacitorUpdater.statsUrl"
|
|
@@ -86,6 +88,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
86
88
|
private var periodCheckDelay = 0
|
|
87
89
|
private var persistCustomId = false
|
|
88
90
|
private var persistModifyUrl = false
|
|
91
|
+
private var keepUrlPathFlagLastValue: Bool?
|
|
89
92
|
public var shakeMenuEnabled = false
|
|
90
93
|
let semaphoreReady = DispatchSemaphore(value: 0)
|
|
91
94
|
|
|
@@ -135,6 +138,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
135
138
|
autoDeleteFailed = getConfig().getBoolean("autoDeleteFailed", true)
|
|
136
139
|
autoDeletePrevious = getConfig().getBoolean("autoDeletePrevious", true)
|
|
137
140
|
keepUrlPathAfterReload = getConfig().getBoolean("keepUrlPathAfterReload", false)
|
|
141
|
+
syncKeepUrlPathFlag(enabled: keepUrlPathAfterReload)
|
|
138
142
|
|
|
139
143
|
// Handle directUpdate configuration - support string values and backward compatibility
|
|
140
144
|
if let directUpdateString = getConfig().getString("directUpdate") {
|
|
@@ -232,8 +236,31 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
232
236
|
self.checkForUpdateAfterDelay()
|
|
233
237
|
}
|
|
234
238
|
|
|
239
|
+
private func syncKeepUrlPathFlag(enabled: Bool) {
|
|
240
|
+
let script: String
|
|
241
|
+
if enabled {
|
|
242
|
+
script = "(function(){ try { localStorage.setItem('\(keepUrlPathFlagKey)', '1'); } catch (err) {} window.__capgoKeepUrlPathAfterReload = true; var evt; try { evt = new CustomEvent('CapacitorUpdaterKeepUrlPathAfterReload', { detail: { enabled: true } }); } catch (e) { evt = document.createEvent('CustomEvent'); evt.initCustomEvent('CapacitorUpdaterKeepUrlPathAfterReload', false, false, { enabled: true }); } window.dispatchEvent(evt); })();"
|
|
243
|
+
} else {
|
|
244
|
+
script = "(function(){ try { localStorage.removeItem('\(keepUrlPathFlagKey)'); } catch (err) {} delete window.__capgoKeepUrlPathAfterReload; var evt; try { evt = new CustomEvent('CapacitorUpdaterKeepUrlPathAfterReload', { detail: { enabled: false } }); } catch (e) { evt = document.createEvent('CustomEvent'); evt.initCustomEvent('CapacitorUpdaterKeepUrlPathAfterReload', false, false, { enabled: false }); } window.dispatchEvent(evt); })();"
|
|
245
|
+
}
|
|
246
|
+
DispatchQueue.main.async { [weak self] in
|
|
247
|
+
guard let self = self, let webView = self.bridge?.webView else {
|
|
248
|
+
return
|
|
249
|
+
}
|
|
250
|
+
if self.keepUrlPathFlagLastValue != enabled {
|
|
251
|
+
let userScript = WKUserScript(source: script, injectionTime: .atDocumentStart, forMainFrameOnly: true)
|
|
252
|
+
webView.configuration.userContentController.addUserScript(userScript)
|
|
253
|
+
self.keepUrlPathFlagLastValue = enabled
|
|
254
|
+
}
|
|
255
|
+
webView.evaluateJavaScript(script, completionHandler: nil)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
235
259
|
private func initialLoad() -> Bool {
|
|
236
260
|
guard let bridge = self.bridge else { return false }
|
|
261
|
+
if keepUrlPathAfterReload {
|
|
262
|
+
syncKeepUrlPathFlag(enabled: true)
|
|
263
|
+
}
|
|
237
264
|
|
|
238
265
|
let id = self.implementation.getCurrentBundleId()
|
|
239
266
|
var dest: URL
|