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,785 +0,0 @@
1
- # App Updates
2
-
3
- The App Updates feature provides a seamless way to manage native app store updates, ensuring users always have the latest version of your app with critical native changes, new permissions, or platform-specific features.
4
-
5
- ## Overview
6
-
7
- While Live Updates handle web assets, App Updates manage the native app binary itself. This feature integrates with:
8
-
9
- - **Google Play Store** on Android (using Play Core Library)
10
- - **Apple App Store** on iOS (using manual version checking)
11
- - **Web platforms** with fallback notifications
12
-
13
- ## Key Features
14
-
15
- ### 🎯 Update Priority Management
16
-
17
- - Configure update urgency (0-5 scale)
18
- - Force critical updates
19
- - Flexible update scheduling
20
-
21
- ### 📱 Native UI Integration
22
-
23
- - Platform-specific update dialogs
24
- - In-app download progress
25
- - Seamless installation flow
26
-
27
- ### 🔄 Update Types
28
-
29
- - **Immediate Updates**: Blocking updates for critical fixes
30
- - **Flexible Updates**: Background downloads with user control
31
- - **Manual Updates**: Direct app store navigation
32
-
33
- ### 📊 Version Intelligence
34
-
35
- - Semantic version comparison
36
- - Minimum version enforcement
37
- - Update availability detection
38
-
39
- ## Implementation Guide
40
-
41
- ### Basic Implementation
42
-
43
- ```typescript
44
- // Check for app updates on startup
45
- async function checkForAppUpdates() {
46
- try {
47
- const updateInfo = await NativeUpdate.getAppUpdateInfo();
48
-
49
- if (updateInfo.updateAvailable) {
50
- console.log(`Update available: ${updateInfo.availableVersion}`);
51
-
52
- // Handle based on priority
53
- if (updateInfo.updatePriority >= 4) {
54
- // High priority - immediate update
55
- await NativeUpdate.performImmediateUpdate();
56
- } else {
57
- // Optional update - show custom UI
58
- showUpdateDialog(updateInfo);
59
- }
60
- }
61
- } catch (error) {
62
- console.error('Update check failed:', error);
63
- }
64
- }
65
- ```
66
-
67
- ### Advanced Implementation
68
-
69
- ```typescript
70
- class AppUpdateManager {
71
- private updateInfo: AppUpdateInfo | null = null;
72
- private downloadProgress = 0;
73
-
74
- async initialize() {
75
- // Configure app updates
76
- await NativeUpdate.configure({
77
- appUpdate: {
78
- checkOnAppStart: true,
79
- minimumVersion: '2.0.0',
80
- updatePriority: 3,
81
- storeUrl: {
82
- android: 'https://play.google.com/store/apps/details?id=com.myapp',
83
- ios: 'https://apps.apple.com/app/id123456789',
84
- },
85
- },
86
- });
87
-
88
- // Set up listeners
89
- this.setupUpdateListeners();
90
-
91
- // Check for updates
92
- await this.checkForUpdates();
93
- }
94
-
95
- private setupUpdateListeners() {
96
- // Android flexible update state changes
97
- NativeUpdate.addListener(
98
- 'appUpdateStateChanged',
99
- (state) => {
100
- this.handleFlexibleUpdateState(state);
101
- }
102
- );
103
-
104
- // Download progress for flexible updates
105
- NativeUpdate.addListener(
106
- 'appUpdateProgress',
107
- (progress) => {
108
- this.downloadProgress = progress.percent;
109
- this.updateProgressUI(progress);
110
- }
111
- );
112
- }
113
-
114
- async checkForUpdates() {
115
- try {
116
- this.updateInfo =
117
- await NativeUpdate.getAppUpdateInfo();
118
-
119
- if (!this.updateInfo.updateAvailable) {
120
- console.log('App is up to date');
121
- return;
122
- }
123
-
124
- // Analyze update type needed
125
- const updateType = this.determineUpdateType(this.updateInfo);
126
-
127
- switch (updateType) {
128
- case 'IMMEDIATE':
129
- await this.performImmediateUpdate();
130
- break;
131
- case 'FLEXIBLE':
132
- await this.startFlexibleUpdate();
133
- break;
134
- case 'OPTIONAL':
135
- this.showOptionalUpdateUI();
136
- break;
137
- }
138
- } catch (error) {
139
- this.handleUpdateError(error);
140
- }
141
- }
142
-
143
- private determineUpdateType(info: AppUpdateInfo): string {
144
- // Force immediate update for critical priority
145
- if (info.updatePriority === 5) {
146
- return 'IMMEDIATE';
147
- }
148
-
149
- // Check if current version is below minimum
150
- if (this.isVersionBelowMinimum(info.currentVersion, info.minimumVersion)) {
151
- return 'IMMEDIATE';
152
- }
153
-
154
- // High priority gets flexible update
155
- if (info.updatePriority >= 3) {
156
- return 'FLEXIBLE';
157
- }
158
-
159
- // Low priority is optional
160
- return 'OPTIONAL';
161
- }
162
-
163
- async performImmediateUpdate() {
164
- try {
165
- // Show blocking update UI
166
- this.showImmediateUpdateUI();
167
-
168
- // Start immediate update
169
- await NativeUpdate.performImmediateUpdate();
170
-
171
- // App will restart automatically after update
172
- } catch (error) {
173
- if (error.code === 'UPDATE_CANCELLED') {
174
- // User cancelled - handle based on requirements
175
- if (this.updateInfo?.updatePriority === 5) {
176
- // Critical update - exit app
177
- App.exitApp();
178
- }
179
- }
180
- }
181
- }
182
-
183
- async startFlexibleUpdate() {
184
- try {
185
- // Start background download
186
- await NativeUpdate.startFlexibleUpdate();
187
-
188
- // Show download progress UI
189
- this.showFlexibleUpdateUI();
190
- } catch (error) {
191
- this.handleUpdateError(error);
192
- }
193
- }
194
-
195
- private handleFlexibleUpdateState(state: FlexibleUpdateState) {
196
- switch (state.status) {
197
- case 'PENDING':
198
- console.log('Update pending');
199
- break;
200
-
201
- case 'DOWNLOADING':
202
- console.log('Downloading update...');
203
- break;
204
-
205
- case 'DOWNLOADED':
206
- // Update ready to install
207
- this.showInstallPrompt();
208
- break;
209
-
210
- case 'INSTALLING':
211
- console.log('Installing update...');
212
- break;
213
-
214
- case 'INSTALLED':
215
- console.log('Update installed successfully');
216
- break;
217
-
218
- case 'FAILED':
219
- this.handleUpdateError(new Error(state.error));
220
- break;
221
- }
222
- }
223
-
224
- async completeFlexibleUpdate() {
225
- try {
226
- await NativeUpdate.completeFlexibleUpdate();
227
- // App will restart with new version
228
- } catch (error) {
229
- console.error('Failed to complete update:', error);
230
- }
231
- }
232
-
233
- private showInstallPrompt() {
234
- // Show snackbar or dialog
235
- this.showDialog({
236
- title: 'Update Ready',
237
- message: 'An update has been downloaded. Restart to apply?',
238
- buttons: [
239
- {
240
- text: 'Restart',
241
- handler: () => this.completeFlexibleUpdate(),
242
- },
243
- {
244
- text: 'Later',
245
- handler: () => {
246
- // Schedule reminder
247
- this.scheduleUpdateReminder();
248
- },
249
- },
250
- ],
251
- });
252
- }
253
- }
254
- ```
255
-
256
- ## Platform-Specific Behavior
257
-
258
- ### Android (Google Play)
259
-
260
- Android uses the Google Play Core Library for in-app updates:
261
-
262
- ```typescript
263
- // Android-specific features
264
- const androidUpdate = {
265
- // Immediate update flow
266
- immediate: async () => {
267
- // Blocks UI until update is installed
268
- await NativeUpdate.performImmediateUpdate();
269
- // App restarts automatically
270
- },
271
-
272
- // Flexible update flow
273
- flexible: async () => {
274
- // Download in background
275
- await NativeUpdate.startFlexibleUpdate();
276
-
277
- // Monitor progress
278
- const listener = await NativeUpdate.addListener(
279
- 'appUpdateProgress',
280
- (progress) => {
281
- console.log(
282
- `Downloaded: ${progress.bytesDownloaded}/${progress.totalBytes}`
283
- );
284
- }
285
- );
286
-
287
- // Complete when ready
288
- await NativeUpdate.completeFlexibleUpdate();
289
- },
290
- };
291
- ```
292
-
293
- ### iOS (App Store)
294
-
295
- iOS requires manual version checking and App Store redirection:
296
-
297
- ```typescript
298
- // iOS-specific implementation
299
- const iosUpdate = {
300
- // Check version manually
301
- check: async () => {
302
- const info = await NativeUpdate.getAppUpdateInfo();
303
-
304
- if (info.updateAvailable) {
305
- // Show custom update dialog
306
- const shouldUpdate = await showUpdateDialog(info);
307
-
308
- if (shouldUpdate) {
309
- // Open App Store
310
- await NativeUpdate.openAppStore();
311
- }
312
- }
313
- },
314
- };
315
- ```
316
-
317
- ### Web Platform
318
-
319
- Web platforms show update notifications:
320
-
321
- ```typescript
322
- // Web fallback
323
- const webUpdate = {
324
- notify: async () => {
325
- const info = await NativeUpdate.getAppUpdateInfo();
326
-
327
- if (info.updateAvailable) {
328
- // Show notification
329
- new Notification('Update Available', {
330
- body: `Version ${info.availableVersion} is available`,
331
- icon: '/icon.png',
332
- actions: [
333
- {
334
- action: 'update',
335
- title: 'Update Now',
336
- },
337
- ],
338
- });
339
- }
340
- },
341
- };
342
- ```
343
-
344
- ## Update Priority Levels
345
-
346
- Configure update behavior based on priority:
347
-
348
- ```typescript
349
- const updatePriorities = {
350
- 0: {
351
- // Low priority
352
- name: 'Optional',
353
- behavior: 'Show notification only',
354
- userControl: 'full',
355
- },
356
- 1: {
357
- // Minor improvements
358
- name: 'Recommended',
359
- behavior: 'Show dialog on app start',
360
- userControl: 'dismissible',
361
- },
362
- 2: {
363
- // Important features
364
- name: 'Important',
365
- behavior: 'Prompt after key actions',
366
- userControl: 'postponable',
367
- },
368
- 3: {
369
- // Significant changes
370
- name: 'High',
371
- behavior: 'Flexible update with reminders',
372
- userControl: 'limited',
373
- },
374
- 4: {
375
- // Critical fixes
376
- name: 'Critical',
377
- behavior: 'Immediate update prompt',
378
- userControl: 'minimal',
379
- },
380
- 5: {
381
- // Security updates
382
- name: 'Mandatory',
383
- behavior: 'Force immediate update',
384
- userControl: 'none',
385
- },
386
- };
387
- ```
388
-
389
- ## Version Management
390
-
391
- ### Semantic Version Comparison
392
-
393
- ```typescript
394
- class VersionManager {
395
- // Compare semantic versions
396
- compareVersions(v1: string, v2: string): number {
397
- const parts1 = v1.split('.').map(Number);
398
- const parts2 = v2.split('.').map(Number);
399
-
400
- for (let i = 0; i < 3; i++) {
401
- if (parts1[i] > parts2[i]) return 1;
402
- if (parts1[i] < parts2[i]) return -1;
403
- }
404
-
405
- return 0;
406
- }
407
-
408
- // Check if update is major/minor/patch
409
- getUpdateType(oldVersion: string, newVersion: string): string {
410
- const [oldMajor, oldMinor, oldPatch] = oldVersion.split('.').map(Number);
411
- const [newMajor, newMinor, newPatch] = newVersion.split('.').map(Number);
412
-
413
- if (newMajor > oldMajor) return 'major';
414
- if (newMinor > oldMinor) return 'minor';
415
- if (newPatch > oldPatch) return 'patch';
416
- return 'none';
417
- }
418
-
419
- // Determine update strategy based on version change
420
- async determineStrategy(info: AppUpdateInfo) {
421
- const updateType = this.getUpdateType(
422
- info.currentVersion,
423
- info.availableVersion
424
- );
425
-
426
- switch (updateType) {
427
- case 'major':
428
- // Major updates might need immediate update
429
- return info.updatePriority >= 3 ? 'immediate' : 'flexible';
430
-
431
- case 'minor':
432
- // Minor updates are usually flexible
433
- return 'flexible';
434
-
435
- case 'patch':
436
- // Patches can be optional unless critical
437
- return info.updatePriority >= 4 ? 'flexible' : 'optional';
438
-
439
- default:
440
- return 'none';
441
- }
442
- }
443
- }
444
- ```
445
-
446
- ### Minimum Version Enforcement
447
-
448
- ```typescript
449
- // Enforce minimum version requirements
450
- async function enforceMinimumVersion() {
451
- const config = {
452
- appUpdate: {
453
- minimumVersion: '2.0.0',
454
- forceUpdateBelow: '1.5.0', // Force update for very old versions
455
- },
456
- };
457
-
458
- const info = await NativeUpdate.getAppUpdateInfo();
459
-
460
- // Check if current version is below minimum
461
- if (isVersionBelow(info.currentVersion, config.appUpdate.minimumVersion)) {
462
- // Force immediate update
463
- try {
464
- await NativeUpdate.performImmediateUpdate();
465
- } catch (error) {
466
- // If update fails or is cancelled, restrict app usage
467
- showMinimumVersionRequired();
468
- disableAppFeatures();
469
- }
470
- }
471
- }
472
- ```
473
-
474
- ## Custom Update UI
475
-
476
- ### Update Dialog Examples
477
-
478
- ```typescript
479
- // Custom update dialog
480
- class UpdateUI {
481
- showUpdateDialog(info: AppUpdateInfo) {
482
- const dialog = {
483
- title: this.getUpdateTitle(info),
484
- message: this.getUpdateMessage(info),
485
- buttons: this.getUpdateButtons(info),
486
- };
487
-
488
- return this.presentDialog(dialog);
489
- }
490
-
491
- private getUpdateTitle(info: AppUpdateInfo): string {
492
- switch (info.updatePriority) {
493
- case 5:
494
- return '🚨 Critical Update Required';
495
- case 4:
496
- return '⚠️ Important Update Available';
497
- case 3:
498
- return '🎯 Recommended Update';
499
- default:
500
- return '✨ New Version Available';
501
- }
502
- }
503
-
504
- private getUpdateMessage(info: AppUpdateInfo): string {
505
- const size = this.formatBytes(info.updateSize);
506
- const features = info.releaseNotes?.slice(0, 3).join('\n• ');
507
-
508
- return `Version ${info.availableVersion} is available (${size})
509
-
510
- What's new:
511
- • ${features}
512
-
513
- ${this.getUpdateUrgency(info)}`;
514
- }
515
-
516
- private getUpdateButtons(info: AppUpdateInfo): DialogButton[] {
517
- if (info.updatePriority === 5) {
518
- // Mandatory update - no cancel option
519
- return [
520
- {
521
- text: 'Update Now',
522
- handler: () => this.startUpdate(info),
523
- },
524
- ];
525
- }
526
-
527
- return [
528
- {
529
- text: 'Update',
530
- handler: () => this.startUpdate(info),
531
- },
532
- {
533
- text: 'Later',
534
- role: 'cancel',
535
- handler: () => this.scheduleReminder(info),
536
- },
537
- ];
538
- }
539
- }
540
- ```
541
-
542
- ### Progress Indicators
543
-
544
- ```typescript
545
- // Update progress UI
546
- class UpdateProgressUI {
547
- private progressBar: HTMLElement;
548
- private statusText: HTMLElement;
549
-
550
- showProgress() {
551
- this.createProgressUI();
552
-
553
- NativeUpdate.addListener(
554
- 'appUpdateProgress',
555
- (progress) => {
556
- this.updateProgress(progress);
557
- }
558
- );
559
- }
560
-
561
- private updateProgress(progress: UpdateProgress) {
562
- // Update progress bar
563
- this.progressBar.style.width = `${progress.percent}%`;
564
-
565
- // Update status text
566
- const downloaded = this.formatBytes(progress.bytesDownloaded);
567
- const total = this.formatBytes(progress.totalBytes);
568
- this.statusText.textContent = `Downloading: ${downloaded} / ${total}`;
569
-
570
- // Show completion
571
- if (progress.percent === 100) {
572
- this.showCompletionUI();
573
- }
574
- }
575
-
576
- private showCompletionUI() {
577
- this.statusText.textContent = 'Update ready to install';
578
- this.showInstallButton();
579
- }
580
- }
581
- ```
582
-
583
- ## Error Handling
584
-
585
- ### Common Errors and Solutions
586
-
587
- ```typescript
588
- async function handleAppUpdateErrors() {
589
- try {
590
- await NativeUpdate.performImmediateUpdate();
591
- } catch (error) {
592
- switch (error.code) {
593
- case 'UPDATE_NOT_AVAILABLE':
594
- console.log('No update available');
595
- break;
596
-
597
- case 'UPDATE_CANCELLED':
598
- // User cancelled the update
599
- if (isCriticalUpdate()) {
600
- showMandatoryUpdateMessage();
601
- }
602
- break;
603
-
604
- case 'UPDATE_FAILED':
605
- // Update failed to install
606
- showRetryDialog();
607
- break;
608
-
609
- case 'PLATFORM_NOT_SUPPORTED':
610
- // Feature not available on this platform
611
- fallbackToManualUpdate();
612
- break;
613
-
614
- case 'PLAY_STORE_NOT_FOUND':
615
- // Google Play Store not installed
616
- showAlternativeUpdateMethod();
617
- break;
618
-
619
- case 'NETWORK_ERROR':
620
- // No internet connection
621
- showOfflineMessage();
622
- scheduleRetryWhenOnline();
623
- break;
624
- }
625
- }
626
- }
627
- ```
628
-
629
- ### Retry Strategies
630
-
631
- ```typescript
632
- class UpdateRetryStrategy {
633
- private retryCount = 0;
634
- private maxRetries = 3;
635
-
636
- async retryUpdate() {
637
- try {
638
- await NativeUpdate.startFlexibleUpdate();
639
- this.retryCount = 0;
640
- } catch (error) {
641
- if (this.shouldRetry(error)) {
642
- this.retryCount++;
643
- const delay = this.calculateBackoff();
644
-
645
- setTimeout(() => {
646
- this.retryUpdate();
647
- }, delay);
648
- } else {
649
- // Give up and show manual update option
650
- this.showManualUpdateOption();
651
- }
652
- }
653
- }
654
-
655
- private calculateBackoff(): number {
656
- // Exponential backoff: 2s, 4s, 8s
657
- return Math.pow(2, this.retryCount) * 1000;
658
- }
659
- }
660
- ```
661
-
662
- ## Testing App Updates
663
-
664
- ### Development Testing
665
-
666
- ```typescript
667
- // Mock update info for testing
668
- const mockUpdateInfo: AppUpdateInfo = {
669
- updateAvailable: true,
670
- currentVersion: '1.0.0',
671
- availableVersion: '2.0.0',
672
- updatePriority: 4,
673
- updateSize: 15 * 1024 * 1024, // 15MB
674
- releaseNotes: [
675
- 'New feature: Dark mode',
676
- 'Performance improvements',
677
- 'Bug fixes',
678
- ],
679
- isFlexibleUpdateAllowed: true,
680
- isImmediateUpdateAllowed: true,
681
- };
682
-
683
- // Test different scenarios
684
- async function testUpdateScenarios() {
685
- // Test immediate update
686
- await testImmediateUpdate();
687
-
688
- // Test flexible update
689
- await testFlexibleUpdate();
690
-
691
- // Test update cancellation
692
- await testUpdateCancellation();
693
-
694
- // Test network errors
695
- await testNetworkErrors();
696
- }
697
- ```
698
-
699
- ### Platform-Specific Testing
700
-
701
- ```bash
702
- # Android testing with internal app sharing
703
- # 1. Build APK with higher version number
704
- # 2. Upload to Play Console internal app sharing
705
- # 3. Install lower version on device
706
- # 4. Test update flow
707
-
708
- # iOS testing with TestFlight
709
- # 1. Upload new version to TestFlight
710
- # 2. Install older version
711
- # 3. Test update detection and App Store redirect
712
- ```
713
-
714
- ## Best Practices
715
-
716
- ### 1. User Experience
717
-
718
- ```typescript
719
- // Provide clear update information
720
- const updateMessage = {
721
- title: 'Exciting Update!',
722
- features: [
723
- '🎨 Beautiful new design',
724
- '⚡ 2x faster performance',
725
- '🐛 Bug fixes and improvements',
726
- ],
727
- size: '12 MB',
728
- time: 'Less than 1 minute',
729
- };
730
- ```
731
-
732
- ### 2. Smart Scheduling
733
-
734
- ```typescript
735
- // Update at appropriate times
736
- class SmartUpdateScheduler {
737
- async scheduleUpdate(info: AppUpdateInfo) {
738
- // Don't interrupt critical user flows
739
- if (this.isUserInCriticalFlow()) {
740
- this.scheduleForLater();
741
- return;
742
- }
743
-
744
- // Check device conditions
745
- const conditions = await this.checkDeviceConditions();
746
-
747
- if (conditions.isCharging && conditions.onWifi) {
748
- // Ideal conditions - start update
749
- await this.startUpdate();
750
- } else {
751
- // Wait for better conditions
752
- this.waitForBetterConditions();
753
- }
754
- }
755
- }
756
- ```
757
-
758
- ### 3. Analytics Integration
759
-
760
- ```typescript
761
- // Track update metrics
762
- async function trackUpdateMetrics(event: string, data: any) {
763
- await analytics.track({
764
- event: `app_update_${event}`,
765
- properties: {
766
- currentVersion: data.currentVersion,
767
- availableVersion: data.availableVersion,
768
- updatePriority: data.updatePriority,
769
- userAction: data.userAction,
770
- timestamp: Date.now(),
771
- },
772
- });
773
- }
774
- ```
775
-
776
- ## Next Steps
777
-
778
- - Configure [App Reviews](https://nativeupdate.aoneahsan.com/docs/features/app-reviews) for user feedback
779
- - Implement [Security Best Practices](https://nativeupdate.aoneahsan.com/docs/guides/security-best-practices)
780
- - Review [Testing Guide](https://nativeupdate.aoneahsan.com/docs/guides/testing-guide)
781
- - Review [API Reference](https://nativeupdate.aoneahsan.com/docs/api/app-update-api)
782
-
783
- ---
784
-
785
- Made with ❤️ by Ahsan Mahmood