Skip to content

[SDK-792] fix(ios): reject showMessage for an empty or unknown message id - #920

Merged
joaodordio merged 8 commits into
masterfrom
fix/SDK-792-ios-show-message-reject
Nov 5, 2026
Merged

joaodordio merged 8 commits into
masterfrom
fix/SDK-792-ios-show-message-reject

Conversation

@joaodordio

@joaodordio joaodordio commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

📝 Summary

Reject showMessage on iOS for an empty or unknown message id, matching the Android bridge after #918.

🎟️ Jira Ticket: SDK-792

📖 Description

ReactIterableAPI.showMessage logged ITBError and returned without calling the resolver or rejecter when the message id was not in the native queue, so the JS promise never settled. An empty id was not checked at all.

It now rejects with the same code and messages as Android (messageId is null or empty, Could not find message with id: <id>), using the same rejecter pattern as getHtmlInAppContent in this file.

Stacked on #918. Branch is cut from #918 so the CHANGELOG lands under the same ## 3.2.1 section. The diff shrinks to three files once #918 merges.

🧪 How to test?

  • yarn test (adds showMessage_nativeRejects_propagatesRejectionToJs, which checks a native rejection reaches the JS caller; the reject strings themselves live in the Swift guards)
  • Example app builds for the iOS simulator with Xcode 27 (xcodebuild ... -sdk iphonesimulator build, BUILD SUCCEEDED)
  • Manual: call Iterable.inAppManager.showMessage with a message that was consumed elsewhere, expect a rejection instead of a hanging promise

🧾 Changelog

Added under ## 3.2.1.

📚 Docs PR if applicable

Covered by SDK-793.

… compiles against native 3.10.1

The published iterableapi 3.10.1 AAR is compiled with Kotlin 1.9 without jvm-default,
so onEmbeddedMessagingSyncSucceeded and onEmbeddedMessagingSyncFailed are abstract
to Java implementers. RNIterableAPIModuleImpl did not override them, so the module
failed javac. Add no-op overrides that match the native defaults.
Iterable.inAppManager.showMessage called IterableInAppManager.showMessage on the React
Native native-modules thread. Since native Android 3.9.0, a host activity that is not a
FragmentActivity takes the Dialog path, whose LifecycleRegistry.addObserver call throws
IllegalStateException off the main thread and kills the process.

- Post the native call with UiThreadUtil.runOnUiThread, matching setAutoDisplayPaused
  and the native iOS SDK.
- Reject when the message id is missing instead of passing null into native (NPE).
- Resolve null when the message is dismissed without a URL instead of NPE on toString.
- Fix the empty messageId check, which used reference equality.

Adds the first JVM unit tests for the Android bridge (Robolectric + Mockito, versions
mirrored from iterable-android-sdk) and excludes them from the npm package.
…ge id

The iOS bridge logged and returned without settling the promise. Reject with the same
messages as the Android bridge.
@joaodordio
joaodordio requested a review from a team as a code owner October 8, 2026 17:21
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Lines Statements Branches Functions
Coverage: 73%
73.63% (634/861) 63.63% (259/407) 68.97% (189/274)

@qltysh

qltysh Bot commented Oct 8, 2026

Copy link
Copy Markdown

Qlty


Coverage Impact

This PR will not change total coverage.

🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@qltysh

qltysh Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

All good ✅

Comment thread src/__tests__/IterableInApp.test.ts Resolved
@joaodordio joaodordio mentioned this pull request Oct 9, 2026
8 tasks done
@joaodordio
joaodordio merged commit f8318f7 into master Nov 5, 2026
22 checks passed
@joaodordio
joaodordio deleted the fix/SDK-792-ios-show-message-reject branch November 5, 2026 17:19
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.

2 participants