native-update 1.0.0 → 1.0.2

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.
Files changed (55) hide show
  1. package/{CapacitorNativeUpdate.podspec → NativeUpdate.podspec} +1 -1
  2. package/Readme.md +16 -16
  3. package/android/src/main/java/com/aoneahsan/nativeupdate/{CapacitorNativeUpdatePlugin.kt → NativeUpdatePlugin.kt} +2 -2
  4. package/dist/esm/core/errors.d.ts +6 -6
  5. package/dist/esm/core/errors.js +8 -8
  6. package/dist/esm/core/errors.js.map +1 -1
  7. package/dist/esm/core/logger.js +1 -1
  8. package/dist/esm/core/logger.js.map +1 -1
  9. package/dist/esm/core/plugin-manager.js +3 -3
  10. package/dist/esm/core/plugin-manager.js.map +1 -1
  11. package/dist/esm/definitions.d.ts +12 -14
  12. package/dist/esm/definitions.js +1 -0
  13. package/dist/esm/definitions.js.map +1 -1
  14. package/dist/esm/index.d.ts +3 -3
  15. package/dist/esm/index.js +2 -2
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/plugin.d.ts +3 -3
  18. package/dist/esm/plugin.js +19 -16
  19. package/dist/esm/plugin.js.map +1 -1
  20. package/dist/esm/web.d.ts +0 -1
  21. package/dist/esm/web.js +3 -3
  22. package/dist/esm/web.js.map +1 -1
  23. package/dist/plugin.cjs.js +1 -1
  24. package/dist/plugin.cjs.js.map +1 -1
  25. package/dist/plugin.esm.js +1 -1
  26. package/dist/plugin.esm.js.map +1 -1
  27. package/dist/plugin.js +2 -2
  28. package/dist/plugin.js.map +1 -1
  29. package/docs/APP_REVIEW_GUIDE.md +12 -12
  30. package/docs/BUNDLE_SIGNING.md +4 -4
  31. package/docs/LIVE_UPDATES_GUIDE.md +48 -48
  32. package/docs/MIGRATION.md +10 -10
  33. package/docs/NATIVE_UPDATES_GUIDE.md +25 -25
  34. package/docs/QUICK_START.md +34 -34
  35. package/docs/README.md +5 -5
  36. package/docs/api/app-review-api.md +15 -15
  37. package/docs/api/app-update-api.md +18 -18
  38. package/docs/api/events-api.md +23 -23
  39. package/docs/api/live-update-api.md +20 -20
  40. package/docs/background-updates.md +18 -18
  41. package/docs/examples/advanced-scenarios.md +27 -27
  42. package/docs/examples/basic-usage.md +48 -30
  43. package/docs/features/app-reviews.md +13 -13
  44. package/docs/features/app-updates.md +21 -21
  45. package/docs/features/live-updates.md +32 -32
  46. package/docs/getting-started/configuration.md +8 -8
  47. package/docs/getting-started/installation.md +4 -4
  48. package/docs/getting-started/quick-start.md +38 -39
  49. package/docs/guides/deployment-guide.md +2 -2
  50. package/docs/guides/migration-from-codepush.md +5 -5
  51. package/docs/guides/testing-guide.md +17 -17
  52. package/docs/security/certificate-pinning.md +2 -2
  53. package/ios/Plugin/{CapacitorNativeUpdatePlugin.m → NativeUpdatePlugin.m} +1 -1
  54. package/package.json +2 -2
  55. /package/ios/Plugin/{CapacitorNativeUpdatePlugin.swift → NativeUpdatePlugin.swift} +0 -0
@@ -57,7 +57,7 @@ Live Updates, also known as Over-The-Air (OTA) updates, allow you to deploy Java
57
57
 
