Skip to content

MOBILE-103: drop legacy RN and reflection for new arch#169

Merged
sergeysozinov merged 5 commits intonew-archfrom
feature/MOBILE-105
Apr 23, 2026
Merged

MOBILE-103: drop legacy RN and reflection for new arch#169
sergeysozinov merged 5 commits intonew-archfrom
feature/MOBILE-105

Conversation

@sergeysozinov
Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (no ReactInstanceManager, 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.

Comment thread android/src/main/java/com/mindboxsdk/MindboxSdkLifecycleListener.kt
Comment thread android/src/main/java/com/mindboxsdk/MindboxJsDelivery.kt
Comment thread android/src/main/java/com/mindboxsdk/MindboxJsDelivery.kt
Comment thread android/src/main/java/com/mindboxsdk/MindboxSdkLifecycleListener.kt
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MindboxJsDelivery queuing.
  • Migrate lifecycle listener from ReactInstanceManager/reflection to ReactHost + ReactInstanceEventListener.
  • Remove ReactContext dependency from MindboxJsDelivery and 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

  • deliverPushNotificationClickedFromExternal drops the event when activeModule is null. Because MindboxJsDelivery.hasListeners is a global flag that isn't reset in invalidate(), a module teardown/reload can leave hasListeners=true while activeModule=null, causing subsequent push-click events to be skipped (and not delayed). Consider either resetting MindboxJsDelivery.Shared.hasListeners to 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.

Comment thread android/src/main/java/com/mindboxsdk/MindboxSdkLifecycleListener.kt
Comment thread android/src/main/java/com/mindboxsdk/MindboxSdkModule.kt Outdated
@sergeysozinov sergeysozinov requested a review from enotniy April 22, 2026 13:28
Comment thread android/src/main/java/com/mindboxsdk/MindboxJsDelivery.kt Outdated
Comment thread android/src/main/java/com/mindboxsdk/MindboxJsDelivery.kt Outdated
Comment thread android/src/main/java/com/mindboxsdk/MindboxJsDelivery.kt Outdated
Comment thread android/src/main/java/com/mindboxsdk/MindboxSdkModule.kt
@sergeysozinov sergeysozinov merged commit 3206e72 into new-arch Apr 23, 2026
4 checks passed
@sergeysozinov sergeysozinov deleted the feature/MOBILE-105 branch April 23, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants