react-native-ota-hot-update 1.0.5 → 1.0.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.
|
@@ -75,13 +75,13 @@ public class HotUpdateModule extends ReactContextBaseJavaModule {
|
|
|
75
75
|
@ReactMethod
|
|
76
76
|
public void setupBundlePath(String path, Promise promise) {
|
|
77
77
|
if (path != null) {
|
|
78
|
+
deleteOldBundleIfneeded();
|
|
78
79
|
File file = new File(path);
|
|
79
80
|
if (file.exists() && file.isFile()) {
|
|
80
81
|
String fileUnzip = unzip(file);
|
|
81
82
|
Log.d("setupBundlePath: ", fileUnzip);
|
|
82
83
|
if (fileUnzip != null) {
|
|
83
84
|
file.delete();
|
|
84
|
-
deleteOldBundleIfneeded();
|
|
85
85
|
SharedPrefs sharedPrefs = new SharedPrefs(getReactApplicationContext());
|
|
86
86
|
sharedPrefs.putString(Common.INSTANCE.getPATH(), fileUnzip);
|
|
87
87
|
promise.resolve(true);
|
package/ios/RNhotupdate.m
CHANGED
|
@@ -98,11 +98,11 @@ RCT_EXPORT_MODULE()
|
|
|
98
98
|
// Expose setupBundlePath method to JavaScript
|
|
99
99
|
RCT_EXPORT_METHOD(setupBundlePath:(NSString *)path withResolver:(RCTPromiseResolveBlock)resolve withRejecter:(RCTPromiseRejectBlock)reject) {
|
|
100
100
|
if ([self isFilePathValid:path]) {
|
|
101
|
+
[self removeBundleIfNeeded];
|
|
101
102
|
//Unzip file
|
|
102
103
|
NSString *extractedFilePath = [self unzipFileAtPath:path];
|
|
103
104
|
NSLog(@"file extraction----- %@", extractedFilePath);
|
|
104
105
|
if (extractedFilePath) {
|
|
105
|
-
[self removeBundleIfNeeded];
|
|
106
106
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
107
107
|
[defaults setObject:extractedFilePath forKey:@"PATH"];
|
|
108
108
|
[defaults synchronize];
|