58
58
  ```typescript
59
59
  // 1. Configure live updates
60
- await CapacitorNativeUpdate.configure({
60
+ await NativeUpdate.configure({
61
61
  liveUpdate: {
62
62
  appId: 'com.myapp.example',
63
63
  serverUrl: 'https://updates.myserver.com',
@@ -66,7 +66,7 @@ await CapacitorNativeUpdate.configure({
66
66
  });
67
67
 
68
68
  // 2. Sync updates (automatic with autoUpdate: true)
69
- const result = await CapacitorNativeUpdate.LiveUpdate.sync();
69
+ const result = await NativeUpdate.LiveUpdate.sync();
70
70
 
71
71
  // 3. Handle the result
72
72
  switch (result.status) {
@@ -87,7 +87,7 @@ class LiveUpdateManager {
87
87
 
88
88
  async initialize() {
89
89
  // Configure with advanced options
90
- await CapacitorNativeUpdate.configure({
90
+ await NativeUpdate.configure({
91
91
  liveUpdate: {
92
92
  appId: 'com.myapp.example',
93
93
  serverUrl: 'https://updates.myserver.com',
@@ -108,7 +108,7 @@ class LiveUpdateManager {
108
108
 
109
109
  private setupUpdateListeners() {
110
110
  // Download progress
111
- CapacitorNativeUpdate.LiveUpdate.addListener(
111
+ NativeUpdate.LiveUpdate.addListener(
112
112
  'downloadProgress',
113
113
  (progress) => {
114
114
  this.updateDownloadProgress(progress.percent);
@@ -116,7 +116,7 @@ class LiveUpdateManager {
116
116
  );
117
117
 
118
118
  // State changes
119
- CapacitorNativeUpdate.LiveUpdate.addListener(
119
+ NativeUpdate.LiveUpdate.addListener(
120
120
  'updateStateChanged',
121
121
  (event) => {
122
122
  this.handleStateChange(event);
@@ -126,8 +126,8 @@ class LiveUpdateManager {
126
126
 
127
127
  async checkForUpdates() {
128
128
  try {
129
- const latest = await CapacitorNativeUpdate.LiveUpdate.getLatest();
130
- const current = await CapacitorNativeUpdate.LiveUpdate.current();
129
+ const latest = await NativeUpdate.LiveUpdate.getLatest();
130
+ const current = await NativeUpdate.LiveUpdate.current();
131
131
 
132
132
  if (this.isNewerVersion(latest.version, current.version)) {
133
133
  this.updateAvailable = true;
@@ -142,7 +142,7 @@ class LiveUpdateManager {
142
142
  if (!this.updateAvailable) return;
143
143
 
144
144
  try {
145
- const bundle = await CapacitorNativeUpdate.LiveUpdate.download({
145
+ const bundle = await NativeUpdate.LiveUpdate.download({
146
146
  version: 'latest',
147
147
  onProgress: (progress) => {
148
148
  console.log(`Download: ${progress.percent}%`);
@@ -150,7 +150,7 @@ class LiveUpdateManager {
150
150
  });
151
151
 
152
152
  // Validate the bundle
153
- const validation = await CapacitorNativeUpdate.LiveUpdate.validateUpdate({
153
+ const validation = await NativeUpdate.LiveUpdate.validateUpdate({
154
154
  bundleId: bundle.bundleId,
155
155
  });
156
156
 
@@ -166,10 +166,10 @@ class LiveUpdateManager {
166
166
 
167
167
  async installUpdate(bundle: BundleInfo) {
168
168
  // Set the bundle as active
169
- await CapacitorNativeUpdate.LiveUpdate.set(bundle);
169
+ await NativeUpdate.LiveUpdate.set(bundle);
170
170
 
171
171
  // Notify app is ready (important for rollback mechanism)
172
- await CapacitorNativeUpdate.LiveUpdate.notifyAppReady();
172
+ await NativeUpdate.LiveUpdate.notifyAppReady();
173
173
 
174
174
  // Schedule reload based on user preference
175
175
  this.scheduleReload();
@@ -177,12 +177,12 @@ class LiveUpdateManager {
177
177
 
178
178
  private scheduleReload() {
179
179
  // Option 1: Immediate reload
180
- // await CapacitorNativeUpdate.LiveUpdate.reload();
180
+ // await NativeUpdate.LiveUpdate.reload();
181
181
 
182
182
  // Option 2: Reload on next app resume
183
183
  App.addListener('appStateChange', ({ isActive }) => {
184
184
  if (isActive) {
185
- CapacitorNativeUpdate.LiveUpdate.reload();
185
+ NativeUpdate.LiveUpdate.reload();
186
186
  }
187
187
  });
188
188
 
@@ -254,7 +254,7 @@ The plugin uses semantic versioning (MAJOR.MINOR.PATCH):
254
254
 
255
255
  ```typescript
