react-native-ota-hot-update 1.1.1 → 1.1.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.
@@ -92,17 +92,21 @@ public class HotUpdateModule extends ReactContextBaseJavaModule {
92
92
  @ReactMethod
93
93
  public void setupBundlePath(String path, String extension, Promise promise) {
94
94
  if (path != null) {
95
- deleteOldBundleIfneeded();
96
95
  File file = new File(path);
97
96
  if (file.exists() && file.isFile()) {
97
+ deleteOldBundleIfneeded();
98
98
  String fileUnzip = unzip(file, extension != null ? extension : ".bundle");
99
- Log.d("setupBundlePath: ", fileUnzip);
100
99
  if (fileUnzip != null) {
100
+ Log.d("setupBundlePath: ", fileUnzip);
101
101
  file.delete();
102
102
  SharedPrefs sharedPrefs = new SharedPrefs(getReactApplicationContext());
103
103
  sharedPrefs.putString(Common.INSTANCE.getPATH(), fileUnzip);
104
104
  promise.resolve(true);
105
105
  } else {
106
+ file.delete();
107
+ deleteDirectory(file.getParentFile());
108
+ SharedPrefs sharedPrefs = new SharedPrefs(getReactApplicationContext());
109
+ sharedPrefs.putString(Common.INSTANCE.getPATH(), "");
106
110
  promise.resolve(false);
107
111
  }
108
112
  } else {
package/ios/RNhotupdate.m CHANGED
@@ -170,8 +170,8 @@ RCT_EXPORT_METHOD(setupBundlePath:(NSString *)path extension:(NSString *)extensi
170
170
  [self removeBundleIfNeeded];
171
171
  //Unzip file
172
172
  NSString *extractedFilePath = [self unzipFileAtPath:path extension:(extension != nil) ? extension : @".jsbundle"];
173
- NSLog(@"file extraction----- %@", extractedFilePath);
174
173
  if (extractedFilePath) {
174
+ NSLog(@"file extraction----- %@", extractedFilePath);
175
175
  NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
176
176
  [defaults setObject:extractedFilePath forKey:@"PATH"];
177
177
  [defaults synchronize];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ota-hot-update",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Hot update for react native",
5
5
  "main": "src/index",
6
6
  "repository": "https://github.com/vantuan88291/react-native-ota-hot-update",
package/src/index.tsx CHANGED
@@ -28,7 +28,6 @@ const downloadBundleFile = async (downloadManager: DownloadManager, uri: string,
28
28
  const res = await downloadManager
29
29
  .config({
30
30
  fileCache: Platform.OS === 'android',
31
- IOSBackgroundTask: true,
32
31
  })
33
32
  .fetch('GET', uri, {
34
33
  ...headers,