feat(notifications): open the chatbox on iOS push notification tap#33
Open
aramslegit wants to merge 1 commit into
Open
feat(notifications): open the chatbox on iOS push notification tap#33aramslegit wants to merge 1 commit into
aramslegit wants to merge 1 commit into
Conversation
On iOS, tapping a Crisp push previously brought the app to the foreground but left the message hidden in the closed chatbox: the notification-tap delegate (didReceive) calls handlePushNotification (SDK bookkeeping only) and never presents the chat. It now presents ChatViewController on the top-most view controller after handlePushNotification, mirroring the module's show(), and no-ops if a chatbox is already in the presentation chain or a transition is in flight. Applies in both notification modes. Android already opens the chatbox on tap via the Crisp SDK's own back-stacked ChatActivity PendingIntent (handleNotification(..., openChatbox=true)), so no Android change is needed.
774b423 to
106ffe4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Open the Crisp chatbox when the user taps a Crisp push notification on iOS.
Today on iOS, tapping a Crisp notification brings the app to the foreground but leaves the message hidden in the closed chatbox. The wrapper's notification-tap delegate (
userNotificationCenter(_:didReceive:withCompletionHandler:)) callsCrispSDK.handlePushNotification(...)(SDK bookkeeping only — the foregroundwillPresentpath also calls it and then just shows a banner) and never presents the chat.This is the natural counterpart to #29, which wired the foreground
onPushNotificationReceivedevent: #29 handled received-while-open; this handles tapped-while-closed.Changes (iOS only)
ios/CrispAppDelegateSubscriber.swift— afterhandlePushNotificationin the tap delegate, presentChatViewControlleron the top-most view controller (mirroring the module's existingshow()). A small helper:presentedViewControllerchain and no-ops if a chatbox is anywhere in it (the chat can itself present a child VC, e.g. an image/attachment preview, so checking only the top-most node would double-present);isBeingPresented/isBeingDismissed), which UIKit would otherwise drop with a warning.This runs in both notification modes (the Crisp-notification branch precedes the coexistence check), which is intended —
handlePushNotificationis bookkeeping-only in both modes, so the explicit present is always needed on iOS.README.md+.changeset/— document the behavior (iOS opens chat on tap; Android already does via the SDK).Design note
This auto-presents the chatbox on tap (what most apps want, and what the SDK's bookkeeping call implies). If you'd prefer the wrapper to instead emit a JS event (e.g.
onPushNotificationTapped) and let the host navigate, I'm happy to switch — just say which you prefer.Testing
Running in production in a shipping app (1fifty), verified end-to-end on a physical iOS device in both notification modes: operator message → background the app → tap the notification → the chatbox opens to the conversation.
Backward compatibility
Additive, iOS-only. No public API or config changes; notification receipt and the existing
show()are unchanged — only the previously-no-op tap path now presents the chat.Notes for reviewers
findRootViewController()(ExpoCrispSdkModule.swift); kept inline to avoid pulling in a shared util in this small PR — happy to extract a shared helper if you prefer.presentChatbox()is actually more robust than the existingshow()(which presents off the root VC and can fail when a modal is already up). Unifyingshow()onto the same logic is a sensible follow-up; left out here to keep the PR focused. (I also have a couple of small standaloneregisterPushTokenrobustness fixes I can send separately.)