Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: only ask for rate us on successful payment #2942

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions app/screens/send-bitcoin-screen/send-bitcoin-completed-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,24 @@ const SendBitcoinCompletedScreen: React.FC<Props> = ({ route }) => {

const FEEDBACK_DELAY = 3000
const CALLBACK_DELAY = 3000

useEffect(() => {
if (!feedbackModalShown) {
if (!showSuggestionModal) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this may be a bug. showSuggestionModal always starts as false until feedback is given. As it is written, the screen will navigate to home at the same time that feedback is requested.

Copy link
Member Author

Choose a reason for hiding this comment

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

this is indeed what it is doing: going to the home screen and asking for a feedback at the same time.

and this was also what was done before, so this PR doesn't change anything for this.

what behavior would you suggest? first ask for feedback and delay the return to home? or the opposite?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think before it was requesting feedback and after that happened it would go to the home screen. Previously, line 100 would be an early return if feedbackModalShown was false and so it wouldn't call the setTimeout to navigate to the home screen in line 105. I think now this screen will be unmounted by the time a suggestion modal would be popped up.

const navigateToHomeTimeout = setTimeout(navigation.popToTop, CALLBACK_DELAY)
return () => clearTimeout(navigateToHomeTimeout)
}
}, [showSuggestionModal, navigation])

useEffect(() => {
if (!feedbackModalShown && status === "SUCCESS") {
const feedbackTimeout = setTimeout(() => {
requestFeedback()
}, FEEDBACK_DELAY)
return () => {
clearTimeout(feedbackTimeout)
}
}
if (!showSuggestionModal) {
const navigateToHomeTimeout = setTimeout(navigation.popToTop, CALLBACK_DELAY)
return () => clearTimeout(navigateToHomeTimeout)
}
}, [client, feedbackModalShown, LL, showSuggestionModal, navigation, requestFeedback])
}, [feedbackModalShown, requestFeedback, status])

const MainIcon = () => {
switch (status) {
Expand Down
Loading