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,142 @@
|
|
|
1
|
+
# Migration Guide: From CodePush to Capacitor Native Update
|
|
2
|
+
|
|
3
|
+
This guide helps you migrate from Microsoft CodePush to Capacitor Native Update.
|
|
4
|
+
|
|
5
|
+
## Key Differences
|
|
6
|
+
|
|
7
|
+
### Architecture
|
|
8
|
+
- **CodePush**: Centralized Microsoft-hosted service
|
|
9
|
+
- **Capacitor Native Update**: Self-hosted solution (you control the infrastructure)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
- **CodePush**: OTA updates only
|
|
13
|
+
- **Capacitor Native Update**: OTA + native app updates + app reviews
|
|
14
|
+
|
|
15
|
+
### Security
|
|
16
|
+
- **CodePush**: Microsoft-managed security
|
|
17
|
+
- **Capacitor Native Update**: Your own security implementation
|
|
18
|
+
|
|
19
|
+
## Migration Steps
|
|
20
|
+
|
|
21
|
+
### 1. Backend Setup
|
|
22
|
+
|
|
23
|
+
First, you need to set up your own update server:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Use our backend template
|
|
27
|
+
cd backend-template
|
|
28
|
+
npm install
|
|
29
|
+
npm start
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 2. Update Your App Code
|
|
33
|
+
|
|
34
|
+
Replace CodePush imports:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
// Old (CodePush)
|
|
38
|
+
import codePush from 'react-native-code-push';
|
|
39
|
+
|
|
40
|
+
// New (Capacitor Native Update)
|
|
41
|
+
import { CapacitorNativeUpdate } from 'capacitor-native-update';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 3. Configure Plugin
|
|
45
|
+
|
|
46
|
+
Replace CodePush configuration:
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// Old (CodePush)
|
|
50
|
+
const codePushOptions = {
|
|
51
|
+
checkFrequency: codePush.CheckFrequency.ON_APP_START,
|
|
52
|
+
deploymentKey: 'YOUR_DEPLOYMENT_KEY',
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// New (Capacitor Native Update)
|
|
56
|
+
await CapacitorNativeUpdate.configure({
|
|
57
|
+
serverUrl: 'https://your-update-server.com',
|
|
58
|
+
channel: 'production',
|
|
59
|
+
autoCheck: true,
|
|
60
|
+
publicKey: 'YOUR_PUBLIC_KEY',
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 4. Update Check Logic
|
|
65
|
+
|
|
66
|
+
Replace update checking:
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// Old (CodePush)
|
|
70
|
+
codePush.sync({
|
|
71
|
+
updateDialog: true,
|
|
72
|
+
installMode: codePush.InstallMode.IMMEDIATE,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// New (Capacitor Native Update)
|
|
76
|
+
const update = await CapacitorNativeUpdate.checkForUpdate();
|
|
77
|
+
if (update.available) {
|
|
78
|
+
await CapacitorNativeUpdate.downloadUpdate();
|
|
79
|
+
await CapacitorNativeUpdate.applyUpdate();
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 5. Bundle Creation
|
|
84
|
+
|
|
85
|
+
Replace release process:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Old (CodePush)
|
|
89
|
+
code-push release-react MyApp ios -d Production
|
|
90
|
+
|
|
91
|
+
# New (Capacitor Native Update)
|
|
92
|
+
node tools/bundle-creator.js create ./www
|
|
93
|
+
node tools/bundle-signer.js sign bundle.zip private-key.pem
|
|
94
|
+
# Upload to your server
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Feature Mapping
|
|
98
|
+
|
|
99
|
+
| CodePush Feature | Capacitor Native Update |
|
|
100
|
+
|-----------------|------------------------|
|
|
101
|
+
| sync() | checkForUpdate() + downloadUpdate() + applyUpdate() |
|
|
102
|
+
| getUpdateMetadata() | getCurrentVersion() |
|
|
103
|
+
| notifyAppReady() | confirmUpdate() |
|
|
104
|
+
| restartApp() | applyUpdate() |
|
|
105
|
+
| clearUpdates() | rollback() |
|
|
106
|
+
|
|
107
|
+
## Migration Checklist
|
|
108
|
+
|
|
109
|
+
- [ ] Set up update server infrastructure
|
|
110
|
+
- [ ] Generate RSA key pair for signing
|
|
111
|
+
- [ ] Update app dependencies
|
|
112
|
+
- [ ] Replace CodePush API calls
|
|
113
|
+
- [ ] Update CI/CD pipeline
|
|
114
|
+
- [ ] Test update flow
|
|
115
|
+
- [ ] Implement rollback strategy
|
|
116
|
+
- [ ] Add monitoring
|
|
117
|
+
|
|
118
|
+
## Benefits After Migration
|
|
119
|
+
|
|
120
|
+
1. **Full Control**: Own your update infrastructure
|
|
121
|
+
2. **No Vendor Lock-in**: Not dependent on Microsoft
|
|
122
|
+
3. **Additional Features**: Native updates and app reviews
|
|
123
|
+
4. **Custom Analytics**: Implement your own tracking
|
|
124
|
+
5. **Flexible Deployment**: Use any CDN or server
|
|
125
|
+
|
|
126
|
+
## Common Issues
|
|
127
|
+
|
|
128
|
+
### Issue: Updates Not Downloading
|
|
129
|
+
- Check server URL is HTTPS
|
|
130
|
+
- Verify CORS configuration
|
|
131
|
+
- Ensure bundle is signed correctly
|
|
132
|
+
|
|
133
|
+
### Issue: Signature Verification Failed
|
|
134
|
+
- Verify public key matches private key
|
|
135
|
+
- Check bundle hasn't been modified
|
|
136
|
+
- Ensure base64 encoding is correct
|
|
137
|
+
|
|
138
|
+
## Need Help?
|
|
139
|
+
|
|
140
|
+
- See [Troubleshooting Guide](../guides/troubleshooting.md)
|
|
141
|
+
- Check [Server Requirements](../server-requirements.md)
|
|
142
|
+
- Review [Security Best Practices](./security-best-practices.md)
|