256
256
  // Version comparison
257
- const current = await CapacitorNativeUpdate.LiveUpdate.current();
257
+ const current = await NativeUpdate.LiveUpdate.current();
258
258
  console.log(current.version); // "1.2.3"
259
259
 
260
260
  // Check if update is major/minor/patch
@@ -273,7 +273,7 @@ function getUpdateType(oldVersion: string, newVersion: string) {
273
273
 
274
274
  ```typescript
275
275
  // List all downloaded bundles
276
- const bundles = await CapacitorNativeUpdate.LiveUpdate.list();
276
+ const bundles = await NativeUpdate.LiveUpdate.list();
277
277
 
278
278
  bundles.forEach((bundle) => {
279
279
  console.log(`Version: ${bundle.version}`);
@@ -283,7 +283,7 @@ bundles.forEach((bundle) => {
283
283
  });
284
284
 
285
285
  // Clean up old bundles
286
- await CapacitorNativeUpdate.LiveUpdate.delete({
286
+ await NativeUpdate.LiveUpdate.delete({
287
287
  keepNewest: 3, // Keep only 3 most recent bundles
288
288
  });
289
289
  ```
@@ -302,7 +302,7 @@ async function onAppReady() {
302
302
  await performHealthCheck();
303
303
 
304
304
  // Notify that app started successfully
305
- await CapacitorNativeUpdate.LiveUpdate.notifyAppReady();
305
+ await NativeUpdate.LiveUpdate.notifyAppReady();
306
306
  } catch (error) {
307
307
  // Don't call notifyAppReady() - automatic rollback will occur
308
308
  console.error('App startup failed:', error);
@@ -314,14 +314,14 @@ async function onAppReady() {
314
314
 
315
315
  ```typescript
316
316
  // Reset to original bundle
317
- await CapacitorNativeUpdate.LiveUpdate.reset();
317
+ await NativeUpdate.LiveUpdate.reset();
318
318
 
319
319
  // Or rollback to previous version
320
- const bundles = await CapacitorNativeUpdate.LiveUpdate.list();
320
+ const bundles = await NativeUpdate.LiveUpdate.list();
321
321
  const previousBundle = bundles[bundles.length - 2];
322
322
  if (previousBundle) {
323
- await CapacitorNativeUpdate.LiveUpdate.set(previousBundle);
324
- await CapacitorNativeUpdate.LiveUpdate.reload();
323
+ await NativeUpdate.LiveUpdate.set(previousBundle);
324
+ await NativeUpdate.LiveUpdate.reload();
325
325
  }
326
326
  ```
327
327
 
@@ -334,7 +334,7 @@ Use channels to manage different release tracks.
334
334
  ```typescript
335
335
  // Set channel based on user preference
336
336
  const channel = getUserPreference('updateChannel') || 'production';
337
- await CapacitorNativeUpdate.LiveUpdate.setChannel(channel);
337
+ await NativeUpdate.LiveUpdate.setChannel(channel);
338
338
 
339
339
  // Available channels examples:
340
340
  // - 'production': Stable releases
@@ -349,7 +349,7 @@ await CapacitorNativeUpdate.LiveUpdate.setChannel(channel);
349
349
  ```typescript
350
350
  // Enable features based on channel
351
351
  async function getFeatureFlags() {
352
- const bundle = await CapacitorNativeUpdate.LiveUpdate.current();
352
+ const bundle = await NativeUpdate.LiveUpdate.current();
353
353
 
354
354
  switch (bundle.metadata?.channel) {
355
355
  case 'alpha':
@@ -379,7 +379,7 @@ async function getFeatureFlags() {
379
379
  2. **Implement delta updates** (coming soon):
380
380
  ```typescript
381
381
  // Future API
382
- const delta = await CapacitorNativeUpdate.LiveUpdate.downloadDelta({
382
+ const delta = await NativeUpdate.LiveUpdate.downloadDelta({
383
383
  fromVersion: current.version,
384
384
  toVersion: latest.version,
385
385
  });
@@ -410,12 +410,12 @@ async function getFeatureFlags() {
410
410
 
411
411
  ```typescript
412
412
  // Monitor storage usage
413
- const storage = await CapacitorNativeUpdate.LiveUpdate.getStorageInfo();
413
+ const storage = await NativeUpdate.LiveUpdate.getStorageInfo();
414
414
  console.log(`Used: ${storage.usedBytes} / ${storage.totalBytes}`);
415
415
 
416
416
  // Clean up when needed
417
417
  if (storage.usedBytes > storage.totalBytes * 0.8) {
418
- await CapacitorNativeUpdate.LiveUpdate.delete({
418
+ await NativeUpdate.LiveUpdate.delete({
419
419
  olderThan: Date.now() - 30 * 24 * 60 * 60 * 1000, // 30 days
420
420
  });
421
421
  }
@@ -427,7 +427,7 @@ if (storage.usedBytes > storage.totalBytes * 0.8) {
427
427
 
428
428
  ```typescript
429
429
  try {
430
- await CapacitorNativeUpdate.LiveUpdate.sync();
430
+ await NativeUpdate.LiveUpdate.sync();
431
431
  } catch (error) {
432
432
  switch (error.code) {
433
433
  case 'NETWORK_ERROR':
@@ -442,7 +442,7 @@ try {
442
442
 
443
443
  case 'CHECKSUM_ERROR':
444
444
  // Bundle corrupted
445
- await CapacitorNativeUpdate.LiveUpdate.delete({
445
+ await NativeUpdate.LiveUpdate.delete({
446
446
  bundleId: error.bundleId,
447
447
  });
448
448
  break;
@@ -474,7 +474,7 @@ class UpdateRetryManager {
474
474
 
475
475
  async syncWithRetry() {
476
476
  try {
477
- await CapacitorNativeUpdate.LiveUpdate.sync();
477
+ await NativeUpdate.LiveUpdate.sync();
478
478
  this.retryCount = 0; // Reset on success
479
479
  } catch (error) {
480
480
  if (this.shouldRetry(error)) {
@@ -526,7 +526,7 @@ const devConfig = {
526
526
  };
527
527
 
528
528
  // Force update check
529
- await CapacitorNativeUpdate.LiveUpdate.sync({ forceCheck: true });
529
+ await NativeUpdate.LiveUpdate.sync({ forceCheck: true });
530
530
 
531
531
  // Simulate different scenarios
532
532
  await testUpdateScenarios();
@@ -565,7 +565,7 @@ function shouldReceiveUpdate(userId: string, percentage: number): boolean {
565
565
 
566
566
  if (shouldReceiveUpdate(user.id, 10)) {
567
567
  // 10% rollout
568
- await CapacitorNativeUpdate.LiveUpdate.setChannel('beta');
568
+ await NativeUpdate.LiveUpdate.setChannel('beta');
569
569
  }
570
570
  ```
571
571
 
@@ -573,7 +573,7 @@ if (shouldReceiveUpdate(user.id, 10)) {
573
573
 
574
574
  ```typescript
575
575
  // Notify users about updates
576
- CapacitorNativeUpdate.LiveUpdate.addListener('updateStateChanged', (event) => {
576
+ NativeUpdate.LiveUpdate.addListener('updateStateChanged', (event) => {
577
577
  if (event.status === 'READY') {
578
578
  showNotification({
579
579
  title: 'Update Ready',
@@ -17,7 +17,7 @@ This guide covers all configuration options available in Capacitor Native Update
17
17
  The plugin is configured using the `configure()` method with an `UpdateConfig` object:
18
18
 
19
19
  ```typescript
20
- await CapacitorNativeUpdate.configure({
20
+ await NativeUpdate.configure({
21
21
  liveUpdate: {
22
22
  /* Live update settings */
23
23
  },
@@ -264,7 +264,7 @@ security: {
264
264
  ```typescript
265
265
  const isDevelopment = process.env.NODE_ENV === 'development';
266
266
 
267
- await CapacitorNativeUpdate.configure({
267
+ await NativeUpdate.configure({
268
268
  liveUpdate: {
269
269
  appId: 'com.yourcompany.app.dev',
270
270
  serverUrl: isDevelopment
@@ -315,7 +315,7 @@ const environments: Record<string, Environment> = {
315
315
 
316
316
  const currentEnv = environments[process.env.APP_ENV || 'production'];
317
317
 
318
- await CapacitorNativeUpdate.configure({
318
+ await NativeUpdate.configure({
319
319
  liveUpdate: {
320
320
  appId: 'com.yourcompany.app',
321
321
  serverUrl: currentEnv.serverUrl,
@@ -332,13 +332,13 @@ await CapacitorNativeUpdate.configure({
332
332
 
333
333
  ```typescript
334
334
  // Change update channel
335
- await CapacitorNativeUpdate.LiveUpdate.setChannel('beta');
335
+ await NativeUpdate.LiveUpdate.setChannel('beta');
336
336
 
337
337
  // Change server URL
338
- await CapacitorNativeUpdate.LiveUpdate.setUpdateUrl('https://new-server.com');
338
+ await NativeUpdate.LiveUpdate.setUpdateUrl('https://new-server.com');
339
339
 
340
340
  // Update security settings
341
- await CapacitorNativeUpdate.Security.updateConfig({
341
+ await NativeUpdate.Security.updateConfig({
342
342
  enforceHttps: true,
343
343
  requireSignature: true,
344
344
  });
@@ -354,7 +354,7 @@ async function loadRemoteConfig() {
354
354
  const remoteConfig = await response.json();
355
355
 
356
356
  // Apply remote configuration
357
- await CapacitorNativeUpdate.configure({
357
+ await NativeUpdate.configure({
358
358
  liveUpdate: {
359
359
  appId: remoteConfig.appId,
360
360
  serverUrl: remoteConfig.updateServer,
@@ -448,7 +448,7 @@ The plugin validates all configuration options and will throw descriptive errors
448
448
 
449
449
  ```typescript
450
450
  try {
451
- await CapacitorNativeUpdate.configure(config);
451
+ await NativeUpdate.configure(config);
452
452
  } catch (error) {
453
453
  if (error.code === 'INVALID_CONFIG') {
454
454
  console.error('Configuration error:', error.message);
@@ -110,10 +110,10 @@ No additional setup is required for web platform. The plugin provides fallback i
110
110
  In your app's initialization code (e.g., `main.ts`, `app.component.ts`, or `App.jsx`):
111
111
 
112
112
  ```typescript
113
- import { CapacitorNativeUpdate } from 'native-update';
113
+ import { NativeUpdate } from 'native-update';
114
114
 
115
115
  // Basic initialization
116
- await CapacitorNativeUpdate.configure({
116
+ await NativeUpdate.configure({
117
117
  liveUpdate: {
118
118
  appId: 'your-app-id',
119
119
  serverUrl: 'https://your-update-server.com',
@@ -141,11 +141,11 @@ To verify the installation:
141
141
 
142
142
  ```typescript
143
143
  // Get current bundle info
144
- const currentBundle = await CapacitorNativeUpdate.LiveUpdate.current();
144
+ const currentBundle = await NativeUpdate.LiveUpdate.current();
145
145
  console.log('Current bundle:', currentBundle);
146
146
 
147
147
  // Check for updates
148
- const latest = await CapacitorNativeUpdate.LiveUpdate.getLatest();
148
+ const latest = await NativeUpdate.LiveUpdate.getLatest();
149
149
  console.log('Latest version available:', latest);
150
150
  ```
151
151
 
@@ -19,26 +19,25 @@ Get up and running with Capacitor Native Update in just a few minutes! This guid
19
19
  ### 1. Import and Configure
20
20
 
21
21
  ```typescript
22
- import { CapacitorNativeUpdate } from 'native-update';
22
+ import { NativeUpdate } from 'native-update';
23
23
 
24
24
  // Initialize the plugin with your configuration
25
25
  async function initializeUpdates() {
26
- await CapacitorNativeUpdate.configure({
27
- liveUpdate: {
28
- appId: 'com.yourcompany.app',
29
- serverUrl: 'https://updates.yourserver.com',
30
- channel: 'production',
26
+ await NativeUpdate.configure({
27
+ config: {
28
+ // Live update settings
31
29
  autoUpdate: true,
30
+ updateChannel: 'production',
32
31
  updateStrategy: 'IMMEDIATE',
33
- },
34
- appUpdate: {
35
- checkOnAppStart: true,
36
- minimumVersion: '1.0.0',
37
- },
38
- appReview: {
32
+
33
+ // Security settings
34
+ enableSignatureVerification: true,
35
+ publicKey: 'your-public-key',
36
+
37
+ // App review settings
39
38
  minimumDaysSinceInstall: 7,
40
39
  minimumLaunchCount: 3,
41
- },
40
+ }
42
41
  });
43
42
  }
44
43
 
@@ -54,7 +53,7 @@ initializeUpdates();
54
53
  // Sync with server and apply updates if available
55
54
  async function syncUpdates() {
56
55
  try {
57
- const result = await CapacitorNativeUpdate.LiveUpdate.sync();
56
+ const result = await NativeUpdate.LiveUpdate.sync();
58
57
 
59
58
  if (result.status === 'UPDATE_INSTALLED') {
60
59
  console.log('Update installed:', result.bundle.version);
@@ -73,8 +72,8 @@ async function syncUpdates() {
73
72
  ```typescript
74
73
  // Check for updates without downloading
75
74
  async function checkForUpdates() {
76
- const latest = await CapacitorNativeUpdate.LiveUpdate.getLatest();
77
- const current = await CapacitorNativeUpdate.LiveUpdate.current();
75
+ const latest = await NativeUpdate.LiveUpdate.getLatest();
76
+ const current = await NativeUpdate.LiveUpdate.current();
78
77
 
79
78
  if (latest.version !== current.version) {
80
79
  console.log(`Update available: ${latest.version}`);
@@ -87,15 +86,15 @@ async function checkForUpdates() {
87
86
  async function downloadAndInstallUpdate() {
88
87
  try {
89
88
  // Download the latest version
90
- const bundle = await CapacitorNativeUpdate.LiveUpdate.download({
89
+ const bundle = await NativeUpdate.LiveUpdate.download({
91
90
  version: 'latest',
92
91
  });
93
92
 
94
93
  // Set it as active
95
- await CapacitorNativeUpdate.LiveUpdate.set(bundle);
94
+ await NativeUpdate.LiveUpdate.set(bundle);
96
95
 
97
96
  // Reload the app to apply
98
- await CapacitorNativeUpdate.LiveUpdate.reload();
97
+ await NativeUpdate.LiveUpdate.reload();
99
98
  } catch (error) {
100
99
  console.error('Update failed:', error);
101
100
  }
@@ -106,7 +105,7 @@ async function downloadAndInstallUpdate() {
106
105
 
107
106
  ```typescript
108
107
  // Add download progress listener
109
- const progressListener = await CapacitorNativeUpdate.LiveUpdate.addListener(
108
+ const progressListener = await NativeUpdate.LiveUpdate.addListener(
110
109
  'downloadProgress',
111
110
  (progress) => {
112
111
  console.log(`Download: ${progress.percent}% complete`);
@@ -125,14 +124,14 @@ const progressListener = await CapacitorNativeUpdate.LiveUpdate.addListener(
125
124
  ```typescript
126
125
  async function checkAppStoreUpdate() {
127
126
  try {
128
- const updateInfo = await CapacitorNativeUpdate.AppUpdate.getAppUpdateInfo();
127
+ const updateInfo = await NativeUpdate.AppUpdate.getAppUpdateInfo();
129
128
 
130
129
  if (updateInfo.updateAvailable) {
131
130
  console.log(`New version available: ${updateInfo.availableVersion}`);
132
131
 
133
132
  if (updateInfo.updatePriority >= 4) {
134
133
  // High priority - immediate update
135
- await CapacitorNativeUpdate.AppUpdate.performImmediateUpdate();
134
+ await NativeUpdate.AppUpdate.performImmediateUpdate();
136
135
  } else {
137
136
  // Optional update
138
137
  showUpdateDialog(updateInfo);
@@ -146,7 +145,7 @@ async function checkAppStoreUpdate() {
146
145
  function showUpdateDialog(updateInfo) {
147
146
  // Show your custom update UI
148
147
  if (userAcceptsUpdate) {
149
- CapacitorNativeUpdate.AppUpdate.openAppStore();
148
+ NativeUpdate.AppUpdate.openAppStore();
150
149
  }
151
150
  }
152
151
  ```
@@ -156,10 +155,10 @@ function showUpdateDialog(updateInfo) {
156
155
  ```typescript
157
156
  // Start downloading in background
158
157
  async function startFlexibleUpdate() {
159
- await CapacitorNativeUpdate.AppUpdate.startFlexibleUpdate();
158
+ await NativeUpdate.AppUpdate.startFlexibleUpdate();
160
159
 
161
160
  // Listen for download completion
162
- const listener = await CapacitorNativeUpdate.AppUpdate.addListener(
161
+ const listener = await NativeUpdate.AppUpdate.addListener(
163
162
  'flexibleUpdateStateChanged',
164
163
  (state) => {
165
164
  if (state.status === 'DOWNLOADED') {
@@ -172,7 +171,7 @@ async function startFlexibleUpdate() {
172
171
 
173
172
  // Complete the update
174
173
  async function completeUpdate() {
175
- await CapacitorNativeUpdate.AppUpdate.completeFlexibleUpdate();
174
+ await NativeUpdate.AppUpdate.completeFlexibleUpdate();
176
175
  // App will restart with new version
177
176
  }
178
177
  ```
@@ -185,11 +184,11 @@ async function completeUpdate() {
185
184
  async function requestReviewIfAppropriate() {
186
185
  try {
187
186
  // Check if we can request a review
188
- const canRequest = await CapacitorNativeUpdate.AppReview.canRequestReview();
187
+ const canRequest = await NativeUpdate.AppReview.canRequestReview();
189
188
 
190
189
  if (canRequest.allowed) {
191
190
  // Request the review
192
- const result = await CapacitorNativeUpdate.AppReview.requestReview();
191
+ const result = await NativeUpdate.AppReview.requestReview();
193
192
 
194
193
  if (result.shown) {
195
194
  console.log('Review dialog was shown');
@@ -214,12 +213,12 @@ requestReviewIfAppropriate();
214
213
  ```typescript
215
214
  // In your main app component
216
215
  import { App } from '@capacitor/app';
217
- import { CapacitorNativeUpdate } from 'native-update';
216
+ import { NativeUpdate } from 'native-update';
218
217
 
219
218
  App.addListener('appStateChange', async ({ isActive }) => {
220
219
  if (isActive) {
221
220
  // Check for updates when app becomes active
222
- await CapacitorNativeUpdate.LiveUpdate.sync({
221
+ await NativeUpdate.LiveUpdate.sync({
223
222
  installMode: 'ON_NEXT_RESUME',
224
223
  });
225
224
  }
@@ -232,7 +231,7 @@ App.addListener('appStateChange', async ({ isActive }) => {
232
231
  class UpdateManager {
233
232
  async initialize() {
234
233
  // Configure plugin
235
- await CapacitorNativeUpdate.configure({
234
+ await NativeUpdate.configure({
236
235
  liveUpdate: {
237
236
  appId: 'your-app-id',
238
237
  serverUrl: 'https://your-server.com',
@@ -249,7 +248,7 @@ class UpdateManager {
249
248
 
250
249
  setupListeners() {
251
250
  // Listen for update state changes
252
- CapacitorNativeUpdate.LiveUpdate.addListener(
251
+ NativeUpdate.LiveUpdate.addListener(
253
252
  'updateStateChanged',
254
253
  (event) => {
255
254
  console.log('Update state:', event.status);
@@ -260,7 +259,7 @@ class UpdateManager {
260
259
 
261
260
  async checkForUpdates() {
262
261
  try {
263
- const result = await CapacitorNativeUpdate.LiveUpdate.sync();
262
+ const result = await NativeUpdate.LiveUpdate.sync();
264
263
 
265
264
  if (result.status === 'UPDATE_INSTALLED') {
266
265
  // Notify user about update
@@ -290,13 +289,13 @@ class UpdateManager {
290
289
  ### Error Handling Best Practices
291
290
 
292
291
  ```typescript
293
- import { CapacitorNativeUpdateError } from 'capacitor-native-update';
292
+ import { NativeUpdateError } from 'native-update';
294
293
 
295
294
  async function safeUpdateCheck() {
296
295
  try {
297
- await CapacitorNativeUpdate.LiveUpdate.sync();
296
+ await NativeUpdate.LiveUpdate.sync();
298
297
  } catch (error) {
299
- if (error instanceof CapacitorNativeUpdateError) {
298
+ if (error instanceof NativeUpdateError) {
300
299
  switch (error.code) {
301
300
  case 'NETWORK_ERROR':
302
301
  // Handle network issues
@@ -325,13 +324,13 @@ async function safeUpdateCheck() {
325
324
  1. **Use staging channel for testing**:
326
325
 
327
326
  ```typescript
328
- await CapacitorNativeUpdate.LiveUpdate.setChannel('staging');
327
+ await NativeUpdate.LiveUpdate.setChannel('staging');
329
328
  ```
330
329
 
331
330
  2. **Enable debug mode for app reviews**:
332
331
 
333
332
  ```typescript
334
- await CapacitorNativeUpdate.configure({
333
+ await NativeUpdate.configure({
335
334
  appReview: {
336
335
  debugMode: true, // Bypass time restrictions
337
336
  },
@@ -341,7 +340,7 @@ async function safeUpdateCheck() {
341
340
  3. **Force update check**:
342
341
  ```typescript
343
342
  // Clear cache and check
344
- await CapacitorNativeUpdate.LiveUpdate.sync({
343
+ await NativeUpdate.LiveUpdate.sync({
345
344
  forceCheck: true,
346
345
  });
347
346
  ```
@@ -100,7 +100,7 @@ const keys = await generateKeyPair();
100
100
  ### 2. Configure Plugin
101
101
 
102
102
  ```typescript
103
- await CapacitorNativeUpdate.configure({
103
+ await NativeUpdate.configure({
104
104
  serverUrl: 'https://updates.your-domain.com',
105
105
  publicKey: PRODUCTION_PUBLIC_KEY,
106
106
  channel: 'production',
@@ -303,7 +303,7 @@ aws s3 sync ./storage/bundles s3://your-backup-bucket/bundles
303
303
 
304
304
  ```typescript
305
305
  // Enable debug logging in production
306
- CapacitorNativeUpdate.configure({
306
+ NativeUpdate.configure({
307
307
  debug: process.env.NODE_ENV !== 'production',
308
308
  serverUrl: 'https://updates.your-domain.com',
309
309
  });
@@ -38,7 +38,7 @@ Replace CodePush imports:
38
38
  import codePush from 'react-native-code-push';
39
39
 
40
40
  // New (Capacitor Native Update)
41
- import { CapacitorNativeUpdate } from 'capacitor-native-update';
41
+ import { NativeUpdate } from 'native-update';
42
42
  ```
43
43
 
44
44
  ### 3. Configure Plugin
@@ -53,7 +53,7 @@ const codePushOptions = {
53
53
  };
54
54
 
55
55
  // New (Capacitor Native Update)
56
- await CapacitorNativeUpdate.configure({
56
+ await NativeUpdate.configure({
57
57
  serverUrl: 'https://your-update-server.com',
58
58
  channel: 'production',
59
59
  autoCheck: true,
@@ -73,10 +73,10 @@ codePush.sync({
73
73
  });
74
74
 
75
75
  // New (Capacitor Native Update)
76
- const update = await CapacitorNativeUpdate.checkForUpdate();
76
+ const update = await NativeUpdate.checkForUpdate();
77
77
  if (update.available) {
78
- await CapacitorNativeUpdate.downloadUpdate();
79
- await CapacitorNativeUpdate.applyUpdate();
78
+ await NativeUpdate.downloadUpdate();
79
+ await NativeUpdate.applyUpdate();
80
80
  }
81
81
  ```
82
82