Repository navigation
feat: hand the identified contact to the messenger before a survey starts - #46
Merged
Merged
Conversation
…arts The messenger skips survey contact questions an identified contact already answered (Messenger-App#240). It reads userId, email, name and phone from session-update once, when the survey starts. - Parse phone from the session answer (it was dropped, so the phone question was never skipped) and store it like the email. - Send session-update to an open widget after every session answer (identify, updateContact, the new session after clearIdentity), not only when the file session changed. - Surveys (showSurvey, server triggers) wait for an identify in flight, at most 3 s, before the widget opens. - The delayed reveal after the ping does nothing once the activity is finishing (a survey with nothing to ask closes right away). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The messenger renders an in-app survey only once its definition is in and something will be asked (Messenger-App#240); a survey with nothing to ask closes without rendering. The activity showed its dim loader as soon as a survey started, so such a survey flashed a dim and spinner. Surveys now keep the loader, the dim and the web view hidden until the first height-update (card) or survey-shown / survey-legacy / height-update (full screen), or until 1.2 s after the start, when today's loader shows (and then stays). Widget opens are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Surveys 2.0: skip contact questions when the user is known (Android)
Part of the "skip contact questions when the user is known" feature:
Deploy order: Server first, then Messenger-App and Frontend (see Server#2079). This SDK change doesn't depend on that order. It needs an Android SDK release to take effect (and the wrappers pick it up when they bump their
gleap-android-sdkdependency). No version bump here.The messenger reads
userId,email,nameandphonefromsession-updateonce, when a survey starts. It skips the email and name/phone questions an identified contact already has, and closes the survey (survey-closednothing_to_ask, thenclose-widget) when nothing is left to ask.Fixed
GleapSessionProperties.fromJSONObjectdidn't readphone, sosessionData.phonewas always missing and phone questions were never skipped. It now reads it (when it isn't JSON null).setGleapUserSessionstores it the same way as the email, so a new contact without a phone no longer keeps the previous contact's phone.session-updatereached an open widget only on ping, or when the file-access token changed. It is now sent after every accepted session answer, which coversidentifyContact/identifyUser,updateContactand the new guest session afterclearIdentity. It still waits for the first ping. This matches iOS and the JS SDK.identifyContactruns in the background, soshowSurvey(...)straight after it, or a server-triggered survey, could ping with the guest session and ask for known data. Surveys now wait inGleapWidgetLauncher.openWithScreenshotuntil no identify is queued or running, checking every 100 ms for at most 3 s. The widget home (SurveyType.NONE) is unchanged.close-widget→closeMainGleapActivity()→finish()already leaves a clean state:onDestroyresetsisOpened, calls the widget-closed listener once, brings back the FAB and clears the dim. The only gap was the 500 ms delayed reveal after the ping. It could still show the web view and the card's dim bands on an activity that was already finishing. It now returns whenisFinishing().Not changed (checked)
sessionDatakeys are alreadyuserId/name/email/phone(GleapWidgetMessages.sessionUpdate).config-update,session-update, then queued actions (start-survey).config-updatealready sendsisAppandsurveyCallbacks.close-widgetcan't arrive beforeonCreate, because the JS bridge is attached there.Side effects
gleapIdwhile the widget is open now reaches the open widget, and the messenger resets its state for the new contact. iOS and the JS SDK already behave this way.Verification
JDK: Android Studio's bundled JBR (OpenJDK 21).
./gradlew build: BUILD SUCCESSFUL../gradlew test --rerun-tasks: 203 tests, 0 failures../gradlew :gleap:assembleRelease :gleap:testDebugUnitTest: passes.Follow-up: hold a survey back until the messenger has something to show (82418ce)
Messenger-App#240 69a4f8b renders an in-app survey only once its definition is in and something will be asked. An all-skipped survey closes (
survey-closednothing_to_ask, thenclose-widget) without rendering anything. The activity used to show its#66000000dim loader as soon as a survey started, until the first ping + 500 ms, so such a survey still flashed a dim and a spinner.What changed, for surveys only:
height-update. For full screen it is the first ofsurvey-shown,survey-legacyorheight-update. These messages are forwarded by appnew.html.survey-closedcancels a pending fallback. An all-skipped survey closes without anything having been visible.Widget (non-survey) opens are unchanged.
appnew.html's own card dim and full-screen background are applied inside the web view, so they stay hidden along with it. appnew.html lives in Messenger-App, not in this repo.
Verified:
./gradlew buildand./gradlew test(203 tests) pass. Not driven on a device or emulator.🤖 Generated with Claude Code