Skip to content

[CustomerCenter] Add presentCustomerCenter modifier#4053

Merged
tonidero merged 6 commits into
integration/customer_support_workflowfrom
customer_center/add-presentation-modifier
Jul 16, 2024
Merged

[CustomerCenter] Add presentCustomerCenter modifier#4053
tonidero merged 6 commits into
integration/customer_support_workflowfrom
customer_center/add-presentation-modifier

Conversation

@tonidero

@tonidero tonidero commented Jul 16, 2024

Copy link
Copy Markdown
Contributor

Description

This adds a modifier, presentCustomerCenter that can be used to more simply display the customer center. The API looks like:

.presentCustomerCenter(isPresented: self.$presentingCustomerCenter) {
    self.presentingCustomerCenter = false
}

@tonidero tonidero added the pr:feat A new feature label Jul 16, 2024
#if !os(macOS) && !os(tvOS)

/// Presentation options to use with the [presentCustomerCenter](x-source-tag://presentCustomerCenter) View modifiers.
public enum CustomerCenterPresentationMode {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is pretty much a duplicate of PaywallPresentationMode. I was thinking of how to avoid duplication. Maybe we could rename the paywall one to PresentationMode and make the current one a typealias, but felt like a too generic name... For now, I've just added this new enum

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yea I think this is fine too. PresentationMode would be very generic indeed, and we cannot be sure that all our future UI features will support all modes, which such a name would kind of imply.

self.onDismiss = onDismiss
self._purchaseHandler = .init(wrappedValue: purchaseHandler ??
PurchaseHandler.default(performPurchase: myAppPurchaseLogic?.performPurchase,
performRestore: myAppPurchaseLogic?.performRestore))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added this from paywalls, but removed it from the public API for now, since we still don't allow passing it to the CustomerCenterView

}

private func customerCenterView() -> some View {
CustomerCenterView()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We need to allow passing in the purchaseHandler (and a lot of other things to the CustomerCenterView). We can add those in separate PRs.

@tonidero tonidero force-pushed the customer_center/add-presentation-modifier branch from 78be07d to bd994cd Compare July 16, 2024 08:46
@tonidero tonidero marked this pull request as ready for review July 16, 2024 09:16
@tonidero tonidero requested a review from a team July 16, 2024 09:16

@JayShortway JayShortway left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It all looks good to me! I'll leave approval to someone with a bit more context on this modifier. 🙂

@tonidero tonidero requested a review from a team July 16, 2024 14:29
Comment thread RevenueCatUI/CustomerCenter/View+PresentCustomerCenter.swift Outdated
@tonidero tonidero merged commit a910b59 into integration/customer_support_workflow Jul 16, 2024
@tonidero tonidero deleted the customer_center/add-presentation-modifier branch July 16, 2024 16:09
vegaro pushed a commit that referenced this pull request Jul 17, 2024
### Description
This adds a modifier, `presentCustomerCenter` that can be used to more
simply display the customer center. The API looks like:
```
.presentCustomerCenter(isPresented: self.$presentingCustomerCenter) {
    self.presentingCustomerCenter = false
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants