native-update 1.0.0 → 1.0.1
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/{CapacitorNativeUpdate.podspec → NativeUpdate.podspec} +1 -1
- package/Readme.md +16 -16
- package/android/src/main/java/com/aoneahsan/nativeupdate/{CapacitorNativeUpdatePlugin.kt → NativeUpdatePlugin.kt} +2 -2
- package/dist/esm/core/errors.d.ts +6 -6
- package/dist/esm/core/errors.js +8 -8
- package/dist/esm/core/errors.js.map +1 -1
- package/dist/esm/core/logger.js +1 -1
- package/dist/esm/core/logger.js.map +1 -1
- package/dist/esm/core/plugin-manager.js +3 -3
- package/dist/esm/core/plugin-manager.js.map +1 -1
- package/dist/esm/definitions.d.ts +12 -14
- package/dist/esm/definitions.js +1 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/plugin.d.ts +3 -3
- package/dist/esm/plugin.js +13 -13
- package/dist/esm/plugin.js.map +1 -1
- package/dist/esm/web.d.ts +0 -1
- package/dist/esm/web.js +3 -3
- package/dist/esm/web.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/APP_REVIEW_GUIDE.md +12 -12
- package/docs/BUNDLE_SIGNING.md +4 -4
- package/docs/LIVE_UPDATES_GUIDE.md +48 -48
- package/docs/MIGRATION.md +10 -10
- package/docs/NATIVE_UPDATES_GUIDE.md +25 -25
- package/docs/QUICK_START.md +34 -34
- package/docs/README.md +5 -5
- package/docs/api/app-review-api.md +15 -15
- package/docs/api/app-update-api.md +18 -18
- package/docs/api/events-api.md +23 -23
- package/docs/api/live-update-api.md +20 -20
- package/docs/background-updates.md +18 -18
- package/docs/examples/advanced-scenarios.md +27 -27
- package/docs/examples/basic-usage.md +17 -17
- package/docs/features/app-reviews.md +13 -13
- package/docs/features/app-updates.md +21 -21
- package/docs/features/live-updates.md +32 -32
- package/docs/getting-started/configuration.md +8 -8
- package/docs/getting-started/installation.md +4 -4
- package/docs/getting-started/quick-start.md +28 -28
- package/docs/guides/deployment-guide.md +2 -2
- package/docs/guides/migration-from-codepush.md +5 -5
- package/docs/guides/testing-guide.md +17 -17
- package/docs/security/certificate-pinning.md +2 -2
- package/ios/Plugin/{CapacitorNativeUpdatePlugin.m → NativeUpdatePlugin.m} +1 -1
- package/package.json +2 -2
- /package/ios/Plugin/{CapacitorNativeUpdatePlugin.swift → NativeUpdatePlugin.swift} +0 -0
package/docs/APP_REVIEW_GUIDE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# App Review Implementation Guide
|
|
2
2
|
|
|
3
|
-
This comprehensive guide explains how to implement in-app review functionality in your Capacitor application using the
|
|
3
|
+
This comprehensive guide explains how to implement in-app review functionality in your Capacitor application using the NativeUpdate plugin.
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
@@ -76,7 +76,7 @@ The App Review feature allows users to rate and review your app without leaving
|
|
|
76
76
|
### Installation
|
|
77
77
|
|
|
78
78
|
```bash
|
|
79
|
-
npm install
|
|
79
|
+
npm install native-update
|
|
80
80
|
npx cap sync
|
|
81
81
|
```
|
|
82
82
|
|
|
@@ -93,7 +93,7 @@ No additional configuration required. The plugin automatically uses StoreKit.
|
|
|
93
93
|
```json
|
|
94
94
|
{
|
|
95
95
|
"plugins": {
|
|
96
|
-
"
|
|
96
|
+
"NativeUpdate": {
|
|
97
97
|
"appStoreId": "YOUR_APP_STORE_ID",
|
|
98
98
|
"reviewPromptDelay": 2000,
|
|
99
99
|
"reviewDebugMode": false
|
|
@@ -107,12 +107,12 @@ No additional configuration required. The plugin automatically uses StoreKit.
|
|
|
107
107
|
### Step 1: Basic Implementation
|
|
108
108
|
|
|
109
109
|
```typescript
|
|
110
|
-
import {
|
|
110
|
+
import { NativeUpdate } from 'native-update';
|
|
111
111
|
|
|
112
112
|
export class AppReviewService {
|
|
113
113
|
async requestReview() {
|
|
114
114
|
try {
|
|
115
|
-
const result = await
|
|
115
|
+
const result = await NativeUpdate.requestReview();
|
|
116
116
|
|
|
117
117
|
if (result.displayed) {
|
|
118
118
|
console.log('Review prompt was displayed');
|
|
@@ -329,7 +329,7 @@ export class TwoStepReviewFlow {
|
|
|
329
329
|
text: 'Sure!',
|
|
330
330
|
handler: async () => {
|
|
331
331
|
this.analytics.track('review_accepted');
|
|
332
|
-
await
|
|
332
|
+
await NativeUpdate.requestReview();
|
|
333
333
|
},
|
|
334
334
|
},
|
|
335
335
|
],
|
|
@@ -540,7 +540,7 @@ export class ReviewABTesting {
|
|
|
540
540
|
|
|
541
541
|
switch (strategy) {
|
|
542
542
|
case 'immediate':
|
|
543
|
-
await
|
|
543
|
+
await NativeUpdate.requestReview();
|
|
544
544
|
break;
|
|
545
545
|
case 'two-step':
|
|
546
546
|
await this.twoStepFlow.initiateReviewFlow();
|
|
@@ -617,7 +617,7 @@ export class ReviewAnalytics {
|
|
|
617
617
|
export class ReviewTestingUtils {
|
|
618
618
|
async enableTestMode() {
|
|
619
619
|
// Enable debug mode
|
|
620
|
-
await
|
|
620
|
+
await NativeUpdate.setReviewDebugMode({ enabled: true });
|
|
621
621
|
|
|
622
622
|
// Reset all preferences
|
|
623
623
|
await this.clearReviewPreferences();
|
|
@@ -630,7 +630,7 @@ export class ReviewTestingUtils {
|
|
|
630
630
|
console.log('Simulating review flow...');
|
|
631
631
|
|
|
632
632
|
// Force display of review prompt
|
|
633
|
-
const result = await
|
|
633
|
+
const result = await NativeUpdate.requestReview({
|
|
634
634
|
force: true, // Only works in debug mode
|
|
635
635
|
});
|
|
636
636
|
|
|
@@ -682,11 +682,11 @@ export class ReviewTestingUtils {
|
|
|
682
682
|
// Debug checklist
|
|
683
683
|
async function debugReviewPrompt() {
|
|
684
684
|
// Check if available on platform
|
|
685
|
-
const isAvailable = await
|
|
685
|
+
const isAvailable = await NativeUpdate.isReviewAvailable();
|
|
686
686
|
console.log('Review available:', isAvailable);
|
|
687
687
|
|
|
688
688
|
// Check system throttling
|
|
689
|
-
const debugInfo = await
|
|
689
|
+
const debugInfo = await NativeUpdate.getReviewDebugInfo();
|
|
690
690
|
console.log('Debug info:', debugInfo);
|
|
691
691
|
|
|
692
692
|
// Check your conditions
|
|
@@ -731,7 +731,7 @@ class ReviewOptimizer {
|
|
|
731
731
|
// Platform fallbacks
|
|
732
732
|
async function requestReviewWithFallback() {
|
|
733
733
|
try {
|
|
734
|
-
const result = await
|
|
734
|
+
const result = await NativeUpdate.requestReview();
|
|
735
735
|
|
|
736
736
|
if (!result.displayed) {
|
|
737
737
|
// System didn't show prompt
|
package/docs/BUNDLE_SIGNING.md
CHANGED
|
@@ -78,7 +78,7 @@ Signatures are:
|
|
|
78
78
|
// capacitor.config.json
|
|
79
79
|
{
|
|
80
80
|
"plugins": {
|
|
81
|
-
"
|
|
81
|
+
"NativeUpdate": {
|
|
82
82
|
"publicKey": "base64-encoded-public-key",
|
|
83
83
|
"enforceSignature": true
|
|
84
84
|
}
|
|
@@ -90,9 +90,9 @@ Signatures are:
|
|
|
90
90
|
|
|
91
91
|
```swift
|
|
92
92
|
// Info.plist
|
|
93
|
-
<key>
|
|
93
|
+
<key>NativeUpdatePublicKey</key>
|
|
94
94
|
<string>base64-encoded-public-key</string>
|
|
95
|
-
<key>
|
|
95
|
+
<key>NativeUpdateEnforceSignature</key>
|
|
96
96
|
<true/>
|
|
97
97
|
```
|
|
98
98
|
|
|
@@ -241,7 +241,7 @@ Response: {
|
|
|
241
241
|
|
|
242
242
|
```typescript
|
|
243
243
|
// Manual verification (advanced use)
|
|
244
|
-
const isValid = await
|
|
244
|
+
const isValid = await NativeUpdate.verifySignature({
|
|
245
245
|
bundlePath: '/path/to/bundle.zip',
|
|
246
246
|
signature: 'base64-signature',
|
|
247
247
|
publicKey: 'base64-public-key', // Optional, uses config if not provided
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Live Updates (OTA) Implementation Guide
|
|
2
2
|
|
|
3
|
-
This comprehensive guide explains how to implement Live Updates (Over-The-Air updates) in your Capacitor application using the
|
|
3
|
+
This comprehensive guide explains how to implement Live Updates (Over-The-Air updates) in your Capacitor application using the NativeUpdate plugin.
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
@@ -69,7 +69,7 @@ sequenceDiagram
|
|
|
69
69
|
### 1. Install the Plugin
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
|
-
npm install
|
|
72
|
+
npm install native-update
|
|
73
73
|
npx cap sync
|
|
74
74
|
```
|
|
75
75
|
|
|
@@ -82,7 +82,7 @@ npx cap sync
|
|
|
82
82
|
"appId": "com.example.app",
|
|
83
83
|
"appName": "My App",
|
|
84
84
|
"plugins": {
|
|
85
|
-
"
|
|
85
|
+
"NativeUpdate": {
|
|
86
86
|
"updateUrl": "https://updates.yourdomain.com/api/v1",
|
|
87
87
|
"enabled": true,
|
|
88
88
|
"autoCheck": true,
|
|
@@ -102,9 +102,9 @@ npx cap sync
|
|
|
102
102
|
Add to `Info.plist`:
|
|
103
103
|
|
|
104
104
|
```xml
|
|
105
|
-
<key>
|
|
105
|
+
<key>NativeUpdateEnabled</key>
|
|
106
106
|
<true/>
|
|
107
|
-
<key>
|
|
107
|
+
<key>NativeUpdateURL</key>
|
|
108
108
|
<string>https://updates.yourdomain.com/api/v1</string>
|
|
109
109
|
```
|
|
110
110
|
|
|
@@ -122,20 +122,20 @@ Add to `AndroidManifest.xml`:
|
|
|
122
122
|
### Step 1: Basic Implementation
|
|
123
123
|
|
|
124
124
|
```typescript
|
|
125
|
-
import {
|
|
125
|
+
import { NativeUpdate } from 'native-update';
|
|
126
126
|
|
|
127
127
|
export class UpdateManager {
|
|
128
128
|
async checkAndUpdate() {
|
|
129
129
|
try {
|
|
130
130
|
// Check for updates
|
|
131
131
|
const { available, version } =
|
|
132
|
-
await
|
|
132
|
+
await NativeUpdate.checkForUpdate();
|
|
133
133
|
|
|
134
134
|
if (available) {
|
|
135
135
|
console.log(`Update available: ${version}`);
|
|
136
136
|
|
|
137
137
|
// Download the update
|
|
138
|
-
const { success } = await
|
|
138
|
+
const { success } = await NativeUpdate.downloadUpdate({
|
|
139
139
|
onProgress: (progress) => {
|
|
140
140
|
console.log(`Download progress: ${progress.percent}%`);
|
|
141
141
|
},
|
|
@@ -143,7 +143,7 @@ export class UpdateManager {
|
|
|
143
143
|
|
|
144
144
|
if (success) {
|
|
145
145
|
// Apply the update
|
|
146
|
-
await
|
|
146
|
+
await NativeUpdate.applyUpdate();
|
|
147
147
|
// App will restart automatically
|
|
148
148
|
}
|
|
149
149
|
}
|
|
@@ -157,7 +157,7 @@ export class UpdateManager {
|
|
|
157
157
|
### Step 2: Advanced Implementation with UI
|
|
158
158
|
|
|
159
159
|
```typescript
|
|
160
|
-
import {
|
|
160
|
+
import { NativeUpdate } from 'native-update';
|
|
161
161
|
import { AlertController, LoadingController } from '@ionic/angular';
|
|
162
162
|
|
|
163
163
|
export class UpdateService {
|
|
@@ -169,7 +169,7 @@ export class UpdateService {
|
|
|
169
169
|
async checkForUpdates(silent = false) {
|
|
170
170
|
try {
|
|
171
171
|
const { available, version, mandatory, notes } =
|
|
172
|
-
await
|
|
172
|
+
await NativeUpdate.checkForUpdate();
|
|
173
173
|
|
|
174
174
|
if (!available) {
|
|
175
175
|
if (!silent) {
|
|
@@ -220,7 +220,7 @@ export class UpdateService {
|
|
|
220
220
|
|
|
221
221
|
try {
|
|
222
222
|
// Download with progress
|
|
223
|
-
await
|
|
223
|
+
await NativeUpdate.downloadUpdate({
|
|
224
224
|
onProgress: (progress) => {
|
|
225
225
|
loading.message = `Downloading... ${Math.round(progress.percent)}%`;
|
|
226
226
|
},
|
|
@@ -229,7 +229,7 @@ export class UpdateService {
|
|
|
229
229
|
loading.message = 'Applying update...';
|
|
230
230
|
|
|
231
231
|
// Apply the update
|
|
232
|
-
await
|
|
232
|
+
await NativeUpdate.applyUpdate();
|
|
233
233
|
|
|
234
234
|
// The app will restart automatically
|
|
235
235
|
} catch (error) {
|
|
@@ -291,19 +291,19 @@ export class AppComponent implements OnInit {
|
|
|
291
291
|
export class UpdateStrategies {
|
|
292
292
|
// Immediate update (default)
|
|
293
293
|
async immediateUpdate() {
|
|
294
|
-
const { available } = await
|
|
294
|
+
const { available } = await NativeUpdate.checkForUpdate();
|
|
295
295
|
if (available) {
|
|
296
|
-
await
|
|
297
|
-
await
|
|
296
|
+
await NativeUpdate.downloadUpdate();
|
|
297
|
+
await NativeUpdate.applyUpdate(); // Restarts immediately
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
// Update on next restart
|
|
302
302
|
async updateOnRestart() {
|
|
303
|
-
const { available } = await
|
|
303
|
+
const { available } = await NativeUpdate.checkForUpdate();
|
|
304
304
|
if (available) {
|
|
305
|
-
await
|
|
306
|
-
await
|
|
305
|
+
await NativeUpdate.downloadUpdate();
|
|
306
|
+
await NativeUpdate.applyUpdate({
|
|
307
307
|
reloadStrategy: 'on-next-restart',
|
|
308
308
|
});
|
|
309
309
|
// Update will be applied next time app starts
|
|
@@ -312,14 +312,14 @@ export class UpdateStrategies {
|
|
|
312
312
|
|
|
313
313
|
// Update with confirmation
|
|
314
314
|
async updateWithConfirmation() {
|
|
315
|
-
const { available } = await
|
|
315
|
+
const { available } = await NativeUpdate.checkForUpdate();
|
|
316
316
|
if (available) {
|
|
317
|
-
await
|
|
317
|
+
await NativeUpdate.downloadUpdate();
|
|
318
318
|
|
|
319
319
|
// Show confirmation dialog
|
|
320
320
|
const confirmed = await this.showUpdateReadyDialog();
|
|
321
321
|
if (confirmed) {
|
|
322
|
-
await
|
|
322
|
+
await NativeUpdate.applyUpdate();
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
}
|
|
@@ -417,20 +417,20 @@ curl -X POST https://updates.example.com/api/v1/bundles \
|
|
|
417
417
|
|
|
418
418
|
```typescript
|
|
419
419
|
// Development channel for testing
|
|
420
|
-
await
|
|
420
|
+
await NativeUpdate.setChannel({ channel: 'development' });
|
|
421
421
|
|
|
422
422
|
// Production channel for users
|
|
423
|
-
await
|
|
423
|
+
await NativeUpdate.setChannel({ channel: 'production' });
|
|
424
424
|
|
|
425
425
|
// Beta channel for early adopters
|
|
426
|
-
await
|
|
426
|
+
await NativeUpdate.setChannel({ channel: 'beta' });
|
|
427
427
|
```
|
|
428
428
|
|
|
429
429
|
### 2. Delta Updates
|
|
430
430
|
|
|
431
431
|
```typescript
|
|
432
432
|
// Enable delta updates to reduce download size
|
|
433
|
-
await
|
|
433
|
+
await NativeUpdate.configureDeltaUpdates({
|
|
434
434
|
enabled: true,
|
|
435
435
|
threshold: 0.3, // Use delta if size < 30% of full bundle
|
|
436
436
|
});
|
|
@@ -440,15 +440,15 @@ await CapacitorNativeUpdate.configureDeltaUpdates({
|
|
|
440
440
|
|
|
441
441
|
```typescript
|
|
442
442
|
// List available versions
|
|
443
|
-
const { versions } = await
|
|
443
|
+
const { versions } = await NativeUpdate.getVersions();
|
|
444
444
|
|
|
445
445
|
// Rollback to previous version
|
|
446
446
|
if (versions.length > 1) {
|
|
447
|
-
await
|
|
447
|
+
await NativeUpdate.rollback();
|
|
448
448
|
}
|
|
449
449
|
|
|
450
450
|
// Rollback to specific version
|
|
451
|
-
await
|
|
451
|
+
await NativeUpdate.switchVersion({
|
|
452
452
|
version: '1.0.0',
|
|
453
453
|
});
|
|
454
454
|
```
|
|
@@ -457,13 +457,13 @@ await CapacitorNativeUpdate.switchVersion({
|
|
|
457
457
|
|
|
458
458
|
```typescript
|
|
459
459
|
// Track update success
|
|
460
|
-
await
|
|
460
|
+
await NativeUpdate.reportUpdateSuccess({
|
|
461
461
|
version: '1.0.1',
|
|
462
462
|
duration: 5000,
|
|
463
463
|
});
|
|
464
464
|
|
|
465
465
|
// Track update failure
|
|
466
|
-
await
|
|
466
|
+
await NativeUpdate.reportUpdateFailure({
|
|
467
467
|
version: '1.0.1',
|
|
468
468
|
error: 'DOWNLOAD_FAILED',
|
|
469
469
|
details: 'Network timeout',
|
|
@@ -474,7 +474,7 @@ await CapacitorNativeUpdate.reportUpdateFailure({
|
|
|
474
474
|
|
|
475
475
|
```typescript
|
|
476
476
|
// Disable auto-check
|
|
477
|
-
await
|
|
477
|
+
await NativeUpdate.configure({
|
|
478
478
|
autoCheck: false,
|
|
479
479
|
});
|
|
480
480
|
|
|
@@ -482,7 +482,7 @@ await CapacitorNativeUpdate.configure({
|
|
|
482
482
|
class CustomUpdateUI {
|
|
483
483
|
async showUpdateFlow() {
|
|
484
484
|
// Custom check
|
|
485
|
-
const update = await
|
|
485
|
+
const update = await NativeUpdate.checkForUpdate();
|
|
486
486
|
|
|
487
487
|
if (update.available) {
|
|
488
488
|
// Show custom UI
|
|
@@ -519,7 +519,7 @@ const skipVersions = ['1.0.2', '1.0.3']; // Known bad versions
|
|
|
519
519
|
class RobustUpdateManager {
|
|
520
520
|
async safeUpdate() {
|
|
521
521
|
try {
|
|
522
|
-
await
|
|
522
|
+
await NativeUpdate.checkForUpdate();
|
|
523
523
|
} catch (error) {
|
|
524
524
|
if (error.code === 'NETWORK_ERROR') {
|
|
525
525
|
// Retry with exponential backoff
|
|
@@ -542,7 +542,7 @@ class RobustUpdateManager {
|
|
|
542
542
|
// Test in development
|
|
543
543
|
if (environment.development) {
|
|
544
544
|
// Force check against staging server
|
|
545
|
-
await
|
|
545
|
+
await NativeUpdate.configure({
|
|
546
546
|
updateUrl: 'https://staging-updates.yourdomain.com',
|
|
547
547
|
channel: 'development',
|
|
548
548
|
});
|
|
@@ -550,7 +550,7 @@ if (environment.development) {
|
|
|
550
550
|
|
|
551
551
|
// A/B testing
|
|
552
552
|
const testGroup = user.id % 2 === 0 ? 'A' : 'B';
|
|
553
|
-
await
|
|
553
|
+
await NativeUpdate.setChannel({
|
|
554
554
|
channel: `production-${testGroup}`,
|
|
555
555
|
});
|
|
556
556
|
```
|
|
@@ -561,15 +561,15 @@ await CapacitorNativeUpdate.setChannel({
|
|
|
561
561
|
// Download during off-peak hours
|
|
562
562
|
const now = new Date().getHours();
|
|
563
563
|
if (now >= 2 && now <= 6) {
|
|
564
|
-
await
|
|
564
|
+
await NativeUpdate.downloadUpdate({
|
|
565
565
|
priority: 'low',
|
|
566
566
|
});
|
|
567
567
|
}
|
|
568
568
|
|
|
569
569
|
// Pause/resume downloads
|
|
570
|
-
const downloadId = await
|
|
571
|
-
await
|
|
572
|
-
await
|
|
570
|
+
const downloadId = await NativeUpdate.startDownload();
|
|
571
|
+
await NativeUpdate.pauseDownload({ id: downloadId });
|
|
572
|
+
await NativeUpdate.resumeDownload({ id: downloadId });
|
|
573
573
|
```
|
|
574
574
|
|
|
575
575
|
## Troubleshooting
|
|
@@ -580,10 +580,10 @@ await CapacitorNativeUpdate.resumeDownload({ id: downloadId });
|
|
|
580
580
|
|
|
581
581
|
```typescript
|
|
582
582
|
// Check if update was downloaded
|
|
583
|
-
const { ready } = await
|
|
583
|
+
const { ready } = await NativeUpdate.isUpdateReady();
|
|
584
584
|
if (ready) {
|
|
585
585
|
// Force apply
|
|
586
|
-
await
|
|
586
|
+
await NativeUpdate.applyUpdate({ force: true });
|
|
587
587
|
}
|
|
588
588
|
```
|
|
589
589
|
|
|
@@ -591,14 +591,14 @@ await CapacitorNativeUpdate.resumeDownload({ id: downloadId });
|
|
|
591
591
|
|
|
592
592
|
```typescript
|
|
593
593
|
// Verify public key configuration
|
|
594
|
-
const config = await
|
|
594
|
+
const config = await NativeUpdate.getConfiguration();
|
|
595
595
|
console.log('Public key:', config.publicKey);
|
|
596
596
|
```
|
|
597
597
|
|
|
598
598
|
3. **Storage issues**
|
|
599
599
|
```typescript
|
|
600
600
|
// Clear old versions
|
|
601
|
-
await
|
|
601
|
+
await NativeUpdate.cleanup({
|
|
602
602
|
keepVersions: 1,
|
|
603
603
|
});
|
|
604
604
|
```
|
|
@@ -607,14 +607,14 @@ await CapacitorNativeUpdate.resumeDownload({ id: downloadId });
|
|
|
607
607
|
|
|
608
608
|
```typescript
|
|
609
609
|
// Enable debug logging
|
|
610
|
-
await
|
|
610
|
+
await NativeUpdate.setDebugMode({ enabled: true });
|
|
611
611
|
|
|
612
612
|
// Monitor update events
|
|
613
|
-
|
|
613
|
+
NativeUpdate.addListener('updateDownloadProgress', (progress) => {
|
|
614
614
|
console.log('Download progress:', progress);
|
|
615
615
|
});
|
|
616
616
|
|
|
617
|
-
|
|
617
|
+
NativeUpdate.addListener('updateStateChange', (state) => {
|
|
618
618
|
console.log('Update state:', state);
|
|
619
619
|
});
|
|
620
620
|
```
|
|
@@ -623,7 +623,7 @@ CapacitorNativeUpdate.addListener('updateStateChange', (state) => {
|
|
|
623
623
|
|
|
624
624
|
```typescript
|
|
625
625
|
// Verify update system health
|
|
626
|
-
const health = await
|
|
626
|
+
const health = await NativeUpdate.getHealth();
|
|
627
627
|
console.log('Update system health:', {
|
|
628
628
|
enabled: health.enabled,
|
|
629
629
|
lastCheck: health.lastCheck,
|
package/docs/MIGRATION.md
CHANGED
|
@@ -13,7 +13,7 @@ If you're migrating from the official Capacitor Live Updates plugin:
|
|
|
13
13
|
import { LiveUpdates } from '@capacitor/live-updates';
|
|
14
14
|
|
|
15
15
|
// After
|
|
16
|
-
import {
|
|
16
|
+
import { NativeUpdate } from 'native-update';
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
2. **Update configuration**:
|
|
@@ -27,7 +27,7 @@ await LiveUpdates.configure({
|
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
// After
|
|
30
|
-
await
|
|
30
|
+
await NativeUpdate.configure({
|
|
31
31
|
liveUpdate: {
|
|
32
32
|
appId: 'your-app-id',
|
|
33
33
|
serverUrl: 'https://your-server.com',
|
|
@@ -45,7 +45,7 @@ await CapacitorNativeUpdate.configure({
|
|
|
45
45
|
const result = await LiveUpdates.sync();
|
|
46
46
|
|
|
47
47
|
// After
|
|
48
|
-
const result = await
|
|
48
|
+
const result = await NativeUpdate.sync();
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
### From Capgo Capacitor Updater
|
|
@@ -65,8 +65,8 @@ import { CapacitorUpdater } from '@capgo/capacitor-updater';
|
|
|
65
65
|
await CapacitorUpdater.download({ url, version });
|
|
66
66
|
|
|
67
67
|
// Capacitor Native Update
|
|
68
|
-
import {
|
|
69
|
-
await
|
|
68
|
+
import { NativeUpdate } from 'native-update';
|
|
69
|
+
await NativeUpdate.download({
|
|
70
70
|
url,
|
|
71
71
|
version,
|
|
72
72
|
checksum: 'required-checksum',
|
|
@@ -90,7 +90,7 @@ If you're migrating from Ionic Appflow:
|
|
|
90
90
|
|
|
91
91
|
```typescript
|
|
92
92
|
// Similar channel concept
|
|
93
|
-
await
|
|
93
|
+
await NativeUpdate.setChannel('production');
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
3. **Additional features**:
|
|
@@ -124,13 +124,13 @@ If you have existing bundles from another solution:
|
|
|
124
124
|
|
|
125
125
|
```typescript
|
|
126
126
|
// Clear old data and start fresh
|
|
127
|
-
await
|
|
127
|
+
await NativeUpdate.reset();
|
|
128
128
|
|
|
129
129
|
// Or manually migrate bundles
|
|
130
130
|
const oldBundles = getOldBundles(); // Your migration logic
|
|
131
131
|
for (const bundle of oldBundles) {
|
|
132
132
|
// Re-download with new security requirements
|
|
133
|
-
await
|
|
133
|
+
await NativeUpdate.download({
|
|
134
134
|
url: bundle.url,
|
|
135
135
|
version: bundle.version,
|
|
136
136
|
checksum: await calculateChecksum(bundle.url),
|
|
@@ -150,7 +150,7 @@ codePush.sync({
|
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
// Convert to:
|
|
153
|
-
await
|
|
153
|
+
await NativeUpdate.sync({
|
|
154
154
|
updateMode: 'immediate',
|
|
155
155
|
});
|
|
156
156
|
```
|
|
@@ -166,7 +166,7 @@ const config = {
|
|
|
166
166
|
},
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
-
await
|
|
169
|
+
await NativeUpdate.configure(config);
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
## Troubleshooting Migration
|