[CustomerCenter] Add presentCustomerCenter modifier#4053
Conversation
| #if !os(macOS) && !os(tvOS) | ||
|
|
||
| /// Presentation options to use with the [presentCustomerCenter](x-source-tag://presentCustomerCenter) View modifiers. | ||
| public enum CustomerCenterPresentationMode { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
We need to allow passing in the purchaseHandler (and a lot of other things to the CustomerCenterView). We can add those in separate PRs.
78be07d to
bd994cd
Compare
JayShortway
left a comment
There was a problem hiding this comment.
It all looks good to me! I'll leave approval to someone with a bit more context on this modifier. 🙂
### 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
}
```
Description
This adds a modifier,
presentCustomerCenterthat can be used to more simply display the customer center. The API looks like: