@hot-updater/react-native 0.27.1 → 0.29.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/android/build.gradle +12 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +3 -0
- package/android/src/main/cpp/CMakeLists.txt +9 -0
- package/android/src/main/cpp/HotUpdaterRecovery.cpp +143 -0
- package/android/src/main/java/com/hotupdater/BundleFileStorageService.kt +325 -210
- package/android/src/main/java/com/hotupdater/BundleMetadata.kt +73 -16
- package/android/src/main/java/com/hotupdater/CohortService.kt +73 -0
- package/android/src/main/java/com/hotupdater/DecompressService.kt +28 -22
- package/android/src/main/java/com/hotupdater/HotUpdaterException.kt +1 -1
- package/android/src/main/java/com/hotupdater/HotUpdaterImpl.kt +51 -13
- package/android/src/main/java/com/hotupdater/HotUpdaterRecoveryManager.kt +533 -0
- package/android/src/main/java/com/hotupdater/HotUpdaterRecoveryReceiver.kt +14 -0
- package/android/src/main/java/com/hotupdater/ReactNativeValueConverters.kt +55 -0
- package/android/src/main/java/com/hotupdater/TarBrDecompressionStrategy.kt +19 -7
- package/android/src/newarch/HotUpdaterModule.kt +16 -25
- package/android/src/oldarch/HotUpdaterModule.kt +20 -26
- package/android/src/oldarch/HotUpdaterSpec.kt +12 -2
- package/ios/HotUpdater/Internal/BundleFileStorageService.swift +340 -232
- package/ios/HotUpdater/Internal/BundleMetadata.swift +61 -8
- package/ios/HotUpdater/Internal/CohortService.swift +63 -0
- package/ios/HotUpdater/Internal/DecompressService.swift +53 -30
- package/ios/HotUpdater/Internal/HotUpdater-Bridging-Header.h +9 -1
- package/ios/HotUpdater/Internal/HotUpdater.mm +376 -70
- package/ios/HotUpdater/Internal/HotUpdaterCrashHandler.h +7 -0
- package/ios/HotUpdater/Internal/HotUpdaterCrashHandler.mm +4 -0
- package/ios/HotUpdater/Internal/HotUpdaterImpl.swift +321 -9
- package/ios/HotUpdater/Internal/TarBrDecompressionStrategy.swift +24 -8
- package/lib/commonjs/DefaultResolver.js +3 -5
- package/lib/commonjs/DefaultResolver.js.map +1 -1
- package/lib/commonjs/checkForUpdate.js +2 -0
- package/lib/commonjs/checkForUpdate.js.map +1 -1
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native.js +211 -39
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/native.spec.js +443 -0
- package/lib/commonjs/native.spec.js.map +1 -0
- package/lib/commonjs/specs/NativeHotUpdater.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/wrap.js +4 -5
- package/lib/commonjs/wrap.js.map +1 -1
- package/lib/module/DefaultResolver.js +3 -5
- package/lib/module/DefaultResolver.js.map +1 -1
- package/lib/module/checkForUpdate.js +3 -1
- package/lib/module/checkForUpdate.js.map +1 -1
- package/lib/module/index.js +14 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/native.js +204 -34
- package/lib/module/native.js.map +1 -1
- package/lib/module/native.spec.js +442 -0
- package/lib/module/native.spec.js.map +1 -0
- package/lib/module/specs/NativeHotUpdater.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/wrap.js +5 -6
- package/lib/module/wrap.js.map +1 -1
- package/lib/typescript/commonjs/checkForUpdate.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +14 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/native.d.ts +43 -23
- package/lib/typescript/commonjs/native.d.ts.map +1 -1
- package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts +32 -8
- package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts.map +1 -1
- package/lib/typescript/commonjs/types.d.ts +6 -3
- package/lib/typescript/commonjs/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/wrap.d.ts +3 -6
- package/lib/typescript/commonjs/wrap.d.ts.map +1 -1
- package/lib/typescript/module/checkForUpdate.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +14 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/native.d.ts +43 -23
- package/lib/typescript/module/native.d.ts.map +1 -1
- package/lib/typescript/module/specs/NativeHotUpdater.d.ts +32 -8
- package/lib/typescript/module/specs/NativeHotUpdater.d.ts.map +1 -1
- package/lib/typescript/module/types.d.ts +6 -3
- package/lib/typescript/module/types.d.ts.map +1 -1
- package/lib/typescript/module/wrap.d.ts +3 -6
- package/lib/typescript/module/wrap.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/DefaultResolver.ts +4 -4
- package/src/checkForUpdate.ts +4 -0
- package/src/index.ts +21 -0
- package/src/native.spec.ts +480 -0
- package/src/native.ts +285 -39
- package/src/specs/NativeHotUpdater.ts +36 -6
- package/src/types.ts +7 -3
- package/src/wrap.tsx +8 -12
|
@@ -7,6 +7,7 @@ import com.facebook.react.bridge.Promise
|
|
|
7
7
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
8
|
import com.facebook.react.bridge.ReactMethod
|
|
9
9
|
import com.facebook.react.bridge.ReadableMap
|
|
10
|
+
import com.facebook.react.bridge.WritableNativeArray
|
|
10
11
|
import com.facebook.react.bridge.WritableNativeMap
|
|
11
12
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
12
13
|
import kotlinx.coroutines.CoroutineScope
|
|
@@ -14,13 +15,12 @@ import kotlinx.coroutines.Dispatchers
|
|
|
14
15
|
import kotlinx.coroutines.SupervisorJob
|
|
15
16
|
import kotlinx.coroutines.cancel
|
|
16
17
|
import kotlinx.coroutines.launch
|
|
17
|
-
import org.json.JSONArray
|
|
18
|
-
import org.json.JSONObject
|
|
19
18
|
|
|
20
19
|
class HotUpdaterModule internal constructor(
|
|
21
20
|
context: ReactApplicationContext,
|
|
22
21
|
) : HotUpdaterSpec(context) {
|
|
23
22
|
private val mReactApplicationContext: ReactApplicationContext = context
|
|
23
|
+
private val cohortService = CohortService(context)
|
|
24
24
|
|
|
25
25
|
// Managed coroutine scope for the module lifecycle
|
|
26
26
|
private val moduleScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
|
|
@@ -153,32 +153,10 @@ class HotUpdaterModule internal constructor(
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
156
|
-
override fun notifyAppReady(
|
|
157
|
-
val bundleId = params.getString("bundleId")
|
|
158
|
-
val result = JSONObject()
|
|
159
|
-
|
|
160
|
-
if (bundleId == null) {
|
|
161
|
-
result.put("status", "STABLE")
|
|
162
|
-
return result.toString()
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
val impl = getInstance()
|
|
166
|
-
val statusMap = impl.notifyAppReady(bundleId)
|
|
167
|
-
|
|
168
|
-
result.put("status", statusMap["status"] as? String ?: "STABLE")
|
|
169
|
-
statusMap["crashedBundleId"]?.let {
|
|
170
|
-
result.put("crashedBundleId", it as String)
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return result.toString()
|
|
174
|
-
}
|
|
156
|
+
override fun notifyAppReady(): WritableNativeMap = getInstance().notifyAppReady().toWritableNativeMap()
|
|
175
157
|
|
|
176
158
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
177
|
-
override fun getCrashHistory():
|
|
178
|
-
val impl = getInstance()
|
|
179
|
-
val crashHistory = impl.getCrashHistory()
|
|
180
|
-
return JSONArray(crashHistory).toString()
|
|
181
|
-
}
|
|
159
|
+
override fun getCrashHistory(): WritableNativeArray = getInstance().getCrashHistory().toWritableNativeArray()
|
|
182
160
|
|
|
183
161
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
184
162
|
override fun clearCrashHistory(): Boolean {
|
|
@@ -192,7 +170,23 @@ class HotUpdaterModule internal constructor(
|
|
|
192
170
|
return impl.getBaseURL()
|
|
193
171
|
}
|
|
194
172
|
|
|
173
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
174
|
+
override fun getBundleId(): String? {
|
|
175
|
+
val impl = getInstance()
|
|
176
|
+
return impl.getBundleId()
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
180
|
+
override fun getManifest(): WritableNativeMap = getInstance().getManifest().toWritableNativeMap()
|
|
181
|
+
|
|
195
182
|
@ReactMethod
|
|
183
|
+
override fun setCohort(cohort: String) {
|
|
184
|
+
cohortService.setCohort(cohort)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
188
|
+
override fun getCohort(): String = cohortService.getCohort()
|
|
189
|
+
|
|
196
190
|
override fun resetChannel(promise: Promise) {
|
|
197
191
|
moduleScope.launch {
|
|
198
192
|
try {
|
|
@@ -4,6 +4,8 @@ import com.facebook.react.bridge.Promise
|
|
|
4
4
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
5
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
6
6
|
import com.facebook.react.bridge.ReadableMap
|
|
7
|
+
import com.facebook.react.bridge.WritableArray
|
|
8
|
+
import com.facebook.react.bridge.WritableMap
|
|
7
9
|
|
|
8
10
|
abstract class HotUpdaterSpec internal constructor(
|
|
9
11
|
context: ReactApplicationContext,
|
|
@@ -17,13 +19,21 @@ abstract class HotUpdaterSpec internal constructor(
|
|
|
17
19
|
|
|
18
20
|
abstract fun reloadProcess(promise: Promise)
|
|
19
21
|
|
|
20
|
-
abstract fun notifyAppReady(
|
|
22
|
+
abstract fun notifyAppReady(): WritableMap
|
|
21
23
|
|
|
22
|
-
abstract fun getCrashHistory():
|
|
24
|
+
abstract fun getCrashHistory(): WritableArray
|
|
23
25
|
|
|
24
26
|
abstract fun clearCrashHistory(): Boolean
|
|
25
27
|
|
|
26
28
|
abstract fun getBaseURL(): String
|
|
27
29
|
|
|
30
|
+
abstract fun setCohort(customId: String)
|
|
31
|
+
|
|
32
|
+
abstract fun getCohort(): String
|
|
33
|
+
|
|
34
|
+
abstract fun getBundleId(): String?
|
|
35
|
+
|
|
36
|
+
abstract fun getManifest(): WritableMap
|
|
37
|
+
|
|
28
38
|
abstract fun resetChannel(promise: Promise)
|
|
29
39
|
}
|