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 CustomerCenterView #3919

Merged
merged 62 commits into from
Jun 28, 2024

Conversation

vegaro
Copy link
Contributor

@vegaro vegaro commented May 28, 2024

Base branch is integration/customer_support_workflow so we don't merge into main yet

Borrows a lot from #3865

Creates a new CustomerCenterView that can be used as a customer support workflow starting point.

All details can be found in https://linear.app/revenuecat/project/sdk-support-workflow-cf7f6a1d5340/overview

@vegaro vegaro changed the title [Support Workflow] Create CustomerCenterView [Support Workflow] Create CustomerCenterView May 28, 2024
@vegaro vegaro changed the base branch from main to integration/customer_support_workflow May 28, 2024 14:52
@vegaro vegaro marked this pull request as ready for review May 28, 2024 16:08
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.

Nice ship! Had some minor comments. I will let someone with more iOS knowhow approve though 😄

Copy link
Contributor

@jamesrb1 jamesrb1 left a comment

Choose a reason for hiding this comment

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

I've only run the views via previews - is there a better way?
I wasn't able to see the Figma file, but have requested access.

To get it to compile I had to change LocalizedString from let enUS: String to let en_US: String (I think the linter made this change, but we should ignore its rule in this case), and CustomerCenterData.FeedbackSurvey.Option to CustomerCenterData.FeedbackSurveyOption.

I think this is going to be a great and widely used new feature.

RevenueCatUI/CustomerCenter/Data/CustomerCenterData.swift Outdated Show resolved Hide resolved
RevenueCatUI/CustomerCenter/Data/CustomerCenterData.swift Outdated Show resolved Hide resolved
RevenueCatUI/CustomerCenter/Data/CustomerCenterData.swift Outdated Show resolved Hide resolved
RevenueCatUI/CustomerCenter/Data/CustomerCenterData.swift Outdated Show resolved Hide resolved
RevenueCatUI/CustomerCenter/Data/CustomerCenterData.swift Outdated Show resolved Hide resolved
RevenueCatUI/CustomerCenter/Views/WrongPlatformView.swift Outdated Show resolved Hide resolved
RevenueCatUI/CustomerCenter/Views/WrongPlatformView.swift Outdated Show resolved Hide resolved
@vegaro
Copy link
Contributor Author

vegaro commented May 29, 2024

I've only run the views via previews - is there a better way?

I've been doing that as well, since making a purchase with PaywallsTester has been complicated. I was planning on looking into that today, so I can test deserialization, etc

To get it to compile I had to change LocalizedString from let enUS: String to let en_US: String (I think the linter made this change, but we should ignore its rule in this case), and CustomerCenterData.FeedbackSurvey.Option to CustomerCenterData.FeedbackSurveyOption.

Oops yes, that's on me. I fixed the linting issues and broke the compilation. Sorry about that

cc @jamesrb1

Copy link
Contributor

@fire-at-will fire-at-will left a comment

Choose a reason for hiding this comment

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

This is going to be so cool! 🤩

Copy link
Member

@aboedo aboedo left a comment

Choose a reason for hiding this comment

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

looking great!!

@vegaro
Copy link
Contributor Author

vegaro commented Jun 7, 2024

It looks like I still have to fix some availability checks, but this is good for another pass I think :)

let dark: RCColor

