@capgo/capacitor-updater 7.20.1 → 7.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -14
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +155 -30
- package/android/src/main/java/ee/forgr/capacitor_updater/CapgoUpdater.java +61 -47
- package/dist/docs.json +146 -2
- package/dist/esm/definitions.d.ts +50 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +3 -1
- package/dist/esm/web.js +8 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +8 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +8 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/CapacitorUpdaterPlugin/CapacitorUpdaterPlugin.swift +116 -15
- package/ios/Sources/CapacitorUpdaterPlugin/CapgoUpdater.swift +3 -0
- package/ios/Sources/CapacitorUpdaterPlugin/InternalUtils.swift +2 -0
- package/package.json +1 -1
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,CA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m/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 setBundleError(options) {\n console.warn('Cannot setBundleError in web', options);\n return BUNDLE_BUILTIN;\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 getFailedUpdate() {\n console.warn('Cannot getFailedUpdate in web');\n return 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,mBAAmB,GAAG,MAAM;AAC1C,YAAY,IAAI;AAChB,gBAAgB,IAAI,GAAG,CAAC,6BAA6B,EAAE;AACvD,oBAAoB,OAAO,IAAI;AAC/B,gBAAgB;AAChB,YAAY;AACZ,YAAY,OAAO,GAAG,EAAE;AACxB;AACA,YAAY;AACZ,YAAY,IAAI;AAChB,gBAAgB,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,GAAG;AACzE,YAAY;AACZ,YAAY,OAAO,GAAG,EAAE;AACxB,gBAAgB,OAAO,KAAK;AAC5B,YAAY;AACZ,QAAQ,CAAC;AACT,QAAQ,MAAM,UAAU,GAAG,MAAM;AACjC,YAAY,IAAI;AAChB,gBAAgB,MAAM,GAAG,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,mBAAmB,CAAC;AAC9E,gBAAgB,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OAAO,CAAC,IAAI,CAAC,kCAAkC,CAAC;AACxD,QAAQ,OAAO,cAAc;AAC7B,IAAI;AACJ,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;AACpC,IAAI;AACJ,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC;AACrD,QAAQ,OAAO,IAAI;AACnB,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;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -348,6 +348,10 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
348
348
|
async delete(options) {
|
|
349
349
|
console.warn('Cannot delete bundle in web', options);
|
|
350
350
|
}
|
|
351
|
+
async setBundleError(options) {
|
|
352
|
+
console.warn('Cannot setBundleError in web', options);
|
|
353
|
+
return BUNDLE_BUILTIN;
|
|
354
|
+
}
|
|
351
355
|
async list() {
|
|
352
356
|
console.warn('Cannot list bundles in web');
|
|
353
357
|
return { bundles: [] };
|
|
@@ -425,6 +429,10 @@ var capacitorCapacitorUpdater = (function (exports, core) {
|
|
|
425
429
|
async getNextBundle() {
|
|
426
430
|
return Promise.resolve(null);
|
|
427
431
|
}
|
|
432
|
+
async getFailedUpdate() {
|
|
433
|
+
console.warn('Cannot getFailedUpdate in web');
|
|
434
|
+
return null;
|
|
435
|
+
}
|
|
428
436
|
async setShakeMenu(_options) {
|
|
429
437
|
throw this.unimplemented('Shake menu not available on web platform');
|
|
430
438
|
}
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,oCAAoC;IAC1D,MAAM,mBAAmB,GAAG,yBAAyB;IACrD,MAAM,iBAAiB,GAAG,GAAG;IAC7B,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,OAAO,OAAO,KAAK,WAAW;IACpH,IAAI,SAAS,EAAE;IACf,IAAI,MAAM,GAAG,GAAG,MAAM;IACtB,IAAI,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE;IACpC,QAAQ,GAAG,CAAC,qBAAqB,GAAG,IAAI;IACxC,QAAQ,MAAM,mBAAmB,GAAG,MAAM;IAC1C,YAAY,IAAI;IAChB,gBAAgB,IAAI,GAAG,CAAC,6BAA6B,EAAE;IACvD,oBAAoB,OAAO,IAAI;IAC/B,gBAAgB;IAChB,YAAY;IACZ,YAAY,OAAO,GAAG,EAAE;IACxB;IACA,YAAY;IACZ,YAAY,IAAI;IAChB,gBAAgB,OAAO,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,GAAG;IACzE,YAAY;IACZ,YAAY,OAAO,GAAG,EAAE;IACxB,gBAAgB,O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AI;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 setBundleError(options) {\n console.warn('Cannot setBundleError in web', options);\n return BUNDLE_BUILTIN;\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 getFailedUpdate() {\n console.warn('Cannot getFailedUpdate in web');\n return 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,oCAAoC;IAC1D,MAAM,mBAAmB,GAAG,yBAAyB;IACrD,MAAM,iBAAiB,GAAG,GAAG;IAC7B,MAAM,SAAS,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M,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;;;;;;;;;;;;;;;"}
|
|
@@ -28,6 +28,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
28
28
|
CAPPluginMethod(name: "set", returnType: CAPPluginReturnPromise),
|
|
29
29
|
CAPPluginMethod(name: "list", returnType: CAPPluginReturnPromise),
|
|
30
30
|
CAPPluginMethod(name: "delete", returnType: CAPPluginReturnPromise),
|
|
31
|
+
CAPPluginMethod(name: "setBundleError", returnType: CAPPluginReturnPromise),
|
|
31
32
|
CAPPluginMethod(name: "reset", returnType: CAPPluginReturnPromise),
|
|
32
33
|
CAPPluginMethod(name: "current", returnType: CAPPluginReturnPromise),
|
|
33
34
|
CAPPluginMethod(name: "reload", returnType: CAPPluginReturnPromise),
|
|
@@ -48,11 +49,12 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
48
49
|
CAPPluginMethod(name: "getBuiltinVersion", returnType: CAPPluginReturnPromise),
|
|
49
50
|
CAPPluginMethod(name: "isAutoUpdateAvailable", returnType: CAPPluginReturnPromise),
|
|
50
51
|
CAPPluginMethod(name: "getNextBundle", returnType: CAPPluginReturnPromise),
|
|
52
|
+
CAPPluginMethod(name: "getFailedUpdate", returnType: CAPPluginReturnPromise),
|
|
51
53
|
CAPPluginMethod(name: "setShakeMenu", returnType: CAPPluginReturnPromise),
|
|
52
54
|
CAPPluginMethod(name: "isShakeMenuEnabled", returnType: CAPPluginReturnPromise)
|
|
53
55
|
]
|
|
54
56
|
public var implementation = CapgoUpdater()
|
|
55
|
-
private let PLUGIN_VERSION: String = "7.
|
|
57
|
+
private let PLUGIN_VERSION: String = "7.22.0"
|
|
56
58
|
static let updateUrlDefault = "https://plugin.capgo.app/updates"
|
|
57
59
|
static let statsUrlDefault = "https://plugin.capgo.app/stats"
|
|
58
60
|
static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
|
|
@@ -61,6 +63,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
61
63
|
private let updateUrlDefaultsKey = "CapacitorUpdater.updateUrl"
|
|
62
64
|
private let statsUrlDefaultsKey = "CapacitorUpdater.statsUrl"
|
|
63
65
|
private let channelUrlDefaultsKey = "CapacitorUpdater.channelUrl"
|
|
66
|
+
private let lastFailedBundleDefaultsKey = "CapacitorUpdater.lastFailedBundle"
|
|
64
67
|
// Note: DELAY_CONDITION_PREFERENCES is now defined in DelayUpdateUtils.DELAY_CONDITION_PREFERENCES
|
|
65
68
|
private var updateUrl = ""
|
|
66
69
|
private var backgroundTaskID: UIBackgroundTaskIdentifier = UIBackgroundTaskIdentifier.invalid
|
|
@@ -88,6 +91,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
88
91
|
private var periodCheckDelay = 0
|
|
89
92
|
private var persistCustomId = false
|
|
90
93
|
private var persistModifyUrl = false
|
|
94
|
+
private var allowManualBundleError = false
|
|
91
95
|
private var keepUrlPathFlagLastValue: Bool?
|
|
92
96
|
public var shakeMenuEnabled = false
|
|
93
97
|
let semaphoreReady = DispatchSemaphore(value: 0)
|
|
@@ -121,6 +125,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
121
125
|
}
|
|
122
126
|
}
|
|
123
127
|
persistModifyUrl = getConfig().getBoolean("persistModifyUrl", false)
|
|
128
|
+
allowManualBundleError = getConfig().getBoolean("allowManualBundleError", false)
|
|
124
129
|
logger.info("init for device \(self.implementation.deviceID)")
|
|
125
130
|
guard let versionName = getConfig().getString("version", Bundle.main.versionName) else {
|
|
126
131
|
logger.error("Cannot get version name")
|
|
@@ -256,6 +261,33 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
256
261
|
}
|
|
257
262
|
}
|
|
258
263
|
|
|
264
|
+
private func persistLastFailedBundle(_ bundle: BundleInfo?) {
|
|
265
|
+
if let bundle = bundle {
|
|
266
|
+
do {
|
|
267
|
+
try UserDefaults.standard.setObj(bundle, forKey: lastFailedBundleDefaultsKey)
|
|
268
|
+
} catch {
|
|
269
|
+
logger.error("Failed to persist failed bundle info \(error.localizedDescription)")
|
|
270
|
+
}
|
|
271
|
+
} else {
|
|
272
|
+
UserDefaults.standard.removeObject(forKey: lastFailedBundleDefaultsKey)
|
|
273
|
+
}
|
|
274
|
+
UserDefaults.standard.synchronize()
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
private func readLastFailedBundle() -> BundleInfo? {
|
|
278
|
+
do {
|
|
279
|
+
let bundle: BundleInfo = try UserDefaults.standard.getObj(forKey: lastFailedBundleDefaultsKey, castTo: BundleInfo.self)
|
|
280
|
+
return bundle
|
|
281
|
+
} catch ObjectSavableError.noValue {
|
|
282
|
+
return nil
|
|
283
|
+
} catch {
|
|
284
|
+
logger.error("Failed to read failed bundle info \(error.localizedDescription)")
|
|
285
|
+
UserDefaults.standard.removeObject(forKey: lastFailedBundleDefaultsKey)
|
|
286
|
+
UserDefaults.standard.synchronize()
|
|
287
|
+
return nil
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
259
291
|
private func initialLoad() -> Bool {
|
|
260
292
|
guard let bridge = self.bridge else { return false }
|
|
261
293
|
if keepUrlPathAfterReload {
|
|
@@ -487,34 +519,50 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
487
519
|
dest = self.implementation.getBundleDirectory(id: id)
|
|
488
520
|
}
|
|
489
521
|
logger.info("Reloading \(id)")
|
|
490
|
-
|
|
522
|
+
|
|
523
|
+
let performReload: () -> Bool = {
|
|
524
|
+
guard let vc = bridge.viewController as? CAPBridgeViewController else {
|
|
525
|
+
self.logger.error("Cannot get viewController")
|
|
526
|
+
return false
|
|
527
|
+
}
|
|
491
528
|
guard let capBridge = vc.bridge else {
|
|
492
|
-
logger.error("Cannot get capBridge")
|
|
529
|
+
self.logger.error("Cannot get capBridge")
|
|
493
530
|
return false
|
|
494
531
|
}
|
|
495
|
-
if keepUrlPathAfterReload {
|
|
496
|
-
|
|
497
|
-
guard let url = vc.webView?.url else {
|
|
498
|
-
self.logger.error("vc.webView?.url is null?")
|
|
499
|
-
return
|
|
500
|
-
}
|
|
532
|
+
if self.keepUrlPathAfterReload {
|
|
533
|
+
if let currentURL = vc.webView?.url {
|
|
501
534
|
capBridge.setServerBasePath(dest.path)
|
|
502
535
|
var urlComponents = URLComponents(url: capBridge.config.serverURL, resolvingAgainstBaseURL: false)!
|
|
503
|
-
urlComponents.path =
|
|
536
|
+
urlComponents.path = currentURL.path
|
|
537
|
+
urlComponents.query = currentURL.query
|
|
538
|
+
urlComponents.fragment = currentURL.fragment
|
|
504
539
|
if let finalUrl = urlComponents.url {
|
|
505
540
|
_ = vc.webView?.load(URLRequest(url: finalUrl))
|
|
541
|
+
} else {
|
|
542
|
+
self.logger.error("Unable to build final URL when keeping path after reload; falling back to base path")
|
|
543
|
+
vc.setServerBasePath(path: dest.path)
|
|
506
544
|
}
|
|
545
|
+
} else {
|
|
546
|
+
self.logger.error("vc.webView?.url is null? Falling back to base path reload.")
|
|
547
|
+
vc.setServerBasePath(path: dest.path)
|
|
507
548
|
}
|
|
508
549
|
} else {
|
|
509
550
|
vc.setServerBasePath(path: dest.path)
|
|
510
|
-
|
|
511
551
|
}
|
|
512
|
-
|
|
513
552
|
self.checkAppReady()
|
|
514
553
|
self.notifyListeners("appReloaded", data: [:])
|
|
515
554
|
return true
|
|
516
555
|
}
|
|
517
|
-
|
|
556
|
+
|
|
557
|
+
if Thread.isMainThread {
|
|
558
|
+
return performReload()
|
|
559
|
+
} else {
|
|
560
|
+
var result = false
|
|
561
|
+
DispatchQueue.main.sync {
|
|
562
|
+
result = performReload()
|
|
563
|
+
}
|
|
564
|
+
return result
|
|
565
|
+
}
|
|
518
566
|
}
|
|
519
567
|
|
|
520
568
|
@objc func reload(_ call: CAPPluginCall) {
|
|
@@ -572,6 +620,36 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
572
620
|
}
|
|
573
621
|
}
|
|
574
622
|
|
|
623
|
+
@objc func setBundleError(_ call: CAPPluginCall) {
|
|
624
|
+
if !allowManualBundleError {
|
|
625
|
+
logger.error("setBundleError called without allowManualBundleError")
|
|
626
|
+
call.reject("setBundleError not allowed. Set allowManualBundleError to true in your config to enable it.")
|
|
627
|
+
return
|
|
628
|
+
}
|
|
629
|
+
guard let id = call.getString("id") else {
|
|
630
|
+
logger.error("setBundleError called without id")
|
|
631
|
+
call.reject("setBundleError called without id")
|
|
632
|
+
return
|
|
633
|
+
}
|
|
634
|
+
let bundle = implementation.getBundleInfo(id: id)
|
|
635
|
+
if bundle.isUnknown() {
|
|
636
|
+
logger.error("setBundleError called with unknown bundle \(id)")
|
|
637
|
+
call.reject("Bundle \(id) does not exist")
|
|
638
|
+
return
|
|
639
|
+
}
|
|
640
|
+
if bundle.isBuiltin() {
|
|
641
|
+
logger.error("setBundleError called on builtin bundle")
|
|
642
|
+
call.reject("Cannot set builtin bundle to error state")
|
|
643
|
+
return
|
|
644
|
+
}
|
|
645
|
+
if self._isAutoUpdateEnabled() {
|
|
646
|
+
logger.warn("setBundleError used while autoUpdate is enabled; this method is intended for manual mode")
|
|
647
|
+
}
|
|
648
|
+
implementation.setError(bundle: bundle)
|
|
649
|
+
let updated = implementation.getBundleInfo(id: id)
|
|
650
|
+
call.resolve(["bundle": updated.toJSON()])
|
|
651
|
+
}
|
|
652
|
+
|
|
575
653
|
@objc func list(_ call: CAPPluginCall) {
|
|
576
654
|
let raw = call.getBool("raw", false)
|
|
577
655
|
let res = implementation.list(raw: raw)
|
|
@@ -831,6 +909,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
831
909
|
self.notifyListeners("updateFailed", data: [
|
|
832
910
|
"bundle": current.toJSON()
|
|
833
911
|
])
|
|
912
|
+
self.persistLastFailedBundle(current)
|
|
834
913
|
self.implementation.sendStats(action: "update_fail", versionName: current.getVersionName())
|
|
835
914
|
self.implementation.setError(bundle: current)
|
|
836
915
|
_ = self._reset(toLastSuccessful: true)
|
|
@@ -1112,6 +1191,15 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
1112
1191
|
}
|
|
1113
1192
|
}
|
|
1114
1193
|
|
|
1194
|
+
private func notifyBreakingEvents(version: String) {
|
|
1195
|
+
guard !version.isEmpty else {
|
|
1196
|
+
return
|
|
1197
|
+
}
|
|
1198
|
+
let payload: [String: Any] = ["version": version]
|
|
1199
|
+
self.notifyListeners("breakingAvailable", data: payload)
|
|
1200
|
+
self.notifyListeners("majorAvailable", data: payload)
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1115
1203
|
func endBackGroundTaskWithNotif(
|
|
1116
1204
|
msg: String,
|
|
1117
1205
|
latestVersionName: String,
|
|
@@ -1171,8 +1259,8 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
1171
1259
|
|
|
1172
1260
|
if let message = res.message, !message.isEmpty {
|
|
1173
1261
|
self.logger.info("API message: \(message)")
|
|
1174
|
-
if res.major == true {
|
|
1175
|
-
self.
|
|
1262
|
+
if res.breaking == true || res.major == true {
|
|
1263
|
+
self.notifyBreakingEvents(version: res.version)
|
|
1176
1264
|
}
|
|
1177
1265
|
self.endBackGroundTaskWithNotif(
|
|
1178
1266
|
msg: message,
|
|
@@ -1437,6 +1525,19 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
1437
1525
|
call.resolve(bundle!.toJSON())
|
|
1438
1526
|
}
|
|
1439
1527
|
|
|
1528
|
+
@objc func getFailedUpdate(_ call: CAPPluginCall) {
|
|
1529
|
+
let bundle = self.readLastFailedBundle()
|
|
1530
|
+
if bundle == nil || bundle?.isUnknown() == true {
|
|
1531
|
+
call.resolve()
|
|
1532
|
+
return
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
self.persistLastFailedBundle(nil)
|
|
1536
|
+
call.resolve([
|
|
1537
|
+
"bundle": bundle!.toJSON()
|
|
1538
|
+
])
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1440
1541
|
@objc func setShakeMenu(_ call: CAPPluginCall) {
|
|
1441
1542
|
guard let enabled = call.getBool("enabled") else {
|
|
1442
1543
|
logger.error("setShakeMenu called without enabled parameter")
|
|
@@ -157,6 +157,7 @@ struct AppVersionDec: Decodable {
|
|
|
157
157
|
let error: String?
|
|
158
158
|
let session_key: String?
|
|
159
159
|
let major: Bool?
|
|
160
|
+
let breaking: Bool?
|
|
160
161
|
let data: [String: String]?
|
|
161
162
|
let manifest: [ManifestEntry]?
|
|
162
163
|
}
|
|
@@ -169,6 +170,7 @@ public class AppVersion: NSObject {
|
|
|
169
170
|
var error: String?
|
|
170
171
|
var sessionKey: String?
|
|
171
172
|
var major: Bool?
|
|
173
|
+
var breaking: Bool?
|
|
172
174
|
var data: [String: String]?
|
|
173
175
|
var manifest: [ManifestEntry]?
|
|
174
176
|
}
|