native-update 3.1.1 → 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.
Files changed (203) hide show
  1. package/AI-INTEGRATION-GUIDE.md +98 -63
  2. package/Readme.md +89 -120
  3. package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +88 -12
  4. package/android/src/main/java/com/aoneahsan/nativeupdate/NativeUpdatePlugin.kt +45 -18
  5. package/cli/package.json +2 -2
  6. package/dist/esm/definitions.d.ts +8 -0
  7. package/dist/esm/plugin.js +16 -2
  8. package/dist/plugin.cjs.js +1 -1
  9. package/dist/plugin.esm.js +1 -1
  10. package/dist/plugin.js +2 -2
  11. package/docs/CHANGELOG.md +108 -0
  12. package/docs/KNOWN_LIMITATIONS.md +2 -2
  13. package/docs/MIGRATION.md +1 -1
  14. package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +64 -8
  15. package/ios/Plugin/NativeUpdatePlugin.swift +39 -13
  16. package/package.json +8 -3
  17. package/docs/AGENTS.md +0 -47
  18. package/docs/APP_REVIEW_GUIDE.md +0 -768
  19. package/docs/BUNDLE_SIGNING.md +0 -277
  20. package/docs/CLAUDE.md +0 -110
  21. package/docs/COMPREHENSIVE_AUDIT_REPORT.md +0 -526
  22. package/docs/DEPLOY_NOTES.md +0 -117
  23. package/docs/EXAMPLE_APPS_SIMPLIFICATION_PLAN.md +0 -384
  24. package/docs/EXAMPLE_APPS_SIMPLIFICATION_TRACKER.md +0 -390
  25. package/docs/LIVE_UPDATES_GUIDE.md +0 -675
  26. package/docs/MANUAL-TASKS.md +0 -30
  27. package/docs/MARKETING_WEBSITE_TRACKER.md +0 -677
  28. package/docs/NATIVE_UPDATES_GUIDE.md +0 -695
  29. package/docs/PACKAGES.md +0 -167
  30. package/docs/PERFORMANCE.md +0 -110
  31. package/docs/PROJECT_COMPLETION_TRACKER.md +0 -411
  32. package/docs/QUICK_START.md +0 -595
  33. package/docs/README.md +0 -130
  34. package/docs/REMAINING_FEATURES.md +0 -192
  35. package/docs/ROADMAP.md +0 -295
  36. package/docs/SECURITY-IF-REPO-PUBLIC.md +0 -232
  37. package/docs/SECURITY.md +0 -356
  38. package/docs/TESTING_REQUIREMENTS.md +0 -201
  39. package/docs/ai-knowledge-base/00-project-profile.md +0 -38
  40. package/docs/ai-knowledge-base/01-features.md +0 -46
  41. package/docs/ai-knowledge-base/02-routes.md +0 -72
  42. package/docs/ai-knowledge-base/03-tech-stack.md +0 -57
  43. package/docs/ai-knowledge-base/README.md +0 -23
  44. package/docs/analytics-tracking.md +0 -37
  45. package/docs/api/API.md +0 -558
  46. package/docs/api/FEATURES.md +0 -414
  47. package/docs/api/app-review-api.md +0 -239
  48. package/docs/api/app-update-api.md +0 -154
  49. package/docs/api/background-update-api.md +0 -170
  50. package/docs/api/events-api.md +0 -323
  51. package/docs/api/live-update-api.md +0 -258
  52. package/docs/archive/MARKETING_WEBSITE_PLAN.md +0 -659
  53. package/docs/background-updates.md +0 -392
  54. package/docs/capacitor-official-plugins.md +0 -46
  55. package/docs/capawesome-plugins.md +0 -29
  56. package/docs/cli-reference.md +0 -321
  57. package/docs/deployment/HOSTINGER_DEPLOY.md +0 -370
  58. package/docs/deployment/PRODUCTION-DEPLOY-CHECKLIST.md +0 -184
  59. package/docs/docs-site/plan.md +0 -201
  60. package/docs/docs-site/scope.md +0 -127
  61. package/docs/docs-site/tracker.json +0 -235
  62. package/docs/error-handling-tracking.md +0 -37
  63. package/docs/examples/advanced-scenarios.md +0 -394
  64. package/docs/examples/android-manifest-example.xml +0 -77
  65. package/docs/examples/basic-usage.md +0 -206
  66. package/docs/examples/node-express-backend-example.md +0 -28
  67. package/docs/examples/react-capacitor-example.md +0 -29
  68. package/docs/features/app-reviews.md +0 -975
  69. package/docs/features/app-updates.md +0 -785
  70. package/docs/features/e2e-full-verification/00-overview.md +0 -99
  71. package/docs/features/e2e-full-verification/00-tracker.json +0 -284
  72. package/docs/features/e2e-full-verification/phase01-backend-schema-fixes.md +0 -183
  73. package/docs/features/e2e-full-verification/phase02-test-auth.md +0 -176
  74. package/docs/features/e2e-full-verification/phase03-api-test-coverage.md +0 -63
  75. package/docs/features/e2e-full-verification/phase04-frontend-package-contract-audit.md +0 -73
  76. package/docs/features/e2e-full-verification/phase05-browser-e2e-matrix.md +0 -69
  77. package/docs/features/e2e-full-verification/phase06-deploy-prod-smoke.md +0 -51
  78. package/docs/features/e2e-full-verification/results/phase01-drift-report.md +0 -50
  79. package/docs/features/e2e-full-verification/results/phase03-coverage-matrix.md +0 -215
  80. package/docs/features/e2e-full-verification/results/phase04-frontend-contract.md +0 -139
  81. package/docs/features/e2e-full-verification/results/phase05-e2e-results.md +0 -99
  82. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-01-dashboard.png +0 -0
  83. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-02-signup.png +0 -0
  84. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-03-settings-persisted.png +0 -0
  85. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04a-app-created.png +0 -0
  86. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04b-duplicate-bundle-422.png +0 -0
  87. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-05-plan-limit-403.png +0 -0
  88. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08a-upload-graceful-fail.png +0 -0
  89. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08b-builds-list.png +0 -0
  90. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-10-rollout-25pct.png +0 -0
  91. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-11-analytics.png +0 -0
  92. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-12-drive-disconnected.png +0 -0
  93. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-13-pricing.png +0 -0
  94. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-14-isolation-403.png +0 -0
  95. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15a-admin-overview.png +0 -0
  96. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15b-regular-user-admin-redirect.png +0 -0
  97. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-16a-delete-dialog.png +0 -0
  98. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-17-mobile-375.png +0 -0
  99. package/docs/features/e2e-full-verification/results/route-list.json +0 -1
  100. package/docs/features/laravel-nova-backend/ASSESSMENT-SUMMARY.md +0 -96
  101. package/docs/features/laravel-nova-backend/IMPLEMENTATION-PLAN.md +0 -504
  102. package/docs/features/laravel-nova-backend/progress-tracker.json +0 -184
  103. package/docs/features/live-updates.md +0 -642
  104. package/docs/features/queues-and-emails/00-overview.md +0 -41
  105. package/docs/features/queues-and-emails/00-tracker.json +0 -99
  106. package/docs/features/queues-and-emails/phase01-foundation.md +0 -15
  107. package/docs/features/queues-and-emails/phase02-queued-jobs.md +0 -19
  108. package/docs/features/queues-and-emails/phase03-transactional-emails.md +0 -16
  109. package/docs/features/queues-and-emails/phase04-quota-ops.md +0 -17
  110. package/docs/features/queues-and-emails/phase05-async-build-processing-DECISION.md +0 -16
  111. package/docs/features/queues-and-emails/phase06-verify-deploy.md +0 -17
  112. package/docs/getting-started/configuration.md +0 -469
  113. package/docs/getting-started/installation.md +0 -300
  114. package/docs/getting-started/quick-start.md +0 -430
  115. package/docs/guides/BACKEND_TEMPLATES_GUIDE.md +0 -183
  116. package/docs/guides/admin-panel.md +0 -268
  117. package/docs/guides/channel-management.md +0 -343
  118. package/docs/guides/dashboard-guide.md +0 -365
  119. package/docs/guides/deployment-guide.md +0 -335
  120. package/docs/guides/end-to-end-workflow.md +0 -491
  121. package/docs/guides/key-management.md +0 -284
  122. package/docs/guides/migration-from-codepush.md +0 -145
  123. package/docs/guides/security-best-practices.md +0 -1057
  124. package/docs/guides/testing-guide.md +0 -346
  125. package/docs/guides/troubleshooting.md +0 -482
  126. package/docs/package-audit.md +0 -41
  127. package/docs/plans/PLANNING_COMPLETE_SUMMARY.md +0 -361
  128. package/docs/plans/TASK_1_ANDROID_EXAMPLE_APP.md +0 -401
  129. package/docs/plans/TASK_2_API_ENDPOINTS.md +0 -856
  130. package/docs/plans/TASK_2_DASHBOARD_UI_UX.md +0 -820
  131. package/docs/plans/TASK_2_DATABASE_SCHEMA.md +0 -704
  132. package/docs/plans/TASK_2_GOOGLE_DRIVE_INTEGRATION.md +0 -646
  133. package/docs/plans/TASK_2_SAAS_ARCHITECTURE.md +0 -587
  134. package/docs/plans/TASK_2_USER_AUTHENTICATION.md +0 -600
  135. package/docs/play-store/ASO-METADATA.md +0 -5
  136. package/docs/play-store/DATA-SAFETY.md +0 -5
  137. package/docs/play-store/DECLARATIONS.md +0 -5
  138. package/docs/play-store/README.md +0 -27
  139. package/docs/play-store/RELEASE-NOTES.md +0 -99
  140. package/docs/play-store/RELEASE-STEPS.md +0 -6
  141. package/docs/play-store/STORE-LISTING.md +0 -7
  142. package/docs/play-store/SUBMISSION-CHECKLIST.md +0 -5
  143. package/docs/production-readiness.md +0 -475
  144. package/docs/project-audit/2026-05-16/00-FINALIZATION-PLAN.md +0 -123
  145. package/docs/project-audit/2026-05-16/01-BATCH-PLAN.md +0 -227
  146. package/docs/project-audit/2026-05-16/02-AUDIT-FINDINGS.md +0 -144
  147. package/docs/project-audit/2026-05-16/sessions/batch-01.md +0 -42
  148. package/docs/project-audit/2026-05-16/sessions/batch-02.md +0 -74
  149. package/docs/project-audit/2026-05-16/sessions/batch-03.md +0 -71
  150. package/docs/project-audit/2026-05-16/sessions/batch-04.md +0 -88
  151. package/docs/project-audit/2026-05-16/sessions/batch-05.md +0 -63
  152. package/docs/project-audit/2026-05-16/sessions/batch-06.md +0 -103
  153. package/docs/project-audit/2026-05-16/sessions/batch-07.md +0 -61
  154. package/docs/project-audit/2026-05-16/sessions/batch-08.md +0 -101
  155. package/docs/project-audit/2026-05-16/sessions/batch-09.md +0 -105
  156. package/docs/project-audit/2026-05-16/sessions/batch-10.md +0 -102
  157. package/docs/project-audit/AUDIT-HISTORY.md +0 -74
  158. package/docs/project-audit/BATCH-PLAN.md +0 -168
  159. package/docs/project-audit/MARKETING-WEBSITE-FINDINGS-2026-05-11.md +0 -73
  160. package/docs/project-audit/PRODUCTION-READINESS-AUDIT-2026-05-08.md +0 -275
  161. package/docs/project-finalization/00-tracker.json +0 -60
  162. package/docs/project-knowledge-base/01-system-overview.md +0 -227
  163. package/docs/project-knowledge-base/02-routes-pages-forms-users.md +0 -352
  164. package/docs/project-knowledge-base/03-tech-stack-modules-services.md +0 -379
  165. package/docs/project-knowledge-base/04-data-models-integrations.md +0 -244
  166. package/docs/project-knowledge-base/05-docs-corpus-inventory.md +0 -256
  167. package/docs/project-knowledge-base/06-operations-testing-legal-content.md +0 -208
  168. package/docs/project-knowledge-base/README.md +0 -103
  169. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-05-19.md +0 -81
  170. package/docs/reports/AUDIT_SUMMARY_2025-12-26.md +0 -203
  171. package/docs/reports/CLAUDE-CODE-COMPLETION-PROMPT.md +0 -403
  172. package/docs/reports/CLAUDE_CODE_PROMPT.md +0 -29
  173. package/docs/reports/CODEBASE_STATUS_REPORT.md +0 -272
  174. package/docs/reports/COMPLETE_VERIFICATION.md +0 -106
  175. package/docs/reports/COMPREHENSIVE-PROJECT-AUDIT-2026-02-24.md +0 -747
  176. package/docs/reports/EVENT_FLOW_VERIFICATION.md +0 -80
  177. package/docs/reports/EXAMPLE_APPS_SIMPLIFICATION_COMPLETE.md +0 -369
  178. package/docs/reports/FINAL_STATUS.md +0 -122
  179. package/docs/reports/FINAL_VERIFICATION_CHECKLIST.md +0 -425
  180. package/docs/reports/MARKETING_WEBSITE_COMPLETE.md +0 -466
  181. package/docs/reports/PACKAGE_COMPLETENESS_REPORT.md +0 -130
  182. package/docs/reports/PRODUCTION_STATUS.md +0 -115
  183. package/docs/reports/PROJECT_RESTRUCTURE_2025-12-27.md +0 -287
  184. package/docs/reports/PROJECT_RESTRUCTURE_FINAL_SUMMARY.md +0 -464
  185. package/docs/reports/PUBLISHING_VERIFICATION.md +0 -144
  186. package/docs/reports/RELEASE_READY_SUMMARY.md +0 -99
  187. package/docs/reports/claude-completion.json +0 -241
  188. package/docs/rules-tracker.md +0 -102
  189. package/docs/security/PRE-LAUNCH-PENTEST-CHECKLIST.md +0 -116
  190. package/docs/security/certificate-pinning.md +0 -122
  191. package/docs/seo-aeo-rules.json +0 -3043
  192. package/docs/social-media-marketing/README.md +0 -81
  193. package/docs/social-media-marketing/posts-batch-01.md +0 -613
  194. package/docs/social-media-marketing/posts-batch-02.md +0 -528
  195. package/docs/social-media-marketing/whatsapp-messages-batch-01.md +0 -458
  196. package/docs/social-media-marketing/whatsapp-status-batch-01.md +0 -355
  197. package/docs/tracking/IMPLEMENTATION_TRACKER.md +0 -303
  198. package/docs/tracking/capacitor-rollout-note-2026-03-01.md +0 -21
  199. package/docs/tracking/completion-tracker-2026-02-24.json +0 -174
  200. package/docs/tracking/finalization-2026-05-16-tracker.json +0 -346
  201. package/docs/tracking/full-audit-tracker.json +0 -121
  202. package/docs/tracking/production-readiness-audit-tracker.json +0 -429
  203. package/docs/tracking/seo-checklist-tracker.json +0 -333