enum Mode: String {
case system = "SYSTEM"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this also have light/dark modes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

going to remove this for now, took this from the draft API and it is meant to be used later as an indication that it should be using the accent color from the app. Since we haven't defined the API completely and I am not using it I will remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am actually removing the whole appearance object, to keep things tidy

@ObservedObject
private(set) var viewModel: ManageSubscriptionsViewModel

let openURL: OpenURLAction
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm this seems unused? (Maybe you're planning to use it later though)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yes, I had a contact support button, that I removed because it's not possible to configure it, and this is leftovers. Removing!

@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
class CustomerCenterViewModel: ObservableObject {
Copy link
Contributor

Choose a reason for hiding this comment

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

Strongly suggest making these @MainActor 😇

case .success:
self.refundRequestStatus = "Refund granted successfully!"
case .userCancelled:
self.refundRequestStatus = "Refund canceled"
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably will need to localize these? I'm seeing that their usage is combined with another string so we would need to localize this (with String(localized: "") and the other text where it's used (in order to avoid localizing all the combinations of these

Copy link
Contributor

Choose a reason for hiding this comment

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

Separately, but I don't really like how these are localized with SwiftUI, since we don't have any compilation-time check that all the localizations are there... Maybe we should extract all these to strings enums so we have it better organized...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, I agree with the localization... I am surprised xcode doesn't warn or anything. We should come back to this because if I am not wrong it's the same mechanism in Paywalls right?

@vegaro
Copy link
Contributor Author

vegaro commented Jun 13, 2024

I ended up removing LocalizedString because localization will most likely be handled in a different way and this was making the response more complex c0a38a1 (#3919)

@vegaro vegaro changed the base branch from integration/customer_support_workflow to request-a-refund June 17, 2024 12:23
@vegaro
Copy link
Contributor Author

vegaro commented Jun 17, 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

@vegaro vegaro force-pushed the integration/customer_support_workflow branch from 027b480 to 83d4b1a Compare June 27, 2024 10:15
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.

We probably still need to handle localization and it would be great to have someone more familiar with SwiftUI take a look, but everything makes sense to me!

case missingPurchase = "MISSING_PURCHASE"
case refundRequest = "REFUND_REQUEST"
case changePlans = "CHANGE_PLANS"
case cancel = "CANCEL"
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I was using lowercase for these in the backend... I'm ok changing them to uppercase though 👍


// swiftlint:disable:next todo
// TODO: make configurable
let urlString = "mailto:support@revenuecat.com?subject=\(encodedSubject)&body=\(encodedBody)"
Copy link
Contributor

Choose a reason for hiding this comment

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

We will be sending these from the backend soon. But we can address this todo in a separate PR 👍

@vegaro
Copy link
Contributor Author

vegaro commented Jun 28, 2024

Thank you @tonidero! Most of the hardcoded strings will go away since we are going to try to localize everything in the backend. So that's for future PRs.

@vegaro
Copy link
Contributor Author

vegaro commented Jun 28, 2024

Going to merge it since the PRs are accumulating. @jamesrb1 feel free to make more comments that I can address in another PR if needed

@vegaro vegaro merged commit 4ab05c3 into integration/customer_support_workflow Jun 28, 2024
24 checks passed
@vegaro vegaro deleted the sdk-3433-supportview branch June 28, 2024 10:16
vegaro added a commit that referenced this pull request Jun 28, 2024
Base branch is `integration/customer_support_workflow` so we don't merge
into `main` yet

Borrows a lot from #3865 

Creates a new `CustomerCenterView` that can be used as a customer
support workflow starting point.

All details can be found in
https://linear.app/revenuecat/project/sdk-support-workflow-cf7f6a1d5340/overview

---------

Co-authored-by: Will Taylor <wtaylor151@gmail.com>
Co-authored-by: James Borthwick <109382862+jamesrb1@users.noreply.github.com>
vegaro added a commit that referenced this pull request Jul 3, 2024
Base branch is `integration/customer_support_workflow` so we don't merge
into `main` yet

Borrows a lot from #3865 

Creates a new `CustomerCenterView` that can be used as a customer
support workflow starting point.

All details can be found in
https://linear.app/revenuecat/project/sdk-support-workflow-cf7f6a1d5340/overview

---------

Co-authored-by: Will Taylor <wtaylor151@gmail.com>
Co-authored-by: James Borthwick <109382862+jamesrb1@users.noreply.github.com>
vegaro added a commit that referenced this pull request Jul 5, 2024
Base branch is `integration/customer_support_workflow` so we don't merge
into `main` yet

Borrows a lot from #3865 

Creates a new `CustomerCenterView` that can be used as a customer
support workflow starting point.

All details can be found in
https://linear.app/revenuecat/project/sdk-support-workflow-cf7f6a1d5340/overview

---------

Co-authored-by: Will Taylor <wtaylor151@gmail.com>
Co-authored-by: James Borthwick <109382862+jamesrb1@users.noreply.github.com>
vegaro added a commit that referenced this pull request Jul 8, 2024
Base branch is `integration/customer_support_workflow` so we don't merge
into `main` yet

Borrows a lot from #3865

Creates a new `CustomerCenterView` that can be used as a customer
support workflow starting point.

All details can be found in
https://linear.app/revenuecat/project/sdk-support-workflow-cf7f6a1d5340/overview

---------

Co-authored-by: Will Taylor <wtaylor151@gmail.com>
Co-authored-by: James Borthwick <109382862+jamesrb1@users.noreply.github.com>
vegaro added a commit that referenced this pull request Jul 9, 2024
Base branch is `integration/customer_support_workflow` so we don't merge
into `main` yet

Borrows a lot from #3865

Creates a new `CustomerCenterView` that can be used as a customer
support workflow starting point.

All details can be found in
https://linear.app/revenuecat/project/sdk-support-workflow-cf7f6a1d5340/overview

---------

Co-authored-by: Will Taylor <wtaylor151@gmail.com>
Co-authored-by: James Borthwick <109382862+jamesrb1@users.noreply.github.com>
vegaro added a commit that referenced this pull request Jul 15, 2024
Base branch is `integration/customer_support_workflow` so we don't merge
into `main` yet

Borrows a lot from #3865

Creates a new `CustomerCenterView` that can be used as a customer
support workflow starting point.

All details can be found in
https://linear.app/revenuecat/project/sdk-support-workflow-cf7f6a1d5340/overview

---------

Co-authored-by: Will Taylor <wtaylor151@gmail.com>
Co-authored-by: James Borthwick <109382862+jamesrb1@users.noreply.github.com>
vegaro added a commit that referenced this pull request Jul 17, 2024
Base branch is `integration/customer_support_workflow` so we don't merge
into `main` yet

Borrows a lot from #3865

Creates a new `CustomerCenterView` that can be used as a customer
support workflow starting point.

All details can be found in
https://linear.app/revenuecat/project/sdk-support-workflow-cf7f6a1d5340/overview

---------

Co-authored-by: Will Taylor <wtaylor151@gmail.com>
Co-authored-by: James Borthwick <109382862+jamesrb1@users.noreply.github.com>
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.

7 participants