You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$1000] Deeplink - No prompt to open in app when navigating to deep link as logged-out web user #25790
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
I QA'd #24638 - it worked fine and I don't believe what we're seeing here is a deploy blocker. I'm going to reassign this to the bug zero team for triage.
@ArekChr I would think we wouldn't want to close this, no? It seems like a bug that we're not triggering the desktop prompt when logged out on staging.
What changes do you think we should make in order to solve the problem?
To address this issue, I recommend the following changes:
Update Conditional Expression
We need to modify the code by removing the conditional expression that checks for isAuthenticated === false. Since the existing else statement implies that isAuthenticated is false, the conditional is unnecessary.
Adjust Denylist for Opening Desktop App
We need to modify the code by either removing HOME from the DEEPLINK_PROMPT_DENYLIST, or by incorporating the condition navigationRef.current.getState().routes.length === 1. This indicates that these changes are specifically related to the DEEPLINK and do not affect HOME. This condition establishes that if the route length is greater than 1, it signifies a deep link; otherwise, it is not a deep link. These changes are aimed at enabling the desktop app to show a prompt for opening when a user, logged out on the web, navigates to a deep link.
Modification of Conditional Code Block Adjust the code as follows:
if (currentScreen === undefined) {
return;
}
const preventPrompt = shouldPreventDeeplinkPrompt(currentScreen);
// navigationRef.current is not null as currentScreen is not undefined. Therefore, we can utilize navigationRef.current.
if (preventPrompt === true && navigationRef.current.getState().routes.length === 1) {
return;
}
This modification ensures proper handling of the prompt prevention based on the conditions mentioned.
What alternative solutions did you explore? (Optional)
We can remove HOME from the DEEPLINK_PROMPT_DENYLIST, but this might disrupt the original functionality.
P.S.
The existing solution has a potential problem of causing an infinite loop due to a specific section of code. This issue arises from the usage of the useEffect hooks in certain parts of the codebase, where each hook has a dependency on the hasShownPrompt variable. Consequently, when any of these dependencies change, it triggers the useEffect hooks and leads to an infinite loop.
To address this problem, two potential solutions have been identified:
Option 1: Removing a specific line of code
In this option, the problematic line in the codebase is removed. However, it's worth noting that this action could potentially disrupt the logic, which is designed to restrict the opening of the desktop app to a single instance.
Option 2: Removing another specific line of code
Alternatively, this option suggests removing a different line of code. Similarly, this approach might impact the logic that allows the opening of the desktop app after a user has logged in.
This Pr is add this #23673 when social sign-in is enabled
What changes do you think we should make in order to solve the problem?
we should remove isAuthenticated === false both places and
we should remove SCREENS.HOME as well because SCREENS.HOME is a root path for this allow the path
+if(!hasShownPrompt){// update this one-setHasShownPrompt(false);andremovethisNavigation.isNavigationReady().then(()=>{// Get initial routeconstinitialRoute=navigationRef.current.getCurrentRoute();setCurrentScreen(initialRoute.name);removeListener.current=navigationRef.current.addListener('state',(event)=>{setCurrentScreen(Navigation.getRouteNameFromStateEvent(event));});});}
because when ever hasShownPrompt changes and isAuthenticated === false means it will update again hasShownPrompt as false and again it will ask the popup to open desktop so it will goes to loop.
@ArekChr did you see discussion that said this somewhere? The reason I thought this was not intentional is that when I was testing it the other day, we were not showing the "switch to desktop" prompt to non-authenticated users on staging, but we were on production.
That inconsistency made me think this was likely a regression introduced at recently (unless we made the active decision to change this somewhere).
@joekaufmanexpensify It Looks like this functionality is intended. There were discussions about not prompting redirects when users are logged out on the web app, a related thread here
cc: @cdanwards
Hi @kbecciv I see you linked to this comment from here, mentioning that the PR wasn't passing tests. I think we are good now, but could you please just take a look to confirm? thanks!
Activity
OSBotify commentedon Aug 23, 2023
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open
StagingDeployCashdeploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:melvin-bot commentedon Aug 23, 2023
Triggered auto assignment to @yuwenmemon (
Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.yuwenmemon commentedon Aug 23, 2023
I QA'd #24638 - it worked fine and I don't believe what we're seeing here is a deploy blocker. I'm going to reassign this to the bug zero team for triage.
19 remaining items
joekaufmanexpensify commentedon Aug 24, 2023
@ArekChr I would think we wouldn't want to close this, no? It seems like a bug that we're not triggering the desktop prompt when logged out on staging.
ArekChr commentedon Aug 25, 2023
Sure, I thought that was intentional.
napster125 commentedon Aug 25, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user is signed out on the web and attempts to navigate to a deep link, there is no prompt to open the link in the desktop app.
What is the root cause of that problem?
The root cause of this problem is that we are not handling deep links when users are logged out.
You can find the relevant code snippet here:
App/src/components/DeeplinkWrapper/index.website.js
Lines 78 to 94 in 34d4e54
What changes do you think we should make in order to solve the problem?
To address this issue, I recommend the following changes:
We need to modify the code by removing the conditional expression that checks for
isAuthenticated === false. Since the existingelsestatement implies thatisAuthenticatedisfalse, the conditional is unnecessary.App/src/components/DeeplinkWrapper/index.website.js
Line 83 in 34d4e54
We need to modify the code by either removing
HOMEfrom theDEEPLINK_PROMPT_DENYLIST, or by incorporating the conditionnavigationRef.current.getState().routes.length === 1. This indicates that these changes are specifically related to theDEEPLINKand do not affectHOME. This condition establishes that if the route length is greater than 1, it signifies a deep link; otherwise, it is not a deep link. These changes are aimed at enabling the desktop app to show a prompt for opening when a user, logged out on the web, navigates to a deep link.App/src/components/DeeplinkWrapper/index.website.js
Lines 87 to 88 in 34d4e54
App/src/CONST.js
Line 444 in 34d4e54
This modification ensures proper handling of the prompt prevention based on the conditions mentioned.
What alternative solutions did you explore? (Optional)
We can remove
HOMEfrom theDEEPLINK_PROMPT_DENYLIST, but this might disrupt the original functionality.P.S.
The existing solution has a potential problem of causing an infinite loop due to a specific section of code. This issue arises from the usage of the useEffect hooks in certain parts of the codebase, where each hook has a dependency on the hasShownPrompt variable. Consequently, when any of these dependencies change, it triggers the useEffect hooks and leads to an infinite loop.
App/src/components/DeeplinkWrapper/index.website.js
Lines 44 to 95 in 34d4e54
App/src/components/DeeplinkWrapper/index.website.js
Line 53 in 34d4e54
App/src/components/DeeplinkWrapper/index.website.js
Line 80 in 34d4e54
To address this problem, two potential solutions have been identified:
In this option, the problematic line in the codebase is removed. However, it's worth noting that this action could potentially disrupt the logic, which is designed to restrict the opening of the desktop app to a single instance.
App/src/components/DeeplinkWrapper/index.website.js
Line 80 in 34d4e54
Result:
expensify.issue.1.mp4
Alternatively, this option suggests removing a different line of code. Similarly, this approach might impact the logic that allows the opening of the desktop app after a user has logged in.
App/src/components/DeeplinkWrapper/index.website.js
Line 53 in 34d4e54
Result:
expensify.issue.2.mp4
Ultimately, the chosen option will depend on the priorities of the project and the desired behavior of the application.
pradeepmdk commentedon Aug 25, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
No prompt to open in app when navigating to deep link as logged-out web user
What is the root cause of that problem?
App/src/components/DeeplinkWrapper/index.website.js
Line 83 in 34d4e54
App/src/components/DeeplinkWrapper/index.website.js
Line 52 in 34d4e54
Both places we are blocking for non-auth people
This Pr is add this #23673 when social sign-in is enabled
What changes do you think we should make in order to solve the problem?
we should remove
isAuthenticated === falseboth places andwe should remove
SCREENS.HOMEas well because SCREENS.HOME is a root path for this allow the pathand
we should update
App/src/components/DeeplinkWrapper/index.website.js
Line 52 in 34d4e54
App/src/components/DeeplinkWrapper/index.website.js
Line 64 in 34d4e54
because when ever
hasShownPromptchanges andisAuthenticated === falsemeans it will update againhasShownPromptas false and again it will ask the popup to open desktop so it will goes to loop.joekaufmanexpensify commentedon Aug 25, 2023
@ArekChr did you see discussion that said this somewhere? The reason I thought this was not intentional is that when I was testing it the other day, we were not showing the "switch to desktop" prompt to non-authenticated users on staging, but we were on production.
That inconsistency made me think this was likely a regression introduced at recently (unless we made the active decision to change this somewhere).
joekaufmanexpensify commentedon Aug 28, 2023
Not overdue
joekaufmanexpensify commentedon Aug 29, 2023
@ArekChr mind sharing your thoughts on this when you have a sec?
melvin-bot commentedon Aug 30, 2023
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
joekaufmanexpensify commentedon Aug 30, 2023
Still pending C+ review
ArekChr commentedon Aug 31, 2023
@joekaufmanexpensify It Looks like this functionality is intended. There were discussions about not prompting redirects when users are logged out on the web app, a related thread here
cc: @cdanwards
joekaufmanexpensify commentedon Aug 31, 2023
Ah cool. Yep, confirmed here. Closing as this is intended!
Julesssss commentedon Jun 6, 2024
Hi @kbecciv I see you linked to this comment from here, mentioning that the PR wasn't passing tests. I think we are good now, but could you please just take a look to confirm? thanks!