-
Notifications
You must be signed in to change notification settings - Fork 50
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
Show dialog after completed or error purchasing #1246
Conversation
if (state.displayCompletedPurchaseMessage) { | ||
PurchaseAlertDialog(viewModel, "Purchase was successful") | ||
} else if (state.displayErrorPurchasingMessage) { | ||
PurchaseAlertDialog(viewModel, "There was a purchasing error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might change this to reuse the dialog for restoring too. In that case the text will be set from the viewmodel. What do you think @tonidero
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #1247
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of comments but it's looking good
...ter/src/main/java/com/revenuecat/paywallstester/ui/screens/paywall/PaywallScreenViewModel.kt
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
override fun onPurchaseError(error: PurchasesError) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we are not displaying the error message in the dialog right? I wonder if instead of a boolean, we should use a nullable string in the state so we can display the error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see we already made the conversion to a nullable string in the followup PR... So then the question is whether we want to include the error in the dialog... IMO, it might be a good idea for a tester app since it would be easier to visualize errors in case they happen when downloaded from the play store.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added error message
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## paywalls #1246 +/- ##
=========================================
Coverage 85.48% 85.48%
=========================================
Files 187 187
Lines 6346 6346
Branches 923 923
=========================================
Hits 5425 5425
Misses 564 564
Partials 357 357 ☔ View full report in Codecov by Sentry. |
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
private fun PurchaseAlertDialog( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to extract this to a different file... But for now, I think it's fine to keep here.
Displays an AlertDialog after purchase is successful or if it errors out