react-native-ota-hot-update 2.0.2 → 2.0.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.
package/README.md
CHANGED
|
@@ -84,17 +84,21 @@ class OtaHotUpdateModule internal constructor(context: ReactApplicationContext)
|
|
|
84
84
|
@ReactMethod
|
|
85
85
|
override fun setupBundlePath(path: String?, extension: String?, promise: Promise) {
|
|
86
86
|
if (path != null) {
|
|
87
|
-
deleteOldBundleIfneeded()
|
|
88
87
|
val file = File(path)
|
|
89
88
|
if (file.exists() && file.isFile) {
|
|
89
|
+
deleteOldBundleIfneeded()
|
|
90
90
|
val fileUnzip = extractZipFile(file, extension ?: ".bundle")
|
|
91
|
-
Log.d("setupBundlePath----: ", fileUnzip!!)
|
|
92
91
|
if (fileUnzip != null) {
|
|
92
|
+
Log.d("setupBundlePath----: ", fileUnzip)
|
|
93
93
|
file.delete()
|
|
94
94
|
val sharedPrefs = SharedPrefs(reactApplicationContext)
|
|
95
95
|
sharedPrefs.putString(PATH, fileUnzip)
|
|
96
96
|
promise.resolve(true)
|
|
97
97
|
} else {
|
|
98
|
+
file.delete()
|
|
99
|
+
deleteDirectory(file.parentFile)
|
|
100
|
+
val sharedPrefs = SharedPrefs(reactApplicationContext)
|
|
101
|
+
sharedPrefs.putString(PATH, "")
|
|
98
102
|
promise.resolve(false)
|
|
99
103
|
}
|
|
100
104
|
} else {
|
package/ios/OtaHotUpdate.mm
CHANGED
|
@@ -171,8 +171,8 @@ RCT_EXPORT_METHOD(setupBundlePath:(NSString *)path extension:(NSString *)extensi
|
|
|
171
171
|
[self removeBundleIfNeeded];
|
|
172
172
|
//Unzip file
|
|
173
173
|
NSString *extractedFilePath = [self unzipFileAtPath:path extension:(extension != nil) ? extension : @".jsbundle"];
|
|
174
|
-
NSLog(@"file extraction----- %@", extractedFilePath);
|
|
175
174
|
if (extractedFilePath) {
|
|
175
|
+
NSLog(@"file extraction----- %@", extractedFilePath);
|
|
176
176
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
177
177
|
[defaults setObject:extractedFilePath forKey:@"PATH"];
|
|
178
178
|
[defaults synchronize];
|