@@ -1,675 +0,0 @@
1
- # Live Updates (OTA) Implementation Guide
2
-
3
- This comprehensive guide explains how to implement Live Updates (Over-The-Air updates) in your Capacitor application using the NativeUpdate plugin.
4
-
5
- ## Table of Contents
6
-
7
- - [Overview](#overview)
8
- - [How Live Updates Work](#how-live-updates-work)
9
- - [Setup Guide](#setup-guide)
10
- - [Implementation Steps](#implementation-steps)
11
- - [Update Server Setup](#update-server-setup)
12
- - [Advanced Features](#advanced-features)
13
- - [Best Practices](#best-practices)
14
- - [Troubleshooting](#troubleshooting)
15
-
16
- ## Overview
17
-
18
- Live Updates allow you to push JavaScript, HTML, CSS, and asset updates to your app without going through the app store review process. This enables:
19
-
20
- - 🚀 Instant bug fixes
21
- - ✨ Feature toggles
22
- - 🎨 UI/UX improvements
23
- - 📊 A/B testing
24
- - 🔧 Quick configuration changes
25
-
26
- ### What Can Be Updated
27
-
28
- ✅ **Can Update:**
29
-
30
- - JavaScript bundles
31
- - HTML files
32
- - CSS stylesheets
33
- - Images and assets
34
- - JSON configuration
35
- - Web fonts
36
-
37
- ❌ **Cannot Update:**
38
-
39
- - Native code (Java/Kotlin/Swift/Objective-C)
40
- - Native plugins
41
- - Platform-specific configurations
42
- - App permissions
43
-
44
- ## How Live Updates Work
45
-
46
- ```mermaid
47
- sequenceDiagram
48
- participant App
49
- participant Plugin
50
- participant Server
51
- participant Storage
52
-
53
- App->>Plugin: checkForUpdate()
54
- Plugin->>Server: GET /check?version=1.0.0
55
- Server-->>Plugin: Update available (1.0.1)
56
- Plugin->>App: Update found
57
- App->>Plugin: downloadUpdate()
58
- Plugin->>Server: Download bundle
59
- Server-->>Plugin: Bundle data
60
- Plugin->>Storage: Save & extract
61
- Plugin->>App: Download complete
62
- App->>Plugin: applyUpdate()
63
- Plugin->>App: Restart required
64
- App->>App: Reload with new bundle
65
- ```
66
-
67
- ## Setup Guide
68
-
69
- ### 1. Install the Plugin
70
-
71
- ```bash
72
- yarn add native-update
73
- npx cap sync
74
- ```
75
-
76
- ### 2. Configure the Plugin
77
-
78
- #### capacitor.config.json
79
-
80
- ```json
81
- {
82
- "appId": "com.example.app",
83
- "appName": "My App",
84
- "plugins": {
85
- "NativeUpdate": {
86
- "updateUrl": "https://updates.yourdomain.com/api/v1",
87
- "enabled": true,
88
- "autoCheck": true,
89
- "checkInterval": 3600,
90
- "channel": "production",
91
- "publicKey": "your-base64-public-key",
92
- "enforceSignature": true,
93
- "updateStrategy": "immediate",
94
- "maxVersions": 3
95
- }
96
- }
97
- }
98
- ```
99
-
100
- ### 3. iOS Additional Setup
101
-
102
- Add to `Info.plist`:
103
-
104
- ```xml
105
- <key>NativeUpdateEnabled</key>
106
- <true/>
107
- <key>NativeUpdateURL</key>
108
- <string>https://updates.yourdomain.com/api/v1</string>
109
- ```
110
-
111
- ### 4. Android Additional Setup
112
-
113
- Add to `AndroidManifest.xml`:
114
-
115
- ```xml
116
- <uses-permission android:name="android.permission.INTERNET" />
117
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
118
- ```
119
-
120
- ## Implementation Steps
121
-
122
- ### Step 1: Basic Implementation
123
-
124
- ```typescript
125
- import { NativeUpdate } from 'native-update';
126
-
127
- export class UpdateManager {
128
- async checkAndUpdate() {
129
- try {
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
- }
150
- } catch (error) {
151
- console.error('Update failed:', error);
152
- }
153
- }
154
- }
155
- ```
156
-
157
- ### Step 2: Advanced Implementation with UI
158
-
159
- ```typescript
160
- import { NativeUpdate } from 'native-update';
161
- import { AlertController, LoadingController } from '@ionic/angular';
162
-
163
- export class UpdateService {
164
- constructor(
165
- private alertCtrl: AlertController,
166
- private loadingCtrl: LoadingController
167
- ) {}
168
-
169
- async checkForUpdates(silent = false) {
170
- try {
171
- const result = await NativeUpdate.sync();
172
-
173
- if (result.status === 'UP_TO_DATE') {
174
- if (!silent) {
175
- await this.showAlert('No Updates', 'Your app is up to date!');
176
- }
177
- return;
178
- }
179
-
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
- },
196
- },
197
- {
198
- text: 'Update',
199
- handler: () => {
200
- this.downloadAndApplyUpdate();
201
- },
202
- },
203
- ],
204
- backdropDismiss: !result.mandatory,
205
- });
206
-
207
- await alert.present();
208
- } catch (error) {
209
- console.error('Update check failed:', error);
210
- }
211
- }
212
-
213
- private async downloadAndApplyUpdate() {
214
- const loading = await this.loadingCtrl.create({
215
- message: 'Downloading update...',
216
- backdropDismiss: false,
217
- });
218
-
219
- await loading.present();
220
-
221
- try {
222
- // Download with progress
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) => {
228
- loading.message = `Downloading... ${Math.round(progress.percent)}%`;
229
- }
230
- );
231
-
232
- loading.message = 'Applying update...';
233
-
234
- // Apply the update
235
- await NativeUpdate.reload();
236
-
237
- // The app will restart automatically
238
- } catch (error) {
239
- await loading.dismiss();
240
- await this.showAlert('Update Failed', error.message);
241
- }
242
- }
243
-
244
- private async showAlert(header: string, message: string) {
245
- const alert = await this.alertCtrl.create({
246
- header,
247
- message,
248
- buttons: ['OK'],
249
- });
250
- await alert.present();
251
- }
252
- }
253
- ```
254
-
255
- ### Step 3: Auto-Update on App Start
256
-
257
- ```typescript
258
- // app.component.ts
259
- import { Component, OnInit } from '@angular/core';
260
- import { Platform } from '@ionic/angular';
261
- import { UpdateService } from './services/update.service';
262
-
263
- @Component({
264
- selector: 'app-root',
265
- templateUrl: 'app.component.html',
266
- })
267
- export class AppComponent implements OnInit {
268
- constructor(
269
- private platform: Platform,
270
- private updateService: UpdateService
271
- ) {}
272
-
273
- async ngOnInit() {
274
- await this.platform.ready();
275
-
276
- // Check for updates on app start
277
- await this.updateService.checkForUpdates(true);
278
-
279
- // Set up periodic checks
280
- setInterval(
281
- () => {
282
- this.updateService.checkForUpdates(true);
283
- },
284
- 60 * 60 * 1000
285
- ); // Every hour
286
- }
287
- }
288
- ```
289
-
290
- ### Step 4: Update Strategies
291
-
292
- ```typescript
293
- // Different update strategies
294
- export class UpdateStrategies {
295
- // Immediate update (default)
296
- async immediateUpdate() {
297
- const result = await NativeUpdate.sync();
298
- if (result.status === 'UPDATE_INSTALLED') {
299
- await NativeUpdate.reload(); // Restarts immediately
300
- }
301
- }
302
-
303
- // Update on next restart
304
- async updateOnRestart() {
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
309
- }
310
- }
311
-
312
- // Update with confirmation
313
- async updateWithConfirmation() {
314
- const result = await NativeUpdate.sync();
315
- if (result.status === 'UPDATE_INSTALLED') {
316
- // Show confirmation dialog
317
- const confirmed = await this.showUpdateReadyDialog();
318
- if (confirmed) {
319
- await NativeUpdate.reload();
320
- }
321
- }
322
- }
323
- }
324
- ```
325
-
326
- ## Update Server Setup
327
-
328
- ### Option 1: Use Our Example Server
329
-
330
- ```bash
331
- cd server-example
332
- yarn install
333
- npm start
334
- ```
335
-
336
- ### Option 2: Implement Your Own
337
-
338
- #### Bundle Structure
339
-
340
- ```
341
- bundle-1.0.1.zip
342
- ├── www/
343
- │ ├── index.html
344
- │ ├── js/
345
- │ │ └── app.bundle.js
346
- │ ├── css/
347
- │ │ └── styles.css
348
- │ └── assets/
349
- │ └── images/
350
- └── manifest.json
351
- ```
352
-
353
- #### manifest.json
354
-
355
- ```json
356
- {
357
- "version": "1.0.1",
358
- "minNativeVersion": "1.0.0",
359
- "timestamp": "2023-12-01T00:00:00Z",
360
- "files": ["www/index.html", "www/js/app.bundle.js", "www/css/styles.css"]
361
- }
362
- ```
363
-
364
- #### Server API Requirements
365
-
366
- **Check Endpoint:**
367
-
368
- ```http
369
- GET /api/v1/check?version=1.0.0&channel=production&appId=com.example.app
370
- ```
371
-
372
- Response:
373
-
374
- ```json
375
- {
376
- "available": true,
377
- "version": "1.0.1",
378
- "url": "https://updates.example.com/bundles/1.0.1.zip",
379
- "mandatory": false,
380
- "notes": "Bug fixes and performance improvements",
381
- "size": 2048576,
382
- "checksum": "sha256:abc123...",
383
- "signature": "base64signature...",
384
- "minNativeVersion": "1.0.0"
385
- }
386
- ```
387
-
388
- ### Creating Update Bundles
389
-
390
- ```bash
391
- # 1. Build your web app
392
- yarn build
393
-
394
- # 2. Create bundle
395
- cd dist
396
- zip -r ../bundle-1.0.1.zip www/
397
-
398
- # 3. Sign the bundle (optional but recommended)
399
- cd ..
400
- npx native-update bundle sign bundle-1.0.1.zip --key private.key
401
-
402
- # 4. Upload to server
403
- curl -X POST https://updates.example.com/api/v1/bundles \
404
- -H "Authorization: Bearer $ADMIN_TOKEN" \
405
- -F "file=@bundle-1.0.1.zip" \
406
- -F "version=1.0.1" \
407
- -F "channel=production" \
408
- -F "notes=Bug fixes"
409
- ```
410
-
411
- ## Advanced Features
412
-
413
- ### 1. Update Channels
414
-
415
- ```typescript
416
- // Development channel for testing
417
- await NativeUpdate.setChannel({ channel: 'development' });
418
-
419
- // Production channel for users
420
- await NativeUpdate.setChannel({ channel: 'production' });
421
-
422
- // Beta channel for early adopters
423
- await NativeUpdate.setChannel({ channel: 'beta' });
424
- ```
425
-
426
- ### 2. Delta Updates
427
-
428
- ```typescript
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
432
- ```
433
-
434
- ### 3. Rollback Support
435
-
436
- ```typescript
437
- // List all downloaded bundles
438
- const bundles = await NativeUpdate.list();
439
-
440
- // Rollback to original app bundle
441
- await NativeUpdate.reset();
442
-
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
- }
449
- ```
450
-
451
- ### 4. Update Metrics
452
-
453
- ```typescript
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
-
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
- }
474
- ```
475
-
476
- ### 5. Custom Update UI
477
-
478
- ```typescript
479
- // Disable auto-check
480
- await NativeUpdate.configure({
481
- autoCheck: false,
482
- });
483
-
484
- // Implement custom UI
485
- class CustomUpdateUI {
486
- async showUpdateFlow() {
487
- // Custom check
488
- const update = await NativeUpdate.sync();
489
-
490
- if (update.status === 'UPDATE_AVAILABLE' || update.status === 'UPDATE_INSTALLED') {
491
- // Show custom UI
492
- const modal = await this.modalCtrl.create({
493
- component: UpdateModalComponent,
494
- componentProps: { update },
495
- });
496
-
497
- await modal.present();
498
- }
499
- }
500
- }
501
- ```
502
-
503
- ## Best Practices
504
-
505
- ### 1. Version Management
506
-
507
- ```typescript
508
- // Semantic versioning
509
- const versions = {
510
- major: '2.0.0', // Breaking changes
511
- minor: '1.1.0', // New features
512
- patch: '1.0.1', // Bug fixes
513
- };
514
-
515
- // Skip versions if needed
516
- const skipVersions = ['1.0.2', '1.0.3']; // Known bad versions
517
- ```
518
-
519
- ### 2. Error Handling
520
-
521
- ```typescript
522
- class RobustUpdateManager {
523
- async safeUpdate() {
524
- try {
525
- await NativeUpdate.sync();
526
- } catch (error) {
527
- if (error.code === 'NETWORK_ERROR') {
528
- // Retry with exponential backoff
529
- await this.retryWithBackoff();
530
- } else if (error.code === 'INVALID_SIGNATURE') {
531
- // Security issue - don't apply
532
- await this.reportSecurityIssue(error);
533
- } else {
534
- // Generic error handling
535
- console.error('Update failed:', error);
536
- }
537
- }
538
- }
539
- }
540
- ```
541
-
542
- ### 3. Testing Updates
543
-
544
- ```typescript
545
- // Test in development
546
- if (environment.development) {
547
- // Force check against staging server
548
- await NativeUpdate.configure({
549
- updateUrl: 'https://staging-updates.yourdomain.com',
550
- channel: 'development',
551
- });
552
- }
553
-
554
- // A/B testing
555
- const testGroup = user.id % 2 === 0 ? 'A' : 'B';
556
- await NativeUpdate.setChannel({
557
- channel: `production-${testGroup}`,
558
- });
559
- ```
560
-
561
- ### 4. Performance Optimization
562
-
563
- ```typescript
564
- // Download during off-peak hours
565
- const now = new Date().getHours();
566
- if (now >= 2 && now <= 6) {
567
- // Download priority would be configured during sync
568
- await NativeUpdate.sync();
569
- }
570
-
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
574
- ```
575
-
576
- ## Troubleshooting
577
-
578
- ### Common Issues
579
-
580
- 1. **Update not applying**
581
-
582
- ```typescript
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();
596
- }
597
- ```
598
-
599
- 2. **Signature verification fails**
600
-
601
- ```typescript
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');
605
- ```
606
-
607
- 3. **Storage issues**
608
- ```typescript
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
618
- });
619
- ```
620
-
621
- ### Debug Mode
622
-
623
- ```typescript
624
- // Enable debug logging through your app's logging system
625
- // The plugin will log errors and important events automatically
626
-
627
- // Monitor update events
628
- NativeUpdate.addListener('downloadProgress', (progress) => {
629
- console.log('Download progress:', progress);
630
- });
631
-
632
- NativeUpdate.addListener('updateStateChanged', (state) => {
633
- console.log('Update state:', state);
634
- });
635
- ```
636
-
637
- ### Health Checks
638
-
639
- ```typescript
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
- }
659
- ```
660
-
661
- ## Security Considerations
662
-
663
- 1. **Always use HTTPS** for update servers
664
- 2. **Implement bundle signing** to prevent tampering
665
- 3. **Validate checksums** before applying updates
666
- 4. **Use certificate pinning** for extra security
667
- 5. **Implement rollback** mechanisms for safety
668
- 6. **Monitor update metrics** to detect issues
669
-
670
- ## Next Steps
671
-
672
- - Read the [Native App Updates Guide](https://nativeupdate.aoneahsan.com/docs/NATIVE_UPDATES_GUIDE)
673
- - Learn about [App Review Integration](https://nativeupdate.aoneahsan.com/docs/APP_REVIEW_GUIDE)
674
- - Check out [Security Best Practices](https://nativeupdate.aoneahsan.com/docs/guides/security-best-practices)
675
- - See [Bundle Signing Documentation](https://nativeupdate.aoneahsan.com/docs/BUNDLE_SIGNING)
@@ -1,30 +0,0 @@
1
- # Manual / User-Only Tasks — Native Update
2
- > The ONE place for everything only you (the human) can do. Fixed path: docs/MANUAL-TASKS.md.
3
- > Global spec: ~/.claude/rules/manual-tasks.md. Last updated: 2026-07-13 (queues+emails batch: row 8 narrowed to ONE cron — queue:work cron now DELETED, scheduler drives the worker; row 10 — grant the FilesHub API key the `email` permission — email sends via FilesHub, NOT SMTP)
4
- >
5
- > ✅ Server agent 2026-07-10: rows 1, 2, 3 CONFIRMED superseded and moved to Completed — prod is live
6
- > (`/api/health` → 200 JSON), PHP 8.3.30 (≥8.3), both new migrations applied on prod MySQL. Row 8's
7
- > `device_hash` half is verified DONE; row 8 now tracks ONLY the still-broken hPanel retention cron
8
- > (owner/hPanel-UI action — the shell has no `crontab` access; see `docs/DEPLOY_NOTES.md`).
9
-
10
- ## ⏳ Pending manual tasks
11
-
12
- | # | Task | Why only you | Detail | Status |
13
- |---|------|--------------|--------|--------|
14
- | 4 | Deploy the Docusaurus docs site (`native-update-docs/`) | Needs Firebase Hosting auth | `cd native-update-docs && yarn build` → `yarn firebase:deploy`. Runbook: `native-update-docs/DEPLOY.md`. (This repo's marketing site + dashboard were deployed by the agent — see Completed.) | ☐ Not started |
15
- | 5 | On-device OTA verification (Android + iOS) | Device-only; agent cannot run emulators/`cap run` | Per `docs/CLAUDE.md` Bundle/OTA Release Safety: test bundles on both platforms, verify checksum validation + rollback + background-update behavior before any live release. | ☐ Not started |
16
- | 6 | Add the **Nova admin Google redirect URI** to the OAuth client | Needs Google Cloud Console access | Google Cloud Console → APIs & Services → Credentials → the OAuth 2.0 Client (`686131007016-…`) → **Authorized redirect URIs** → add BOTH `http://localhost:5946/admin/login/google/callback` (dev) and `https://nativeupdatebe.aoneahsan.com/admin/login/google/callback` (prod). Without it, admin sign-in returns Google's `redirect_uri_mismatch`. (The Nova admin panel is now **Google-only** — password login/reset removed; only admins can enter. `GOOGLE_ADMIN_REDIRECT_URI` already set in `.env`/`.env.example`.) | ☐ Not started |
17
- | 8 | 🟠 **Fix the `schedule:run` hPanel cron + DELETE the `queue:work` cron** so the scheduler (and with it analytics cleanup + the queue worker) actually runs | hPanel UI only — no `crontab` binary in this CageFS shell | `device_hash` `VARCHAR(191)` half is **DONE + verified**. Still open: the crons error every minute (Hostinger passes `>/dev/null` as a literal arg). **Since 2026-07-13 only ONE cron is needed** — the scheduler now drives the queue worker itself (`routes/console.php`), so in **hPanel → Advanced → Cron Jobs**: fix `schedule:run` with the `/bin/sh -c "…"` form (exact line in the 2026-07-10 item of `docs/DEPLOY_NOTES.md`) and **delete the `queue:work` cron entirely**. Verify: arg-parse errors stop in `storage/logs/laravel-*.log`. | ☐ Not started (hPanel) |
18
- | 10 | 🟡 **Run the pending FilesHub PROD migration** so `/emails/send` stops 503ing, then flip this app's prod `MAIL_MAILER=fileshub` | FilesHub prod server access (Hostinger) — owner/server-agent only | **Key DONE (agent, 2026-07-13):** the owner-provided `fh_live_…` key is in `~/.secrets/native-update/fileshub-api-key` + committed `backend/.env`; verified live — auth + `email` permission PASS (request reaches FilesHub's send pipeline). **Blocked on FilesHub's side:** prod `/api/v1/emails/send` throws `Unknown column 'email_attachments.updated_at'` → 503. The fix is ALREADY COMMITTED in the files-hub repo (migration `2026_07_03_100000_add_updated_at_to_email_attachments_table`, commit `af19905`) — it just needs `git pull` + `php artisan migrate --force` on the **FilesHub** prod app. Then: set this app's prod `FILESHUB_API_KEY` to the same key, `MAIL_MAILER=fileshub`, `php artisan config:cache`, and re-run the test-mail check (DEPLOY_NOTES 2026-07-13 item step 5). **Until then, prod stays on `MAIL_MAILER=log` — safe.** | ☐ FilesHub migrate pending |
19
- | 7 | 🟡 Set **`GOOGLE_CLIENT_SECRET`** in the **prod** Hostinger `.env` (dev `.env` ✅ done by agent 2026-07-10) | Secret must be set on the server — needs Hostinger SSH/hPanel | **Dev done:** the rotated secret (`GOCSPX-RKrsCCFZP…`, the only working one after the old one was deleted in Google Cloud Console 2026-07-10) is now in committed `backend/.env` (private repo) and stored in `~/.secrets/native-update/google-oauth-client-secret` + `~/.secrets/INDEX.md`. **Still for you:** during the #1 Hostinger deploy, set the SAME `GOOGLE_CLIENT_SECRET=GOCSPX-RKrsCCFZP…` in the production `.env`, then `php artisan config:clear` (or re-cache). Without it, Google sign-in (admin + dashboard) fails token exchange with `client_secret is missing`. | ☐ Not started (prod only) |
20
- | 9 | ✅ **Server deploy of the E2E-verification batch — DONE + verified 2026-07-10** (commits `d11cb50..682a211`) | — | Server agent pulled `main`, overlaid `backend/`, `composer install --no-dev`, applied both migrations (`apps.bundle_id` → `varchar(191) UNI`, `builds.status` enum gained `paused`), added the 3 `TEST_AUTH_*` vars to prod `.env`, rebuilt config/route/view cache. Verified live: `POST /api/auth/test-e2e/<slug>/login` with a wrong password → **401**, bogus slug → **404**. **Handed to the LOCAL agent:** run the full prod smoke (phase06.3 — create app → API key → update-check → analytics rows → cleanup) and close the feature. Residual server item: the hPanel crons → row 8. | ✅ Done (server) — local smoke pending |
21
-
22
- ## ✅ Completed manual tasks
23
-
24
- | Task | Done | Date |
25
- |------|------|------|
26
- | (#1) Production backend restored + live — `curl https://nativeupdatebe.aoneahsan.com/api/health` → 200 JSON (`{"status":"ok",…,"env":"production"}`) | verified by server agent | 2026-07-10 |
27
- | (#2) Laravel 11→13 + spatie-permission 6→8 upgrade against prod MySQL — all migrations applied clean on prod DB; app serving | verified by server agent | 2026-07-10 |
28
- | (#3) Production PHP ≥ 8.3 — `php -v` → **PHP 8.3.30** (Node not needed at runtime; Vite assets ship pre-built) | verified by server agent | 2026-07-10 |
29
- | Publish `native-update@3.1.0` to npm (`npm view native-update version` → 3.1.0, tag `latest`) | by agent at user request | 2026-07-02 |
30
- | Deploy marketing site + dashboard (`website/`) to Firebase Hosting (project `native-update`; live bundle `index-BgWyydoP.js`, immutable asset caching) | by agent at user request | 2026-07-02 |