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

Improve promotional offer button when pressed #4342

Conversation

vegaro
Copy link
Contributor

@vegaro vegaro commented Oct 2, 2024

Reported in #4335

  • Adds a loading to the button
  • Disables the button when pressed to prevent multiple presses
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2024-10-02.at.16.44.56.mp4

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.

Looks great! Thanks!

withAnimation(.easeInOut(duration: 0.3)) {
loadingState = true
}
await viewModel.purchasePromo()
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make sure but this shouldn't trigger any errors right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we are catching the error, and not doing anything with it atm, but that's from before this change, so that improvement should come in a different PR

Copy link
Member

@JayShortway JayShortway left a comment

Choose a reason for hiding this comment

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

So smooth!

@@ -35,6 +35,7 @@ struct PromotionalOfferView: View {
private var appearance: CustomerCenterConfigData.Appearance
@Environment(\.colorScheme)
private var colorScheme
@State private var loadingState: Bool = false
Copy link
Member

Choose a reason for hiding this comment

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

Super nit suggestion for your consideration:

-    @State private var loadingState: Bool = false
+    @State private var isLoading: Bool = false

@vegaro vegaro merged commit 7f226d6 into main Oct 7, 2024
7 checks passed
@vegaro vegaro deleted the sdk-3596-promotional-offer-view-button-is-touchable-multiple-times branch October 7, 2024 12:58
This was referenced Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants