native-update 3.1.2 → 3.1.3
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/AI-INTEGRATION-GUIDE.md +15 -10
- package/Readme.md +35 -35
- package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +88 -12
- package/android/src/main/java/com/aoneahsan/nativeupdate/NativeUpdatePlugin.kt +45 -18
- package/dist/esm/definitions.d.ts +8 -0
- package/dist/esm/plugin.js +16 -2
- package/dist/plugin.cjs.js +1 -1
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.js +2 -2
- package/docs/CHANGELOG.md +73 -0
- package/docs/KNOWN_LIMITATIONS.md +2 -2
- package/docs/MIGRATION.md +1 -1
- package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +64 -8
- package/ios/Plugin/NativeUpdatePlugin.swift +39 -13
- package/package.json +8 -3
- package/docs/AGENTS.md +0 -47
- package/docs/APP_REVIEW_GUIDE.md +0 -768
- package/docs/BUNDLE_SIGNING.md +0 -277
- package/docs/CLAUDE.md +0 -110
- package/docs/COMPREHENSIVE_AUDIT_REPORT.md +0 -526
- package/docs/DEPLOY_NOTES.md +0 -116
- package/docs/EXAMPLE_APPS_SIMPLIFICATION_PLAN.md +0 -384
- package/docs/EXAMPLE_APPS_SIMPLIFICATION_TRACKER.md +0 -390
- package/docs/LIVE_UPDATES_GUIDE.md +0 -675
- package/docs/MANUAL-TASKS.md +0 -30
- package/docs/MARKETING_WEBSITE_TRACKER.md +0 -677
- package/docs/NATIVE_UPDATES_GUIDE.md +0 -695
- package/docs/PACKAGES.md +0 -167
- package/docs/PERFORMANCE.md +0 -110
- package/docs/PROJECT_COMPLETION_TRACKER.md +0 -411
- package/docs/QUICK_START.md +0 -595
- package/docs/README.md +0 -130
- package/docs/REMAINING_FEATURES.md +0 -192
- package/docs/ROADMAP.md +0 -295
- package/docs/SECURITY-IF-REPO-PUBLIC.md +0 -232
- package/docs/SECURITY.md +0 -356
- package/docs/TESTING_REQUIREMENTS.md +0 -201
- package/docs/ai-knowledge-base/00-project-profile.md +0 -38
- package/docs/ai-knowledge-base/01-features.md +0 -46
- package/docs/ai-knowledge-base/02-routes.md +0 -72
- package/docs/ai-knowledge-base/03-tech-stack.md +0 -57
- package/docs/ai-knowledge-base/README.md +0 -23
- package/docs/analytics-tracking.md +0 -37
- package/docs/api/API.md +0 -558
- package/docs/api/FEATURES.md +0 -414
- package/docs/api/app-review-api.md +0 -239
- package/docs/api/app-update-api.md +0 -154
- package/docs/api/background-update-api.md +0 -170
- package/docs/api/events-api.md +0 -323
- package/docs/api/live-update-api.md +0 -258
- package/docs/archive/MARKETING_WEBSITE_PLAN.md +0 -659
- package/docs/background-updates.md +0 -392
- package/docs/capacitor-official-plugins.md +0 -46
- package/docs/capawesome-plugins.md +0 -29
- package/docs/cli-reference.md +0 -321
- package/docs/deployment/HOSTINGER_DEPLOY.md +0 -370
- package/docs/deployment/PRODUCTION-DEPLOY-CHECKLIST.md +0 -184
- package/docs/docs-site/plan.md +0 -201
- package/docs/docs-site/scope.md +0 -127
- package/docs/docs-site/tracker.json +0 -235
- package/docs/error-handling-tracking.md +0 -37
- package/docs/examples/advanced-scenarios.md +0 -394
- package/docs/examples/android-manifest-example.xml +0 -77
- package/docs/examples/basic-usage.md +0 -206
- package/docs/examples/node-express-backend-example.md +0 -28
- package/docs/examples/react-capacitor-example.md +0 -29
- package/docs/features/app-reviews.md +0 -975
- package/docs/features/app-updates.md +0 -785
- package/docs/features/e2e-full-verification/00-overview.md +0 -99
- package/docs/features/e2e-full-verification/00-tracker.json +0 -284
- package/docs/features/e2e-full-verification/phase01-backend-schema-fixes.md +0 -183
- package/docs/features/e2e-full-verification/phase02-test-auth.md +0 -176
- package/docs/features/e2e-full-verification/phase03-api-test-coverage.md +0 -63
- package/docs/features/e2e-full-verification/phase04-frontend-package-contract-audit.md +0 -73
- package/docs/features/e2e-full-verification/phase05-browser-e2e-matrix.md +0 -69
- package/docs/features/e2e-full-verification/phase06-deploy-prod-smoke.md +0 -51
- package/docs/features/e2e-full-verification/results/phase01-drift-report.md +0 -50
- package/docs/features/e2e-full-verification/results/phase03-coverage-matrix.md +0 -215
- package/docs/features/e2e-full-verification/results/phase04-frontend-contract.md +0 -139
- package/docs/features/e2e-full-verification/results/phase05-e2e-results.md +0 -99
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-01-dashboard.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-02-signup.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-03-settings-persisted.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04a-app-created.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04b-duplicate-bundle-422.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-05-plan-limit-403.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08a-upload-graceful-fail.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08b-builds-list.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-10-rollout-25pct.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-11-analytics.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-12-drive-disconnected.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-13-pricing.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-14-isolation-403.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15a-admin-overview.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15b-regular-user-admin-redirect.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-16a-delete-dialog.png +0 -0
- package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-17-mobile-375.png +0 -0
- package/docs/features/e2e-full-verification/results/route-list.json +0 -1
- package/docs/features/laravel-nova-backend/ASSESSMENT-SUMMARY.md +0 -96
- package/docs/features/laravel-nova-backend/IMPLEMENTATION-PLAN.md +0 -504
- package/docs/features/laravel-nova-backend/progress-tracker.json +0 -184
- package/docs/features/live-updates.md +0 -642
- package/docs/features/queues-and-emails/00-overview.md +0 -41
- package/docs/features/queues-and-emails/00-tracker.json +0 -99
- package/docs/features/queues-and-emails/phase01-foundation.md +0 -15
- package/docs/features/queues-and-emails/phase02-queued-jobs.md +0 -19
- package/docs/features/queues-and-emails/phase03-transactional-emails.md +0 -16
- package/docs/features/queues-and-emails/phase04-quota-ops.md +0 -17
- package/docs/features/queues-and-emails/phase05-async-build-processing-DECISION.md +0 -16
- package/docs/features/queues-and-emails/phase06-verify-deploy.md +0 -17
- package/docs/getting-started/configuration.md +0 -469
- package/docs/getting-started/installation.md +0 -300
- package/docs/getting-started/quick-start.md +0 -430
- package/docs/guides/BACKEND_TEMPLATES_GUIDE.md +0 -183
- package/docs/guides/admin-panel.md +0 -268
- package/docs/guides/channel-management.md +0 -343
- package/docs/guides/dashboard-guide.md +0 -365
- package/docs/guides/deployment-guide.md +0 -335
- package/docs/guides/end-to-end-workflow.md +0 -491
- package/docs/guides/key-management.md +0 -284
- package/docs/guides/migration-from-codepush.md +0 -145
- package/docs/guides/security-best-practices.md +0 -1057
- package/docs/guides/testing-guide.md +0 -346
- package/docs/guides/troubleshooting.md +0 -482
- package/docs/package-audit.md +0 -41
- package/docs/plans/PLANNING_COMPLETE_SUMMARY.md +0 -361
- package/docs/plans/TASK_1_ANDROID_EXAMPLE_APP.md +0 -401
- package/docs/plans/TASK_2_API_ENDPOINTS.md +0 -856
- package/docs/plans/TASK_2_DASHBOARD_UI_UX.md +0 -820
- package/docs/plans/TASK_2_DATABASE_SCHEMA.md +0 -704
- package/docs/plans/TASK_2_GOOGLE_DRIVE_INTEGRATION.md +0 -646
- package/docs/plans/TASK_2_SAAS_ARCHITECTURE.md +0 -587
- package/docs/plans/TASK_2_USER_AUTHENTICATION.md +0 -600
- package/docs/play-store/ASO-METADATA.md +0 -5
- package/docs/play-store/DATA-SAFETY.md +0 -5
- package/docs/play-store/DECLARATIONS.md +0 -5
- package/docs/play-store/README.md +0 -27
- package/docs/play-store/RELEASE-NOTES.md +0 -99
- package/docs/play-store/RELEASE-STEPS.md +0 -6
- package/docs/play-store/STORE-LISTING.md +0 -7
- package/docs/play-store/SUBMISSION-CHECKLIST.md +0 -5
- package/docs/production-readiness.md +0 -475
- package/docs/project-audit/2026-05-16/00-FINALIZATION-PLAN.md +0 -123
- package/docs/project-audit/2026-05-16/01-BATCH-PLAN.md +0 -227
- package/docs/project-audit/2026-05-16/02-AUDIT-FINDINGS.md +0 -144
- package/docs/project-audit/2026-05-16/sessions/batch-01.md +0 -42
- package/docs/project-audit/2026-05-16/sessions/batch-02.md +0 -74
- package/docs/project-audit/2026-05-16/sessions/batch-03.md +0 -71
- package/docs/project-audit/2026-05-16/sessions/batch-04.md +0 -88
- package/docs/project-audit/2026-05-16/sessions/batch-05.md +0 -63
- package/docs/project-audit/2026-05-16/sessions/batch-06.md +0 -103
- package/docs/project-audit/2026-05-16/sessions/batch-07.md +0 -61
- package/docs/project-audit/2026-05-16/sessions/batch-08.md +0 -101
- package/docs/project-audit/2026-05-16/sessions/batch-09.md +0 -105
- package/docs/project-audit/2026-05-16/sessions/batch-10.md +0 -102
- package/docs/project-audit/AUDIT-HISTORY.md +0 -74
- package/docs/project-audit/BATCH-PLAN.md +0 -168
- package/docs/project-audit/MARKETING-WEBSITE-FINDINGS-2026-05-11.md +0 -73
- package/docs/project-audit/PRODUCTION-READINESS-AUDIT-2026-05-08.md +0 -275
- package/docs/project-finalization/00-tracker.json +0 -60
- package/docs/project-knowledge-base/01-system-overview.md +0 -227
- package/docs/project-knowledge-base/02-routes-pages-forms-users.md +0 -352
- package/docs/project-knowledge-base/03-tech-stack-modules-services.md +0 -379
- package/docs/project-knowledge-base/04-data-models-integrations.md +0 -244
- package/docs/project-knowledge-base/05-docs-corpus-inventory.md +0 -256
- package/docs/project-knowledge-base/06-operations-testing-legal-content.md +0 -208
- package/docs/project-knowledge-base/README.md +0 -103
- package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-05-19.md +0 -81
- package/docs/reports/AUDIT_SUMMARY_2025-12-26.md +0 -203
- package/docs/reports/CLAUDE-CODE-COMPLETION-PROMPT.md +0 -403
- package/docs/reports/CLAUDE_CODE_PROMPT.md +0 -29
- package/docs/reports/CODEBASE_STATUS_REPORT.md +0 -272
- package/docs/reports/COMPLETE_VERIFICATION.md +0 -106
- package/docs/reports/COMPREHENSIVE-PROJECT-AUDIT-2026-02-24.md +0 -747
- package/docs/reports/EVENT_FLOW_VERIFICATION.md +0 -80
- package/docs/reports/EXAMPLE_APPS_SIMPLIFICATION_COMPLETE.md +0 -369
- package/docs/reports/FINAL_STATUS.md +0 -122
- package/docs/reports/FINAL_VERIFICATION_CHECKLIST.md +0 -425
- package/docs/reports/MARKETING_WEBSITE_COMPLETE.md +0 -466
- package/docs/reports/PACKAGE_COMPLETENESS_REPORT.md +0 -130
- package/docs/reports/PRODUCTION_STATUS.md +0 -115
- package/docs/reports/PROJECT_RESTRUCTURE_2025-12-27.md +0 -287
- package/docs/reports/PROJECT_RESTRUCTURE_FINAL_SUMMARY.md +0 -464
- package/docs/reports/PUBLISHING_VERIFICATION.md +0 -144
- package/docs/reports/RELEASE_READY_SUMMARY.md +0 -99
- package/docs/reports/claude-completion.json +0 -241
- package/docs/rules-tracker.md +0 -102
- package/docs/security/PRE-LAUNCH-PENTEST-CHECKLIST.md +0 -116
- package/docs/security/certificate-pinning.md +0 -122
- package/docs/seo-aeo-rules.json +0 -3043
- package/docs/social-media-marketing/README.md +0 -81
- package/docs/social-media-marketing/posts-batch-01.md +0 -613
- package/docs/social-media-marketing/posts-batch-02.md +0 -528
- package/docs/social-media-marketing/whatsapp-messages-batch-01.md +0 -458
- package/docs/social-media-marketing/whatsapp-status-batch-01.md +0 -355
- package/docs/tracking/IMPLEMENTATION_TRACKER.md +0 -303
- package/docs/tracking/capacitor-rollout-note-2026-03-01.md +0 -21
- package/docs/tracking/completion-tracker-2026-02-24.json +0 -174
- package/docs/tracking/finalization-2026-05-16-tracker.json +0 -346
- package/docs/tracking/full-audit-tracker.json +0 -121
- package/docs/tracking/production-readiness-audit-tracker.json +0 -429
- package/docs/tracking/seo-checklist-tracker.json +0 -333
|
@@ -1,642 +0,0 @@
|
|
|
1
|
-
# Live Updates (OTA)
|
|
2
|
-
|
|
3
|
-
> **⚠️ Backend Infrastructure Required**
|
|
4
|
-
>
|
|
5
|
-
> Live Updates require a complete backend infrastructure that you must build:
|
|
6
|
-
> - **Update Server**: Host and serve update bundles
|
|
7
|
-
> - **Bundle Generation**: CI/CD pipeline to create and sign bundles
|
|
8
|
-
> - **Version Management**: Track versions, channels, and rollbacks
|
|
9
|
-
> - **Security Infrastructure**: Implement signing and verification
|
|
10
|
-
> - **CDN/Storage**: Distribute bundles globally
|
|
11
|
-
>
|
|
12
|
-
> This plugin provides the client-side implementation only. Without the backend, Live Updates will not function.
|
|
13
|
-
|
|
14
|
-
Live Updates, also known as Over-The-Air (OTA) updates, allow you to deploy JavaScript, HTML, and CSS changes to your app instantly without going through app store review processes. This feature is perfect for bug fixes, content updates, and minor feature additions.
|
|
15
|
-
|
|
16
|
-
## How Live Updates Work
|
|
17
|
-
|
|
18
|
-
1. **Bundle Creation**: Your web assets are packaged into a bundle with metadata
|
|
19
|
-
2. **Version Check**: The app checks for new versions on your update server
|
|
20
|
-
3. **Download**: New bundles are downloaded in the background
|
|
21
|
-
4. **Verification**: Checksums and signatures are validated for security
|
|
22
|
-
5. **Installation**: The update is applied based on your configured strategy
|
|
23
|
-
6. **Activation**: The app reloads with the new bundle
|
|
24
|
-
|
|
25
|
-
## Key Features
|
|
26
|
-
|
|
27
|
-
### 🚀 Instant Deployment
|
|
28
|
-
|
|
29
|
-
- Deploy updates within minutes
|
|
30
|
-
- No app store review delays
|
|
31
|
-
- Fix critical bugs immediately
|
|
32
|
-
|
|
33
|
-
### 🔒 Secure Updates
|
|
34
|
-
|
|
35
|
-
- Cryptographic signature verification
|
|
36
|
-
- Checksum validation
|
|
37
|
-
- HTTPS enforcement
|
|
38
|
-
- Certificate pinning support
|
|
39
|
-
|
|
40
|
-
### 📦 Smart Bundle Management
|
|
41
|
-
|
|
42
|
-
- Automatic cleanup of old bundles
|
|
43
|
-
- Storage usage optimization
|
|
44
|
-
- Version history tracking
|
|
45
|
-
- Rollback capabilities
|
|
46
|
-
|
|
47
|
-
### 🎯 Targeted Deployments
|
|
48
|
-
|
|
49
|
-
- Multiple update channels
|
|
50
|
-
- Gradual rollouts
|
|
51
|
-
- A/B testing support
|
|
52
|
-
- User segmentation
|
|
53
|
-
|
|
54
|
-
## Implementation Guide
|
|
55
|
-
|
|
56
|
-
### Basic Implementation
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
// 1. Configure live updates
|
|
60
|
-
await NativeUpdate.configure({
|
|
61
|
-
liveUpdate: {
|
|
62
|
-
appId: 'com.myapp.example',
|
|
63
|
-
serverUrl: 'https://updates.myserver.com',
|
|
64
|
-
autoUpdate: true,
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// 2. Sync updates (automatic with autoUpdate: true)
|
|
69
|
-
const result = await NativeUpdate.sync();
|
|
70
|
-
|
|
71
|
-
// 3. Handle the result
|
|
72
|
-
switch (result.status) {
|
|
73
|
-
case 'UPDATE_INSTALLED':
|
|
74
|
-
console.log('Update installed:', result.bundle.version);
|
|
75
|
-
break;
|
|
76
|
-
case 'UP_TO_DATE':
|
|
77
|
-
console.log('App is up to date');
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Advanced Implementation
|
|
83
|
-
|
|
84
|
-
```typescript
|
|
85
|
-
class LiveUpdateManager {
|
|
86
|
-
private updateAvailable = false;
|
|
87
|
-
|
|
88
|
-
async initialize() {
|
|
89
|
-
// Configure with advanced options
|
|
90
|
-
await NativeUpdate.configure({
|
|
91
|
-
liveUpdate: {
|
|
92
|
-
appId: 'com.myapp.example',
|
|
93
|
-
serverUrl: 'https://updates.myserver.com',
|
|
94
|
-
channel: this.getUpdateChannel(),
|
|
95
|
-
updateStrategy: 'BACKGROUND',
|
|
96
|
-
publicKey: this.getPublicKey(),
|
|
97
|
-
requireSignature: true,
|
|
98
|
-
checksumAlgorithm: 'SHA-512',
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// Set up listeners
|
|
103
|
-
this.setupUpdateListeners();
|
|
104
|
-
|
|
105
|
-
// Initial check
|
|
106
|
-
await this.checkForUpdates();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
private setupUpdateListeners() {
|
|
110
|
-
// Download progress
|
|
111
|
-
NativeUpdate.addListener(
|
|
112
|
-
'downloadProgress',
|
|
113
|
-
(progress) => {
|
|
114
|
-
this.updateDownloadProgress(progress.percent);
|
|
115
|
-
}
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
// State changes
|
|
119
|
-
NativeUpdate.addListener(
|
|
120
|
-
'updateStateChanged',
|
|
121
|
-
(event) => {
|
|
122
|
-
this.handleStateChange(event);
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
async checkForUpdates() {
|
|
128
|
-
try {
|
|
129
|
-
const latest = await NativeUpdate.getLatest();
|
|
130
|
-
const current = await NativeUpdate.current();
|
|
131
|
-
|
|
132
|
-
if (this.isNewerVersion(latest.version, current.version)) {
|
|
133
|
-
this.updateAvailable = true;
|
|
134
|
-
this.notifyUpdateAvailable(latest);
|
|
135
|
-
}
|
|
136
|
-
} catch (error) {
|
|
137
|
-
console.error('Update check failed:', error);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
async downloadUpdate() {
|
|
142
|
-
if (!this.updateAvailable) return;
|
|
143
|
-
|
|
144
|
-
try {
|
|
145
|
-
const bundle = await NativeUpdate.download({
|
|
146
|
-
version: 'latest',
|
|
147
|
-
onProgress: (progress) => {
|
|
148
|
-
console.log(`Download: ${progress.percent}%`);
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
// Validate the bundle
|
|
153
|
-
const validation = await NativeUpdate.validateUpdate({
|
|
154
|
-
bundleId: bundle.bundleId,
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
if (validation.valid) {
|
|
158
|
-
await this.installUpdate(bundle);
|
|
159
|
-
} else {
|
|
160
|
-
throw new Error('Bundle validation failed');
|
|
161
|
-
}
|
|
162
|
-
} catch (error) {
|
|
163
|
-
this.handleUpdateError(error);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
async installUpdate(bundle: BundleInfo) {
|
|
168
|
-
// Set the bundle as active
|
|
169
|
-
await NativeUpdate.set(bundle);
|
|
170
|
-
|
|
171
|
-
// Notify app is ready (important for rollback mechanism)
|
|
172
|
-
await NativeUpdate.notifyAppReady();
|
|
173
|
-
|
|
174
|
-
// Schedule reload based on user preference
|
|
175
|
-
this.scheduleReload();
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
private scheduleReload() {
|
|
179
|
-
// Option 1: Immediate reload
|
|
180
|
-
// await NativeUpdate.reload();
|
|
181
|
-
|
|
182
|
-
// Option 2: Reload on next app resume
|
|
183
|
-
App.addListener('appStateChange', ({ isActive }) => {
|
|
184
|
-
if (isActive) {
|
|
185
|
-
NativeUpdate.reload();
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
// Option 3: User-triggered reload
|
|
190
|
-
this.showUpdateReadyDialog();
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
## Update Strategies
|
|
196
|
-
|
|
197
|
-
### Immediate Updates
|
|
198
|
-
|
|
199
|
-
Updates are downloaded and applied immediately when detected.
|
|
200
|
-
|
|
201
|
-
```typescript
|
|
202
|
-
{
|
|
203
|
-
updateStrategy: 'IMMEDIATE',
|
|
204
|
-
mandatoryInstallMode: 'IMMEDIATE'
|
|
205
|
-
}
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
**Use when:**
|
|
209
|
-
|
|
210
|
-
- Critical bug fixes
|
|
211
|
-
- Security patches
|
|
212
|
-
- Time-sensitive content
|
|
213
|
-
|
|
214
|
-
### Background Updates
|
|
215
|
-
|
|
216
|
-
Updates download in the background and install based on install mode.
|
|
217
|
-
|
|
218
|
-
```typescript
|
|
219
|
-
{
|
|
220
|
-
updateStrategy: 'BACKGROUND',
|
|
221
|
-
mandatoryInstallMode: 'ON_NEXT_RESTART',
|
|
222
|
-
optionalInstallMode: 'ON_NEXT_RESUME'
|
|
223
|
-
}
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
**Use when:**
|
|
227
|
-
|
|
228
|
-
- Regular feature updates
|
|
229
|
-
- Non-critical improvements
|
|
230
|
-
- Large bundle sizes
|
|
231
|
-
|
|
232
|
-
### Manual Updates
|
|
233
|
-
|
|
234
|
-
Full control over download and installation timing.
|
|
235
|
-
|
|
236
|
-
```typescript
|
|
237
|
-
{
|
|
238
|
-
updateStrategy: 'MANUAL',
|
|
239
|
-
autoUpdate: false
|
|
240
|
-
}
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
**Use when:**
|
|
244
|
-
|
|
245
|
-
- User-initiated updates
|
|
246
|
-
- Specific update windows
|
|
247
|
-
- Custom update UI
|
|
248
|
-
|
|
249
|
-
## Version Management
|
|
250
|
-
|
|
251
|
-
### Semantic Versioning
|
|
252
|
-
|
|
253
|
-
The plugin uses semantic versioning (MAJOR.MINOR.PATCH):
|
|
254
|
-
|
|
255
|
-
```typescript
|
|
256
|
-
// Version comparison
|
|
257
|
-
const current = await NativeUpdate.current();
|
|
258
|
-
console.log(current.version); // "1.2.3"
|
|
259
|
-
|
|
260
|
-
// Check if update is major/minor/patch
|
|
261
|
-
function getUpdateType(oldVersion: string, newVersion: string) {
|
|
262
|
-
const [oldMajor, oldMinor, oldPatch] = oldVersion.split('.').map(Number);
|
|
263
|
-
const [newMajor, newMinor, newPatch] = newVersion.split('.').map(Number);
|
|
264
|
-
|
|
265
|
-
if (newMajor > oldMajor) return 'major';
|
|
266
|
-
if (newMinor > oldMinor) return 'minor';
|
|
267
|
-
if (newPatch > oldPatch) return 'patch';
|
|
268
|
-
return 'none';
|
|
269
|
-
}
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
### Bundle History
|
|
273
|
-
|
|
274
|
-
```typescript
|
|
275
|
-
// List all downloaded bundles
|
|
276
|
-
const bundles = await NativeUpdate.list();
|
|
277
|
-
|
|
278
|
-
bundles.forEach((bundle) => {
|
|
279
|
-
console.log(`Version: ${bundle.version}`);
|
|
280
|
-
console.log(`Downloaded: ${new Date(bundle.downloadTime)}`);
|
|
281
|
-
console.log(`Size: ${bundle.size} bytes`);
|
|
282
|
-
console.log(`Status: ${bundle.status}`);
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
// Clean up old bundles
|
|
286
|
-
await NativeUpdate.delete({
|
|
287
|
-
keepNewest: 3, // Keep only 3 most recent bundles
|
|
288
|
-
});
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
## Rollback Mechanism
|
|
292
|
-
|
|
293
|
-
The plugin includes automatic rollback for failed updates.
|
|
294
|
-
|
|
295
|
-
### Automatic Rollback
|
|
296
|
-
|
|
297
|
-
```typescript
|
|
298
|
-
// Mark app as ready after successful startup
|
|
299
|
-
async function onAppReady() {
|
|
300
|
-
try {
|
|
301
|
-
// Verify app is working correctly
|
|
302
|
-
await performHealthCheck();
|
|
303
|
-
|
|
304
|
-
// Notify that app started successfully
|
|
305
|
-
await NativeUpdate.notifyAppReady();
|
|
306
|
-
} catch (error) {
|
|
307
|
-
// Don't call notifyAppReady() - automatic rollback will occur
|
|
308
|
-
console.error('App startup failed:', error);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
### Manual Rollback
|
|
314
|
-
|
|
315
|
-
```typescript
|
|
316
|
-
// Reset to original bundle
|
|
317
|
-
await NativeUpdate.reset();
|
|
318
|
-
|
|
319
|
-
// Or rollback to previous version
|
|
320
|
-
const bundles = await NativeUpdate.list();
|
|
321
|
-
const previousBundle = bundles[bundles.length - 2];
|
|
322
|
-
if (previousBundle) {
|
|
323
|
-
await NativeUpdate.set(previousBundle);
|
|
324
|
-
await NativeUpdate.reload();
|
|
325
|
-
}
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
## Update Channels
|
|
329
|
-
|
|
330
|
-
Use channels to manage different release tracks.
|
|
331
|
-
|
|
332
|
-
### Channel Configuration
|
|
333
|
-
|
|
334
|
-
```typescript
|
|
335
|
-
// Set channel based on user preference
|
|
336
|
-
const channel = getUserPreference('updateChannel') || 'production';
|
|
337
|
-
await NativeUpdate.setChannel(channel);
|
|
338
|
-
|
|
339
|
-
// Available channels examples:
|
|
340
|
-
// - 'production': Stable releases
|
|
341
|
-
// - 'beta': Beta testing
|
|
342
|
-
// - 'alpha': Early access
|
|
343
|
-
// - 'development': Dev builds
|
|
344
|
-
// - 'staging': Pre-production
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
### Channel-Based Features
|
|
348
|
-
|
|
349
|
-
```typescript
|
|
350
|
-
// Enable features based on channel
|
|
351
|
-
async function getFeatureFlags() {
|
|
352
|
-
const bundle = await NativeUpdate.current();
|
|
353
|
-
|
|
354
|
-
switch (bundle.metadata?.channel) {
|
|
355
|
-
case 'alpha':
|
|
356
|
-
return { experimentalFeatures: true, debugMode: true };
|
|
357
|
-
case 'beta':
|
|
358
|
-
return { experimentalFeatures: true, debugMode: false };
|
|
359
|
-
default:
|
|
360
|
-
return { experimentalFeatures: false, debugMode: false };
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
## Performance Optimization
|
|
366
|
-
|
|
367
|
-
### Bundle Size Optimization
|
|
368
|
-
|
|
369
|
-
1. **Minimize bundle size**:
|
|
370
|
-
|
|
371
|
-
```bash
|
|
372
|
-
# Use production builds
|
|
373
|
-
yarn build -- --mode production
|
|
374
|
-
|
|
375
|
-
# Enable compression
|
|
376
|
-
gzip -9 bundle.js
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
2. **Delta updates** (server-side configuration):
|
|
380
|
-
```typescript
|
|
381
|
-
// Delta updates are handled automatically by the sync() method
|
|
382
|
-
// when the server provides delta patches. The SDK will:
|
|
383
|
-
// - Request delta if available from server
|
|
384
|
-
// - Apply binary diff patches efficiently
|
|
385
|
-
// - Fall back to full download if delta unavailable
|
|
386
|
-
const result = await NativeUpdate.sync();
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
### Download Optimization
|
|
390
|
-
|
|
391
|
-
```typescript
|
|
392
|
-
// Configure optimal download settings
|
|
393
|
-
{
|
|
394
|
-
liveUpdate: {
|
|
395
|
-
// Download only on WiFi
|
|
396
|
-
downloadOnWifiOnly: true,
|
|
397
|
-
|
|
398
|
-
// Limit concurrent downloads
|
|
399
|
-
maxConcurrentDownloads: 1,
|
|
400
|
-
|
|
401
|
-
// Set reasonable timeout
|
|
402
|
-
timeout: 30000,
|
|
403
|
-
|
|
404
|
-
// Enable resume capability
|
|
405
|
-
resumableDownloads: true
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
### Storage Management
|
|
411
|
-
|
|
412
|
-
```typescript
|
|
413
|
-
// Monitor bundle count and clean up old versions
|
|
414
|
-
const bundles = await NativeUpdate.list();
|
|
415
|
-
console.log(`Total bundles: ${bundles.length}`);
|
|
416
|
-
|
|
417
|
-
// Clean up old bundles (keep only recent 5)
|
|
418
|
-
if (bundles.length > 5) {
|
|
419
|
-
// Sort by downloadTime and keep the 5 most recent
|
|
420
|
-
const sortedBundles = bundles.sort((a, b) =>
|
|
421
|
-
new Date(b.downloadTime).getTime() - new Date(a.downloadTime).getTime()
|
|
422
|
-
);
|
|
423
|
-
|
|
424
|
-
const toDelete = sortedBundles.slice(5);
|
|
425
|
-
for (const bundle of toDelete) {
|
|
426
|
-
await NativeUpdate.delete({
|
|
427
|
-
bundleId: bundle.bundleId,
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
## Error Handling
|
|
434
|
-
|
|
435
|
-
### Common Errors and Solutions
|
|
436
|
-
|
|
437
|
-
```typescript
|
|
438
|
-
try {
|
|
439
|
-
await NativeUpdate.sync();
|
|
440
|
-
} catch (error) {
|
|
441
|
-
switch (error.code) {
|
|
442
|
-
case 'NETWORK_ERROR':
|
|
443
|
-
// No internet connection
|
|
444
|
-
showOfflineMessage();
|
|
445
|
-
break;
|
|
446
|
-
|
|
447
|
-
case 'SERVER_ERROR':
|
|
448
|
-
// Update server is down
|
|
449
|
-
scheduleRetry();
|
|
450
|
-
break;
|
|
451
|
-
|
|
452
|
-
case 'CHECKSUM_ERROR':
|
|
453
|
-
// Bundle corrupted
|
|
454
|
-
await NativeUpdate.delete({
|
|
455
|
-
bundleId: error.bundleId,
|
|
456
|
-
});
|
|
457
|
-
break;
|
|
458
|
-
|
|
459
|
-
case 'SIGNATURE_ERROR':
|
|
460
|
-
// Security validation failed
|
|
461
|
-
logSecurityEvent(error);
|
|
462
|
-
break;
|
|
463
|
-
|
|
464
|
-
case 'STORAGE_ERROR':
|
|
465
|
-
// Not enough space
|
|
466
|
-
await cleanupStorage();
|
|
467
|
-
break;
|
|
468
|
-
|
|
469
|
-
case 'VERSION_MISMATCH':
|
|
470
|
-
// Incompatible update
|
|
471
|
-
promptForAppUpdate();
|
|
472
|
-
break;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
### Retry Logic
|
|
478
|
-
|
|
479
|
-
```typescript
|
|
480
|
-
class UpdateRetryManager {
|
|
481
|
-
private retryCount = 0;
|
|
482
|
-
private maxRetries = 3;
|
|
483
|
-
|
|
484
|
-
async syncWithRetry() {
|
|
485
|
-
try {
|
|
486
|
-
await NativeUpdate.sync();
|
|
487
|
-
this.retryCount = 0; // Reset on success
|
|
488
|
-
} catch (error) {
|
|
489
|
-
if (this.shouldRetry(error)) {
|
|
490
|
-
this.retryCount++;
|
|
491
|
-
const delay = this.getRetryDelay();
|
|
492
|
-
|
|
493
|
-
console.log(
|
|
494
|
-
`Retry ${this.retryCount}/${this.maxRetries} in ${delay}ms`
|
|
495
|
-
);
|
|
496
|
-
|
|
497
|
-
setTimeout(() => {
|
|
498
|
-
this.syncWithRetry();
|
|
499
|
-
}, delay);
|
|
500
|
-
} else {
|
|
501
|
-
throw error; // Don't retry
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
private shouldRetry(error: any): boolean {
|
|
507
|
-
return (
|
|
508
|
-
this.retryCount < this.maxRetries &&
|
|
509
|
-
['NETWORK_ERROR', 'TIMEOUT_ERROR', 'SERVER_ERROR'].includes(error.code)
|
|
510
|
-
);
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
private getRetryDelay(): number {
|
|
514
|
-
// Exponential backoff
|
|
515
|
-
return Math.min(1000 * Math.pow(2, this.retryCount), 30000);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
```
|
|
519
|
-
|
|
520
|
-
## Testing Live Updates
|
|
521
|
-
|
|
522
|
-
### Development Testing
|
|
523
|
-
|
|
524
|
-
```typescript
|
|
525
|
-
// Enable development mode
|
|
526
|
-
const devConfig = {
|
|
527
|
-
liveUpdate: {
|
|
528
|
-
appId: 'com.myapp.dev',
|
|
529
|
-
serverUrl: 'http://localhost:3000',
|
|
530
|
-
channel: 'development',
|
|
531
|
-
allowEmulator: true,
|
|
532
|
-
requireSignature: false, // Disable in dev
|
|
533
|
-
autoUpdate: false, // Manual control
|
|
534
|
-
},
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
// Force update check
|
|
538
|
-
await NativeUpdate.sync();
|
|
539
|
-
|
|
540
|
-
// Simulate different scenarios
|
|
541
|
-
await testUpdateScenarios();
|
|
542
|
-
```
|
|
543
|
-
|
|
544
|
-
### Update Server Testing
|
|
545
|
-
|
|
546
|
-
Set up a local update server for testing:
|
|
547
|
-
|
|
548
|
-
```bash
|
|
549
|
-
# See server-example directory
|
|
550
|
-
cd server-example
|
|
551
|
-
yarn install
|
|
552
|
-
yarn dev
|
|
553
|
-
```
|
|
554
|
-
|
|
555
|
-
### Test Scenarios
|
|
556
|
-
|
|
557
|
-
1. **Successful update**
|
|
558
|
-
2. **Network interruption**
|
|
559
|
-
3. **Corrupted bundle**
|
|
560
|
-
4. **Version rollback**
|
|
561
|
-
5. **Storage full**
|
|
562
|
-
6. **Signature mismatch**
|
|
563
|
-
|
|
564
|
-
## Best Practices
|
|
565
|
-
|
|
566
|
-
### 1. Progressive Rollout
|
|
567
|
-
|
|
568
|
-
```typescript
|
|
569
|
-
// Roll out to percentage of users
|
|
570
|
-
function shouldReceiveUpdate(userId: string, percentage: number): boolean {
|
|
571
|
-
const hash = hashCode(userId);
|
|
572
|
-
return hash % 100 < percentage;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
if (shouldReceiveUpdate(user.id, 10)) {
|
|
576
|
-
// 10% rollout
|
|
577
|
-
await NativeUpdate.setChannel('beta');
|
|
578
|
-
}
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
### 2. Update Notifications
|
|
582
|
-
|
|
583
|
-
```typescript
|
|
584
|
-
// Notify users about updates
|
|
585
|
-
NativeUpdate.addListener('updateStateChanged', (event) => {
|
|
586
|
-
if (event.status === 'READY') {
|
|
587
|
-
showNotification({
|
|
588
|
-
title: 'Update Ready',
|
|
589
|
-
body: 'A new version is available. Restart to apply.',
|
|
590
|
-
actions: [
|
|
591
|
-
{ id: 'restart', title: 'Restart Now' },
|
|
592
|
-
{ id: 'later', title: 'Later' },
|
|
593
|
-
],
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
```
|
|
598
|
-
|
|
599
|
-
### 3. Monitoring
|
|
600
|
-
|
|
601
|
-
```typescript
|
|
602
|
-
// Track update metrics
|
|
603
|
-
async function trackUpdateMetrics(result: SyncResult) {
|
|
604
|
-
const metrics = {
|
|
605
|
-
event: 'live_update',
|
|
606
|
-
status: result.status,
|
|
607
|
-
version: result.bundle?.version,
|
|
608
|
-
downloadTime: result.downloadTime,
|
|
609
|
-
installTime: result.installTime,
|
|
610
|
-
bundleSize: result.bundle?.size,
|
|
611
|
-
};
|
|
612
|
-
|
|
613
|
-
await analytics.track(metrics);
|
|
614
|
-
}
|
|
615
|
-
```
|
|
616
|
-
|
|
617
|
-
### 4. Fallback Strategy
|
|
618
|
-
|
|
619
|
-
```typescript
|
|
620
|
-
// Implement fallback for critical features
|
|
621
|
-
async function loadFeature(featureName: string) {
|
|
622
|
-
try {
|
|
623
|
-
// Try loading from update bundle
|
|
624
|
-
return await import(`./features/${featureName}`);
|
|
625
|
-
} catch (error) {
|
|
626
|
-
// Fall back to shipped version
|
|
627
|
-
console.warn(`Loading fallback for ${featureName}`);
|
|
628
|
-
return await import(`./features-fallback/${featureName}`);
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
```
|
|
632
|
-
|
|
633
|
-
## Next Steps
|
|
634
|
-
|
|
635
|
-
- Set up your update server (see backend-template folder)
|
|
636
|
-
- Implement [Security Best Practices](https://nativeupdate.aoneahsan.com/docs/guides/security-best-practices)
|
|
637
|
-
- Configure [App Updates](https://nativeupdate.aoneahsan.com/docs/features/app-updates) for native changes
|
|
638
|
-
- Explore [API Reference](https://nativeupdate.aoneahsan.com/docs/api/live-update-api)
|
|
639
|
-
|
|
640
|
-
---
|
|
641
|
-
|
|
642
|
-
Made with ❤️ by Ahsan Mahmood
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Queues + Emails — Overview
|
|
2
|
-
|
|
3
|
-
**Full implementation plan (complete code per task): `/Users/pc/.claude/plans/queues-and-emails-native-update.md`**
|
|
4
|
-
Tracker: `00-tracker.json` (resume point). Model workflow: Fable 5 planned; Opus 4.8 implements; Fable 5 reviews.
|
|
5
|
-
|
|
6
|
-
## What + why
|
|
7
|
-
|
|
8
|
-
The backend queues nothing today (`QUEUE_CONNECTION=database`, jobs tables exist + empty on prod)
|
|
9
|
-
and sends zero email (`MAIL_*` unset → log mailer). This feature:
|
|
10
|
-
|
|
11
|
-
1. **Queue worker with no new cron** — scheduler-driven `queue:work --stop-when-empty` every
|
|
12
|
-
minute from `routes/console.php` (the existing `schedule:run` cron drives it). Supersedes the
|
|
13
|
-
earlier advice to add a second cron on the server.
|
|
14
|
-
2. **Transactional email layer** — queued notifications: welcome, admin new-user alert,
|
|
15
|
-
subscription lifecycle (activated/cancelled/suspended/expired/payment_failed), account
|
|
16
|
-
suspension, MAU quota warning/exceeded, daily failed-jobs admin alert (that one deliberately
|
|
17
|
-
NOT queued). Transport: **FilesHub email API** (prod — global rule: FilesHub for email sending
|
|
18
|
-
+ file storage; custom `FilesHubTransport`), log (local), array (tests).
|
|
19
|
-
3. **Async PayPal webhook processing** — signature verified sync, handling moved to
|
|
20
|
-
`ProcessPayPalWebhookJob` (unique on event id, 3 tries + backoff), controller ACKs 200 fast.
|
|
21
|
-
4. **Reliable FilesHub cleanup** — `DeleteFilesHubObjectsJob` with retries replaces
|
|
22
|
-
fire-and-forget deletes; fixes a latent bug where deleting a promoted build could destroy the
|
|
23
|
-
FilesHub object a sibling build still serves (zero-copy promotions share `fileshub_public_id`).
|
|
24
|
-
5. **Quota + ops monitoring** — daily `quota:check-mau` (warn at 80%, exceeded at 100%, max once
|
|
25
|
-
per calendar month each) and `queue:alert-failed`; plus `queue:prune-failed` weekly and
|
|
26
|
-
`sanctum:prune-expired` daily.
|
|
27
|
-
|
|
28
|
-
**Deliberately NOT queued:** update-check analytics (stays `afterResponse()` — hottest path),
|
|
29
|
-
`SubscriptionController` PayPal calls (user-interactive). **Deferred:** async build upload
|
|
30
|
-
processing (phase05, owner decision — YAGNI until a real upload timeout is seen).
|
|
31
|
-
|
|
32
|
-
## Acceptance criteria
|
|
33
|
-
|
|
34
|
-
- `vendor/bin/pint --dirty` clean; `php artisan test` fully green (sqlite; MySQL parity for the
|
|
35
|
-
new users migration when available). NO new test files (owner rule) — only side-effect fixes.
|
|
36
|
-
- `php artisan schedule:list` shows: worker every minute, prune-failed weekly, sanctum-prune +
|
|
37
|
-
quota:check-mau + queue:alert-failed daily, analytics:cleanup monthly (existing).
|
|
38
|
-
- Every new env key in `.env.example` with `[REQUIRED*]`/`[OPTIONAL]` tag; local `.env` stays
|
|
39
|
-
no-send (`log` mailer, `sync` queue).
|
|
40
|
-
- Deploy delta appended to `docs/DEPLOY_NOTES.md`; owner-only steps in `docs/MANUAL-TASKS.md`;
|
|
41
|
-
compact doc sync in backend + root CLAUDE/AGENTS. ONE commit per session, pushed.
|