native-update 1.0.0
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 +18 -0
- package/LICENSE +21 -0
- package/Readme.md +451 -0
- package/android/build.gradle +92 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +8 -0
- package/android/gradle.properties +17 -0
- package/android/proguard-rules.pro +29 -0
- package/android/settings.gradle +2 -0
- package/android/src/main/AndroidManifest.xml +34 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/AppReviewPlugin.kt +153 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/AppUpdatePlugin.kt +275 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundNotificationManager.kt +390 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundUpdateManager.kt +46 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundUpdatePlugin.kt +333 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/BackgroundUpdateWorker.kt +251 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/CapacitorNativeUpdatePlugin.kt +265 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +526 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/NotificationActionReceiver.kt +99 -0
- package/android/src/main/java/com/aoneahsan/nativeupdate/SecurityManager.kt +249 -0
- package/dist/esm/__tests__/bundle-manager.test.d.ts +1 -0
- package/dist/esm/__tests__/bundle-manager.test.js +123 -0
- package/dist/esm/__tests__/bundle-manager.test.js.map +1 -0
- package/dist/esm/__tests__/config.test.d.ts +1 -0
- package/dist/esm/__tests__/config.test.js +69 -0
- package/dist/esm/__tests__/config.test.js.map +1 -0
- package/dist/esm/__tests__/integration.test.d.ts +1 -0
- package/dist/esm/__tests__/integration.test.js +78 -0
- package/dist/esm/__tests__/integration.test.js.map +1 -0
- package/dist/esm/__tests__/security.test.d.ts +1 -0
- package/dist/esm/__tests__/security.test.js +54 -0
- package/dist/esm/__tests__/security.test.js.map +1 -0
- package/dist/esm/__tests__/version-manager.test.d.ts +1 -0
- package/dist/esm/__tests__/version-manager.test.js +45 -0
- package/dist/esm/__tests__/version-manager.test.js.map +1 -0
- package/dist/esm/app-review/app-review-manager.d.ts +24 -0
- package/dist/esm/app-review/app-review-manager.js +195 -0
- package/dist/esm/app-review/app-review-manager.js.map +1 -0
- package/dist/esm/app-review/index.d.ts +5 -0
- package/dist/esm/app-review/index.js +6 -0
- package/dist/esm/app-review/index.js.map +1 -0
- package/dist/esm/app-review/platform-review-handler.d.ts +20 -0
- package/dist/esm/app-review/platform-review-handler.js +138 -0
- package/dist/esm/app-review/platform-review-handler.js.map +1 -0
- package/dist/esm/app-review/review-conditions-checker.d.ts +22 -0
- package/dist/esm/app-review/review-conditions-checker.js +155 -0
- package/dist/esm/app-review/review-conditions-checker.js.map +1 -0
- package/dist/esm/app-review/review-rate-limiter.d.ts +23 -0
- package/dist/esm/app-review/review-rate-limiter.js +164 -0
- package/dist/esm/app-review/review-rate-limiter.js.map +1 -0
- package/dist/esm/app-review/types.d.ts +41 -0
- package/dist/esm/app-review/types.js +2 -0
- package/dist/esm/app-review/types.js.map +1 -0
- package/dist/esm/app-update/app-update-checker.d.ts +13 -0
- package/dist/esm/app-update/app-update-checker.js +104 -0
- package/dist/esm/app-update/app-update-checker.js.map +1 -0
- package/dist/esm/app-update/app-update-installer.d.ts +19 -0
- package/dist/esm/app-update/app-update-installer.js +123 -0
- package/dist/esm/app-update/app-update-installer.js.map +1 -0
- package/dist/esm/app-update/app-update-manager.d.ts +28 -0
- package/dist/esm/app-update/app-update-manager.js +199 -0
- package/dist/esm/app-update/app-update-manager.js.map +1 -0
- package/dist/esm/app-update/app-update-notifier.d.ts +14 -0
- package/dist/esm/app-update/app-update-notifier.js +100 -0
- package/dist/esm/app-update/app-update-notifier.js.map +1 -0
- package/dist/esm/app-update/index.d.ts +6 -0
- package/dist/esm/app-update/index.js +7 -0
- package/dist/esm/app-update/index.js.map +1 -0
- package/dist/esm/app-update/platform-app-update.d.ts +19 -0
- package/dist/esm/app-update/platform-app-update.js +129 -0
- package/dist/esm/app-update/platform-app-update.js.map +1 -0
- package/dist/esm/app-update/types.d.ts +58 -0
- package/dist/esm/app-update/types.js +12 -0
- package/dist/esm/app-update/types.js.map +1 -0
- package/dist/esm/background-update/background-scheduler.d.ts +17 -0
- package/dist/esm/background-update/background-scheduler.js +195 -0
- package/dist/esm/background-update/background-scheduler.js.map +1 -0
- package/dist/esm/background-update/index.d.ts +3 -0
- package/dist/esm/background-update/index.js +3 -0
- package/dist/esm/background-update/index.js.map +1 -0
- package/dist/esm/background-update/notification-manager.d.ts +29 -0
- package/dist/esm/background-update/notification-manager.js +89 -0
- package/dist/esm/background-update/notification-manager.js.map +1 -0
- package/dist/esm/core/analytics.d.ts +70 -0
- package/dist/esm/core/analytics.js +137 -0
- package/dist/esm/core/analytics.js.map +1 -0
- package/dist/esm/core/cache-manager.d.ts +72 -0
- package/dist/esm/core/cache-manager.js +275 -0
- package/dist/esm/core/cache-manager.js.map +1 -0
- package/dist/esm/core/config.d.ts +48 -0
- package/dist/esm/core/config.js +83 -0
- package/dist/esm/core/config.js.map +1 -0
- package/dist/esm/core/errors.d.ts +51 -0
- package/dist/esm/core/errors.js +80 -0
- package/dist/esm/core/errors.js.map +1 -0
- package/dist/esm/core/logger.d.ts +21 -0
- package/dist/esm/core/logger.js +109 -0
- package/dist/esm/core/logger.js.map +1 -0
- package/dist/esm/core/performance.d.ts +53 -0
- package/dist/esm/core/performance.js +140 -0
- package/dist/esm/core/performance.js.map +1 -0
- package/dist/esm/core/plugin-manager.d.ts +66 -0
- package/dist/esm/core/plugin-manager.js +148 -0
- package/dist/esm/core/plugin-manager.js.map +1 -0
- package/dist/esm/core/security.d.ts +93 -0
- package/dist/esm/core/security.js +315 -0
- package/dist/esm/core/security.js.map +1 -0
- package/dist/esm/definitions.d.ts +639 -0
- package/dist/esm/definitions.js +103 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.js +16 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/live-update/bundle-manager.d.ts +94 -0
- package/dist/esm/live-update/bundle-manager.js +310 -0
- package/dist/esm/live-update/bundle-manager.js.map +1 -0
- package/dist/esm/live-update/certificate-pinning.d.ts +38 -0
- package/dist/esm/live-update/certificate-pinning.js +78 -0
- package/dist/esm/live-update/certificate-pinning.js.map +1 -0
- package/dist/esm/live-update/download-manager.d.ts +67 -0
- package/dist/esm/live-update/download-manager.js +319 -0
- package/dist/esm/live-update/download-manager.js.map +1 -0
- package/dist/esm/live-update/update-manager.d.ts +52 -0
- package/dist/esm/live-update/update-manager.js +294 -0
- package/dist/esm/live-update/update-manager.js.map +1 -0
- package/dist/esm/live-update/version-manager.d.ts +84 -0
- package/dist/esm/live-update/version-manager.js +335 -0
- package/dist/esm/live-update/version-manager.js.map +1 -0
- package/dist/esm/plugin.d.ts +6 -0
- package/dist/esm/plugin.js +283 -0
- package/dist/esm/plugin.js.map +1 -0
- package/dist/esm/security/crypto.d.ts +25 -0
- package/dist/esm/security/crypto.js +70 -0
- package/dist/esm/security/crypto.js.map +1 -0
- package/dist/esm/security/validator.d.ts +60 -0
- package/dist/esm/security/validator.js +143 -0
- package/dist/esm/security/validator.js.map +1 -0
- package/dist/esm/web.d.ts +74 -0
- package/dist/esm/web.js +595 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +2 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.esm.js +2 -0
- package/dist/plugin.esm.js.map +1 -0
- package/dist/plugin.js +3 -0
- package/dist/plugin.js.map +1 -0
- package/docs/APP_REVIEW_GUIDE.md +768 -0
- package/docs/BUNDLE_SIGNING.md +264 -0
- package/docs/LIVE_UPDATES_GUIDE.md +650 -0
- package/docs/MIGRATION.md +192 -0
- package/docs/NATIVE_UPDATES_GUIDE.md +694 -0
- package/docs/QUICK_START.md +606 -0
- package/docs/README.md +111 -0
- package/docs/REMAINING_FEATURES.md +139 -0
- package/docs/api/app-review-api.md +259 -0
- package/docs/api/app-update-api.md +238 -0
- package/docs/api/events-api.md +451 -0
- package/docs/api/live-update-api.md +265 -0
- package/docs/background-updates.md +392 -0
- package/docs/examples/advanced-scenarios.md +410 -0
- package/docs/examples/basic-usage.md +185 -0
- package/docs/features/app-reviews.md +975 -0
- package/docs/features/app-updates.md +785 -0
- package/docs/features/live-updates.md +633 -0
- package/docs/getting-started/configuration.md +468 -0
- package/docs/getting-started/installation.md +209 -0
- package/docs/getting-started/quick-start.md +379 -0
- package/docs/guides/deployment-guide.md +333 -0
- package/docs/guides/migration-from-codepush.md +142 -0
- package/docs/guides/security-best-practices.md +1057 -0
- package/docs/guides/testing-guide.md +373 -0
- package/docs/production-readiness.md +478 -0
- package/docs/security/certificate-pinning.md +122 -0
- package/docs/server-requirements.md +147 -0
- package/ios/Plugin/AppReview/AppReviewPlugin.swift +158 -0
- package/ios/Plugin/AppUpdate/AppUpdatePlugin.swift +234 -0
- package/ios/Plugin/BackgroundUpdate/BackgroundNotificationManager.swift +329 -0
- package/ios/Plugin/BackgroundUpdate/BackgroundUpdatePlugin.swift +396 -0
- package/ios/Plugin/CapacitorNativeUpdatePlugin.m +45 -0
- package/ios/Plugin/CapacitorNativeUpdatePlugin.swift +190 -0
- package/ios/Plugin/Info.plist +43 -0
- package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +689 -0
- package/ios/Plugin/LiveUpdate/WebViewConfiguration.swift +45 -0
- package/ios/Plugin/Security/SecurityManager.swift +289 -0
- package/package.json +90 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Migration Guide
|
|
2
|
+
|
|
3
|
+
## Migrating from Other Update Solutions
|
|
4
|
+
|
|
5
|
+
### From Capacitor Live Updates (Official)
|
|
6
|
+
|
|
7
|
+
If you're migrating from the official Capacitor Live Updates plugin:
|
|
8
|
+
|
|
9
|
+
1. **Update imports**:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
// Before
|
|
13
|
+
import { LiveUpdates } from '@capacitor/live-updates';
|
|
14
|
+
|
|
15
|
+
// After
|
|
16
|
+
import { CapacitorNativeUpdate } from 'capacitor-native-update';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
2. **Update configuration**:
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
// Before
|
|
23
|
+
await LiveUpdates.configure({
|
|
24
|
+
appId: 'your-app-id',
|
|
25
|
+
channel: 'production',
|
|
26
|
+
autoUpdateMethod: 'background',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// After
|
|
30
|
+
await CapacitorNativeUpdate.configure({
|
|
31
|
+
liveUpdate: {
|
|
32
|
+
appId: 'your-app-id',
|
|
33
|
+
serverUrl: 'https://your-server.com',
|
|
34
|
+
channel: 'production',
|
|
35
|
+
updateStrategy: 'background',
|
|
36
|
+
publicKey: 'your-public-key',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
3. **Update method calls**:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
// Before
|
|
45
|
+
const result = await LiveUpdates.sync();
|
|
46
|
+
|
|
47
|
+
// After
|
|
48
|
+
const result = await CapacitorNativeUpdate.sync();
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### From Capgo Capacitor Updater
|
|
52
|
+
|
|
53
|
+
If you're migrating from @capgo/capacitor-updater:
|
|
54
|
+
|
|
55
|
+
1. **Bundle management differences**:
|
|
56
|
+
- Our plugin uses a different bundle storage mechanism
|
|
57
|
+
- You'll need to re-download any active bundles
|
|
58
|
+
- Bundle IDs are generated differently
|
|
59
|
+
|
|
60
|
+
2. **API differences**:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// Capgo
|
|
64
|
+
import { CapacitorUpdater } from '@capgo/capacitor-updater';
|
|
65
|
+
await CapacitorUpdater.download({ url, version });
|
|
66
|
+
|
|
67
|
+
// Capacitor Native Update
|
|
68
|
+
import { CapacitorNativeUpdate } from 'capacitor-native-update';
|
|
69
|
+
await CapacitorNativeUpdate.download({
|
|
70
|
+
url,
|
|
71
|
+
version,
|
|
72
|
+
checksum: 'required-checksum',
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
3. **Security enhancements**:
|
|
77
|
+
- Checksum is now required for all downloads
|
|
78
|
+
- HTTPS is enforced by default
|
|
79
|
+
- Public key verification is built-in
|
|
80
|
+
|
|
81
|
+
### From Ionic Appflow
|
|
82
|
+
|
|
83
|
+
If you're migrating from Ionic Appflow:
|
|
84
|
+
|
|
85
|
+
1. **Self-hosted server required**:
|
|
86
|
+
- Unlike Appflow, this plugin requires your own update server
|
|
87
|
+
- See our server implementation guide for details
|
|
88
|
+
|
|
89
|
+
2. **Channel management**:
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
// Similar channel concept
|
|
93
|
+
await CapacitorNativeUpdate.setChannel('production');
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
3. **Additional features**:
|
|
97
|
+
- Native app update checks
|
|
98
|
+
- In-app review integration
|
|
99
|
+
- More granular security controls
|
|
100
|
+
|
|
101
|
+
## Breaking Changes
|
|
102
|
+
|
|
103
|
+
### Version 1.0.0
|
|
104
|
+
|
|
105
|
+
This is the initial release, but here are key differences from similar plugins:
|
|
106
|
+
|
|
107
|
+
1. **Required parameters**:
|
|
108
|
+
- `checksum` is required for all bundle downloads
|
|
109
|
+
- `serverUrl` must use HTTPS (unless explicitly disabled)
|
|
110
|
+
|
|
111
|
+
2. **Security by default**:
|
|
112
|
+
- HTTPS enforcement is on by default
|
|
113
|
+
- Signature verification is recommended
|
|
114
|
+
- Input validation cannot be disabled
|
|
115
|
+
|
|
116
|
+
3. **Unified API**:
|
|
117
|
+
- All update types (live, native, reviews) in one plugin
|
|
118
|
+
- Single configuration object
|
|
119
|
+
- Consistent error handling
|
|
120
|
+
|
|
121
|
+
## Data Migration
|
|
122
|
+
|
|
123
|
+
If you have existing bundles from another solution:
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
// Clear old data and start fresh
|
|
127
|
+
await CapacitorNativeUpdate.reset();
|
|
128
|
+
|
|
129
|
+
// Or manually migrate bundles
|
|
130
|
+
const oldBundles = getOldBundles(); // Your migration logic
|
|
131
|
+
for (const bundle of oldBundles) {
|
|
132
|
+
// Re-download with new security requirements
|
|
133
|
+
await CapacitorNativeUpdate.download({
|
|
134
|
+
url: bundle.url,
|
|
135
|
+
version: bundle.version,
|
|
136
|
+
checksum: await calculateChecksum(bundle.url),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Configuration Migration
|
|
142
|
+
|
|
143
|
+
### Old Configuration Patterns
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
// CodePush style
|
|
147
|
+
codePush.sync({
|
|
148
|
+
deploymentKey: 'key',
|
|
149
|
+
installMode: codePush.InstallMode.IMMEDIATE,
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// Convert to:
|
|
153
|
+
await CapacitorNativeUpdate.sync({
|
|
154
|
+
updateMode: 'immediate',
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Environment-Specific Config
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
const config = {
|
|
162
|
+
liveUpdate: {
|
|
163
|
+
serverUrl: process.env.UPDATE_SERVER_URL,
|
|
164
|
+
channel: process.env.UPDATE_CHANNEL || 'production',
|
|
165
|
+
publicKey: process.env.UPDATE_PUBLIC_KEY,
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
await CapacitorNativeUpdate.configure(config);
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Troubleshooting Migration
|
|
173
|
+
|
|
174
|
+
### Common Issues
|
|
175
|
+
|
|
176
|
+
1. **"Checksum required" error**:
|
|
177
|
+
- Calculate SHA-256 checksum of your bundles
|
|
178
|
+
- Include in download request
|
|
179
|
+
|
|
180
|
+
2. **"HTTPS required" error**:
|
|
181
|
+
- Update server URLs to use HTTPS
|
|
182
|
+
- Or disable enforcement (not recommended)
|
|
183
|
+
|
|
184
|
+
3. **Bundle compatibility**:
|
|
185
|
+
- Bundles from other systems won't work directly
|
|
186
|
+
- Re-package and sign your bundles
|
|
187
|
+
|
|
188
|
+
### Getting Help
|
|
189
|
+
|
|
190
|
+
- Check our [example app](../example) for implementation patterns
|
|
191
|
+
- Review the [API documentation](../API.md)
|
|
192
|
+
- File issues on GitHub for migration problems
|