MOBILE-103: drop legacy RN and reflection for new arch#169
MOBILE-103: drop legacy RN and reflection for new arch#169sergeysozinov merged 5 commits intonew-archfrom
Conversation
… New Architecture
There was a problem hiding this comment.
Pull request overview
Updates the Android React Native integration to rely exclusively on the New Architecture APIs (ReactHost), removing legacy RN / reflection-based compatibility paths.
Changes:
- Simplified push-click delivery plumbing by removing the external fallback ReactContext parameter.
- Reworked ReactContext discovery/listening to use
ReactHost+ReactInstanceEventListener(noReactInstanceManager, no reflection). - Added lifecycle cleanup for the registered
ReactInstanceEventListener.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| android/src/main/java/com/mindboxsdk/MindboxSdkModule.kt | Simplifies external push-click entrypoint to depend on the active module instance only. |
| android/src/main/java/com/mindboxsdk/MindboxSdkLifecycleListener.kt | Switches ReactContext lifecycle tracking to ReactHost-based APIs and adds listener removal on destroy. |
| android/src/main/java/com/mindboxsdk/MindboxJsDelivery.kt | Updates push-click dispatch call site to match the simplified module API. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR updates the React Native Android integration to assume the New Architecture APIs (ReactHost) and removes legacy/reflective paths, simplifying push-click delivery plumbing.
Changes:
- Simplify example app push intent handling by removing ReactContext/instance listeners and relying on
MindboxJsDeliveryqueuing. - Migrate lifecycle listener from
ReactInstanceManager/reflection toReactHost+ReactInstanceEventListener. - Remove
ReactContextdependency fromMindboxJsDeliveryand adjust the module delivery API accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| example/exampleApp/android/app/src/main/java/com/exampleapp/MainActivity.kt | Removes legacy/new-arch branching listeners and directly forwards intents to Mindbox + JS delivery. |
| android/src/main/java/com/mindboxsdk/MindboxSdkModule.kt | Updates push-click delivery helper signature and module dispatch logic. |
| android/src/main/java/com/mindboxsdk/MindboxSdkLifecycleListener.kt | Drops ReactInstanceManager + reflection fallback; uses ReactHost listener APIs. |
| android/src/main/java/com/mindboxsdk/MindboxJsDelivery.kt | Removes stored ReactContext; keeps singleton + delayed intent logic for JS listener readiness. |
| android/src/main/java/com/mindboxsdk/MindboxEventEmitter.kt | Updates JS delivery initialization/calls to match new MindboxJsDelivery singleton API. |
Comments suppressed due to low confidence (1)
android/src/main/java/com/mindboxsdk/MindboxSdkModule.kt:51
deliverPushNotificationClickedFromExternaldrops the event whenactiveModuleis null. BecauseMindboxJsDelivery.hasListenersis a global flag that isn't reset ininvalidate(), a module teardown/reload can leavehasListeners=truewhileactiveModule=null, causing subsequent push-click events to be skipped (and not delayed). Consider either resettingMindboxJsDelivery.Shared.hasListenersto false when clearing/invalidating the module, or queueing the event for later delivery until a new module becomes active.
fun deliverPushNotificationClickedFromExternal(bundle: Bundle) {
val module: MindboxSdkModule? = activeModule
if (module != null) {
module.emitPushFromDelivery(bundle)
} else {
Mindbox.writeLog("[RN][MindboxSdkModule] deliverPush: no active module, event skipped", Level.WARN)
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…rnal modifier for hasListener property
https://tracker.yandex.ru/MOBILE-105