cordova-plugin-hot-updates 1.0.0 → 2.0.0
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/package.json +1 -1
- package/src/ios/HotUpdates.h +25 -131
- package/src/ios/HotUpdates.m +1118 -435
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cordova-plugin-hot-updates",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Cordova plugin for automatic 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": {
|
package/src/ios/HotUpdates.h
CHANGED
|
@@ -19,29 +19,6 @@
|
|
|
19
19
|
|
|
20
20
|
#import <UIKit/UIKit.h>
|
|
21
21
|
#import <Cordova/CDVPlugin.h>
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Cordova Hot Updates Plugin for iOS
|
|
25
|
-
*
|
|
26
|
-
* Provides automatic over-the-air (OTA) updates for Cordova applications
|
|
27
|
-
* using the WebView Reload approach for instant updates.
|
|
28
|
-
*
|
|
29
|
-
* Key Features:
|
|
30
|
-
* - Automatic background update checking and downloading
|
|
31
|
-
* - Seamless installation using wwwFolderName switching
|
|
32
|
-
* - Version compatibility checks with semantic versioning
|
|
33
|
-
* - Configurable update intervals and server endpoints
|
|
34
|
-
* - No AppDelegate modifications required
|
|
35
|
-
*
|
|
36
|
-
* Architecture:
|
|
37
|
-
* - Uses Documents/www folder for updated content
|
|
38
|
-
* - Switches WebView to load from Documents instead of bundle
|
|
39
|
-
* - Maintains backward compatibility with bundle version
|
|
40
|
-
* - Supports rollback mechanisms
|
|
41
|
-
*
|
|
42
|
-
* @version 1.0.0
|
|
43
|
-
* @author Mustafin Vladimir
|
|
44
|
-
*/
|
|
45
22
|
@interface HotUpdates : CDVPlugin
|
|
46
23
|
{
|
|
47
24
|
NSString *documentsPath;
|
|
@@ -49,134 +26,51 @@
|
|
|
49
26
|
NSString *updateServerURL;
|
|
50
27
|
NSString *appBundleVersion;
|
|
51
28
|
NSTimer *updateCheckTimer;
|
|
52
|
-
NSTimeInterval checkInterval;
|
|
53
|
-
}
|
|
54
29
|
|
|
55
|
-
|
|
30
|
+
// Settings
|
|
31
|
+
BOOL autoUpdateEnabled; // Флаг автообновлений
|
|
32
|
+
BOOL firstLaunchDone; // Первый запуск выполнен
|
|
33
|
+
NSMutableArray *ignoreList; // Список игнорируемых версий
|
|
34
|
+
NSString *previousVersionPath; // Путь к предыдущей версии
|
|
35
|
+
}
|
|
56
36
|
|
|
57
|
-
|
|
58
|
-
* Initialize the Hot Updates plugin
|
|
59
|
-
* Called automatically when the plugin is loaded by Cordova
|
|
60
|
-
*/
|
|
37
|
+
// Plugin lifecycle methods
|
|
61
38
|
- (void)pluginInitialize;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Load configuration from config.xml
|
|
65
|
-
*/
|
|
66
39
|
- (void)loadConfiguration;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Initialize www folder in Documents directory
|
|
70
|
-
*/
|
|
71
40
|
- (void)initializeWWWFolder;
|
|
72
|
-
|
|
73
|
-
#pragma mark - Update Management Methods
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Check for pending updates on startup and install them
|
|
77
|
-
*/
|
|
78
41
|
- (void)checkAndInstallPendingUpdate;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Switch WebView to updated content and reload
|
|
82
|
-
*/
|
|
83
42
|
- (void)switchToUpdatedContentWithReload;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Force reload the WebView with new content
|
|
87
|
-
*/
|
|
88
43
|
- (void)reloadWebView;
|
|
89
44
|
|
|
90
|
-
|
|
91
|
-
* Install pending update to Documents/www
|
|
92
|
-
* @param newVersion Version string of the update to install
|
|
93
|
-
*/
|
|
45
|
+
// Update management methods
|
|
94
46
|
- (void)installPendingUpdate:(NSString*)newVersion;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Start background update checking process
|
|
98
|
-
*/
|
|
99
47
|
- (void)startBackgroundUpdateProcess;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Perform automatic update check
|
|
103
|
-
*/
|
|
104
48
|
- (void)performAutomaticUpdateCheck;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Download update automatically in background
|
|
108
|
-
* @param downloadURL URL to download the update from
|
|
109
|
-
* @param newVersion Version string of the update
|
|
110
|
-
*/
|
|
111
49
|
- (void)downloadUpdateAutomatically:(NSString*)downloadURL version:(NSString*)newVersion;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Prepare downloaded update for next launch
|
|
115
|
-
* @param updateLocation Local file URL of downloaded update
|
|
116
|
-
* @param newVersion Version string of the update
|
|
117
|
-
*/
|
|
118
50
|
- (void)prepareUpdateForNextLaunch:(NSURL*)updateLocation version:(NSString*)newVersion;
|
|
51
|
+
- (BOOL)unzipFile:(NSString *)zipPath toDestination:(NSString *)destinationPath;
|
|
119
52
|
|
|
120
|
-
|
|
121
|
-
* Unzip update file to destination
|
|
122
|
-
* @param zipPath Path to ZIP file
|
|
123
|
-
* @param destinationPath Destination directory path
|
|
124
|
-
* @return YES if successful, NO if failed
|
|
125
|
-
*/
|
|
126
|
-
- (BOOL)unzipFile:(NSString*)zipPath toDestination:(NSString*)destinationPath;
|
|
127
|
-
|
|
128
|
-
#pragma mark - Version Comparison Utilities
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Compare two semantic version strings
|
|
132
|
-
* @param version1 First version string (e.g., "2.7.7")
|
|
133
|
-
* @param version2 Second version string (e.g., "2.8.0")
|
|
134
|
-
* @return NSComparisonResult indicating the relationship between the versions
|
|
135
|
-
*/
|
|
53
|
+
// Version comparison utilities
|
|
136
54
|
- (NSComparisonResult)compareVersion:(NSString*)version1 withVersion:(NSString*)version2;
|
|
137
55
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Get current version information
|
|
142
|
-
* @param command CDVInvokedUrlCommand from JavaScript
|
|
143
|
-
*/
|
|
56
|
+
// JavaScript callable methods (minimal set for debugging)
|
|
144
57
|
- (void)getCurrentVersion:(CDVInvokedUrlCommand*)command;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Get pending update information
|
|
148
|
-
* @param command CDVInvokedUrlCommand from JavaScript
|
|
149
|
-
*/
|
|
150
58
|
- (void)getPendingUpdateInfo:(CDVInvokedUrlCommand*)command;
|
|
151
59
|
|
|
152
|
-
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
|
|
60
|
+
// Settings management
|
|
61
|
+
- (void)setAutoUpdateEnabled:(CDVInvokedUrlCommand*)command;
|
|
62
|
+
- (void)addToIgnoreList:(CDVInvokedUrlCommand*)command;
|
|
63
|
+
- (void)removeFromIgnoreList:(CDVInvokedUrlCommand*)command;
|
|
64
|
+
- (void)clearIgnoreList:(CDVInvokedUrlCommand*)command;
|
|
65
|
+
- (void)getIgnoreListJS:(CDVInvokedUrlCommand*)command;
|
|
66
|
+
|
|
67
|
+
// Update methods
|
|
68
|
+
- (void)forceUpdate:(CDVInvokedUrlCommand*)command;
|
|
69
|
+
- (void)canary:(CDVInvokedUrlCommand*)command;
|
|
70
|
+
- (void)rollback:(CDVInvokedUrlCommand*)command;
|
|
156
71
|
- (void)checkForUpdates:(CDVInvokedUrlCommand*)command;
|
|
157
72
|
|
|
158
|
-
|
|
159
|
-
*
|
|
160
|
-
* @param command CDVInvokedUrlCommand from JavaScript with [downloadURL, version, callbackId]
|
|
161
|
-
*/
|
|
162
|
-
- (void)downloadUpdate:(CDVInvokedUrlCommand*)command;
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Get plugin configuration
|
|
166
|
-
* @param command CDVInvokedUrlCommand from JavaScript
|
|
167
|
-
*/
|
|
168
|
-
- (void)getConfiguration:(CDVInvokedUrlCommand*)command;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Install pending update immediately (requires app restart)
|
|
172
|
-
* @param command CDVInvokedUrlCommand from JavaScript
|
|
173
|
-
*/
|
|
174
|
-
- (void)installUpdate:(CDVInvokedUrlCommand*)command;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Set progress callback for downloads
|
|
178
|
-
* @param command CDVInvokedUrlCommand from JavaScript
|
|
179
|
-
*/
|
|
180
|
-
- (void)setProgressCallback:(CDVInvokedUrlCommand*)command;
|
|
73
|
+
// Information methods
|
|
74
|
+
- (void)getVersionInfo:(CDVInvokedUrlCommand*)command;
|
|
181
75
|
|
|
182
|
-
@end
|
|
76
|
+
@end
|