Page MenuHomePhabricator

[native] DisplayCommunityDirectoryPrompt
ClosedPublic

Authored by varun on Nov 26 2024, 10:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 14, 8:16 AM
Unknown Object (File)
Fri, Mar 14, 8:16 AM
Unknown Object (File)
Fri, Mar 14, 8:16 AM
Unknown Object (File)
Fri, Mar 14, 8:16 AM
Unknown Object (File)
Fri, Mar 14, 8:16 AM
Unknown Object (File)
Thu, Mar 13, 10:17 AM
Unknown Object (File)
Sun, Mar 9, 4:17 PM
Unknown Object (File)
Tue, Mar 4, 1:19 AM
Subscribers

Details

Summary

the second time a logged in user foregrounds the app, they will see the bottom sheet asking if they want to check out the community directory. if the user is not on the home screen, they won't get the prompt

Depends on D13997

Test Plan

confirmed that prompt only displays once per installation. it doesn't display if user is not logged in or not on the home screen

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

varun held this revision as a draft.
native/components/display-community-directory-prompt.react.js
53 ↗(On Diff #46094)

an undefined fid means the user hasn't been prompted to set a farcaster association yet

native/components/display-community-directory-prompt.react.js
66 ↗(On Diff #46094)

as @ashoat noted on a previous diff in this stack, this isn't a promise, but rather a function that returns a promise. i should revise this before publishing to avoid calling the keyserver endpoint multiple times

fix up promises and use useCurrentLeafRouteName hook

varun published this revision for review.Feb 11 2025, 8:15 PM
varun edited the summary of this revision. (Show Details)
varun edited the test plan for this revision. (Show Details)
This comment was removed by varun.
ashoat requested changes to this revision.Feb 11 2025, 9:10 PM
ashoat added inline comments.
native/components/display-community-directory-prompt.react.js
17 ↗(On Diff #47013)

Can you prioritize moving this constant, instead of adding more references to it? See comment here. You created a follow-up task for this four weeks ago, but this is the kind of thing that should be trivial and probably doesn't even need a Linear task. Should take 5 minutes to put up a diff

51–54 ↗(On Diff #47013)

Why do we need this? Doesn't useOnFirstLaunchEffect already guarantee that the effect will only fire once?

61 ↗(On Diff #47013)

Does this include GENESIS? If so, let's bump the check to 4

62 ↗(On Diff #47013)

Hmm... this approach risks the prompt never being displayed, as it relies on the user foregrounding the app shortly after backgrounding it.

Why did you opt for this approach instead of the one from the task description that references uses connectFarcasterAlertInfo (persisted Redux state)? This would allow us to show the prompt on the second time the app is cold started, which is more reliable.

The whole goal here is simply to avoid showing the prompt at the same time as the NUX.

This revision now requires changes to proceed.Feb 11 2025, 9:10 PM
ashoat added inline comments.
native/components/display-community-directory-prompt.react.js
84 ↗(On Diff #47013)

We discussed on the call filtering to only communities with farcasterChannelID

native/components/display-community-directory-prompt.react.js
62 ↗(On Diff #47013)

Some context was lost, but looks like @varun had initially taken an approach like the one I'm suggesting in D13509

Shouldn't D14391 be added to the stack here? You seem to be depending on it

Please make sure to address the comment about the effect running more than once before landing

native/components/display-community-directory-prompt.react.js
68 ↗(On Diff #47296)

I'm worried that this effect will run more than once. In the old system, useOnFirstLaunchEffect gave us this guarantee... but the equivalent check in the new system has been moved upstream, to DisplayCommunityDirectoryPromptHandler. We have to rely on React to unrender this component (due to the Redux dispatch) before it reruns the effect, and I'm not sure that's very reliable. Can we add a ref or something else to make sure this only runs once?

71 ↗(On Diff #47296)

Can you remind me why we need to dispatch this to Redux? Guessing we just want to keep it updated with the latest state? Not necessary for this work, but no downside and we might as well?

75 ↗(On Diff #47296)

I guess we call this here because the data might be out-of-date (it's only updated when CommunityDrawerContent is opened, right?)

This revision is now accepted and ready to land.Thu, Feb 27, 11:37 PM
native/components/display-community-directory-prompt.react.js
71 ↗(On Diff #47296)

Not necessary for this work, but no downside and we might as well?

that's right

75 ↗(On Diff #47296)

that's correct

This revision was automatically updated to reflect the committed changes.