-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CustomerCenter] Add action handler (#4057)
### Description This PR provides a possible approach to implementing an "action" handler. This allows developer to respond to events that happen during the customer support flow. The current approach consists of making `CustomerCenterActionHandler`, a lambda that receives an action that can be passed in by the developer. Then calling that with the appropriate action from the customer center. This PR also moves some code to the view model for simplicity and moving logic away from the view layer.
- Loading branch information
Showing
11 changed files
with
164 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
RevenueCatUI/CustomerCenter/Data/CustomerCenterAction.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import RevenueCat | ||
|
||
/// Typealias for handler for Customer center actions | ||
public typealias CustomerCenterActionHandler = @MainActor @Sendable (CustomerCenterAction) -> Void | ||
|
||
/// Represents an event the customer may perform during the Customer Center flow | ||
public enum CustomerCenterAction { | ||
|
||
/// Starting the restoration process | ||
case restoreStarted | ||
/// Restore errored out | ||
case restoreFailed(_ error: Error) | ||
/// Restore completed successfully | ||
case restoreCompleted(_ customerInfo: CustomerInfo) | ||
/// Going to display manage subscription page, whether for cancellation or changing plans. | ||
case showingManageSubscriptions | ||
/// Starting refund request process | ||
case refundRequestStarted(_ productId: String) | ||
/// Refund request process finished, with result provided. | ||
case refundRequestCompleted(_ refundRequestStatus: RefundRequestStatus) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.