native-update 1.1.3 → 1.1.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/android/src/main/java/com/aoneahsan/nativeupdate/AppUpdatePlugin.kt +41 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +12 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/NativeUpdatePlugin.kt +52 -1
- package/backend-template/README.md +56 -0
- package/backend-template/package.json +20 -0
- package/backend-template/server.js +121 -0
- package/cli/index.js +22 -14
- package/dist/esm/core/event-emitter.d.ts +33 -0
- package/dist/esm/core/event-emitter.js +75 -0
- package/dist/esm/core/event-emitter.js.map +1 -0
- package/dist/esm/core/plugin-manager.d.ts +16 -0
- package/dist/esm/core/plugin-manager.js +50 -0
- package/dist/esm/core/plugin-manager.js.map +1 -1
- package/dist/esm/definitions.d.ts +59 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/plugin.js +43 -15
- package/dist/esm/plugin.js.map +1 -1
- package/dist/plugin.cjs.js +1 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/dist/plugin.js +2 -2
- package/dist/plugin.js.map +1 -1
- package/docs/NATIVE_UPDATES_GUIDE.md +1 -1
- package/docs/QUICK_START.md +1 -1
- package/docs/api/app-update-api.md +9 -1
- package/docs/api/background-update-api.md +157 -0
- package/docs/api/events-api.md +123 -0
- package/docs/api/live-update-api.md +16 -0
- package/docs/features/app-updates.md +4 -4
- package/docs/getting-started/quick-start.md +1 -1
- package/ios/Plugin/AppUpdate/AppUpdatePlugin.swift +15 -0
- package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +6 -0
- package/ios/Plugin/NativeUpdatePlugin.swift +45 -0
- package/package.json +24 -14
|
@@ -191,7 +191,7 @@ export class AndroidFlexibleUpdate {
|
|
|
191
191
|
|
|
192
192
|
// Listen for download progress
|
|
193
193
|
NativeUpdate.addListener(
|
|
194
|
-
'
|
|
194
|
+
'appUpdateProgress',
|
|
195
195
|
(progress) => {
|
|
196
196
|
console.log(
|
|
197
197
|
`Download progress: ${progress.bytesDownloaded} / ${progress.totalBytesToDownload}`
|
package/docs/QUICK_START.md
CHANGED
|
@@ -229,7 +229,7 @@ export class AndroidUpdateProgress {
|
|
|
229
229
|
|
|
230
230
|
// Track progress
|
|
231
231
|
NativeUpdate.addListener(
|
|
232
|
-
'
|
|
232
|
+
'appUpdateProgress',
|
|
233
233
|
(progress) => {
|
|
234
234
|
this.downloadProgress = Math.round(
|
|
235
235
|
(progress.bytesDownloaded / progress.totalBytesToDownload) * 100
|
|
@@ -73,7 +73,15 @@ await NativeUpdate.openAppStore({
|
|
|
73
73
|
|
|
74
74
|
## Events
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
App update events are available for monitoring the native app update process. See the [Events API Reference](./events-api.md#app-update-events) for complete documentation of the following events:
|
|
77
|
+
|
|
78
|
+
- `appUpdateStateChanged` - Fired when update state changes
|
|
79
|
+
- `appUpdateProgress` - Monitor download progress for flexible updates
|
|
80
|
+
- `appUpdateAvailable` - Notified when a new version is available
|
|
81
|
+
- `appUpdateReady` - Update downloaded and ready to install
|
|
82
|
+
- `appUpdateFailed` - Update process failed
|
|
83
|
+
- `appUpdateNotificationClicked` - User clicked update notification
|
|
84
|
+
- `appUpdateInstallClicked` - User clicked install in notification
|
|
77
85
|
|
|
78
86
|
## Platform Differences
|
|
79
87
|
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Background Update API Reference
|
|
2
|
+
|
|
3
|
+
Complete API documentation for background update functionality.
|
|
4
|
+
|
|
5
|
+
## Methods
|
|
6
|
+
|
|
7
|
+
### enableBackgroundUpdates(config)
|
|
8
|
+
|
|
9
|
+
Enable background update checking.
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
await NativeUpdate.enableBackgroundUpdates({
|
|
13
|
+
checkInterval: 3600000, // Check every hour (in ms)
|
|
14
|
+
requireWifi: true, // Only check on WiFi
|
|
15
|
+
requireCharging: false, // Don't require charging
|
|
16
|
+
updateTypes: ['live', 'native'], // Check both update types
|
|
17
|
+
notificationConfig: {
|
|
18
|
+
enabled: true,
|
|
19
|
+
title: 'Update Available',
|
|
20
|
+
autoCancel: true
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### disableBackgroundUpdates()
|
|
26
|
+
|
|
27
|
+
Disable all background update checks.
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
await NativeUpdate.disableBackgroundUpdates();
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### getBackgroundUpdateStatus()
|
|
34
|
+
|
|
35
|
+
Get current background update configuration and status.
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
const status = await NativeUpdate.getBackgroundUpdateStatus();
|
|
39
|
+
// Returns:
|
|
40
|
+
{
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
lastCheckTime?: number;
|
|
43
|
+
nextScheduledCheck?: number;
|
|
44
|
+
checkInterval?: number;
|
|
45
|
+
updateTypes: string[];
|
|
46
|
+
notificationEnabled: boolean;
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### scheduleBackgroundCheck(options)
|
|
51
|
+
|
|
52
|
+
Schedule a one-time background check.
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
await NativeUpdate.scheduleBackgroundCheck({
|
|
56
|
+
delay: 60000, // Check in 1 minute
|
|
57
|
+
type: 'live' // Check for live updates only
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### triggerBackgroundCheck()
|
|
62
|
+
|
|
63
|
+
Immediately trigger a background update check.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
const result = await NativeUpdate.triggerBackgroundCheck();
|
|
67
|
+
// Returns:
|
|
68
|
+
{
|
|
69
|
+
liveUpdateAvailable: boolean;
|
|
70
|
+
nativeUpdateAvailable: boolean;
|
|
71
|
+
error?: string;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### setNotificationPreferences(preferences)
|
|
76
|
+
|
|
77
|
+
Configure notification preferences for background updates.
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
await NativeUpdate.setNotificationPreferences({
|
|
81
|
+
enabled: true,
|
|
82
|
+
showProgress: true,
|
|
83
|
+
soundEnabled: false,
|
|
84
|
+
vibrationEnabled: true,
|
|
85
|
+
ledColor: '#00FF00',
|
|
86
|
+
importance: 'HIGH'
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### getNotificationPermissions()
|
|
91
|
+
|
|
92
|
+
Check current notification permissions.
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
const permissions = await NativeUpdate.getNotificationPermissions();
|
|
96
|
+
// Returns:
|
|
97
|
+
{
|
|
98
|
+
granted: boolean;
|
|
99
|
+
canRequestPermission: boolean;
|
|
100
|
+
permanentlyDenied: boolean;
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### requestNotificationPermissions()
|
|
105
|
+
|
|
106
|
+
Request notification permissions from the user.
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
const result = await NativeUpdate.requestNotificationPermissions();
|
|
110
|
+
// Returns:
|
|
111
|
+
{
|
|
112
|
+
granted: boolean;
|
|
113
|
+
permanentlyDenied: boolean;
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Events
|
|
118
|
+
|
|
119
|
+
### backgroundUpdateProgress
|
|
120
|
+
|
|
121
|
+
Fired during background update operations.
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
NativeUpdate.addListener('backgroundUpdateProgress', (event) => {
|
|
125
|
+
console.log('Background update:', event.status);
|
|
126
|
+
// event.type: 'live' | 'native'
|
|
127
|
+
// event.status: 'checking' | 'downloading' | 'completed' | 'failed'
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### backgroundUpdateNotification
|
|
132
|
+
|
|
133
|
+
Fired when background check finds an update.
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
NativeUpdate.addListener('backgroundUpdateNotification', (event) => {
|
|
137
|
+
console.log('Update available:', event.updateAvailable);
|
|
138
|
+
// event.type: 'live' | 'native'
|
|
139
|
+
// event.version: string
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Platform Notes
|
|
144
|
+
|
|
145
|
+
### Android
|
|
146
|
+
- Uses WorkManager for reliable scheduling
|
|
147
|
+
- Respects battery optimization settings
|
|
148
|
+
- Requires notification permission for user alerts
|
|
149
|
+
|
|
150
|
+
### iOS
|
|
151
|
+
- Uses BackgroundTasks framework
|
|
152
|
+
- Limited by iOS background execution policies
|
|
153
|
+
- May not run exactly at scheduled times
|
|
154
|
+
|
|
155
|
+
### Web
|
|
156
|
+
- Uses Service Workers when available
|
|
157
|
+
- Falls back to periodic checks when app is active
|
package/docs/api/events-api.md
CHANGED
|
@@ -64,6 +64,129 @@ NativeUpdate.addListener('downloadProgress', (progress) => {
|
|
|
64
64
|
}
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
## App Update Events
|
|
68
|
+
|
|
69
|
+
### appUpdateStateChanged
|
|
70
|
+
|
|
71
|
+
Fired when the native app update state changes.
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
NativeUpdate.addListener('appUpdateStateChanged', (state) => {
|
|
75
|
+
console.log('App update state:', state.status);
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Event Data:**
|
|
80
|
+
```typescript
|
|
81
|
+
{
|
|
82
|
+
status: InstallStatus; // See InstallStatus enum
|
|
83
|
+
installErrorCode?: number; // Error code if status is FAILED
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### appUpdateProgress
|
|
88
|
+
|
|
89
|
+
Fired during app update download progress.
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
NativeUpdate.addListener('appUpdateProgress', (progress) => {
|
|
93
|
+
console.log(`Download progress: ${progress.percent}%`);
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Event Data:**
|
|
98
|
+
```typescript
|
|
99
|
+
{
|
|
100
|
+
percent: number; // Download percentage (0-100)
|
|
101
|
+
bytesDownloaded: number; // Bytes downloaded so far
|
|
102
|
+
totalBytes: number; // Total download size
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### appUpdateAvailable
|
|
107
|
+
|
|
108
|
+
Fired when a new app update is detected.
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
NativeUpdate.addListener('appUpdateAvailable', (info) => {
|
|
112
|
+
console.log(`Update available: ${info.availableVersion}`);
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Event Data:**
|
|
117
|
+
```typescript
|
|
118
|
+
{
|
|
119
|
+
currentVersion: string;
|
|
120
|
+
availableVersion: string;
|
|
121
|
+
updatePriority: number; // 0-5, where 5 is critical
|
|
122
|
+
updateSize?: number; // Update size in bytes
|
|
123
|
+
releaseNotes?: string[]; // Release notes array
|
|
124
|
+
storeUrl?: string; // App store URL
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### appUpdateReady
|
|
129
|
+
|
|
130
|
+
Fired when the app update is downloaded and ready to install.
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
NativeUpdate.addListener('appUpdateReady', (event) => {
|
|
134
|
+
console.log('Update ready to install');
|
|
135
|
+
// Prompt user to restart/install
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Event Data:**
|
|
140
|
+
```typescript
|
|
141
|
+
{
|
|
142
|
+
message: string; // "Update downloaded and ready to install"
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### appUpdateFailed
|
|
147
|
+
|
|
148
|
+
Fired when an app update fails.
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
NativeUpdate.addListener('appUpdateFailed', (error) => {
|
|
152
|
+
console.error('Update failed:', error.error);
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Event Data:**
|
|
157
|
+
```typescript
|
|
158
|
+
{
|
|
159
|
+
error: string; // Error message
|
|
160
|
+
code: string; // Error code
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### appUpdateNotificationClicked
|
|
165
|
+
|
|
166
|
+
Fired when the user clicks on an update notification.
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
NativeUpdate.addListener('appUpdateNotificationClicked', () => {
|
|
170
|
+
console.log('User clicked update notification');
|
|
171
|
+
// Navigate to update screen
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Event Data:** Empty object `{}`
|
|
176
|
+
|
|
177
|
+
### appUpdateInstallClicked
|
|
178
|
+
|
|
179
|
+
Fired when the user clicks the install button in an update notification.
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
NativeUpdate.addListener('appUpdateInstallClicked', () => {
|
|
183
|
+
console.log('User clicked install in notification');
|
|
184
|
+
// Start update installation
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Event Data:** Empty object `{}`
|
|
189
|
+
|
|
67
190
|
## Background Update Events
|
|
68
191
|
|
|
69
192
|
### backgroundUpdateProgress
|
|
@@ -148,6 +148,22 @@ Notify that the app has successfully started with the new bundle.
|
|
|
148
148
|
await NativeUpdate.notifyAppReady();
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
+
### getLatest()
|
|
152
|
+
|
|
153
|
+
Get information about the latest available update from the server.
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
const latest = await NativeUpdate.getLatest();
|
|
157
|
+
// Returns:
|
|
158
|
+
{
|
|
159
|
+
available: boolean; // Whether an update is available
|
|
160
|
+
version?: string; // Version number of the latest update
|
|
161
|
+
url?: string; // Download URL for the update
|
|
162
|
+
mandatory?: boolean; // Whether this is a mandatory update
|
|
163
|
+
notes?: string; // Release notes for the update
|
|
164
|
+
size?: number; // Size in bytes of the update bundle
|
|
165
|
+
}
|
|
166
|
+
```
|
|
151
167
|
|
|
152
168
|
### setChannel(channel)
|
|
153
169
|
|
|
@@ -95,7 +95,7 @@ class AppUpdateManager {
|
|
|
95
95
|
private setupUpdateListeners() {
|
|
96
96
|
// Android flexible update state changes
|
|
97
97
|
NativeUpdate.addListener(
|
|
98
|
-
'
|
|
98
|
+
'appUpdateStateChanged',
|
|
99
99
|
(state) => {
|
|
100
100
|
this.handleFlexibleUpdateState(state);
|
|
101
101
|
}
|
|
@@ -103,7 +103,7 @@ class AppUpdateManager {
|
|
|
103
103
|
|
|
104
104
|
// Download progress for flexible updates
|
|
105
105
|
NativeUpdate.addListener(
|
|
106
|
-
'
|
|
106
|
+
'appUpdateProgress',
|
|
107
107
|
(progress) => {
|
|
108
108
|
this.downloadProgress = progress.percent;
|
|
109
109
|
this.updateProgressUI(progress);
|
|
@@ -276,7 +276,7 @@ const androidUpdate = {
|
|
|
276
276
|
|
|
277
277
|
// Monitor progress
|
|
278
278
|
const listener = await NativeUpdate.addListener(
|
|
279
|
-
'
|
|
279
|
+
'appUpdateProgress',
|
|
280
280
|
(progress) => {
|
|
281
281
|
console.log(
|
|
282
282
|
`Downloaded: ${progress.bytesDownloaded}/${progress.totalBytes}`
|
|
@@ -551,7 +551,7 @@ class UpdateProgressUI {
|
|
|
551
551
|
this.createProgressUI();
|
|
552
552
|
|
|
553
553
|
NativeUpdate.addListener(
|
|
554
|
-
'
|
|
554
|
+
'appUpdateProgress',
|
|
555
555
|
(progress) => {
|
|
556
556
|
this.updateProgress(progress);
|
|
557
557
|
}
|
|
@@ -159,7 +159,7 @@ async function startFlexibleUpdate() {
|
|
|
159
159
|
|
|
160
160
|
// Listen for download completion
|
|
161
161
|
const listener = await NativeUpdate.addListener(
|
|
162
|
-
'
|
|
162
|
+
'appUpdateStateChanged',
|
|
163
163
|
(state) => {
|
|
164
164
|
if (state.status === 'DOWNLOADED') {
|
|
165
165
|
// Prompt user to restart
|
|
@@ -6,11 +6,16 @@ class AppUpdatePlugin {
|
|
|
6
6
|
private weak var plugin: CAPPlugin?
|
|
7
7
|
private var config: [String: Any]?
|
|
8
8
|
private let iTunesLookupURL = "https://itunes.apple.com/lookup"
|
|
9
|
+
private var eventListener: ((String, [String: Any]) -> Void)?
|
|
9
10
|
|
|
10
11
|
init(plugin: CAPPlugin) {
|
|
11
12
|
self.plugin = plugin
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
func setEventListener(_ listener: @escaping (String, [String: Any]) -> Void) {
|
|
16
|
+
self.eventListener = listener
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
func configure(_ config: [String: Any]) throws {
|
|
15
20
|
self.config = config
|
|
16
21
|
}
|
|
@@ -43,6 +48,16 @@ class AppUpdatePlugin {
|
|
|
43
48
|
result["clientVersionStalenessDays"] = days
|
|
44
49
|
}
|
|
45
50
|
}
|
|
51
|
+
|
|
52
|
+
// Emit available event
|
|
53
|
+
var availableData: [String: Any] = [
|
|
54
|
+
"currentVersion": currentVersion,
|
|
55
|
+
"availableVersion": storeVersion
|
|
56
|
+
]
|
|
57
|
+
if let priority = result["updatePriority"] as? Int {
|
|
58
|
+
availableData["updatePriority"] = priority
|
|
59
|
+
}
|
|
60
|
+
eventListener?("appUpdateAvailable", availableData)
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
// iOS doesn't have the same update types as Android
|
|
@@ -517,6 +517,12 @@ class LiveUpdatePlugin {
|
|
|
517
517
|
defaults.set(bundles, forKey: "native_update_bundles")
|
|
518
518
|
}
|
|
519
519
|
|
|
520
|
+
func cleanup() {
|
|
521
|
+
// Clean up any resources
|
|
522
|
+
downloadTask?.cancel()
|
|
523
|
+
downloadTask = nil
|
|
524
|
+
}
|
|
525
|
+
|
|
520
526
|
private func cleanupOldBundles(keepVersions: Int) {
|
|
521
527
|
let bundles = getAllBundles().sorted { bundle1, bundle2 in
|
|
522
528
|
let time1 = bundle1["downloadTime"] as? Double ?? 0
|
|
@@ -8,6 +8,7 @@ public class NativeUpdatePlugin: CAPPlugin {
|
|
|
8
8
|
private var appReviewPlugin: AppReviewPlugin!
|
|
9
9
|
private var backgroundUpdatePlugin: BackgroundUpdatePlugin!
|
|
10
10
|
private var securityManager: SecurityManager!
|
|
11
|
+
private var isInitialized = false
|
|
11
12
|
|
|
12
13
|
override public func load() {
|
|
13
14
|
super.load()
|
|
@@ -27,6 +28,49 @@ public class NativeUpdatePlugin: CAPPlugin {
|
|
|
27
28
|
liveUpdatePlugin.setStateChangeListener { [weak self] state in
|
|
28
29
|
self?.notifyListeners("updateStateChanged", data: state)
|
|
29
30
|
}
|
|
31
|
+
|
|
32
|
+
// Set up app update event listener
|
|
33
|
+
appUpdatePlugin.setEventListener { [weak self] eventName, data in
|
|
34
|
+
self?.notifyListeners(eventName, data: data)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@objc func initialize(_ call: CAPPluginCall) {
|
|
39
|
+
guard let config = call.getObject("config") else {
|
|
40
|
+
call.reject("Configuration object is required")
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
do {
|
|
45
|
+
// Initialize with filesystem and preferences if provided
|
|
46
|
+
// In iOS, we typically don't need these as we use native APIs
|
|
47
|
+
|
|
48
|
+
// Apply configuration
|
|
49
|
+
configure(call)
|
|
50
|
+
|
|
51
|
+
isInitialized = true
|
|
52
|
+
call.resolve()
|
|
53
|
+
} catch {
|
|
54
|
+
call.reject("Initialization failed", error.localizedDescription)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@objc func isInitialized(_ call: CAPPluginCall) {
|
|
59
|
+
call.resolve(["initialized": isInitialized])
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@objc func cleanup(_ call: CAPPluginCall) {
|
|
63
|
+
// Clean up any resources
|
|
64
|
+
liveUpdatePlugin.cleanup()
|
|
65
|
+
// Disable background updates through the plugin method
|
|
66
|
+
let disableCall = CAPPluginCall(
|
|
67
|
+
callbackId: "cleanup_disable",
|
|
68
|
+
options: [:],
|
|
69
|
+
success: { _ in },
|
|
70
|
+
error: { _ in }
|
|
71
|
+
)
|
|
72
|
+
backgroundUpdatePlugin.disableBackgroundUpdates(disableCall)
|
|
73
|
+
call.resolve()
|
|
30
74
|
}
|
|
31
75
|
|
|
32
76
|
@objc func configure(_ call: CAPPluginCall) {
|
|
@@ -88,6 +132,7 @@ public class NativeUpdatePlugin: CAPPlugin {
|
|
|
88
132
|
|
|
89
133
|
@objc func reset(_ call: CAPPluginCall) {
|
|
90
134
|
liveUpdatePlugin.reset(call)
|
|
135
|
+
isInitialized = false
|
|
91
136
|
}
|
|
92
137
|
|
|
93
138
|
@objc func current(_ call: CAPPluginCall) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-update",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Foundation package for building a comprehensive update system for Capacitor apps. Provides architecture and interfaces but requires backend implementation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/plugin.cjs.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"NativeUpdate.podspec",
|
|
24
24
|
"docs/",
|
|
25
25
|
"cli/",
|
|
26
|
-
"
|
|
26
|
+
"backend-template/"
|
|
27
27
|
],
|
|
28
28
|
"author": {
|
|
29
29
|
"name": "Ahsan Mahmood",
|
|
@@ -44,7 +44,17 @@
|
|
|
44
44
|
"plugin",
|
|
45
45
|
"native",
|
|
46
46
|
"app-updates",
|
|
47
|
-
"native-updates"
|
|
47
|
+
"native-updates",
|
|
48
|
+
"ota",
|
|
49
|
+
"live-updates",
|
|
50
|
+
"hot-reload",
|
|
51
|
+
"app-store",
|
|
52
|
+
"google-play",
|
|
53
|
+
"in-app-updates",
|
|
54
|
+
"app-reviews",
|
|
55
|
+
"ios",
|
|
56
|
+
"android",
|
|
57
|
+
"hybrid"
|
|
48
58
|
],
|
|
49
59
|
"scripts": {
|
|
50
60
|
"build": "npm run clean && npm run tsc && rollup -c rollup.config.js",
|
|
@@ -62,35 +72,35 @@
|
|
|
62
72
|
},
|
|
63
73
|
"dependencies": {
|
|
64
74
|
"archiver": "^7.0.1",
|
|
65
|
-
"chalk": "^5.6.
|
|
66
|
-
"commander": "^14.0.
|
|
75
|
+
"chalk": "^5.6.2",
|
|
76
|
+
"commander": "^14.0.1",
|
|
67
77
|
"express": "^5.1.0",
|
|
68
78
|
"ora": "^8.2.0",
|
|
69
79
|
"prompts": "^2.4.2"
|
|
70
80
|
},
|
|
71
81
|
"devDependencies": {
|
|
72
|
-
"@capacitor/android": "^7.4.
|
|
73
|
-
"@capacitor/core": "^7.4.
|
|
82
|
+
"@capacitor/android": "^7.4.3",
|
|
83
|
+
"@capacitor/core": "^7.4.3",
|
|
74
84
|
"@capacitor/filesystem": "^7.1.4",
|
|
75
|
-
"@capacitor/ios": "^7.4.
|
|
85
|
+
"@capacitor/ios": "^7.4.3",
|
|
76
86
|
"@capacitor/preferences": "^7.0.2",
|
|
77
87
|
"@rollup/plugin-json": "^6.1.0",
|
|
78
88
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
79
89
|
"@rollup/plugin-terser": "^0.4.4",
|
|
80
|
-
"@types/node": "^24.3.
|
|
81
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
82
|
-
"@typescript-eslint/parser": "^8.
|
|
90
|
+
"@types/node": "^24.3.3",
|
|
91
|
+
"@typescript-eslint/eslint-plugin": "^8.43.0",
|
|
92
|
+
"@typescript-eslint/parser": "^8.43.0",
|
|
83
93
|
"@vitest/ui": "^3.2.4",
|
|
84
|
-
"eslint": "^9.
|
|
94
|
+
"eslint": "^9.35.0",
|
|
85
95
|
"happy-dom": "^18.0.1",
|
|
86
96
|
"prettier": "^3.6.2",
|
|
87
97
|
"rimraf": "^6.0.1",
|
|
88
|
-
"rollup": "^4.
|
|
98
|
+
"rollup": "^4.50.1",
|
|
89
99
|
"typescript": "^5.9.2",
|
|
90
100
|
"vitest": "^3.2.4"
|
|
91
101
|
},
|
|
92
102
|
"peerDependencies": {
|
|
93
|
-
"@capacitor/core": "^7.4.
|
|
103
|
+
"@capacitor/core": "^7.4.3"
|
|
94
104
|
},
|
|
95
105
|
"capacitor": {
|
|
96
106
|
"ios": {
|