native-update 1.4.4 → 1.4.6
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 +4 -4
- package/Readme.md +33 -33
- package/android/src/main/AndroidManifest.xml +2 -3
- package/dist/esm/__tests__/bundle-manager.test.js +49 -22
- package/dist/esm/__tests__/bundle-manager.test.js.map +1 -1
- package/dist/esm/app-update/app-update-checker.d.ts +27 -1
- package/dist/esm/app-update/app-update-checker.js +109 -4
- package/dist/esm/app-update/app-update-checker.js.map +1 -1
- package/dist/esm/background-update/background-scheduler.d.ts +25 -0
- package/dist/esm/background-update/background-scheduler.js +176 -61
- package/dist/esm/background-update/background-scheduler.js.map +1 -1
- package/dist/esm/core/config.d.ts +15 -0
- package/dist/esm/core/config.js +8 -0
- package/dist/esm/core/config.js.map +1 -1
- package/dist/esm/core/errors.d.ts +4 -0
- package/dist/esm/core/errors.js +5 -0
- package/dist/esm/core/errors.js.map +1 -1
- package/dist/esm/core/plugin-manager.d.ts +6 -0
- package/dist/esm/core/plugin-manager.js +17 -0
- package/dist/esm/core/plugin-manager.js.map +1 -1
- package/dist/esm/definitions.d.ts +82 -0
- package/dist/esm/definitions.js +1 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/firestore/schema.d.ts +1 -0
- package/dist/esm/firestore/schema.js +5 -1
- package/dist/esm/firestore/schema.js.map +1 -1
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/live-update/delta-processor.d.ts +7 -3
- package/dist/esm/live-update/delta-processor.js +100 -13
- package/dist/esm/live-update/delta-processor.js.map +1 -1
- package/dist/esm/plugin.js +384 -21
- package/dist/esm/plugin.js.map +1 -1
- package/dist/esm/security/crypto.d.ts +64 -1
- package/dist/esm/security/crypto.js +158 -1
- package/dist/esm/security/crypto.js.map +1 -1
- package/dist/esm/web.d.ts +40 -1
- package/dist/esm/web.js +317 -23
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +1 -1
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.esm.js +1 -1
- package/dist/plugin.esm.js.map +1 -1
- package/dist/plugin.js +2 -2
- package/dist/plugin.js.map +1 -1
- package/docs/CHANGELOG.md +13 -0
- package/docs/KNOWN_LIMITATIONS.md +54 -69
- package/docs/REMAINING_FEATURES.md +14 -13
- package/docs/features/live-updates.md +7 -7
- package/docs/production-readiness.md +20 -23
- package/docs/reports/CLAUDE-CODE-COMPLETION-PROMPT.md +403 -0
- package/docs/reports/CLAUDE_CODE_PROMPT.md +29 -0
- package/docs/reports/CODEBASE_STATUS_REPORT.md +272 -0
- package/docs/reports/COMPREHENSIVE-PROJECT-AUDIT-2026-02-24.md +747 -0
- package/docs/reports/claude-completion.json +241 -0
- package/docs/tracking/capacitor-rollout-note-2026-03-01.md +21 -0
- package/docs/tracking/completion-tracker-2026-02-24.json +174 -0
- package/package.json +10 -10
package/AI-INTEGRATION-GUIDE.md
CHANGED
|
@@ -283,8 +283,8 @@ async function handlePurchaseComplete() {
|
|
|
283
283
|
|
|
284
284
|
## Links
|
|
285
285
|
|
|
286
|
-
- [Full Documentation](
|
|
287
|
-
- [API Reference](
|
|
286
|
+
- [Full Documentation](https://nativeupdate.aoneahsan.com/docs)
|
|
287
|
+
- [API Reference](https://nativeupdate.aoneahsan.com/docs/api/API)
|
|
288
288
|
- [Example Apps](./example-apps/)
|
|
289
|
-
- [CLI Reference](
|
|
290
|
-
- [Security Guide](
|
|
289
|
+
- [CLI Reference](https://nativeupdate.aoneahsan.com/docs/cli-reference)
|
|
290
|
+
- [Security Guide](https://nativeupdate.aoneahsan.com/docs/guides/security-best-practices)
|
package/Readme.md
CHANGED
|
@@ -15,49 +15,49 @@
|
|
|
15
15
|
|
|
16
16
|
## 📚 Documentation
|
|
17
17
|
|
|
18
|
-
- **[AI Integration Guide](
|
|
18
|
+
- **[AI Integration Guide](https://nativeupdate.aoneahsan.com/docs/AI-INTEGRATION-GUIDE)** - Quick reference for AI development agents (Claude, Cursor, Copilot)
|
|
19
19
|
|
|
20
20
|
### Getting Started
|
|
21
21
|
|
|
22
|
-
- **[Installation Guide](
|
|
23
|
-
- **[Quick Start Guide](
|
|
24
|
-
- **[Configuration Guide](
|
|
25
|
-
- **[End-to-End Workflow](
|
|
22
|
+
- **[Installation Guide](https://nativeupdate.aoneahsan.com/docs/getting-started/installation)** - Step-by-step installation instructions
|
|
23
|
+
- **[Quick Start Guide](https://nativeupdate.aoneahsan.com/docs/getting-started/quick-start)** - Get up and running in minutes
|
|
24
|
+
- **[Configuration Guide](https://nativeupdate.aoneahsan.com/docs/getting-started/configuration)** - Detailed configuration options
|
|
25
|
+
- **[End-to-End Workflow](https://nativeupdate.aoneahsan.com/docs/guides/end-to-end-workflow)** - Complete setup to production guide
|
|
26
26
|
|
|
27
27
|
### Dashboard & Management
|
|
28
28
|
|
|
29
|
-
- **[Dashboard Guide](
|
|
30
|
-
- **[Channel Management](
|
|
31
|
-
- **[Admin Panel](
|
|
29
|
+
- **[Dashboard Guide](https://nativeupdate.aoneahsan.com/docs/guides/dashboard-guide)** - Complete dashboard user guide
|
|
30
|
+
- **[Channel Management](https://nativeupdate.aoneahsan.com/docs/guides/channel-management)** - Dev/staging/production channels
|
|
31
|
+
- **[Admin Panel](https://nativeupdate.aoneahsan.com/docs/guides/admin-panel)** - Super-admin documentation
|
|
32
32
|
|
|
33
33
|
### Features Documentation
|
|
34
34
|
|
|
35
|
-
- **[Live Updates (OTA)](
|
|
36
|
-
- **[App Updates](
|
|
37
|
-
- **[App Reviews](
|
|
38
|
-
- **[Background Updates](
|
|
35
|
+
- **[Live Updates (OTA)](https://nativeupdate.aoneahsan.com/docs/features/live-updates)** - Deploy web updates instantly
|
|
36
|
+
- **[App Updates](https://nativeupdate.aoneahsan.com/docs/features/app-updates)** - Native app store update management
|
|
37
|
+
- **[App Reviews](https://nativeupdate.aoneahsan.com/docs/features/app-reviews)** - In-app review integration
|
|
38
|
+
- **[Background Updates](https://nativeupdate.aoneahsan.com/docs/background-updates)** - Background update management
|
|
39
39
|
|
|
40
40
|
### Guides & Best Practices
|
|
41
41
|
|
|
42
|
-
- **[Security Best Practices](
|
|
43
|
-
- **[Deployment Guide](
|
|
44
|
-
- **[Migration Guide](
|
|
45
|
-
- **[Production Readiness](
|
|
46
|
-
- **[Bundle Signing](
|
|
47
|
-
- **[Troubleshooting](
|
|
42
|
+
- **[Security Best Practices](https://nativeupdate.aoneahsan.com/docs/guides/security-best-practices)** - Implement secure updates
|
|
43
|
+
- **[Deployment Guide](https://nativeupdate.aoneahsan.com/docs/guides/deployment-guide)** - Deployment procedures
|
|
44
|
+
- **[Migration Guide](https://nativeupdate.aoneahsan.com/docs/MIGRATION)** - Migrate from other solutions
|
|
45
|
+
- **[Production Readiness](https://nativeupdate.aoneahsan.com/docs/production-readiness)** - Production deployment checklist
|
|
46
|
+
- **[Bundle Signing](https://nativeupdate.aoneahsan.com/docs/BUNDLE_SIGNING)** - Cryptographic signing guide
|
|
47
|
+
- **[Troubleshooting](https://nativeupdate.aoneahsan.com/docs/guides/troubleshooting)** - Common issues and solutions
|
|
48
48
|
|
|
49
49
|
### API Reference
|
|
50
50
|
|
|
51
|
-
- **[Live Update API](
|
|
52
|
-
- **[App Update API](
|
|
53
|
-
- **[App Review API](
|
|
54
|
-
- **[Events API](
|
|
55
|
-
- **[CLI Reference](
|
|
51
|
+
- **[Live Update API](https://nativeupdate.aoneahsan.com/docs/api/live-update-api)** - Complete API for OTA updates
|
|
52
|
+
- **[App Update API](https://nativeupdate.aoneahsan.com/docs/api/app-update-api)** - Native app update methods
|
|
53
|
+
- **[App Review API](https://nativeupdate.aoneahsan.com/docs/api/app-review-api)** - Review request methods
|
|
54
|
+
- **[Events API](https://nativeupdate.aoneahsan.com/docs/api/events-api)** - Event listeners and handlers
|
|
55
|
+
- **[CLI Reference](https://nativeupdate.aoneahsan.com/docs/cli-reference)** - Command-line tools documentation
|
|
56
56
|
|
|
57
57
|
### Examples
|
|
58
58
|
|
|
59
|
-
- **[Basic Usage](
|
|
60
|
-
- **[Advanced Scenarios](
|
|
59
|
+
- **[Basic Usage](https://nativeupdate.aoneahsan.com/docs/examples/basic-usage)** - Simple implementation examples
|
|
60
|
+
- **[Advanced Scenarios](https://nativeupdate.aoneahsan.com/docs/examples/advanced-scenarios)** - Complex use cases
|
|
61
61
|
|
|
62
62
|
---
|
|
63
63
|
|
|
@@ -89,7 +89,7 @@ Native Update supports three deployment channels:
|
|
|
89
89
|
| **Staging** | QA/Beta testing | Configurable | 1 hour |
|
|
90
90
|
| **Production** | Live users | No (consent) | Daily |
|
|
91
91
|
|
|
92
|
-
See [Channel Management Guide](
|
|
92
|
+
See [Channel Management Guide](https://nativeupdate.aoneahsan.com/docs/guides/channel-management) for detailed configuration.
|
|
93
93
|
|
|
94
94
|
---
|
|
95
95
|
|
|
@@ -395,7 +395,7 @@ npx native-update backend create express --with-admin
|
|
|
395
395
|
- Generate keys: `npx native-update keys generate --type rsa --size 4096`
|
|
396
396
|
- Supports RSA (2048/4096) and EC (256/384) keys
|
|
397
397
|
- Creates timestamped key pairs with proper permissions
|
|
398
|
-
- See [Key Management Guide](
|
|
398
|
+
- See [Key Management Guide](https://nativeupdate.aoneahsan.com/docs/guides/key-management) for detailed instructions
|
|
399
399
|
|
|
400
400
|
✅ **Backend Templates**
|
|
401
401
|
- Express.js: `npx native-update backend create express --with-admin`
|
|
@@ -410,7 +410,7 @@ npx native-update backend create express --with-admin
|
|
|
410
410
|
✅ **Migration Tools**
|
|
411
411
|
- From CodePush: `npx native-update migrate --from codepush`
|
|
412
412
|
|
|
413
|
-
See [CLI Reference](
|
|
413
|
+
See [CLI Reference](https://nativeupdate.aoneahsan.com/docs/cli-reference) for complete documentation.
|
|
414
414
|
|
|
415
415
|
## 🏗️ Development Status
|
|
416
416
|
|
|
@@ -459,12 +459,12 @@ See [CLI Reference](./docs/cli-reference.md) for complete documentation.
|
|
|
459
459
|
## 🚀 Getting Started with Development
|
|
460
460
|
|
|
461
461
|
1. **Understand the Architecture**:
|
|
462
|
-
- Review the documentation
|
|
462
|
+
- Review the documentation at `https://nativeupdate.aoneahsan.com/docs`
|
|
463
463
|
- Study the TypeScript interfaces in `/src/definitions.ts`
|
|
464
|
-
- Check the [ROADMAP.md](
|
|
464
|
+
- Check the [ROADMAP.md](https://nativeupdate.aoneahsan.com/docs/ROADMAP) for development priorities
|
|
465
465
|
|
|
466
466
|
2. **Build Required Infrastructure**:
|
|
467
|
-
- Set up an update server (see [server requirements](
|
|
467
|
+
- Set up an update server (see [server requirements](https://nativeupdate.aoneahsan.com/docs/server-requirements))
|
|
468
468
|
- Implement bundle storage solution
|
|
469
469
|
- Create signing infrastructure
|
|
470
470
|
|
|
@@ -494,8 +494,8 @@ This package is **open-source** and created by **Ahsan Mahmood** for the develop
|
|
|
494
494
|
|
|
495
495
|
- **[NPM Package](https://www.npmjs.com/package/native-update)** - Package and versions
|
|
496
496
|
- **[Website](https://nativeupdate.aoneahsan.com)** - Official website and dashboard
|
|
497
|
-
- **[Documentation](
|
|
498
|
-
- **[Examples](
|
|
497
|
+
- **[Documentation](https://nativeupdate.aoneahsan.com/docs/README)** - Comprehensive documentation
|
|
498
|
+
- **[Examples](https://nativeupdate.aoneahsan.com/docs/examples/basic-usage)** - Real-world usage examples
|
|
499
499
|
|
|
500
500
|
### Professional Support
|
|
501
501
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
-
package="com.aoneahsan.nativeupdate">
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
3
2
|
|
|
4
3
|
<!-- Required permissions -->
|
|
5
4
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
@@ -15,4 +14,4 @@
|
|
|
15
14
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
16
15
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
|
17
16
|
|
|
18
|
-
</manifest>
|
|
17
|
+
</manifest>
|
|
@@ -67,38 +67,65 @@ describe('BundleManager', () => {
|
|
|
67
67
|
});
|
|
68
68
|
describe('cleanupOldBundles', () => {
|
|
69
69
|
it('should keep only specified number of bundles', async () => {
|
|
70
|
-
|
|
70
|
+
// Create 4 bundles with different download times
|
|
71
|
+
const bundles = [
|
|
71
72
|
{
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
bundleId: 'bundle-1.0.0',
|
|
74
|
+
version: '1.0.0',
|
|
75
|
+
path: '/bundles/bundle-1.0.0',
|
|
76
|
+
downloadTime: new Date('2024-01-01').getTime(),
|
|
77
|
+
size: 1024,
|
|
78
|
+
status: 'ready',
|
|
79
|
+
checksum: 'a'.repeat(64),
|
|
80
|
+
verified: true,
|
|
74
81
|
},
|
|
75
82
|
{
|
|
76
|
-
|
|
77
|
-
|
|
83
|
+
bundleId: 'bundle-1.0.1',
|
|
84
|
+
version: '1.0.1',
|
|
85
|
+
path: '/bundles/bundle-1.0.1',
|
|
86
|
+
downloadTime: new Date('2024-01-02').getTime(),
|
|
87
|
+
size: 1024,
|
|
88
|
+
status: 'ready',
|
|
89
|
+
checksum: 'b'.repeat(64),
|
|
90
|
+
verified: true,
|
|
78
91
|
},
|
|
79
92
|
{
|
|
80
|
-
|
|
81
|
-
|
|
93
|
+
bundleId: 'bundle-1.0.2',
|
|
94
|
+
version: '1.0.2',
|
|
95
|
+
path: '/bundles/bundle-1.0.2',
|
|
96
|
+
downloadTime: new Date('2024-01-03').getTime(),
|
|
97
|
+
size: 1024,
|
|
98
|
+
status: 'ready',
|
|
99
|
+
checksum: 'c'.repeat(64),
|
|
100
|
+
verified: true,
|
|
82
101
|
},
|
|
83
102
|
{
|
|
84
|
-
|
|
85
|
-
|
|
103
|
+
bundleId: 'bundle-1.0.3',
|
|
104
|
+
version: '1.0.3',
|
|
105
|
+
path: '/bundles/bundle-1.0.3',
|
|
106
|
+
downloadTime: new Date('2024-01-04').getTime(),
|
|
107
|
+
size: 1024,
|
|
108
|
+
status: 'ready',
|
|
109
|
+
checksum: 'd'.repeat(64),
|
|
110
|
+
verified: true,
|
|
86
111
|
},
|
|
87
112
|
];
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
mtime: b.modificationTime,
|
|
97
|
-
})),
|
|
98
|
-
});
|
|
113
|
+
// Save all bundles
|
|
114
|
+
for (const bundle of bundles) {
|
|
115
|
+
await bundleManager.saveBundleInfo(bundle);
|
|
116
|
+
}
|
|
117
|
+
// Verify we have 4 bundles
|
|
118
|
+
const beforeCleanup = await bundleManager.getAllBundles();
|
|
119
|
+
expect(beforeCleanup.length).toBe(4);
|
|
120
|
+
// Cleanup to keep only 2 bundles
|
|
99
121
|
await bundleManager['cleanupOldBundles'](2);
|
|
100
|
-
// Should
|
|
101
|
-
|
|
122
|
+
// Should have only 2 bundles remaining (the newest ones)
|
|
123
|
+
const afterCleanup = await bundleManager.getAllBundles();
|
|
124
|
+
expect(afterCleanup.length).toBe(2);
|
|
125
|
+
// The 2 newest bundles should remain
|
|
126
|
+
const bundleIds = afterCleanup.map((b) => b.bundleId);
|
|
127
|
+
expect(bundleIds).toContain('bundle-1.0.3');
|
|
128
|
+
expect(bundleIds).toContain('bundle-1.0.2');
|
|
102
129
|
});
|
|
103
130
|
});
|
|
104
131
|
describe('getBundle', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle-manager.test.js","sourceRoot":"","sources":["../../../src/__tests__/bundle-manager.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,oBAAoB;AACpB,EAAE,CAA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AAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACzB,EAAE,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;YAC5C,MAAM,MAAM,GAAe;gBACzB,QAAQ,EAAE,cAAc;gBACxB,OAAO,EAAE,OAAO;gBAChB,IAAI,EAAE,uBAAuB;gBAC7B,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;gBACxB,IAAI,EAAE,IAAI;gBACV,MAAM,EAAE,OAAuB;gBAC/B,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;gBACxB,SAAS,EAAE,KAAK;gBAChB,QAAQ,EAAE,IAAI;aACf,CAAC;YAEF,MAAM,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YAC3C,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;YAChE,MAAM,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;YAChC,MAAM,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,13 +1,39 @@
|
|
|
1
1
|
import { PluginConfig } from '../core/config';
|
|
2
2
|
import { AppUpdateInfo, AppUpdateOptions } from './types';
|
|
3
|
+
interface CachedAppInfo {
|
|
4
|
+
version: string;
|
|
5
|
+
build: string;
|
|
6
|
+
name: string;
|
|
7
|
+
id: string;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
}
|
|
3
10
|
export declare class AppUpdateChecker {
|
|
4
11
|
private config;
|
|
5
12
|
private logger;
|
|
13
|
+
private cachedAppInfo;
|
|
14
|
+
private readonly CACHE_DURATION;
|
|
6
15
|
constructor(config: PluginConfig);
|
|
7
16
|
checkServerVersion(_?: AppUpdateOptions): Promise<Partial<AppUpdateInfo>>;
|
|
8
17
|
compareVersions(version1: string, version2: string): number;
|
|
9
18
|
isUpdateRequired(currentVersion: string, availableVersion: string, minimumVersion?: string): boolean;
|
|
10
19
|
determineUpdatePriority(versionDiff: string, stalenessDays?: number): number;
|
|
11
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Get current app version using @capacitor/app
|
|
22
|
+
* Falls back to config or default if native API unavailable
|
|
23
|
+
*/
|
|
24
|
+
getCurrentVersion(): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Get current app build number
|
|
27
|
+
*/
|
|
28
|
+
getCurrentBuild(): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Get full app info
|
|
31
|
+
*/
|
|
32
|
+
getAppInfo(): Promise<CachedAppInfo>;
|
|
33
|
+
/**
|
|
34
|
+
* Clear the cached app info (useful after updates)
|
|
35
|
+
*/
|
|
36
|
+
clearCache(): void;
|
|
12
37
|
private getPlatform;
|
|
13
38
|
}
|
|
39
|
+
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Logger } from '../core/logger';
|
|
2
2
|
export class AppUpdateChecker {
|
|
3
3
|
constructor(config) {
|
|
4
|
+
this.cachedAppInfo = null;
|
|
5
|
+
this.CACHE_DURATION = 60 * 1000; // 1 minute cache
|
|
4
6
|
this.config = config;
|
|
5
7
|
this.logger = new Logger('AppUpdateChecker');
|
|
6
8
|
}
|
|
@@ -9,9 +11,10 @@ export class AppUpdateChecker {
|
|
|
9
11
|
return {};
|
|
10
12
|
}
|
|
11
13
|
try {
|
|
14
|
+
const currentVersion = await this.getCurrentVersion();
|
|
12
15
|
const url = new URL(`${this.config.updateUrl}/app-version`);
|
|
13
16
|
url.searchParams.append('platform', this.getPlatform());
|
|
14
|
-
url.searchParams.append('current',
|
|
17
|
+
url.searchParams.append('current', currentVersion);
|
|
15
18
|
if (this.config.channel) {
|
|
16
19
|
url.searchParams.append('channel', this.config.channel);
|
|
17
20
|
}
|
|
@@ -19,7 +22,7 @@ export class AppUpdateChecker {
|
|
|
19
22
|
method: 'GET',
|
|
20
23
|
headers: {
|
|
21
24
|
Accept: 'application/json',
|
|
22
|
-
'X-App-Version':
|
|
25
|
+
'X-App-Version': currentVersion,
|
|
23
26
|
'X-App-Platform': this.getPlatform(),
|
|
24
27
|
},
|
|
25
28
|
});
|
|
@@ -83,9 +86,111 @@ export class AppUpdateChecker {
|
|
|
83
86
|
// Patch version = LOW (priority 1)
|
|
84
87
|
return 1;
|
|
85
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Get current app version using @capacitor/app
|
|
91
|
+
* Falls back to config or default if native API unavailable
|
|
92
|
+
*/
|
|
86
93
|
async getCurrentVersion() {
|
|
87
|
-
//
|
|
88
|
-
|
|
94
|
+
// Check cache first
|
|
95
|
+
if (this.cachedAppInfo && Date.now() - this.cachedAppInfo.timestamp < this.CACHE_DURATION) {
|
|
96
|
+
return this.cachedAppInfo.version;
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
// Try to use @capacitor/app for real version info
|
|
100
|
+
const { App } = await import('@capacitor/app');
|
|
101
|
+
const info = await App.getInfo();
|
|
102
|
+
// Cache the result
|
|
103
|
+
this.cachedAppInfo = {
|
|
104
|
+
version: info.version,
|
|
105
|
+
build: info.build,
|
|
106
|
+
name: info.name,
|
|
107
|
+
id: info.id,
|
|
108
|
+
timestamp: Date.now(),
|
|
109
|
+
};
|
|
110
|
+
this.logger.debug('Got app info from Capacitor', {
|
|
111
|
+
version: info.version,
|
|
112
|
+
build: info.build,
|
|
113
|
+
});
|
|
114
|
+
return info.version;
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
this.logger.debug('Failed to get app info from Capacitor, using fallback', error);
|
|
118
|
+
// Fallback to config value or environment
|
|
119
|
+
const configAppVersion = this.config.appVersion;
|
|
120
|
+
if (typeof configAppVersion === 'string') {
|
|
121
|
+
return configAppVersion;
|
|
122
|
+
}
|
|
123
|
+
// Try to get from environment/window
|
|
124
|
+
if (typeof window !== 'undefined') {
|
|
125
|
+
const windowWithVersion = window;
|
|
126
|
+
if (typeof windowWithVersion.APP_VERSION === 'string') {
|
|
127
|
+
return windowWithVersion.APP_VERSION;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Last resort fallback
|
|
131
|
+
return '1.0.0';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Get current app build number
|
|
136
|
+
*/
|
|
137
|
+
async getCurrentBuild() {
|
|
138
|
+
// Check cache first
|
|
139
|
+
if (this.cachedAppInfo && Date.now() - this.cachedAppInfo.timestamp < this.CACHE_DURATION) {
|
|
140
|
+
return this.cachedAppInfo.build;
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
const { App } = await import('@capacitor/app');
|
|
144
|
+
const info = await App.getInfo();
|
|
145
|
+
// Cache the result
|
|
146
|
+
this.cachedAppInfo = {
|
|
147
|
+
version: info.version,
|
|
148
|
+
build: info.build,
|
|
149
|
+
name: info.name,
|
|
150
|
+
id: info.id,
|
|
151
|
+
timestamp: Date.now(),
|
|
152
|
+
};
|
|
153
|
+
return info.build;
|
|
154
|
+
}
|
|
155
|
+
catch (_a) {
|
|
156
|
+
return '1';
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get full app info
|
|
161
|
+
*/
|
|
162
|
+
async getAppInfo() {
|
|
163
|
+
// Check cache first
|
|
164
|
+
if (this.cachedAppInfo && Date.now() - this.cachedAppInfo.timestamp < this.CACHE_DURATION) {
|
|
165
|
+
return this.cachedAppInfo;
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
const { App } = await import('@capacitor/app');
|
|
169
|
+
const info = await App.getInfo();
|
|
170
|
+
this.cachedAppInfo = {
|
|
171
|
+
version: info.version,
|
|
172
|
+
build: info.build,
|
|
173
|
+
name: info.name,
|
|
174
|
+
id: info.id,
|
|
175
|
+
timestamp: Date.now(),
|
|
176
|
+
};
|
|
177
|
+
return this.cachedAppInfo;
|
|
178
|
+
}
|
|
179
|
+
catch (_a) {
|
|
180
|
+
return {
|
|
181
|
+
version: '1.0.0',
|
|
182
|
+
build: '1',
|
|
183
|
+
name: 'App',
|
|
184
|
+
id: 'com.app',
|
|
185
|
+
timestamp: Date.now(),
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Clear the cached app info (useful after updates)
|
|
191
|
+
*/
|
|
192
|
+
clearCache() {
|
|
193
|
+
this.cachedAppInfo = null;
|
|
89
194
|
}
|
|
90
195
|
getPlatform() {
|
|
91
196
|
// Detect platform
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-update-checker.js","sourceRoot":"","sources":["../../../src/app-update/app-update-checker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"app-update-checker.js","sourceRoot":"","sources":["../../../src/app-update/app-update-checker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAiBxC,MAAM,OAAO,gBAAgB;IAM3B,YAAY,MAAoB;QAHxB,kBAAa,GAAyB,IAAI,CAAC;QAClC,mBAAc,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,iBAAiB;QAG5D,IAAI,CAAC,MAAM,GAAG,MAAsB,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,CAAoB;QAEpB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAC3B,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACtD,MAAM,GAAG,GAAG,IAAI,GAAG,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BAAM,IAAI,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC9C,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
import type { BackgroundUpdateConfig, BackgroundUpdateStatus, BackgroundCheckResult } from '../definitions';
|
|
2
|
+
import type { AppUpdateManager } from '../app-update/app-update-manager';
|
|
3
|
+
import type { VersionManager } from '../live-update/version-manager';
|
|
4
|
+
import type { BundleManager } from '../live-update/bundle-manager';
|
|
5
|
+
interface BackgroundSchedulerDeps {
|
|
6
|
+
appUpdateManager?: AppUpdateManager;
|
|
7
|
+
versionManager?: VersionManager;
|
|
8
|
+
bundleManager?: BundleManager;
|
|
9
|
+
}
|
|
2
10
|
export declare class BackgroundScheduler {
|
|
3
11
|
private config;
|
|
4
12
|
private status;
|
|
13
|
+
private readonly logger;
|
|
14
|
+
private readonly configManager;
|
|
15
|
+
private deps;
|
|
16
|
+
constructor();
|
|
17
|
+
/**
|
|
18
|
+
* Set dependencies for the scheduler
|
|
19
|
+
*/
|
|
20
|
+
setDependencies(deps: BackgroundSchedulerDeps): void;
|
|
5
21
|
configure(config: BackgroundUpdateConfig): void;
|
|
6
22
|
getStatus(): BackgroundUpdateStatus;
|
|
7
23
|
performCheck(): Promise<BackgroundCheckResult>;
|
|
@@ -9,9 +25,18 @@ export declare class BackgroundScheduler {
|
|
|
9
25
|
private checkAppUpdate;
|
|
10
26
|
private checkLiveUpdate;
|
|
11
27
|
private sendNotification;
|
|
28
|
+
/**
|
|
29
|
+
* Get current app version
|
|
30
|
+
*/
|
|
31
|
+
private getCurrentAppVersion;
|
|
32
|
+
/**
|
|
33
|
+
* Get current platform
|
|
34
|
+
*/
|
|
35
|
+
private getPlatform;
|
|
12
36
|
protected calculateNextCheckTime(): number;
|
|
13
37
|
protected shouldRespectBatteryOptimization(): boolean;
|
|
14
38
|
protected isNetworkConditionMet(): boolean;
|
|
15
39
|
protected isBatteryLevelSufficient(): boolean;
|
|
16
40
|
private compareVersions;
|
|
17
41
|
}
|
|
42
|
+
export {};
|