react-native-ota-hot-update 2.0.9 → 2.1.1

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
@@ -58,7 +58,7 @@ From react native 0.77, AppDelegate changed to swift file, so the configuration
58
58
  - Select Header File under the iOS section and click Next.
59
59
  - Name it something like `YourProjectName-Bridging-Header.h` and save it in your project directory.
60
60
  - In your project's Build Settings: Search for `Objective-C Bridging Header`.
61
- Set its value to the relative path of your bridging header file, e.g., YourProjectName/YourProjectName-Bridging-Header.h.
61
+ Set its value to the relative path of your bridging header file, e.g., YourProjectName/YourProjectName-Bridging-Header.h, remember need to create header file inside folder `YourProjectName`
62
62
  2. Open `YourProjectName-Bridging-Header.h` and add this line:
63
63
 
64
64
  `#import "OtaHotUpdate.h"`
@@ -12,6 +12,7 @@ import com.facebook.react.module.model.ReactModuleInfoProvider
12
12
  import com.rnhotupdate.Common.CURRENT_VERSION_NAME
13
13
  import com.rnhotupdate.Common.DEFAULT_BUNDLE
14
14
  import com.rnhotupdate.Common.PATH
15
+ import com.rnhotupdate.Common.VERSION
15
16
  import com.rnhotupdate.SharedPrefs
16
17
 
17
18
 
@@ -60,8 +61,13 @@ class OtaHotUpdate(context: Context?) : TurboReactPackage() {
60
61
  }
61
62
  val sharedPrefs = SharedPrefs(mContext!!)
62
63
  val pathBundle = sharedPrefs.getString(PATH)
64
+ val version = sharedPrefs.getString(VERSION)
63
65
  val currentVersionName = sharedPrefs.getString(CURRENT_VERSION_NAME)
64
- if (pathBundle == "" || (!currentVersionName.isNullOrEmpty() && currentVersionName != mContext?.getPackageInfo()?.versionName)) {
66
+ if (pathBundle == "" || (currentVersionName != mContext?.getPackageInfo()?.versionName)) {
67
+ if (version != "") {
68
+ // reset version number because bundle is wrong version, need download from new version
69
+ sharedPrefs.putString(VERSION, "")
70
+ }
65
71
  return DEFAULT_BUNDLE
66
72
  }
67
73
  return pathBundle!!
@@ -13,5 +13,5 @@ abstract class OtaHotUpdateSpec internal constructor(context: ReactApplicationCo
13
13
  abstract fun getCurrentVersion(a: Double, promise: Promise)
14
14
  abstract fun setCurrentVersion(version: String?, promise: Promise)
15
15
  abstract fun setExactBundlePath(path: String?, promise: Promise)
16
- abstract fun rollbackToPreviousBundle()
16
+ abstract fun rollbackToPreviousBundle(a: Double, promise: Promise)
17
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ota-hot-update",
3
- "version": "2.0.9",
3
+ "version": "2.1.1",
4
4
  "description": "Hot update for react native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",