native-update 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{CapacitorNativeUpdate.podspec → NativeUpdate.podspec} +1 -1
- package/Readme.md +16 -16
- package/android/src/main/java/com/aoneahsan/nativeupdate/{CapacitorNativeUpdatePlugin.kt → NativeUpdatePlugin.kt} +2 -2
- package/dist/esm/core/errors.d.ts +6 -6
- package/dist/esm/core/errors.js +8 -8
- package/dist/esm/core/errors.js.map +1 -1
- package/dist/esm/core/logger.js +1 -1
- package/dist/esm/core/logger.js.map +1 -1
- package/dist/esm/core/plugin-manager.js +3 -3
- package/dist/esm/core/plugin-manager.js.map +1 -1
- package/dist/esm/definitions.d.ts +12 -14
- package/dist/esm/definitions.js +1 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/plugin.d.ts +3 -3
- package/dist/esm/plugin.js +19 -16
- package/dist/esm/plugin.js.map +1 -1
- package/dist/esm/web.d.ts +0 -1
- package/dist/esm/web.js +3 -3
- 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/APP_REVIEW_GUIDE.md +12 -12
- package/docs/BUNDLE_SIGNING.md +4 -4
- package/docs/LIVE_UPDATES_GUIDE.md +48 -48
- package/docs/MIGRATION.md +10 -10
- package/docs/NATIVE_UPDATES_GUIDE.md +25 -25
- package/docs/QUICK_START.md +34 -34
- package/docs/README.md +5 -5
- package/docs/api/app-review-api.md +15 -15
- package/docs/api/app-update-api.md +18 -18
- package/docs/api/events-api.md +23 -23
- package/docs/api/live-update-api.md +20 -20
- package/docs/background-updates.md +18 -18
- package/docs/examples/advanced-scenarios.md +27 -27
- package/docs/examples/basic-usage.md +48 -30
- package/docs/features/app-reviews.md +13 -13
- package/docs/features/app-updates.md +21 -21
- package/docs/features/live-updates.md +32 -32
- package/docs/getting-started/configuration.md +8 -8
- package/docs/getting-started/installation.md +4 -4
- package/docs/getting-started/quick-start.md +38 -39
- package/docs/guides/deployment-guide.md +2 -2
- package/docs/guides/migration-from-codepush.md +5 -5
- package/docs/guides/testing-guide.md +17 -17
- package/docs/security/certificate-pinning.md +2 -2
- package/ios/Plugin/{CapacitorNativeUpdatePlugin.m → NativeUpdatePlugin.m} +1 -1
- package/package.json +2 -2
- /package/ios/Plugin/{CapacitorNativeUpdatePlugin.swift → NativeUpdatePlugin.swift} +0 -0
|
@@ -45,7 +45,7 @@ src/__tests__/
|
|
|
45
45
|
|
|
46
46
|
2. **Configure Plugin**
|
|
47
47
|
```typescript
|
|
48
|
-
await
|
|
48
|
+
await NativeUpdate.configure({
|
|
49
49
|
serverUrl: 'http://localhost:3000',
|
|
50
50
|
channel: 'development',
|
|
51
51
|
autoCheck: true,
|
|
@@ -55,12 +55,12 @@ src/__tests__/
|
|
|
55
55
|
3. **Test Update Flow**
|
|
56
56
|
```typescript
|
|
57
57
|
// Check for updates
|
|
58
|
-
const update = await
|
|
58
|
+
const update = await NativeUpdate.checkForUpdate();
|
|
59
59
|
|
|
60
60
|
// Download if available
|
|
61
61
|
if (update.available) {
|
|
62
|
-
await
|
|
63
|
-
await
|
|
62
|
+
await NativeUpdate.downloadUpdate();
|
|
63
|
+
await NativeUpdate.applyUpdate();
|
|
64
64
|
}
|
|
65
65
|
```
|
|
66
66
|
|
|
@@ -110,7 +110,7 @@ src/__tests__/
|
|
|
110
110
|
```typescript
|
|
111
111
|
// Test HTTPS enforcement
|
|
112
112
|
try {
|
|
113
|
-
await
|
|
113
|
+
await NativeUpdate.configure({
|
|
114
114
|
serverUrl: 'http://insecure.com', // Should fail
|
|
115
115
|
});
|
|
116
116
|
} catch (error) {
|
|
@@ -124,7 +124,7 @@ try {
|
|
|
124
124
|
node tools/bundle-signer.js sign test-bundle.zip private-key.pem
|
|
125
125
|
|
|
126
126
|
# Verify in app
|
|
127
|
-
const isValid = await
|
|
127
|
+
const isValid = await NativeUpdate.verifySignature(
|
|
128
128
|
bundleData,
|
|
129
129
|
signature
|
|
130
130
|
);
|
|
@@ -135,7 +135,7 @@ const isValid = await CapacitorNativeUpdate.verifySignature(
|
|
|
135
135
|
#### Download Performance
|
|
136
136
|
```typescript
|
|
137
137
|
// Monitor download speed
|
|
138
|
-
|
|
138
|
+
NativeUpdate.addListener('downloadProgress', (progress) => {
|
|
139
139
|
console.log(`Speed: ${progress.speed} MB/s`);
|
|
140
140
|
console.log(`Progress: ${progress.percent}%`);
|
|
141
141
|
});
|
|
@@ -170,23 +170,23 @@ CapacitorNativeUpdate.addListener('downloadProgress', (progress) => {
|
|
|
170
170
|
// Full update test
|
|
171
171
|
async function testCompleteUpdate() {
|
|
172
172
|
// Configure
|
|
173
|
-
await
|
|
173
|
+
await NativeUpdate.configure({
|
|
174
174
|
serverUrl: 'https://your-server.com',
|
|
175
175
|
publicKey: 'your-public-key',
|
|
176
176
|
});
|
|
177
177
|
|
|
178
178
|
// Check
|
|
179
|
-
const update = await
|
|
179
|
+
const update = await NativeUpdate.checkForUpdate();
|
|
180
180
|
if (!update.available) return;
|
|
181
181
|
|
|
182
182
|
// Download with progress
|
|
183
|
-
await
|
|
183
|
+
await NativeUpdate.downloadUpdate();
|
|
184
184
|
|
|
185
185
|
// Apply
|
|
186
|
-
await
|
|
186
|
+
await NativeUpdate.applyUpdate();
|
|
187
187
|
|
|
188
188
|
// Verify
|
|
189
|
-
const current = await
|
|
189
|
+
const current = await NativeUpdate.getCurrentVersion();
|
|
190
190
|
console.log('Updated to:', current.version);
|
|
191
191
|
}
|
|
192
192
|
```
|
|
@@ -196,7 +196,7 @@ CapacitorNativeUpdate.addListener('downloadProgress', (progress) => {
|
|
|
196
196
|
#### Network Failures
|
|
197
197
|
```typescript
|
|
198
198
|
// Test offline behavior
|
|
199
|
-
await
|
|
199
|
+
await NativeUpdate.checkForUpdate()
|
|
200
200
|
.catch(error => {
|
|
201
201
|
expect(error.code).toBe('NETWORK_ERROR');
|
|
202
202
|
});
|
|
@@ -206,7 +206,7 @@ await CapacitorNativeUpdate.checkForUpdate()
|
|
|
206
206
|
```typescript
|
|
207
207
|
// Test checksum validation
|
|
208
208
|
const corruptedBundle = await fetch('corrupted-bundle.zip');
|
|
209
|
-
await
|
|
209
|
+
await NativeUpdate.applyUpdate(corruptedBundle)
|
|
210
210
|
.catch(error => {
|
|
211
211
|
expect(error.code).toBe('CHECKSUM_ERROR');
|
|
212
212
|
});
|
|
@@ -218,13 +218,13 @@ await CapacitorNativeUpdate.applyUpdate(corruptedBundle)
|
|
|
218
218
|
// Test rollback mechanism
|
|
219
219
|
async function testRollback() {
|
|
220
220
|
// Apply bad update
|
|
221
|
-
await
|
|
221
|
+
await NativeUpdate.applyUpdate(badUpdate);
|
|
222
222
|
|
|
223
223
|
// Simulate app crash
|
|
224
224
|
await simulateCrash();
|
|
225
225
|
|
|
226
226
|
// Verify rollback on restart
|
|
227
|
-
const version = await
|
|
227
|
+
const version = await NativeUpdate.getCurrentVersion();
|
|
228
228
|
expect(version).toBe(previousVersion);
|
|
229
229
|
}
|
|
230
230
|
```
|
|
@@ -334,7 +334,7 @@ artillery quick --count 100 --num 10 \
|
|
|
334
334
|
|
|
335
335
|
### Enable Debug Logging
|
|
336
336
|
```typescript
|
|
337
|
-
|
|
337
|
+
NativeUpdate.configure({
|
|
338
338
|
debug: true,
|
|
339
339
|
logLevel: 'verbose',
|
|
340
340
|
});
|
|
@@ -7,7 +7,7 @@ Certificate pinning provides an additional layer of security by ensuring that yo
|
|
|
7
7
|
Certificate pinning is configured through the security configuration:
|
|
8
8
|
|
|
9
9
|
```typescript
|
|
10
|
-
import { NativeUpdate } from '
|
|
10
|
+
import { NativeUpdate } from 'native-update';
|
|
11
11
|
|
|
12
12
|
await NativeUpdate.configure({
|
|
13
13
|
config: {
|
|
@@ -59,7 +59,7 @@ openssl x509 -in certificate.crt -pubkey -noout | \
|
|
|
59
59
|
### Using the Plugin Utility
|
|
60
60
|
|
|
61
61
|
```typescript
|
|
62
|
-
import { CertificatePinning } from '
|
|
62
|
+
import { CertificatePinning } from 'native-update/certificate-pinning';
|
|
63
63
|
|
|
64
64
|
// Generate pin from PEM certificate
|
|
65
65
|
const pin = await CertificatePinning.generateFingerprint(certificatePem);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
// Define the plugin using the CAP_PLUGIN Macro, and
|
|
5
5
|
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
|
|
6
|
-
CAP_PLUGIN(NativeUpdatePlugin, "
|
|
6
|
+
CAP_PLUGIN(NativeUpdatePlugin, "NativeUpdate",
|
|
7
7
|
CAP_PLUGIN_METHOD(configure, CAPPluginReturnPromise);
|
|
8
8
|
CAP_PLUGIN_METHOD(getSecurityInfo, CAPPluginReturnPromise);
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-update",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Foundation package for building a comprehensive update system for Capacitor apps. Provides architecture and interfaces but requires backend implementation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/plugin.cjs.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"android/proguard-rules.pro",
|
|
18
18
|
"dist/",
|
|
19
19
|
"ios/Plugin/",
|
|
20
|
-
"
|
|
20
|
+
"NativeUpdate.podspec",
|
|
21
21
|
"docs/"
|
|
22
22
|
],
|
|
23
23
|
"author": {
|
|
File without changes
|