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

Show dialog after completed or error purchasing #1246

Merged
merged 4 commits into from
Sep 13, 2023
Merged

Conversation

vegaro
Copy link
Contributor

@vegaro vegaro commented Sep 13, 2023

Displays an AlertDialog after purchase is successful or if it errors out

@vegaro vegaro requested a review from a team September 13, 2023 12:49
@vegaro vegaro changed the base branch from main to cesar/pwl-197-add-support-for-purchasing September 13, 2023 12:50
if (state.displayCompletedPurchaseMessage) {
PurchaseAlertDialog(viewModel, "Purchase was successful")
} else if (state.displayErrorPurchasingMessage) {
PurchaseAlertDialog(viewModel, "There was a purchasing error")
Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see #1247

Copy link
Contributor

@tonidero tonidero left a 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

}
}

override fun onPurchaseError(error: PurchasesError) {
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added error message

Base automatically changed from cesar/pwl-197-add-support-for-purchasing to paywalls September 13, 2023 13:22
@codecov
Copy link

codecov bot commented Sep 13, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (e1c78a0) 85.48% compared to head (b1b8cd5) 85.48%.

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.
📢 Have feedback on the report? Share it here.

}
}
}
}

@Composable
private fun PurchaseAlertDialog(
Copy link
Contributor

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.

@vegaro vegaro merged commit c313806 into paywalls Sep 13, 2023
7 checks passed
@vegaro vegaro deleted the show-dialog branch September 13, 2023 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants