Skip to content

Commit d51e77a

Browse files
robingenzclaude
andauthored
feat!: protocol f6b26e1, core-android 429070e and core-ios 0.2.0 (#23)
* feat!: protocol f6b26e1 and core-android 85278b8 The React Native SDK's share of the wire round decided 2026-10-31 (hotcodepush-team/ hotcodepush#324). The bridges pass the cores' JSON through and call none of the renamed core APIs, so the wire change reaches the app through the pins alone; the iOS core stays at 0.1.0 until 0.2.0 is released. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * feat!: core-android 429070e and the cores' renamed APIs Follows the cores' contract audit of 2026-10-31: getChannel() and getDevice() replace channel() and deviceResult(), and the bundle loaders drop isConnectionMetered() and the network monitor it held, since the cores read their own. The Android test resource file carries fingerprint and embeddedBundleId as null, which the stricter reader requires. The iOS core stays at 0.1.0 until 0.2.0 is released. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat!: core-ios 0.2.0 The xcframework of core-ios 0.2.0, the release with the wire change of 2026-10-31 and the renamed core API the previous commit follows. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
1 parent b0b429a commit d51e77a

12 files changed

Lines changed: 16 additions & 26 deletions

‎android/build.gradle‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ repositories {
4444

4545
dependencies {
4646
implementation 'com.facebook.react:react-android'
47-
implementation 'com.hotcodepush:core-android:2af4210f48715513dd0a8028f00d08d12c530fda'
47+
implementation 'com.hotcodepush:core-android:429070ec80066b8f21396434d1e608b0317d34a3'
4848
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2'
4949
testImplementation 'junit:junit:4.13.2'
5050
testImplementation 'org.mockito:mockito-core:5.20.0'

‎android/src/main/java/com/hotcodepush/reactnative/HotCodePushModule.kt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ class HotCodePushModule(reactContext: ReactApplicationContext) : NativeHotCodePu
4343

4444
override fun downloadUpdate(options: ReadableMap, promise: Promise) = runtime.invoke(promise) { it.downloadUpdate(downloadUpdateOptions(options)).toJson() }
4545

46-
override fun getChannel(promise: Promise) = runtime.invoke(promise) { it.channel().toJson() }
46+
override fun getChannel(promise: Promise) = runtime.invoke(promise) { it.getChannel().toJson() }
4747

48-
override fun getDevice(promise: Promise) = runtime.invoke(promise) { it.deviceResult().toJson() }
48+
override fun getDevice(promise: Promise) = runtime.invoke(promise) { it.getDevice().toJson() }
4949

5050
override fun getState(promise: Promise) = runtime.invoke(promise) { it.getState().toJson() }
5151

‎android/src/main/java/com/hotcodepush/reactnative/HotCodePushRuntime.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ interface HotCodePushEventSink {
4040
class HotCodePushRuntime internal constructor(private val context: Context) : CoreListener {
4141
private val scheduler = HandlerScheduler()
4242
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
43-
private val loader = ReactNativeBundleLoader(context, SharedPreferencesStore(context), FileStore.defaultRootDirectory(context), ::reloadReactNative)
43+
private val loader = ReactNativeBundleLoader(SharedPreferencesStore(context), FileStore.defaultRootDirectory(context), ::reloadReactNative)
4444

4545
@Volatile private var core: Core? = null
4646

‎android/src/main/java/com/hotcodepush/reactnative/ReactNativeBundleLoader.kt‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,20 @@ import com.hotcodepush.core.EmbeddedBundle
66
import com.hotcodepush.core.EmbeddedBundleManifest
77
import com.hotcodepush.core.Hashing
88
import com.hotcodepush.core.KeyValueStore
9-
import com.hotcodepush.core.NetworkMonitor
109
import com.hotcodepush.core.PlainException
1110
import java.io.File
1211
import java.io.InputStream
1312

1413
// React Native loads the JavaScript its host is handed, so a switch is a reload of the host.
1514
// Bundles live under the `served` directory of the store, and a `null` bundle ID means the embedded bundle.
1615
class ReactNativeBundleLoader(
17-
context: Context,
1816
// The core's own store, so the bundle for the next start lies beside the state it belongs to.
1917
private val store: KeyValueStore,
2018
storeDirectory: File,
2119
private val reloadReactNative: () -> Unit,
2220
) : BundleLoader {
2321
class RequestedReload(val bundleId: String?)
2422

25-
private val networkMonitor = NetworkMonitor(context)
2623
private val servedDirectory = File(storeDirectory, "served")
2724

2825
private var isHostRunning = false
@@ -78,8 +75,6 @@ class ReactNativeBundleLoader(
7875
@Synchronized
7976
override fun servedBundleId(): String? = if (isHostRunning) runningBundleId else persistedBundleId()
8077

81-
override fun isConnectionMetered(): Boolean = networkMonitor.isConnectionMetered()
82-
8378
private fun bundleFile(bundleId: String) = File(projectionDirectory(bundleId), BUNDLE_FILE_NAME)
8479

8580
// The persisted bundle counts only while its JavaScript is on disk. Otherwise the embedded bundle runs.

‎android/src/test/java/com/hotcodepush/reactnative/FirstRenderListenerTest.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class FirstRenderListenerTest {
3131
private val reactRoot = TestReactRoot(context)
3232
private val uiManager: UIManager = mock(UIManager::class.java)
3333
private var requestedReloads = 0
34-
private val loader = ReactNativeBundleLoader(context, SharedPreferencesStore(context), File(context.filesDir, "hotcodepush")) { requestedReloads++ }
34+
private val loader = ReactNativeBundleLoader(SharedPreferencesStore(context), File(context.filesDir, "hotcodepush")) { requestedReloads++ }
3535
private var renders = 0
3636

3737
@Test

‎android/src/test/java/com/hotcodepush/reactnative/HotCodePushRuntimeTest.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import java.io.File
2222
class HotCodePushRuntimeTest {
2323
private val context = contextWithResourceFile()
2424
private val runtime = HotCodePushRuntime(context)
25-
private val bundleLoader = ReactNativeBundleLoader(context, SharedPreferencesStore(context), File(context.filesDir, "hotcodepush")) {}
25+
private val bundleLoader = ReactNativeBundleLoader(SharedPreferencesStore(context), File(context.filesDir, "hotcodepush")) {}
2626
private val embeddedBundleLoader = JSBundleLoader.createAssetLoader(context, EMBEDDED_BUNDLE_URL, true)
2727

2828
@Test

‎android/src/test/java/com/hotcodepush/reactnative/ReactNativeBundleLoaderTest.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ class ReactNativeBundleLoaderTest {
4242
assertEquals("b1", createLoader(SharedPreferencesStore(context)).servedBundleId())
4343
}
4444

45-
private fun createLoader(store: KeyValueStore) = ReactNativeBundleLoader(context, store, File(context.filesDir, "hotcodepush")) {}
45+
private fun createLoader(store: KeyValueStore) = ReactNativeBundleLoader(store, File(context.filesDir, "hotcodepush")) {}
4646
}

‎android/src/test/java/com/hotcodepush/reactnative/ResourceFileContext.kt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import org.mockito.Mockito.`when`
77
import org.mockito.Mockito.mock
88
import org.robolectric.RuntimeEnvironment
99

10-
private const val RESOURCE_FILE = """{"appId":"0b6d5c1e-2f3a-4b5c-8d9e-0f1a2b3c4d5e","channelId":null,"builtAt":"2026-10-08T00:00:00.000Z","embeddedBundleManifest":null}"""
10+
private const val RESOURCE_FILE = """{"appId":"0b6d5c1e-2f3a-4b5c-8d9e-0f1a2b3c4d5e","channelId":null,"builtAt":"2026-10-08T00:00:00.000Z","fingerprint":null,"embeddedBundleManifest":null,"embeddedBundleId":null}"""
1111

1212
internal fun contextWithResourceFile(): Context {
1313
val resourceAssets = mock(AssetManager::class.java)

‎ios/HotCodePushRuntime.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ private let isDebugBuild = false
152152
case .downloadUpdate:
153153
return try Json.encodeObject(await core.downloadUpdate(options: try HotCodePushRuntime.downloadUpdateOptions(from: options)))
154154
case .getChannel:
155-
return try Json.encodeObject(await core.channel())
155+
return try Json.encodeObject(await core.getChannel())
156156
case .getDevice:
157-
return try Json.encodeObject(await core.deviceResult())
157+
return try Json.encodeObject(await core.getDevice())
158158
case .getState:
159159
return try Json.encodeObject(await core.getState())
160160
case .notifyReady:

‎ios/ReactNativeBundleLoader.swift‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ final class ReactNativeBundleLoader: BundleLoader {
1515
private static let servedBundleIdKey = "hotcodepush.servedBundleId"
1616

1717
private let lock = NSLock()
18-
private let networkMonitor = NetworkMonitor()
1918
private let servedDirectory: URL
2019
private let store: KeyValueStore
2120

@@ -101,10 +100,6 @@ final class ReactNativeBundleLoader: BundleLoader {
101100
return isHostRunning ? _runningBundleId : persistedBundleId()
102101
}
103102

104-
func isConnectionMetered() -> Bool {
105-
return networkMonitor.isConnectionMetered()
106-
}
107-
108103
private func bundleFileURL(bundleId: String) -> URL {
109104
return projectionDirectory(bundleId: bundleId).appendingPathComponent(ReactNativeBundleLoader.bundleFileName)
110105
}

0 commit comments

Comments
 (0)