react-native-ota-hot-update 2.2.51 → 2.2.53

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.
@@ -28,10 +28,10 @@ class OtaHotUpdateModule internal constructor(context: ReactApplicationContext)
28
28
  if (path != null) {
29
29
  val file = File(path)
30
30
  if (file.exists() && file.isFile) {
31
- utils.deleteOldBundleIfneeded(null)
32
31
  val fileUnzip = utils.extractZipFile(file, extension ?: ".bundle")
33
32
  if (fileUnzip != null) {
34
33
  file.delete()
34
+ utils.deleteOldBundleIfneeded(null)
35
35
  val sharedPrefs = SharedPrefs(reactApplicationContext)
36
36
  val oldPath = sharedPrefs.getString(PATH)
37
37
  if (!oldPath.equals("")) {
@@ -31,14 +31,15 @@ class Utils internal constructor(private val context: Context) {
31
31
  val pathName = if (pathKey != null) pathKey else PREVIOUS_PATH
32
32
  val sharedPrefs = SharedPrefs(context)
33
33
  val path = sharedPrefs.getString(pathName)
34
- val file = File(path)
35
- if (file.exists() && file.isFile) {
36
- val isDeleted = deleteDirectory(file.parentFile)
37
- sharedPrefs.putString(pathName, "")
38
- return isDeleted
39
- } else {
40
- return false
34
+ if (!path.isNullOrEmpty()) {
35
+ val file = File(path)
36
+ if (file.exists() && file.isFile) {
37
+ val isDeleted = deleteDirectory(file.parentFile)
38
+ sharedPrefs.putString(pathName, "")
39
+ return isDeleted
40
+ }
41
41
  }
42
+ return false
42
43
  }
43
44
 
44
45
  fun extractZipFile(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ota-hot-update",
3
- "version": "2.2.51",
3
+ "version": "2.2.53",
4
4
  "description": "Hot update for react native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",