cordova-plugin-hot-updates 2.1.0 ā 2.1.1
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/README.md +187 -365
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,293 +1,200 @@
|
|
|
1
1
|
# Cordova Hot Updates Plugin
|
|
2
2
|
|
|
3
|
-
š„ **
|
|
3
|
+
š„ **Frontend-controlled over-the-air (OTA) hot updates for Cordova iOS applications**
|
|
4
4
|
|
|
5
5
|
[](https://badge.fury.io/js/cordova-plugin-hot-updates)
|
|
6
6
|
[](#license)
|
|
7
7
|
|
|
8
|
-
This plugin enables
|
|
8
|
+
This plugin enables **manual, JavaScript-controlled** web content updates for your Cordova iOS applications without requiring App Store approval. Your frontend code decides when to check, download, and install updates.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## ⨠What's New in v2.1.0
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- **āļø Configurable**: Customizable server URLs and check intervals
|
|
17
|
-
- **šÆ Zero Configuration**: Works out of the box with sensible defaults
|
|
12
|
+
- ā
**Smart Download**: `getUpdate()` won't re-download already installed versions
|
|
13
|
+
- ā
**Cleaner Native Code**: Removed debug logs and emojis for production
|
|
14
|
+
- ā
**Better Documentation**: Complete API docs in `docs/` folder
|
|
15
|
+
- ā
**Bug Fixes**: Fixed duplicate download issues and code cleanup
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
[See full changelog](CHANGELOG.md)
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
- [Quick Start](#-quick-start)
|
|
23
|
-
- [Configuration](#-configuration)
|
|
24
|
-
- [API Reference](#-api-reference)
|
|
25
|
-
- [Server Implementation](#-server-implementation)
|
|
26
|
-
- [How It Works](#-how-it-works)
|
|
27
|
-
- [Troubleshooting](#-troubleshooting)
|
|
28
|
-
- [Contributing](#-contributing)
|
|
29
|
-
- [License](#-license)
|
|
19
|
+
## šÆ Key Features
|
|
30
20
|
|
|
31
|
-
|
|
21
|
+
- **š® Frontend Control**: Your JavaScript decides when to update (no automatic background checks)
|
|
22
|
+
- **ā” Two-Step Updates**: Separate download and install for better UX
|
|
23
|
+
- **š Auto-Install**: If user ignores popup, update installs on next app launch
|
|
24
|
+
- **š¦ Canary System**: Automatic rollback if update fails to load (20-second timeout)
|
|
25
|
+
- **š IgnoreList**: Tracks problematic versions (informational only)
|
|
26
|
+
- **š Instant Effect**: WebView Reload approach - no app restart needed
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
## š¦ Installation
|
|
34
29
|
|
|
35
30
|
```bash
|
|
36
|
-
# Install from npm
|
|
31
|
+
# Install from npm
|
|
37
32
|
cordova plugin add cordova-plugin-hot-updates
|
|
38
33
|
|
|
39
|
-
# Install CocoaPods dependencies (
|
|
34
|
+
# Install CocoaPods dependencies (required)
|
|
40
35
|
cd platforms/ios
|
|
41
36
|
pod install
|
|
42
37
|
```
|
|
43
38
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
# Install from local path
|
|
51
|
-
cordova plugin add /path/to/cordova-plugin-hot-updates
|
|
52
|
-
|
|
53
|
-
# Install specific version
|
|
54
|
-
cordova plugin add cordova-plugin-hot-updates@1.0.0
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Installation with pnpm
|
|
58
|
-
|
|
59
|
-
If your project uses pnpm, you may need additional configuration:
|
|
60
|
-
|
|
61
|
-
1. Create or update `.npmrc` in your project root:
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
public-hoist-pattern[]=cordova-plugin-*
|
|
65
|
-
shamefully-hoist=true
|
|
66
|
-
auto-install-peers=true
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
2. Then install the plugin:
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
cordova plugin add cordova-plugin-hot-updates
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
**Note**: Cordova CLI internally uses npm, which can sometimes conflict with pnpm's node_modules structure. The above configuration helps resolve this.
|
|
39
|
+
**Requirements:**
|
|
40
|
+
- Cordova >= 7.0.0
|
|
41
|
+
- cordova-ios >= 4.4.0
|
|
42
|
+
- iOS >= 11.0
|
|
43
|
+
- CocoaPods (for SSZipArchive dependency)
|
|
76
44
|
|
|
77
45
|
## š Quick Start
|
|
78
46
|
|
|
79
|
-
### 1.
|
|
80
|
-
|
|
81
|
-
Add to your `config.xml`:
|
|
82
|
-
|
|
83
|
-
```xml
|
|
84
|
-
<preference name="hot_updates_server_url" value="https://your-server.com/api/updates" />
|
|
85
|
-
<preference name="hot_updates_check_interval" value="300000" />
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### 2. Basic Usage
|
|
47
|
+
### 1. Minimal Integration
|
|
89
48
|
|
|
90
49
|
```javascript
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
50
|
+
document.addEventListener('deviceready', function() {
|
|
51
|
+
// STEP 1: Confirm app loaded successfully (REQUIRED on every start!)
|
|
52
|
+
cordova.exec(
|
|
53
|
+
function(info) {
|
|
54
|
+
const currentVersion = info.installedVersion || info.appBundleVersion;
|
|
55
|
+
|
|
56
|
+
// This MUST be called within 20 seconds or automatic rollback occurs
|
|
57
|
+
window.HotUpdates.canary(currentVersion, function() {
|
|
58
|
+
console.log('ā
Canary confirmed');
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// STEP 2: Check for updates on YOUR server
|
|
62
|
+
fetch('https://your-api.com/updates/check?version=' + currentVersion)
|
|
63
|
+
.then(r => r.json())
|
|
64
|
+
.then(data => {
|
|
65
|
+
if (data.hasUpdate) {
|
|
66
|
+
// STEP 3: Download update
|
|
67
|
+
window.HotUpdates.getUpdate({
|
|
68
|
+
url: data.downloadURL,
|
|
69
|
+
version: data.newVersion
|
|
70
|
+
}, function(error) {
|
|
71
|
+
if (error) {
|
|
72
|
+
console.error('Download failed:', error.error.message);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// STEP 4: Show popup
|
|
77
|
+
if (confirm('Update to ' + data.newVersion + '?')) {
|
|
78
|
+
// STEP 5: Install immediately
|
|
79
|
+
window.HotUpdates.forceUpdate(function(error) {
|
|
80
|
+
if (error) {
|
|
81
|
+
console.error('Install failed:', error.error.message);
|
|
82
|
+
}
|
|
83
|
+
// WebView reloads automatically
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
// If user cancels: update installs automatically on next launch
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
125
90
|
},
|
|
126
91
|
function(error) {
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
## āļø Configuration
|
|
139
|
-
|
|
140
|
-
### config.xml Preferences
|
|
141
|
-
|
|
142
|
-
| Preference | Default | Description |
|
|
143
|
-
|------------|---------|-------------|
|
|
144
|
-
| `hot_updates_server_url` | `https://your-server.com/api/updates` | Update server endpoint |
|
|
145
|
-
| `hot_updates_check_interval` | `300000` | Check interval in milliseconds (5 minutes) |
|
|
146
|
-
| `hot_updates_auto_download` | `true` | Enable automatic download |
|
|
147
|
-
| `hot_updates_auto_install` | `true` | Enable automatic installation on restart |
|
|
148
|
-
|
|
149
|
-
### Example Configuration
|
|
150
|
-
|
|
151
|
-
```xml
|
|
152
|
-
<widget id="com.yourcompany.yourapp" version="1.0.0">
|
|
153
|
-
<!-- Hot Updates Configuration -->
|
|
154
|
-
<preference name="hot_updates_server_url" value="https://updates.yourapp.com/api/check" />
|
|
155
|
-
<preference name="hot_updates_check_interval" value="600000" />
|
|
156
|
-
<preference name="hot_updates_auto_download" value="true" />
|
|
157
|
-
<preference name="hot_updates_auto_install" value="true" />
|
|
158
|
-
|
|
159
|
-
<!-- Your other configurations... -->
|
|
160
|
-
</widget>
|
|
92
|
+
console.error('Failed to get version:', error);
|
|
93
|
+
},
|
|
94
|
+
'HotUpdates',
|
|
95
|
+
'getVersionInfo',
|
|
96
|
+
[]
|
|
97
|
+
);
|
|
98
|
+
});
|
|
161
99
|
```
|
|
162
100
|
|
|
163
101
|
## š API Reference
|
|
164
102
|
|
|
165
|
-
### Methods
|
|
103
|
+
### Core Methods (v2.1.0)
|
|
166
104
|
|
|
167
|
-
#### `
|
|
105
|
+
#### 1. `getUpdate({url, version?}, callback)`
|
|
168
106
|
|
|
169
|
-
|
|
107
|
+
Downloads update in background. **Does NOT install!**
|
|
170
108
|
|
|
171
109
|
```javascript
|
|
172
|
-
HotUpdates.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
);
|
|
110
|
+
window.HotUpdates.getUpdate({
|
|
111
|
+
url: 'https://server.com/updates/2.7.8.zip',
|
|
112
|
+
version: '2.7.8' // Optional
|
|
113
|
+
}, function(error) {
|
|
114
|
+
if (error) {
|
|
115
|
+
console.error('Download failed:', error.error.message);
|
|
116
|
+
} else {
|
|
117
|
+
console.log('ā
Download complete');
|
|
118
|
+
}
|
|
119
|
+
});
|
|
180
120
|
```
|
|
181
121
|
|
|
182
|
-
|
|
122
|
+
**Features:**
|
|
123
|
+
- Returns success if version already installed (won't re-download)
|
|
124
|
+
- Saves to two locations: immediate install + auto-install on next launch
|
|
125
|
+
- Callback format: `null` on success, `{error: {message}}` on error
|
|
183
126
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
```javascript
|
|
187
|
-
HotUpdates.getPendingUpdateInfo(
|
|
188
|
-
function(info) {
|
|
189
|
-
// info object contains:
|
|
190
|
-
// - hasPendingUpdate: boolean
|
|
191
|
-
// - pendingVersion: string
|
|
192
|
-
// - appBundleVersion: string
|
|
193
|
-
// - installedVersion: string
|
|
194
|
-
// - message: string
|
|
195
|
-
},
|
|
196
|
-
function(error) {
|
|
197
|
-
console.error('Error getting update info:', error);
|
|
198
|
-
}
|
|
199
|
-
);
|
|
200
|
-
```
|
|
127
|
+
#### 2. `forceUpdate(callback)`
|
|
201
128
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
Manually triggers an update check.
|
|
129
|
+
Installs downloaded update and reloads WebView. **No parameters needed!**
|
|
205
130
|
|
|
206
131
|
```javascript
|
|
207
|
-
HotUpdates.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
// - minAppVersion: string (if specified)
|
|
215
|
-
},
|
|
216
|
-
function(error) {
|
|
217
|
-
console.error('Update check failed:', error);
|
|
218
|
-
}
|
|
219
|
-
);
|
|
132
|
+
window.HotUpdates.forceUpdate(function(error) {
|
|
133
|
+
if (error) {
|
|
134
|
+
console.error('Install failed:', error.error.message);
|
|
135
|
+
} else {
|
|
136
|
+
console.log('ā
Installed, reloading...');
|
|
137
|
+
}
|
|
138
|
+
});
|
|
220
139
|
```
|
|
221
140
|
|
|
222
|
-
|
|
141
|
+
**Important:**
|
|
142
|
+
- Must call `getUpdate()` first
|
|
143
|
+
- WebView reloads automatically after ~1 second
|
|
144
|
+
- Call `canary()` after reload to confirm success
|
|
223
145
|
|
|
224
|
-
|
|
146
|
+
#### 3. `canary(version, callback)`
|
|
147
|
+
|
|
148
|
+
Confirms bundle loaded successfully. **REQUIRED on every app start!**
|
|
225
149
|
|
|
226
150
|
```javascript
|
|
227
|
-
HotUpdates.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
function() {
|
|
231
|
-
console.log('Download completed');
|
|
232
|
-
},
|
|
233
|
-
function(error) {
|
|
234
|
-
console.error('Download failed:', error);
|
|
235
|
-
},
|
|
236
|
-
function(progress) {
|
|
237
|
-
console.log('Download progress:', progress + '%');
|
|
238
|
-
}
|
|
239
|
-
);
|
|
151
|
+
window.HotUpdates.canary('2.7.8', function() {
|
|
152
|
+
console.log('ā
Canary confirmed');
|
|
153
|
+
});
|
|
240
154
|
```
|
|
241
155
|
|
|
242
|
-
|
|
156
|
+
**Critical:**
|
|
157
|
+
- Must be called within 20 seconds after app start
|
|
158
|
+
- If not called: automatic rollback to previous version
|
|
159
|
+
- Failed version is added to ignore list
|
|
243
160
|
|
|
244
|
-
|
|
161
|
+
#### 4. `getIgnoreList(callback)`
|
|
162
|
+
|
|
163
|
+
Returns list of versions that caused problems.
|
|
245
164
|
|
|
246
165
|
```javascript
|
|
247
|
-
HotUpdates.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
//
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
function(error) {
|
|
256
|
-
console.error('Error getting config:', error);
|
|
257
|
-
}
|
|
258
|
-
);
|
|
166
|
+
window.HotUpdates.getIgnoreList(function(result) {
|
|
167
|
+
const badVersions = result.versions; // ["2.7.5", "2.7.6"]
|
|
168
|
+
|
|
169
|
+
// Check before downloading
|
|
170
|
+
if (!badVersions.includes(newVersion)) {
|
|
171
|
+
// Safe to download
|
|
172
|
+
}
|
|
173
|
+
});
|
|
259
174
|
```
|
|
260
175
|
|
|
261
|
-
|
|
176
|
+
**Note:** IgnoreList is informational only - you decide whether to skip versions.
|
|
262
177
|
|
|
263
|
-
|
|
178
|
+
## š„ļø Server Requirements
|
|
264
179
|
|
|
265
|
-
|
|
180
|
+
Your server should provide:
|
|
266
181
|
|
|
267
|
-
|
|
182
|
+
### Check Endpoint
|
|
268
183
|
|
|
269
|
-
**
|
|
270
|
-
```json
|
|
271
|
-
{
|
|
272
|
-
"hasUpdate": true,
|
|
273
|
-
"version": "1.2.0",
|
|
274
|
-
"downloadURL": "https://yourserver.com/updates/v1.2.0.zip",
|
|
275
|
-
"minAppVersion": "1.0.0",
|
|
276
|
-
"releaseNotes": "Bug fixes and improvements"
|
|
277
|
-
}
|
|
278
|
-
```
|
|
184
|
+
**GET** `/api/updates/check?version={current}&platform=ios`
|
|
279
185
|
|
|
280
|
-
**Response** (when no update available):
|
|
281
186
|
```json
|
|
282
187
|
{
|
|
283
|
-
"hasUpdate":
|
|
284
|
-
"
|
|
188
|
+
"hasUpdate": true,
|
|
189
|
+
"newVersion": "2.7.8",
|
|
190
|
+
"downloadURL": "https://server.com/updates/2.7.8.zip",
|
|
191
|
+
"minAppVersion": "2.7.0"
|
|
285
192
|
}
|
|
286
193
|
```
|
|
287
194
|
|
|
288
|
-
### Update Package
|
|
195
|
+
### Update Package
|
|
289
196
|
|
|
290
|
-
|
|
197
|
+
ZIP file containing `www` folder:
|
|
291
198
|
|
|
292
199
|
```
|
|
293
200
|
update.zip
|
|
@@ -295,136 +202,72 @@ update.zip
|
|
|
295
202
|
āāā index.html
|
|
296
203
|
āāā js/
|
|
297
204
|
āāā css/
|
|
298
|
-
āāā img/
|
|
299
205
|
āāā ...
|
|
300
206
|
```
|
|
301
207
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
```javascript
|
|
305
|
-
const express = require('express');
|
|
306
|
-
const app = express();
|
|
307
|
-
|
|
308
|
-
app.get('/api/updates/check', (req, res) => {
|
|
309
|
-
const { version, platform } = req.query;
|
|
310
|
-
const currentVersion = version || '1.0.0';
|
|
311
|
-
const latestVersion = '1.2.0'; // Your latest version
|
|
312
|
-
|
|
313
|
-
if (compareVersions(currentVersion, latestVersion) < 0) {
|
|
314
|
-
res.json({
|
|
315
|
-
hasUpdate: true,
|
|
316
|
-
version: latestVersion,
|
|
317
|
-
downloadURL: `https://yourserver.com/updates/v${latestVersion}.zip`,
|
|
318
|
-
minAppVersion: '1.0.0',
|
|
319
|
-
releaseNotes: 'Bug fixes and improvements'
|
|
320
|
-
});
|
|
321
|
-
} else {
|
|
322
|
-
res.json({
|
|
323
|
-
hasUpdate: false,
|
|
324
|
-
message: 'No updates available'
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
function compareVersions(version1, version2) {
|
|
330
|
-
const v1parts = version1.split('.').map(Number);
|
|
331
|
-
const v2parts = version2.split('.').map(Number);
|
|
332
|
-
|
|
333
|
-
for (let i = 0; i < Math.max(v1parts.length, v2parts.length); i++) {
|
|
334
|
-
const v1part = v1parts[i] || 0;
|
|
335
|
-
const v2part = v2parts[i] || 0;
|
|
208
|
+
## š§ How It Works
|
|
336
209
|
|
|
337
|
-
|
|
338
|
-
if (v1part > v2part) return 1;
|
|
339
|
-
}
|
|
210
|
+
### Two-Step Update Flow
|
|
340
211
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
212
|
+
```
|
|
213
|
+
1. JS checks YOUR server for updates
|
|
214
|
+
2. getUpdate() downloads ZIP in background
|
|
215
|
+
3. Show popup to user
|
|
216
|
+
4. User clicks "Update": forceUpdate() installs immediately
|
|
217
|
+
5. User ignores: update auto-installs on next app launch
|
|
218
|
+
6. WebView reloads with new content
|
|
219
|
+
7. JS calls canary() to confirm success
|
|
347
220
|
```
|
|
348
221
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
### WebView Reload Approach
|
|
222
|
+
### Rollback Protection
|
|
352
223
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
5. **Next Launch**: New updates are applied on next app restart
|
|
224
|
+
- 20-second canary timer starts after update
|
|
225
|
+
- If `canary()` not called ā automatic rollback
|
|
226
|
+
- Failed version added to ignore list
|
|
227
|
+
- App continues working on previous version
|
|
358
228
|
|
|
359
229
|
### File Structure
|
|
360
230
|
|
|
361
231
|
```
|
|
362
232
|
Documents/
|
|
363
|
-
āāā www/ #
|
|
364
|
-
āāā
|
|
365
|
-
|
|
366
|
-
āāā
|
|
233
|
+
āāā www/ # Active version
|
|
234
|
+
āāā www_previous/ # Backup (for rollback)
|
|
235
|
+
āāā pending_update/ # Next launch auto-install
|
|
236
|
+
āāā temp_downloaded_update/ # Immediate install
|
|
367
237
|
```
|
|
368
238
|
|
|
369
|
-
|
|
239
|
+
## š Full Documentation
|
|
370
240
|
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
```
|
|
241
|
+
- **[docs/README.md](docs/README.md)** - Quick start guide
|
|
242
|
+
- **[docs/API.md](docs/API.md)** - Complete API reference
|
|
243
|
+
- **[docs/hot-updates-admin.html](docs/hot-updates-admin.html)** - Testing interface
|
|
244
|
+
- **[CHANGELOG.md](CHANGELOG.md)** - Version history
|
|
376
245
|
|
|
377
246
|
## š Troubleshooting
|
|
378
247
|
|
|
379
248
|
### Common Issues
|
|
380
249
|
|
|
381
|
-
**
|
|
382
|
-
-
|
|
383
|
-
-
|
|
384
|
-
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
1.
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
3. If still not working, check that Cordova CLI can access the plugin:
|
|
405
|
-
```bash
|
|
406
|
-
ls node_modules/cordova-plugin-hot-updates
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
**Updates not downloading**
|
|
410
|
-
- Check your server URL in config.xml
|
|
411
|
-
- Verify server is returning correct JSON format
|
|
412
|
-
- Check device network connectivity
|
|
413
|
-
- Enable debugging with `cordova run ios --device --debug`
|
|
414
|
-
|
|
415
|
-
**WebView not reloading updated content**
|
|
416
|
-
- Ensure `Documents/www/index.html` exists
|
|
417
|
-
- Check iOS device logs for WebView errors
|
|
418
|
-
- Verify ZIP package contains `www` folder
|
|
419
|
-
|
|
420
|
-
**CocoaPods issues**
|
|
421
|
-
- Run `pod install` in `platforms/ios` directory
|
|
422
|
-
- Update CocoaPods: `sudo gem install cocoapods`
|
|
423
|
-
- Clean and rebuild: `cordova clean ios && cordova build ios`
|
|
424
|
-
|
|
425
|
-
### Debug Logging
|
|
426
|
-
|
|
427
|
-
The plugin provides extensive console logging. To view:
|
|
250
|
+
**Updates not working**
|
|
251
|
+
- Check `canary()` is called on every app start
|
|
252
|
+
- Verify server URL returns correct JSON
|
|
253
|
+
- Check iOS device logs for errors
|
|
254
|
+
|
|
255
|
+
**Duplicate downloads**
|
|
256
|
+
- ā
Fixed in v2.1.0! `getUpdate()` now checks installed version
|
|
257
|
+
|
|
258
|
+
**WebView shows old content**
|
|
259
|
+
- ā
Fixed in v2.1.0! Cache is cleared before reload
|
|
260
|
+
|
|
261
|
+
**CocoaPods errors**
|
|
262
|
+
```bash
|
|
263
|
+
cd platforms/ios
|
|
264
|
+
pod install
|
|
265
|
+
cordova clean ios && cordova build ios
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Debug Logs
|
|
269
|
+
|
|
270
|
+
All plugin actions are logged with `[HotUpdates]` prefix:
|
|
428
271
|
|
|
429
272
|
```bash
|
|
430
273
|
# iOS Simulator
|
|
@@ -434,39 +277,17 @@ cordova run ios --debug
|
|
|
434
277
|
# Use Xcode console or Safari Web Inspector
|
|
435
278
|
```
|
|
436
279
|
|
|
437
|
-
### Reset Plugin State
|
|
438
|
-
|
|
439
|
-
```javascript
|
|
440
|
-
// Clear all plugin data (for testing)
|
|
441
|
-
localStorage.removeItem('hot_updates_installed_version');
|
|
442
|
-
localStorage.removeItem('hot_updates_pending_version');
|
|
443
|
-
localStorage.removeItem('hot_updates_has_pending');
|
|
444
|
-
```
|
|
445
|
-
|
|
446
280
|
## ā ļø Important Notes
|
|
447
281
|
|
|
448
282
|
- **iOS Only**: Currently supports iOS platform only
|
|
449
|
-
- **
|
|
283
|
+
- **Manual Updates Only**: No automatic background checking (you control everything)
|
|
450
284
|
- **App Store Compliance**: Only update web content, not native code
|
|
451
|
-
- **
|
|
452
|
-
- **
|
|
453
|
-
|
|
454
|
-
## š Requirements
|
|
455
|
-
|
|
456
|
-
- **Cordova**: >= 7.0.0
|
|
457
|
-
- **cordova-ios**: >= 4.4.0
|
|
458
|
-
- **iOS**: >= 11.0
|
|
459
|
-
- **CocoaPods**: For SSZipArchive dependency
|
|
285
|
+
- **HTTPS Required**: Update server should use HTTPS in production
|
|
286
|
+
- **Testing**: Test rollback mechanism thoroughly
|
|
460
287
|
|
|
461
288
|
## š¤ Contributing
|
|
462
289
|
|
|
463
|
-
Contributions are welcome! Please
|
|
464
|
-
|
|
465
|
-
1. Fork the repository
|
|
466
|
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
467
|
-
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
468
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
469
|
-
5. Open a Pull Request
|
|
290
|
+
Contributions are welcome! Please submit a Pull Request.
|
|
470
291
|
|
|
471
292
|
## š License
|
|
472
293
|
|
|
@@ -474,14 +295,15 @@ This project is licensed under the Custom Non-Commercial License - see the [LICE
|
|
|
474
295
|
|
|
475
296
|
**ā ļø Commercial use is strictly prohibited without explicit written permission from the copyright holder.**
|
|
476
297
|
|
|
477
|
-
For commercial licensing inquiries, please contact: **Mustafin Vladimir**
|
|
298
|
+
For commercial licensing inquiries, please contact: **Mustafin Vladimir** <outvova.gor@gmail.com>
|
|
478
299
|
|
|
479
300
|
## šāāļø Support
|
|
480
301
|
|
|
481
302
|
- **Issues**: [GitHub Issues](https://github.com/vladimirDarksy/Cordova_hot_update/issues)
|
|
482
|
-
- **
|
|
483
|
-
- **Discussions**: [GitHub Discussions](https://github.com/vladimirDarksy/Cordova_hot_update/discussions)
|
|
303
|
+
- **npm**: [cordova-plugin-hot-updates](https://www.npmjs.com/package/cordova-plugin-hot-updates)
|
|
484
304
|
|
|
485
305
|
---
|
|
486
306
|
|
|
487
|
-
**Made with ā¤ļø by [Mustafin Vladimir](https://github.com/vladimirDarksy)**
|
|
307
|
+
**Made with ā¤ļø by [Mustafin Vladimir](https://github.com/vladimirDarksy)**
|
|
308
|
+
|
|
309
|
+
**Version:** 2.1.0 | **Last Updated:** 2025-11-04
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cordova-plugin-hot-updates",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Cordova plugin for frontend-controlled over-the-air (OTA) hot updates using WebView Reload approach. Enables seamless web content updates without requiring App Store approval.",
|
|
5
5
|
"main": "www/HotUpdates.js",
|
|
6
6
|
"scripts": {
|