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

[Customer Center] Create a completion handler #4028

Conversation

vegaro
Copy link
Contributor

@vegaro vegaro commented Jul 6, 2024

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

Description

@vegaro
Copy link
Contributor Author

vegaro commented Jul 6, 2024

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @vegaro and the rest of your teammates on Graphite Graphite

@RevenueCat-Danger-Bot
Copy link

1 Error
🚫 Label the PR using one of the change type labels
Label Description
breaking Changes that are breaking
build Changes that affect the build system
ci Changes to our CI configuration files and scripts
docs Documentation only changes
feat A new feature
fix A bug fix
perf A code change that improves performance
RevenueCatUI A change to the RevenueCatUI library
refactor A code change that neither fixes a bug nor adds a feature
style Changes that don't affect the meaning of the code (white-space, formatting, missing semi-colons, etc
test Adding missing tests or correcting existing tests
next_release Preparing a new release
dependencies Updating a dependency
phc_dependencies Updating purchases-hybrid-common dependency

Generated by 🚫 Danger

@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 9efea65 to 4569a03 Compare July 8, 2024 10:35
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from f6c8421 to 0bd1880 Compare July 8, 2024 10:35
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 4569a03 to 647fd79 Compare July 8, 2024 10:38
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from 0bd1880 to e2bf8b8 Compare July 8, 2024 10:38
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 647fd79 to 76e80a6 Compare July 8, 2024 14:07
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from e2bf8b8 to 07c65ee Compare July 8, 2024 14:07
@vegaro vegaro changed the title Create a completion handler [Customer Center] Create a completion handler Jul 8, 2024
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 76e80a6 to 68385b1 Compare July 8, 2024 16:12
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from 07c65ee to 73696c6 Compare July 8, 2024 16:12
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 68385b1 to 2af82b5 Compare July 8, 2024 18:42
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from 73696c6 to 21ad1e0 Compare July 8, 2024 18:42
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 2af82b5 to 19fa733 Compare July 8, 2024 19:52
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from 21ad1e0 to 7a91e51 Compare July 8, 2024 19:52
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 19fa733 to 37cd710 Compare July 8, 2024 20:13
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from 7a91e51 to d218ffc Compare July 8, 2024 20:13
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 37cd710 to a1b2611 Compare July 9, 2024 12:51
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from d218ffc to 6ff8e66 Compare July 9, 2024 12:51
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from a1b2611 to 7f1d724 Compare July 9, 2024 14:44
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from 6ff8e66 to 9a3c5c6 Compare July 9, 2024 14:44
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 7f1d724 to 9976082 Compare July 9, 2024 15:13
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from 9a3c5c6 to 02eed7c Compare July 9, 2024 15:14
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 9976082 to 2afffc0 Compare July 9, 2024 18:32
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from 02eed7c to 5afee3b Compare July 9, 2024 18:32
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 2afffc0 to 2986865 Compare July 9, 2024 19:49
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from 5afee3b to f78fe44 Compare July 9, 2024 19:49
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 2986865 to 7ccc4f5 Compare July 10, 2024 09:41
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from f78fe44 to f6621c6 Compare July 10, 2024 09:41
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 7ccc4f5 to 20e1603 Compare July 10, 2024 12:38
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from f6621c6 to 458fa4c Compare July 10, 2024 12:38
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 20e1603 to 4aeabf3 Compare July 10, 2024 13:33
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from 458fa4c to 1dfd58a Compare July 10, 2024 13:33
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 4aeabf3 to f0a9752 Compare July 10, 2024 21:50
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from 1dfd58a to d1173d1 Compare July 10, 2024 21:50
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from f0a9752 to e9a8262 Compare July 15, 2024 17:21
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from d1173d1 to d6eca04 Compare July 15, 2024 17:21
import Foundation
import SwiftUI

final class CustomerCenterCompletionHandler: ObservableObject {
Copy link
Contributor

Choose a reason for hiding this comment

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

I've been wondering whether it would make more sense to call this CustomerCenterActionHandler. Then, we would notify whenever an action is performed.

My main concern with this approach is that it moves away from what we have in paywalls, where we have individual callbacks for many actions like purchase/restore started/failed/completed... But I feel since there are going to be more actions here, it makes more sense to do something like that. Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point... Right, I think at some point we will have actions that are no completion actions like feedbackSurveyStarted so we want this to be an action handler. I honestly prefer just having this handler with a bunch of different events that can be handled in a switch statement than a lot of functions like we do in paywalls

It is true that adding a new event to a sealed class is technically a breaking change, but I think it's assumable. It is also true that it's not possible to modify an existing case in an enum (and add more properties) without creating a new event, but that's also an issue with independent functions.

In summary I find it cleaner to use sealed class when we are going to have a lot of potential events.


}

struct CustomerCenterResult: Equatable {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we follow my previous suggestion, I would move away from using the Result naming, since this may happen at any point, and even multiple times. I would only keep this naming if we want to return a single result after the customer center closes, but I think I prefer my suggested option. Lmk what you think!

@StateObject
private var viewModel = CustomerCenterViewModel()
@StateObject
private var completionHandler: CustomerCenterCompletionHandler = .default()
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to move this inside the view model? That way we centralize the logic there.

@@ -200,6 +209,7 @@ struct ManageSubscriptionsButtonsView: View {
Task {
openURL(URLUtilities.createMailURL()!)
}
completionHandler.supportContacted()
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally this calls the view model, which internally calls whatever it needs I think.

@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from e9a8262 to 43ded08 Compare July 16, 2024 15:55
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from d6eca04 to f51f583 Compare July 16, 2024 15:56
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from 43ded08 to a9430db Compare July 17, 2024 09:25
@vegaro vegaro force-pushed the 07-06-create_a_completion_handler branch from f51f583 to c50e65e Compare July 17, 2024 09:25
@vegaro vegaro force-pushed the 07-05-add_contact_support_button branch from a9430db to f4116bb Compare July 17, 2024 12:43
@vegaro vegaro closed this Jul 17, 2024
@vegaro vegaro deleted the 07-06-create_a_completion_handler branch July 17, 2024 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants