native-update 4.4.4 โ 4.4.6
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/AI-INTEGRATION-GUIDE.md +1 -1
- package/README.md +16 -2
- package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +18 -1
- package/dist/esm/core/update-check.d.ts +1 -1
- package/dist/esm/core/update-check.js +1 -1
- package/dist/esm/definitions.d.ts +13 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.js +2 -2
- package/docs/CHANGELOG.md +18 -0
- package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +8 -1
- package/package.json +1 -1
package/AI-INTEGRATION-GUIDE.md
CHANGED
|
@@ -107,7 +107,7 @@ if (eligibility.canRequest) {
|
|
|
107
107
|
|--------|-------------|---------|
|
|
108
108
|
| `sync(options?)` | Check and apply updates | `Promise<SyncResult>` |
|
|
109
109
|
| `download(options)` | Download specific version | `Promise<BundleInfo>` |
|
|
110
|
-
| `set(bundle)` |
|
|
110
|
+
| `set({ ...bundle, applyOn? })` | Make a bundle the app's bundle: `'now'` (default) switches at once, `'next-start'` (4.4.5+) stages it for the next cold start | `Promise<void>` |
|
|
111
111
|
| `reload()` | Reload app with current bundle | `Promise<void>` |
|
|
112
112
|
| `reset()` | Reset to original bundle | `Promise<void>` |
|
|
113
113
|
| `current()` | Get current bundle info | `Promise<BundleInfo>` |
|
package/README.md
CHANGED
|
@@ -16,6 +16,16 @@
|
|
|
16
16
|
|
|
17
17
|
</div>
|
|
18
18
|
|
|
19
|
+
<a id="available-on"></a>
|
|
20
|
+
## ๐ฆ Available on [#](#available-on)
|
|
21
|
+
|
|
22
|
+
| Where | Link |
|
|
23
|
+
|---|---|
|
|
24
|
+
| npm | [`native-update`](https://www.npmjs.com/package/native-update) |
|
|
25
|
+
| Dashboard | [nativeupdate.aoneahsan.com](https://nativeupdate.aoneahsan.com) |
|
|
26
|
+
| Docs | [nativeupdate-docs.aoneahsan.com](https://nativeupdate-docs.aoneahsan.com) |
|
|
27
|
+
| Everything | [All apps](https://nativeupdate-docs.aoneahsan.com/apps) |
|
|
28
|
+
|
|
19
29
|
> [!IMPORTANT]
|
|
20
30
|
> Call `NativeUpdate.notifyAppReady()` on **every** successful boot. Activating a bundle marks it
|
|
21
31
|
> pending-verification, and the native layer rolls it back after two cold starts that never confirm. Miss
|
|
@@ -28,7 +38,7 @@ are available as an HTTP API for CI and coding agents.
|
|
|
28
38
|
|
|
29
39
|
| | |
|
|
30
40
|
|---|---|
|
|
31
|
-
| **Version** | `4.4.
|
|
41
|
+
| **Version** | `4.4.6` |
|
|
32
42
|
| **License** | Proprietary โ free to use in your apps ([LICENSE](./LICENSE)) |
|
|
33
43
|
| **Node** | `>=24.16.0` (install + CLI toolchain) |
|
|
34
44
|
| **Platforms** | iOS 14+ ยท Android 8.0+ (API 26) ยท Web |
|
|
@@ -39,6 +49,7 @@ are available as an HTTP API for CI and coding agents.
|
|
|
39
49
|
<a id="table-of-contents"></a>
|
|
40
50
|
## ๐งญ Table of Contents [#](#table-of-contents)
|
|
41
51
|
|
|
52
|
+
- [๐ฆ Available on](#available-on)
|
|
42
53
|
- [๐ก Why native-update](#why-native-update)
|
|
43
54
|
- [โจ Features](#features)
|
|
44
55
|
- [๐ฑ Platform Support](#platform-support)
|
|
@@ -217,6 +228,9 @@ if (latest.available && latest.url && latest.version && latest.checksum) {
|
|
|
217
228
|
}
|
|
218
229
|
```
|
|
219
230
|
|
|
231
|
+
To leave the running app alone, stage the bundle instead: `await NativeUpdate.set({ ...bundle, applyOn: 'next-start' })`
|
|
232
|
+
loads it at the next cold start, where `notifyAppReady()` confirms it.
|
|
233
|
+
|
|
220
234
|
### Handle a store update
|
|
221
235
|
|
|
222
236
|
```ts
|
|
@@ -521,7 +535,7 @@ indexed at [`/raw/manifest.json`](https://nativeupdate-docs.aoneahsan.com/raw/ma
|
|
|
521
535
|
<a id="changelog"></a>
|
|
522
536
|
## ๐ Changelog [#](#changelog)
|
|
523
537
|
|
|
524
|
-
Latest release: **`4.4.4
|
|
538
|
+
Latest release: **`4.4.6`** (README: every released place; no code changes). 4.4.5: `set()` takes `applyOn: 'next-start'`, which stages a bundle for the next cold start instead of reloading the running app. Before that, 4.4.4: `--ota-tag` reads `versionName` only from a real statement in `build.gradle`
|
|
525
539
|
(comments and message strings are skipped, `versionName appVersionName` is followed to its value). **`4.4.3`**: Android logs `Built <id> from a N-byte patch` when an update arrives as a `NUDELTA/1`
|
|
526
540
|
patch, so you can see deltas working on a device. No API change.
|
|
527
541
|
|
|
@@ -61,7 +61,7 @@ class LiveUpdatePlugin(
|
|
|
61
61
|
|
|
62
62
|
companion object {
|
|
63
63
|
/** This plugin's version, sent as X-Sdk-Version. Kept equal to package.json by tests/sdk-version.test.ts. */
|
|
64
|
-
const val SDK_VERSION = "4.4.
|
|
64
|
+
const val SDK_VERSION = "4.4.6"
|
|
65
65
|
|
|
66
66
|
// SharedPreferences keys. Kept as constants so A2 (boot-time
|
|
67
67
|
// re-verification) and A3 (crash-loop auto-rollback) stay in sync
|
|
@@ -307,6 +307,14 @@ class LiveUpdatePlugin(
|
|
|
307
307
|
|
|
308
308
|
setActiveBundle(bundleId)
|
|
309
309
|
persistWebViewBasePath(extractedPath)
|
|
310
|
+
if (call.getString("applyOn") == "next-start") {
|
|
311
|
+
// Staged: Capacitor reads the persisted path at the next cold start. The running WebView is
|
|
312
|
+
// untouched, and this process's notifyAppReady() must not confirm a bundle that has not run.
|
|
313
|
+
stagedForNextStart = bundleId
|
|
314
|
+
call.resolve()
|
|
315
|
+
return
|
|
316
|
+
}
|
|
317
|
+
stagedForNextStart = null
|
|
310
318
|
// Hop to UI thread; setServerBasePath must run on the WebView's
|
|
311
319
|
// thread per Capacitor's Bridge contract.
|
|
312
320
|
activity.runOnUiThread {
|
|
@@ -891,6 +899,10 @@ class LiveUpdatePlugin(
|
|
|
891
899
|
prefs.edit().putString(bundleId, bundleInfo.toString()).apply()
|
|
892
900
|
}
|
|
893
901
|
|
|
902
|
+
/** A bundle set with applyOn "next-start" in this process; it runs from the next cold start. */
|
|
903
|
+
@Volatile
|
|
904
|
+
private var stagedForNextStart: String? = null
|
|
905
|
+
|
|
894
906
|
private fun setActiveBundle(bundleId: String) {
|
|
895
907
|
val prefs = context.getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE)
|
|
896
908
|
val currentActive = prefs.getString(ACTIVE_BUNDLE_KEY, null)
|
|
@@ -1047,6 +1059,11 @@ class LiveUpdatePlugin(
|
|
|
1047
1059
|
// signal. Clear the pending-verify state so cold starts after this
|
|
1048
1060
|
// no longer count against the bundle.
|
|
1049
1061
|
val prefs = context.getSharedPreferences(PREF_FILE, Context.MODE_PRIVATE)
|
|
1062
|
+
val staged = stagedForNextStart
|
|
1063
|
+
if (staged != null && prefs.getString(PENDING_BUNDLE_KEY, null) == staged) {
|
|
1064
|
+
// The bundle waiting for the next start has not run yet; only its own boot may confirm it.
|
|
1065
|
+
return
|
|
1066
|
+
}
|
|
1050
1067
|
prefs.edit()
|
|
1051
1068
|
.putBoolean("current_bundle_verified", true)
|
|
1052
1069
|
.remove(PENDING_BUNDLE_KEY)
|
|
@@ -60,7 +60,7 @@ import type { AppIdentity } from '../types/app-identity';
|
|
|
60
60
|
* This plugin's version, sent as `X-Sdk-Version`. Kept equal to package.json (and to the Kotlin and Swift
|
|
61
61
|
* constants) by tests/sdk-version.test.ts.
|
|
62
62
|
*/
|
|
63
|
-
export declare const SDK_VERSION = "4.4.
|
|
63
|
+
export declare const SDK_VERSION = "4.4.6";
|
|
64
64
|
/** Request inputs for a single backend update check. */
|
|
65
65
|
export interface UpdateCheckRequest {
|
|
66
66
|
/** API key issued by the dashboard; sent as `X-API-Key`. Required. */
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
* This plugin's version, sent as `X-Sdk-Version`. Kept equal to package.json (and to the Kotlin and Swift
|
|
60
60
|
* constants) by tests/sdk-version.test.ts.
|
|
61
61
|
*/
|
|
62
|
-
export const SDK_VERSION = '4.4.
|
|
62
|
+
export const SDK_VERSION = '4.4.6';
|
|
63
63
|
/**
|
|
64
64
|
* Perform one update check against the Native Update backend.
|
|
65
65
|
*
|
|
@@ -13,9 +13,13 @@ export interface LiveUpdatePlugin {
|
|
|
13
13
|
*/
|
|
14
14
|
download(options: DownloadOptions): Promise<BundleInfo>;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Make a downloaded, verified bundle the app's bundle.
|
|
17
|
+
*
|
|
18
|
+
* `applyOn: 'now'` (the default) switches the WebView to it at once. `applyOn: 'next-start'` stages it: the
|
|
19
|
+
* running app is untouched and the bundle loads at the next cold start, where `notifyAppReady()` confirms it
|
|
20
|
+
* (two unconfirmed starts roll it back). Stage when a reload mid-task would lose the user's work.
|
|
17
21
|
*/
|
|
18
|
-
set(bundle:
|
|
22
|
+
set(bundle: SetBundleOptions): Promise<void>;
|
|
19
23
|
/**
|
|
20
24
|
* Reload the app with current bundle
|
|
21
25
|
*/
|
|
@@ -344,6 +348,13 @@ export interface BundleInfo {
|
|
|
344
348
|
verified: boolean;
|
|
345
349
|
metadata?: Record<string, unknown>;
|
|
346
350
|
}
|
|
351
|
+
/** When a bundle passed to `set()` becomes the running app. */
|
|
352
|
+
export type ApplyOn = 'now' | 'next-start';
|
|
353
|
+
/** A bundle from `download()`/`downloadUpdate()`, plus when to switch to it. */
|
|
354
|
+
export interface SetBundleOptions extends BundleInfo {
|
|
355
|
+
/** Default `'now'`. */
|
|
356
|
+
applyOn?: ApplyOn;
|
|
357
|
+
}
|
|
347
358
|
export interface DeleteOptions {
|
|
348
359
|
bundleId?: string;
|
|
349
360
|
keepVersions?: number;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { NativeUpdate } from './plugin';
|
|
2
2
|
export { BackgroundUpdateType, NotificationPriority, UpdateStrategy, UpdateMode, InstallMode, ChecksumAlgorithm, SyncStatus, BundleStatus, InstallStatus, UpdateErrorCode, } from './definitions';
|
|
3
|
-
export type { NativeUpdatePlugin, NativeUpdateCombinedPlugin, NativeUpdateListeners, LiveUpdatePlugin, AppUpdatePlugin, AppReviewPlugin, PluginConfig, UpdateConfig, LiveUpdateConfig, AppUpdateConfig, AppReviewConfig, BundleInfo, DownloadOptions, DownloadProgressEvent, SyncOptions, SyncResult, DeleteOptions, LatestVersion, ValidateOptions, ValidationResult, CheckForUpdateResult, DownloadUpdateOptions, AppIdentity, AppUpdateInfo, OpenAppStoreOptions, ReviewResult, CanRequestReviewResult, UpdateStateChangedEvent, AppUpdateStateChangedEvent, AppUpdateProgressEvent, AppUpdateAvailableEvent, AppUpdateReadyEvent, AppUpdateFailedEvent, AppUpdateNotificationClickedEvent, AppUpdateInstallClickedEvent, BackgroundUpdateProgressEvent, BackgroundUpdateNotificationEvent, UpdateError, BackgroundUpdatePlugin, BackgroundUpdateConfig, BackgroundUpdateStatus, BackgroundCheckResult, NotificationPreferences, NotificationPermissionStatus, SecurityConfig, SecurityInfo, CertificatePinning, CertificatePin, PluginInitConfig, PluginListenerHandle, } from './definitions';
|
|
3
|
+
export type { NativeUpdatePlugin, NativeUpdateCombinedPlugin, NativeUpdateListeners, LiveUpdatePlugin, AppUpdatePlugin, AppReviewPlugin, PluginConfig, UpdateConfig, LiveUpdateConfig, AppUpdateConfig, AppReviewConfig, BundleInfo, SetBundleOptions, ApplyOn, DownloadOptions, DownloadProgressEvent, SyncOptions, SyncResult, DeleteOptions, LatestVersion, ValidateOptions, ValidationResult, CheckForUpdateResult, DownloadUpdateOptions, AppIdentity, AppUpdateInfo, OpenAppStoreOptions, ReviewResult, CanRequestReviewResult, UpdateStateChangedEvent, AppUpdateStateChangedEvent, AppUpdateProgressEvent, AppUpdateAvailableEvent, AppUpdateReadyEvent, AppUpdateFailedEvent, AppUpdateNotificationClickedEvent, AppUpdateInstallClickedEvent, BackgroundUpdateProgressEvent, BackgroundUpdateNotificationEvent, UpdateError, BackgroundUpdatePlugin, BackgroundUpdateConfig, BackgroundUpdateStatus, BackgroundCheckResult, NotificationPreferences, NotificationPermissionStatus, SecurityConfig, SecurityInfo, CertificatePinning, CertificatePin, PluginInitConfig, PluginListenerHandle, } from './definitions';
|
|
4
4
|
export type { RolloutConfig, RolloutTargetSegments, RolloutSchedule, RolloutTimestamp, DeviceInfo, UpdateCheckResponse, } from './types/rollout';
|
|
5
5
|
export { ErrorCode, NativeUpdateError, ConfigurationError, DownloadError, ValidationError, StorageError, UpdateError as UpdateErrorClass, } from './core/errors';
|
|
6
6
|
export { ConfigManager } from './core/config';
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import type { NativeUpdateCombinedPlugin, SecurityInfo, SyncOptions, SyncResult, DownloadOptions, BundleInfo, DeleteOptions, LatestVersion, ValidateOptions, ValidationResult, AppUpdateInfo, OpenAppStoreOptions, ReviewResult, CanRequestReviewResult, BackgroundUpdateConfig, BackgroundUpdateStatus, BackgroundCheckResult, NotificationPreferences, NotificationPermissionStatus, CheckForUpdateResult, DownloadUpdateOptions, AppIdentity } from './definitions';
|
|
2
|
+
import type { NativeUpdateCombinedPlugin, SecurityInfo, SyncOptions, SyncResult, DownloadOptions, BundleInfo, SetBundleOptions, DeleteOptions, LatestVersion, ValidateOptions, ValidationResult, AppUpdateInfo, OpenAppStoreOptions, ReviewResult, CanRequestReviewResult, BackgroundUpdateConfig, BackgroundUpdateStatus, BackgroundCheckResult, NotificationPreferences, NotificationPermissionStatus, CheckForUpdateResult, DownloadUpdateOptions, AppIdentity } from './definitions';
|
|
3
3
|
import type { PluginInitConfig } from './definitions';
|
|
4
4
|
export declare class NativeUpdateWeb extends WebPlugin implements NativeUpdateCombinedPlugin {
|
|
5
5
|
private config;
|
|
@@ -25,7 +25,7 @@ export declare class NativeUpdateWeb extends WebPlugin implements NativeUpdateCo
|
|
|
25
25
|
*/
|
|
26
26
|
sync(_options?: SyncOptions): Promise<SyncResult>;
|
|
27
27
|
download(options: DownloadOptions): Promise<BundleInfo>;
|
|
28
|
-
set(bundle:
|
|
28
|
+
set(bundle: SetBundleOptions): Promise<void>;
|
|
29
29
|
reload(): Promise<void>;
|
|
30
30
|
reset(): Promise<void>;
|
|
31
31
|
current(): Promise<BundleInfo>;
|