react-native-ota-hot-update 2.0.8 → 2.1.0
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"`
|
|
@@ -66,6 +66,7 @@ class OtaHotUpdateModule internal constructor(context: ReactApplicationContext)
|
|
|
66
66
|
zip.entries().asSequence().forEach { entry ->
|
|
67
67
|
zip.getInputStream(entry).use { input ->
|
|
68
68
|
if (topLevelFolder == null) {
|
|
69
|
+
// Get root folder of zip file after unzip
|
|
69
70
|
val parts = entry.name.split("/")
|
|
70
71
|
if (parts.size > 1) {
|
|
71
72
|
topLevelFolder = parts.first()
|
|
@@ -113,7 +114,6 @@ class OtaHotUpdateModule internal constructor(context: ReactApplicationContext)
|
|
|
113
114
|
deleteOldBundleIfneeded(null)
|
|
114
115
|
val fileUnzip = extractZipFile(file, extension ?: ".bundle")
|
|
115
116
|
if (fileUnzip != null) {
|
|
116
|
-
Log.d("setupBundlePath----: ", fileUnzip)
|
|
117
117
|
file.delete()
|
|
118
118
|
val sharedPrefs = SharedPrefs(reactApplicationContext)
|
|
119
119
|
val oldPath = sharedPrefs.getString(PATH)
|
|
@@ -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/ios/OtaHotUpdate.mm
CHANGED
|
@@ -196,8 +196,6 @@ RCT_EXPORT_MODULE()
|
|
|
196
196
|
if (removeError) {
|
|
197
197
|
NSLog(@"Failed to delete zip file: %@", removeError.localizedDescription);
|
|
198
198
|
}
|
|
199
|
-
NSLog(@"File path----: %@", jsbundleFilePath);
|
|
200
|
-
// Return the .jsbundle file path or nil if not found
|
|
201
199
|
return jsbundleFilePath;
|
|
202
200
|
}
|
|
203
201
|
|
|
@@ -210,7 +208,6 @@ RCT_EXPORT_METHOD(setupBundlePath:(NSString *)path extension:(NSString *)extensi
|
|
|
210
208
|
//Unzip file
|
|
211
209
|
NSString *extractedFilePath = [self unzipFileAtPath:path extension:(extension != nil) ? extension : @".jsbundle"];
|
|
212
210
|
if (extractedFilePath) {
|
|
213
|
-
NSLog(@"file extraction----- %@", extractedFilePath);
|
|
214
211
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
215
212
|
NSString *oldPath = [defaults stringForKey:@"PATH"];
|
|
216
213
|
if (oldPath) {
|