Skip to content

101425: Native share - Android - No sharing flow/app freezes when share image signed out - #105299

Open
abbasifaizan70 wants to merge 16 commits into
Expensify:mainfrom
abbasifaizan70:101425
Open

abbasifaizan70 wants to merge 16 commits into
Expensify:mainfrom
abbasifaizan70:101425

Conversation

@abbasifaizan70

@abbasifaizan70 abbasifaizan70 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

A share received while signed out is now parked in memory instead of being replayed through the report deep-link path, which dropped it (or set the onboarding error) for a new account. linkingConfig.filter stops React Navigation from mounting share/root as launch state while signed out, so onboarding no longer evicts the share modal. useOnboardingFlowRouter opens the parked share when onboarding isn’t needed, and defers it when onboarding starts; the onboarding exits then open it on top of the landing screen.

Fixed Issues

$ #101425
PROPOSAL: #101425 (comment)

Tests

  • Verify that no errors appear in the JS console

Scenario 1:

  1. Select a photo from device gallery
  2. Share it to Expensify app
  3. Verify the login screen for Expensify app displayed
  4. Login with new user with private domain
  5. After signing you are redirected to the sharing flow

Scenario 2:

  1. Select a photo from device gallery
  2. Share it to Expensify app
  3. Verify the login screen for Expensify app displayed
  4. Login with new user with public domain
  5. After signing you are redirected to the sharing flow

Offline tests

same as tests.

QA Steps

  • Verify that no errors appear in the JS console

same as tests.

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen_Recording_20261103_003728_New.Expensify.Dev.mp4

Screen_Recording_20261103_003554_New.Expensify.Dev.1.mp4
Android: mWeb Chrome

Not applicable.

iOS: Native
Screen.Recording.iPhone.17.Pro.Max.03-11-2026.at.12.57.55.AM.mp4
iOS: mWeb Safari

Not applicable.

MacOS: Chrome / Safari

Not applicable.

@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/libs/Navigation/guards/OnboardingGuard.ts 98.44% <100.00%> (+0.03%) ⬆️
src/libs/Navigation/helpers/isNativeShareLink.ts 100.00% <100.00%> (ø)
src/libs/Navigation/linkingConfig/index.ts 100.00% <100.00%> (ø)
src/libs/actions/Link.ts 72.32% <100.00%> (+0.22%) ⬆️
src/libs/navigateAfterOnboarding.ts 94.44% <100.00%> (+0.15%) ⬆️
src/libs/Navigation/helpers/pendingNativeShare.ts 97.36% <97.36%> (ø)
src/hooks/useOnboardingFlow.ts 84.33% <83.33%> (+2.79%) ⬆️
... and 9 files with indirect coverage changes

@abbasifaizan70 abbasifaizan70 changed the title 101425: Native share - Android - No sharing flow/app freezes when sha… 101425: Native share - Android - No sharing flow/app freezes when share image signed out Nov 2, 2026
@abbasifaizan70
abbasifaizan70 marked this pull request as ready for review November 2, 2026 20:03
@abbasifaizan70
abbasifaizan70 requested review from a team as code owners November 2, 2026 20:03
@melvin-bot
melvin-bot Bot requested review from jayeshmangwani and removed request for a team November 2, 2026 20:03
@melvin-bot

melvin-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown

@jayeshmangwani Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot requested review from garrettmknight and removed request for a team November 2, 2026 20:03
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T06:57:06.165174Z 8bb2afb Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jayeshmangwani

Copy link
Copy Markdown
Contributor

@MelvinBot review
@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 732c4dde37

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/libs/actions/Share.ts Resolved
@abbasifaizan70

Copy link
Copy Markdown
Contributor Author

@jayeshmangwani Can you review again?

garrettmknight
garrettmknight previously approved these changes Nov 11, 2026

@garrettmknight garrettmknight left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Flow looks good from a product perspective.

@jayeshmangwani

Copy link
Copy Markdown
Contributor

@jayeshmangwani Can you review again?

Sorry for the delay. I was OOO for a few days, but I'm testing this PR again today.

@jayeshmangwani

Copy link
Copy Markdown
Contributor

@abbasifaizan70 I tried testing this on iOS 27.2, but the fix doesn't seem to work for me.

Screen.Recording.2026-11-15.at.7.20.48.AM.mov

@abbasifaizan70

Copy link
Copy Markdown
Contributor Author
Screen.Recording.iPhone.17.Pro.Max.18-11-2026.at.4.33.46.AM.mp4

@jayeshmangwani I updated with latest main and after tested it working totally fine. Can you check again? Thanks

Comment thread src/libs/actions/Share.ts Resolved
Comment thread src/libs/actions/Share.ts Resolved
Comment thread src/libs/Navigation/NavigationRoot.tsx Resolved
@abbasifaizan70

Copy link
Copy Markdown
Contributor Author

@jayeshmangwani all review comments are addressed and pushed:

  • The in-memory share state moved out of actions/Share.ts into src/libs/Navigation/helpers/pendingNativeShare.ts, merged with the flag from shouldParkNativeShare.ts. One module now owns the state and the session cleanup, and actions/Share.ts is back to what main has.
  • OnboardingGuard.evaluate now keeps the share for the onboarding exit right before its final REDIRECT. wasShareFlowMounted and both NavigationRoot calls are removed.
  • Long comments are shortened.
  • Renamed to NativeShareStatus / nativeShareStatus, with 'waitingForOnboardingCheck' and 'waitingForOnboardingExit'.

@jayeshmangwani

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8bb2afb55f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

return;
}
attempts++;
pushShareFlow();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Wait for the welcome modal's exit navigation before retrying

When a native share is parked behind the migrated-user welcome modal, the dismissal state event can precede transitionStart, so this retry opens and consumes the share before the modal's exit navigation. Fresh evidence beyond the earlier consumption issue is src/components/MigratedUserWelcomeModal.tsx:62–66, where handleClose schedules Navigation.navigate(spendRoute) in goBack's afterTransition. That later navigation pushes TabNavigator above the share (src/libs/Navigation/helpers/linkTo/index.ts:240–244), leaving the user on Spend with no pending intent to reopen. Retry after the welcome modal's landing navigation, rather than as soon as the modal disappears.

Useful? React with 👍 / 👎.

Comment thread src/libs/actions/Link.ts
Comment on lines +525 to +527
if (isNativeShareLink(route) && shouldParkNativeShare(isAuthenticated)) {
setPendingNativeShare();
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the anonymous-session sign-in gate for parked shares

If the user has an anonymous public-room session created during this app run and shares while OpenApp is still loading, this early return captures the link instead of reaching the anonymous-route check at src/libs/actions/Link.ts:599–601. After loading, useOnboardingFlowRouter replays it through openPendingNativeShare, which never checks the session type, even though canAnonymousUserAccessRoute('share/root') is false. The result is the Share composer under an anonymous account, with no real sign-in prompt, rather than the existing sign-out/sign-in flow. Preserve that access gate before parking or replaying the intent.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
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