native-update 1.0.3 → 1.0.5
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/docs/APP_REVIEW_GUIDE.md +2 -2
- package/docs/BUNDLE_SIGNING.md +10 -4
- package/docs/LIVE_UPDATES_GUIDE.md +152 -127
- package/docs/MIGRATION.md +2 -2
- package/docs/NATIVE_UPDATES_GUIDE.md +17 -16
- package/docs/QUICK_START.md +64 -75
- package/docs/README.md +4 -5
- package/docs/api/app-review-api.md +1 -21
- package/docs/api/app-update-api.md +18 -110
- package/docs/api/events-api.md +83 -334
- package/docs/api/live-update-api.md +63 -86
- package/docs/examples/advanced-scenarios.md +72 -88
- package/docs/examples/basic-usage.md +41 -38
- package/docs/features/app-reviews.md +1 -1
- package/docs/features/app-updates.md +1 -1
- package/docs/features/live-updates.md +23 -14
- package/docs/getting-started/configuration.md +1 -1
- package/docs/getting-started/installation.md +2 -2
- package/docs/getting-started/quick-start.md +3 -3
- package/docs/guides/migration-from-codepush.md +10 -11
- package/docs/guides/security-best-practices.md +3 -3
- package/docs/guides/testing-guide.md +27 -28
- package/package.json +1 -1
package/docs/APP_REVIEW_GUIDE.md
CHANGED
|
@@ -764,5 +764,5 @@ Key takeaways for implementing app reviews:
|
|
|
764
764
|
## Next Steps
|
|
765
765
|
|
|
766
766
|
- Review the [Quick Start Guide](./QUICK_START.md)
|
|
767
|
-
- Check the [API Reference](
|
|
768
|
-
- See
|
|
767
|
+
- Check the [API Reference](./api/app-review-api.md)
|
|
768
|
+
- See example implementation in the `/example` directory
|
package/docs/BUNDLE_SIGNING.md
CHANGED
|
@@ -240,12 +240,18 @@ Response: {
|
|
|
240
240
|
### Plugin Methods
|
|
241
241
|
|
|
242
242
|
```typescript
|
|
243
|
-
//
|
|
244
|
-
|
|
243
|
+
// Signature verification is handled automatically during sync/download
|
|
244
|
+
// Use validateUpdate for manual verification
|
|
245
|
+
const result = await NativeUpdate.LiveUpdate.validateUpdate({
|
|
245
246
|
bundlePath: '/path/to/bundle.zip',
|
|
246
|
-
|
|
247
|
-
|
|
247
|
+
checksum: 'expected-sha256-checksum',
|
|
248
|
+
signature: 'base64-signature' // Optional
|
|
248
249
|
});
|
|
250
|
+
|
|
251
|
+
console.log('Validation result:', result.isValid);
|
|
252
|
+
if (!result.isValid) {
|
|
253
|
+
console.log('Validation details:', result.details);
|
|
254
|
+
}
|
|
249
255
|
```
|
|
250
256
|
|
|
251
257
|
## Compliance
|
|
@@ -127,25 +127,25 @@ import { NativeUpdate } from 'native-update';
|
|
|
127
127
|
export class UpdateManager {
|
|
128
128
|
async checkAndUpdate() {
|
|
129
129
|
try {
|
|
130
|
-
//
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
130
|
+
// Sync with the update server
|
|
131
|
+
const result = await NativeUpdate.sync();
|
|
132
|
+
|
|
133
|
+
switch (result.status) {
|
|
134
|
+
case 'UPDATE_AVAILABLE':
|
|
135
|
+
console.log(`Update available: ${result.bundle?.version}`);
|
|
136
|
+
// Update will be downloaded automatically by sync
|
|
137
|
+
break;
|
|
138
|
+
case 'UPDATE_INSTALLED':
|
|
139
|
+
console.log(`Update installed: ${result.bundle?.version}`);
|
|
140
|
+
// Reload the app to apply the update
|
|
141
|
+
await NativeUpdate.reload();
|
|
142
|
+
break;
|
|
143
|
+
case 'UP_TO_DATE':
|
|
144
|
+
console.log('App is up to date');
|
|
145
|
+
break;
|
|
146
|
+
case 'ERROR':
|
|
147
|
+
console.error('Update error:', result.error);
|
|
148
|
+
break;
|
|
149
149
|
}
|
|
150
150
|
} catch (error) {
|
|
151
151
|
console.error('Update failed:', error);
|
|
@@ -168,41 +168,41 @@ export class UpdateService {
|
|
|
168
168
|
|
|
169
169
|
async checkForUpdates(silent = false) {
|
|
170
170
|
try {
|
|
171
|
-
const
|
|
172
|
-
await NativeUpdate.checkForUpdate();
|
|
171
|
+
const result = await NativeUpdate.sync();
|
|
173
172
|
|
|
174
|
-
if (
|
|
173
|
+
if (result.status === 'UP_TO_DATE') {
|
|
175
174
|
if (!silent) {
|
|
176
175
|
await this.showAlert('No Updates', 'Your app is up to date!');
|
|
177
176
|
}
|
|
178
177
|
return;
|
|
179
178
|
}
|
|
180
179
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
180
|
+
if (result.status === 'UPDATE_AVAILABLE' || result.status === 'UPDATE_INSTALLED') {
|
|
181
|
+
// Show update dialog
|
|
182
|
+
const alert = await this.alertCtrl.create({
|
|
183
|
+
header: 'Update Available',
|
|
184
|
+
message: `Version ${result.version} is available.\n\n${result.description || 'Bug fixes and improvements'}`,
|
|
185
|
+
buttons: [
|
|
186
|
+
{
|
|
187
|
+
text: result.mandatory ? 'Update Now' : 'Later',
|
|
188
|
+
role: 'cancel',
|
|
189
|
+
handler: () => {
|
|
190
|
+
if (result.mandatory) {
|
|
191
|
+
// Force update for mandatory updates
|
|
192
|
+
this.downloadAndApplyUpdate();
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
},
|
|
195
196
|
},
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
{
|
|
198
|
+
text: 'Update',
|
|
199
|
+
handler: () => {
|
|
200
|
+
this.downloadAndApplyUpdate();
|
|
201
|
+
},
|
|
201
202
|
},
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
});
|
|
203
|
+
],
|
|
204
|
+
backdropDismiss: !result.mandatory,
|
|
205
|
+
});
|
|
206
206
|
|
|
207
207
|
await alert.present();
|
|
208
208
|
} catch (error) {
|
|
@@ -220,16 +220,19 @@ export class UpdateService {
|
|
|
220
220
|
|
|
221
221
|
try {
|
|
222
222
|
// Download with progress
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
// The sync method already handles downloading
|
|
224
|
+
// Progress tracking would be done via event listeners
|
|
225
|
+
const downloadListener = NativeUpdate.addListener(
|
|
226
|
+
'downloadProgress',
|
|
227
|
+
(progress) => {
|
|
225
228
|
loading.message = `Downloading... ${Math.round(progress.percent)}%`;
|
|
226
|
-
}
|
|
227
|
-
|
|
229
|
+
}
|
|
230
|
+
);
|
|
228
231
|
|
|
229
232
|
loading.message = 'Applying update...';
|
|
230
233
|
|
|
231
234
|
// Apply the update
|
|
232
|
-
await NativeUpdate.
|
|
235
|
+
await NativeUpdate.reload();
|
|
233
236
|
|
|
234
237
|
// The app will restart automatically
|
|
235
238
|
} catch (error) {
|
|
@@ -291,35 +294,29 @@ export class AppComponent implements OnInit {
|
|
|
291
294
|
export class UpdateStrategies {
|
|
292
295
|
// Immediate update (default)
|
|
293
296
|
async immediateUpdate() {
|
|
294
|
-
const
|
|
295
|
-
if (
|
|
296
|
-
await NativeUpdate.
|
|
297
|
-
await NativeUpdate.applyUpdate(); // Restarts immediately
|
|
297
|
+
const result = await NativeUpdate.sync();
|
|
298
|
+
if (result.status === 'UPDATE_INSTALLED') {
|
|
299
|
+
await NativeUpdate.reload(); // Restarts immediately
|
|
298
300
|
}
|
|
299
301
|
}
|
|
300
302
|
|
|
301
303
|
// Update on next restart
|
|
302
304
|
async updateOnRestart() {
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
reloadStrategy: 'on-next-restart',
|
|
308
|
-
});
|
|
309
|
-
// Update will be applied next time app starts
|
|
305
|
+
const result = await NativeUpdate.sync();
|
|
306
|
+
if (result.status === 'UPDATE_INSTALLED') {
|
|
307
|
+
// Update is already installed, just don't reload immediately
|
|
308
|
+
// Update will be applied on next app restart
|
|
310
309
|
}
|
|
311
310
|
}
|
|
312
311
|
|
|
313
312
|
// Update with confirmation
|
|
314
313
|
async updateWithConfirmation() {
|
|
315
|
-
const
|
|
316
|
-
if (
|
|
317
|
-
await NativeUpdate.downloadUpdate();
|
|
318
|
-
|
|
314
|
+
const result = await NativeUpdate.sync();
|
|
315
|
+
if (result.status === 'UPDATE_INSTALLED') {
|
|
319
316
|
// Show confirmation dialog
|
|
320
317
|
const confirmed = await this.showUpdateReadyDialog();
|
|
321
318
|
if (confirmed) {
|
|
322
|
-
await NativeUpdate.
|
|
319
|
+
await NativeUpdate.reload();
|
|
323
320
|
}
|
|
324
321
|
}
|
|
325
322
|
}
|
|
@@ -429,45 +426,51 @@ await NativeUpdate.setChannel({ channel: 'beta' });
|
|
|
429
426
|
### 2. Delta Updates
|
|
430
427
|
|
|
431
428
|
```typescript
|
|
432
|
-
//
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
threshold: 0.3, // Use delta if size < 30% of full bundle
|
|
436
|
-
});
|
|
429
|
+
// Delta updates would be handled server-side
|
|
430
|
+
// The sync() method will automatically use delta updates if available
|
|
431
|
+
// Configure your server to provide delta updates when appropriate
|
|
437
432
|
```
|
|
438
433
|
|
|
439
434
|
### 3. Rollback Support
|
|
440
435
|
|
|
441
436
|
```typescript
|
|
442
|
-
// List
|
|
443
|
-
const
|
|
437
|
+
// List all downloaded bundles
|
|
438
|
+
const bundles = await NativeUpdate.list();
|
|
444
439
|
|
|
445
|
-
// Rollback to
|
|
446
|
-
|
|
447
|
-
await NativeUpdate.rollback();
|
|
448
|
-
}
|
|
440
|
+
// Rollback to original app bundle
|
|
441
|
+
await NativeUpdate.reset();
|
|
449
442
|
|
|
450
|
-
// Rollback to specific
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
443
|
+
// Rollback to a specific bundle
|
|
444
|
+
if (bundles.length > 1) {
|
|
445
|
+
const previousBundle = bundles[bundles.length - 2];
|
|
446
|
+
await NativeUpdate.set(previousBundle);
|
|
447
|
+
await NativeUpdate.reload();
|
|
448
|
+
}
|
|
454
449
|
```
|
|
455
450
|
|
|
456
451
|
### 4. Update Metrics
|
|
457
452
|
|
|
458
453
|
```typescript
|
|
459
|
-
//
|
|
460
|
-
|
|
461
|
-
version:
|
|
462
|
-
|
|
463
|
-
|
|
454
|
+
// Implement your own metrics tracking
|
|
455
|
+
class UpdateMetrics {
|
|
456
|
+
async trackSuccess(version: string, duration: number) {
|
|
457
|
+
// Send to your analytics service
|
|
458
|
+
await analytics.track('update_success', {
|
|
459
|
+
version,
|
|
460
|
+
duration,
|
|
461
|
+
timestamp: Date.now()
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
464
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
465
|
+
async trackFailure(version: string, error: string) {
|
|
466
|
+
// Send to your analytics service
|
|
467
|
+
await analytics.track('update_failure', {
|
|
468
|
+
version,
|
|
469
|
+
error,
|
|
470
|
+
timestamp: Date.now()
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}
|
|
471
474
|
```
|
|
472
475
|
|
|
473
476
|
### 5. Custom Update UI
|
|
@@ -482,9 +485,9 @@ await NativeUpdate.configure({
|
|
|
482
485
|
class CustomUpdateUI {
|
|
483
486
|
async showUpdateFlow() {
|
|
484
487
|
// Custom check
|
|
485
|
-
const update = await NativeUpdate.
|
|
488
|
+
const update = await NativeUpdate.sync();
|
|
486
489
|
|
|
487
|
-
if (update.
|
|
490
|
+
if (update.status === 'UPDATE_AVAILABLE' || update.status === 'UPDATE_INSTALLED') {
|
|
488
491
|
// Show custom UI
|
|
489
492
|
const modal = await this.modalCtrl.create({
|
|
490
493
|
component: UpdateModalComponent,
|
|
@@ -519,7 +522,7 @@ const skipVersions = ['1.0.2', '1.0.3']; // Known bad versions
|
|
|
519
522
|
class RobustUpdateManager {
|
|
520
523
|
async safeUpdate() {
|
|
521
524
|
try {
|
|
522
|
-
await NativeUpdate.
|
|
525
|
+
await NativeUpdate.sync();
|
|
523
526
|
} catch (error) {
|
|
524
527
|
if (error.code === 'NETWORK_ERROR') {
|
|
525
528
|
// Retry with exponential backoff
|
|
@@ -561,15 +564,13 @@ await NativeUpdate.setChannel({
|
|
|
561
564
|
// Download during off-peak hours
|
|
562
565
|
const now = new Date().getHours();
|
|
563
566
|
if (now >= 2 && now <= 6) {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
});
|
|
567
|
+
// Download priority would be configured during sync
|
|
568
|
+
await NativeUpdate.sync();
|
|
567
569
|
}
|
|
568
570
|
|
|
569
|
-
//
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
await NativeUpdate.resumeDownload({ id: downloadId });
|
|
571
|
+
// Download management would be handled by the sync() method
|
|
572
|
+
// For custom download control, implement your own download manager
|
|
573
|
+
// that uses the download() method with proper retry logic
|
|
573
574
|
```
|
|
574
575
|
|
|
575
576
|
## Troubleshooting
|
|
@@ -579,42 +580,56 @@ await NativeUpdate.resumeDownload({ id: downloadId });
|
|
|
579
580
|
1. **Update not applying**
|
|
580
581
|
|
|
581
582
|
```typescript
|
|
582
|
-
// Check
|
|
583
|
-
const
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
583
|
+
// Check current bundle status
|
|
584
|
+
const current = await NativeUpdate.current();
|
|
585
|
+
console.log('Current bundle:', current);
|
|
586
|
+
|
|
587
|
+
// List all bundles to see if update was downloaded
|
|
588
|
+
const bundles = await NativeUpdate.list();
|
|
589
|
+
console.log('Available bundles:', bundles);
|
|
590
|
+
|
|
591
|
+
// If update bundle exists but not active, set it
|
|
592
|
+
const updateBundle = bundles.find(b => b.version === 'new-version');
|
|
593
|
+
if (updateBundle && updateBundle.bundleId !== current.bundleId) {
|
|
594
|
+
await NativeUpdate.set(updateBundle);
|
|
595
|
+
await NativeUpdate.reload();
|
|
587
596
|
}
|
|
588
597
|
```
|
|
589
598
|
|
|
590
599
|
2. **Signature verification fails**
|
|
591
600
|
|
|
592
601
|
```typescript
|
|
593
|
-
//
|
|
594
|
-
|
|
595
|
-
console.log('
|
|
602
|
+
// Check current configuration by examining the plugin setup
|
|
603
|
+
// Configuration is set during plugin initialization
|
|
604
|
+
console.log('Verify your capacitor.config.json for publicKey setting');
|
|
596
605
|
```
|
|
597
606
|
|
|
598
607
|
3. **Storage issues**
|
|
599
608
|
```typescript
|
|
600
|
-
//
|
|
601
|
-
await NativeUpdate.
|
|
602
|
-
keepVersions:
|
|
609
|
+
// Delete old bundles, keeping only the latest N versions
|
|
610
|
+
await NativeUpdate.delete({
|
|
611
|
+
keepVersions: 2 // Keep only 2 most recent versions
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
// Or delete bundles older than a certain date
|
|
615
|
+
const thirtyDaysAgo = Date.now() - (30 * 24 * 60 * 60 * 1000);
|
|
616
|
+
await NativeUpdate.delete({
|
|
617
|
+
olderThan: thirtyDaysAgo
|
|
603
618
|
});
|
|
604
619
|
```
|
|
605
620
|
|
|
606
621
|
### Debug Mode
|
|
607
622
|
|
|
608
623
|
```typescript
|
|
609
|
-
// Enable debug logging
|
|
610
|
-
|
|
624
|
+
// Enable debug logging through your app's logging system
|
|
625
|
+
// The plugin will log errors and important events automatically
|
|
611
626
|
|
|
612
627
|
// Monitor update events
|
|
613
|
-
NativeUpdate.addListener('
|
|
628
|
+
NativeUpdate.addListener('downloadProgress', (progress) => {
|
|
614
629
|
console.log('Download progress:', progress);
|
|
615
630
|
});
|
|
616
631
|
|
|
617
|
-
NativeUpdate.addListener('
|
|
632
|
+
NativeUpdate.addListener('updateStateChanged', (state) => {
|
|
618
633
|
console.log('Update state:', state);
|
|
619
634
|
});
|
|
620
635
|
```
|
|
@@ -622,15 +637,25 @@ NativeUpdate.addListener('updateStateChange', (state) => {
|
|
|
622
637
|
### Health Checks
|
|
623
638
|
|
|
624
639
|
```typescript
|
|
625
|
-
//
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
640
|
+
// Implement your own health check system
|
|
641
|
+
class UpdateHealthCheck {
|
|
642
|
+
async checkHealth() {
|
|
643
|
+
const current = await NativeUpdate.current();
|
|
644
|
+
const bundles = await NativeUpdate.list();
|
|
645
|
+
|
|
646
|
+
const health = {
|
|
647
|
+
currentVersion: current.version,
|
|
648
|
+
currentBundleId: current.bundleId,
|
|
649
|
+
bundleStatus: current.status,
|
|
650
|
+
totalBundles: bundles.length,
|
|
651
|
+
lastUpdateTime: current.downloadTime,
|
|
652
|
+
isVerified: current.verified
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
console.log('Update system health:', health);
|
|
656
|
+
return health;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
634
659
|
```
|
|
635
660
|
|
|
636
661
|
## Security Considerations
|
|
@@ -646,5 +671,5 @@ console.log('Update system health:', {
|
|
|
646
671
|
|
|
647
672
|
- Read the [Native App Updates Guide](./NATIVE_UPDATES_GUIDE.md)
|
|
648
673
|
- Learn about [App Review Integration](./APP_REVIEW_GUIDE.md)
|
|
649
|
-
- Check out [Security Best Practices](./
|
|
674
|
+
- Check out [Security Best Practices](./guides/security-best-practices.md)
|
|
650
675
|
- See [Bundle Signing Documentation](./BUNDLE_SIGNING.md)
|
package/docs/MIGRATION.md
CHANGED
|
@@ -187,6 +187,6 @@ await NativeUpdate.configure(config);
|
|
|
187
187
|
|
|
188
188
|
### Getting Help
|
|
189
189
|
|
|
190
|
-
- Check our
|
|
191
|
-
- Review the [API documentation](
|
|
190
|
+
- Check our example app in the `/example` directory for implementation patterns
|
|
191
|
+
- Review the [API documentation](./api/live-update-api.md)
|
|
192
192
|
- File issues on GitHub for migration problems
|
|
@@ -113,7 +113,7 @@ export class NativeUpdateService {
|
|
|
113
113
|
const platform = Capacitor.getPlatform();
|
|
114
114
|
|
|
115
115
|
// Check for native app updates
|
|
116
|
-
const result = await NativeUpdate.
|
|
116
|
+
const result = await NativeUpdate.getAppUpdateInfo();
|
|
117
117
|
|
|
118
118
|
if (result.updateAvailable) {
|
|
119
119
|
console.log(`Update available: ${result.availableVersion}`);
|
|
@@ -144,7 +144,7 @@ export class AndroidImmediateUpdate {
|
|
|
144
144
|
async performImmediateUpdate() {
|
|
145
145
|
try {
|
|
146
146
|
// Start immediate update
|
|
147
|
-
const { started } = await NativeUpdate.
|
|
147
|
+
const { started } = await NativeUpdate.performImmediateUpdate();
|
|
148
148
|
|
|
149
149
|
if (started) {
|
|
150
150
|
// The app will be restarted automatically after update
|
|
@@ -201,10 +201,12 @@ export class AndroidFlexibleUpdate {
|
|
|
201
201
|
);
|
|
202
202
|
|
|
203
203
|
// Listen for download completion
|
|
204
|
-
NativeUpdate.addListener('
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
NativeUpdate.addListener('updateStateChanged', (event) => {
|
|
205
|
+
if (event.status === 'DOWNLOADED') {
|
|
206
|
+
console.log('Update downloaded');
|
|
207
|
+
this.updateDownloaded = true;
|
|
208
|
+
this.showInstallPrompt();
|
|
209
|
+
}
|
|
208
210
|
});
|
|
209
211
|
} catch (error) {
|
|
210
212
|
console.error('Flexible update failed:', error);
|
|
@@ -261,7 +263,7 @@ export class AndroidFlexibleUpdate {
|
|
|
261
263
|
export class iOSAppStoreUpdate {
|
|
262
264
|
async checkAndPromptUpdate() {
|
|
263
265
|
try {
|
|
264
|
-
const result = await NativeUpdate.
|
|
266
|
+
const result = await NativeUpdate.getAppUpdateInfo();
|
|
265
267
|
|
|
266
268
|
if (result.updateAvailable) {
|
|
267
269
|
await this.showiOSUpdateDialog(result);
|
|
@@ -314,7 +316,7 @@ export class UnifiedUpdateService {
|
|
|
314
316
|
|
|
315
317
|
async checkAndUpdateApp() {
|
|
316
318
|
try {
|
|
317
|
-
const updateInfo = await NativeUpdate.
|
|
319
|
+
const updateInfo = await NativeUpdate.getAppUpdateInfo();
|
|
318
320
|
|
|
319
321
|
if (!updateInfo.updateAvailable) {
|
|
320
322
|
console.log('App is up to date');
|
|
@@ -411,7 +413,7 @@ export class UpdateStatusManager {
|
|
|
411
413
|
|
|
412
414
|
private setupUpdateListeners() {
|
|
413
415
|
// Installation status
|
|
414
|
-
NativeUpdate.addListener('
|
|
416
|
+
NativeUpdate.addListener('updateStateChanged', (status) => {
|
|
415
417
|
switch (status.status) {
|
|
416
418
|
case 'PENDING':
|
|
417
419
|
console.log('Update pending');
|
|
@@ -534,7 +536,7 @@ export class UpdateUIService {
|
|
|
534
536
|
```typescript
|
|
535
537
|
export class SmartUpdateScheduler {
|
|
536
538
|
async scheduleUpdate() {
|
|
537
|
-
const updateInfo = await NativeUpdate.
|
|
539
|
+
const updateInfo = await NativeUpdate.getAppUpdateInfo();
|
|
538
540
|
|
|
539
541
|
if (!updateInfo.updateAvailable) return;
|
|
540
542
|
|
|
@@ -643,16 +645,15 @@ const state = await NativeUpdate.getUpdateState();
|
|
|
643
645
|
if (state.status === 'FAILED') {
|
|
644
646
|
// Clear update data and retry
|
|
645
647
|
await NativeUpdate.clearUpdateData();
|
|
646
|
-
await NativeUpdate.
|
|
648
|
+
await NativeUpdate.getAppUpdateInfo();
|
|
647
649
|
}
|
|
648
650
|
```
|
|
649
651
|
|
|
650
652
|
#### 3. iOS App Store Not Opening
|
|
651
653
|
|
|
652
654
|
```typescript
|
|
653
|
-
//
|
|
654
|
-
|
|
655
|
-
console.log('App Store ID:', config.appStoreId);
|
|
655
|
+
// App Store ID is configured in capacitor.config.json
|
|
656
|
+
// Check your configuration file for the appStoreId setting
|
|
656
657
|
|
|
657
658
|
// Manual fallback
|
|
658
659
|
if (!config.appStoreId) {
|
|
@@ -690,5 +691,5 @@ if (!config.appStoreId) {
|
|
|
690
691
|
|
|
691
692
|
- Learn about [Live Updates (OTA)](./LIVE_UPDATES_GUIDE.md)
|
|
692
693
|
- Implement [App Review Features](./APP_REVIEW_GUIDE.md)
|
|
693
|
-
- Review [Security Guidelines](./
|
|
694
|
-
- Check [API Reference](
|
|
694
|
+
- Review [Security Guidelines](./guides/security-best-practices.md)
|
|
695
|
+
- Check [API Reference](./api/app-update-api.md)
|