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

Add action sheet with payment options for 30 and 90 days #7468

Conversation

SteffenErn
Copy link
Contributor

@SteffenErn SteffenErn commented Jan 15, 2025

Adds the 90 day payment option to the account view, out of time view and welcome view.

Hint: Test "out of time" view by presenting it right on app launch.

ApplicationCoordinator.swift:140


        case .main:
//            presentMain(animated: animated, completion: completion)
            presentOutOfTime(animated: animated, completion: completion)

This change is Reviewable

@SteffenErn SteffenErn added the iOS Issues related to iOS label Jan 15, 2025
@SteffenErn SteffenErn self-assigned this Jan 15, 2025
Copy link

linear bot commented Jan 15, 2025

@SteffenErn SteffenErn force-pushed the add-action-sheet-with-payment-options-for-30-and-90-days-ios-990 branch from 7e79f74 to 5aa7664 Compare January 17, 2025 07:41
Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

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

Reviewed 13 of 15 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @SteffenErn)


ios/MullvadVPN/View controllers/CreationAccount/Welcome/WelcomeContentView.swift line 113 at r2 (raw file):

        button.setAccessibilityIdentifier(.purchaseButton)
        let localizedString = NSLocalizedString(
            "BUY_CREDIT_BUTTON",

Rename to ADD_TIME_BUTTON.


ios/MullvadVPN/Coordinators/OutOfTimeCoordinator.swift line 87 at r2 (raw file):

    }

    func outOfTimeViewControllerDidRequestShowPurchaseOptions(

Showing purchases options is done the same way in multiple places. Could we move this logic into a view model, helper or something similar to reduce code duplication?


ios/MullvadVPN/View controllers/Account/AccountViewController.swift line 199 at r2 (raw file):

        }

//        purchaseButton.setTitle(productState.purchaseButtonTitle, for: .normal)

Remove if not used.


ios/MullvadVPN/View controllers/Account/AccountViewController.swift line 269 at r2 (raw file):

            return
        }
        let productIdentifiers = Set(StoreSubscription.allCases)

No need to use a Set here.


ios/MullvadVPN/View controllers/Account/AccountViewController.swift line 270 at r2 (raw file):

        }
        let productIdentifiers = Set(StoreSubscription.allCases)
        setIsFetchingProducts(true)

Requesting products is done in multiple places. Could we perhaps move most of the body/validation into the interactor instead? That way we don't risk validating differently in various places. Also reduces code duplication.


ios/MullvadVPN/View controllers/CreationAccount/Welcome/WelcomeInteractor.swift line 31 at r2 (raw file):

        didSet {
            guard viewDidLoad else { return }
//            Might trigger a popup without user interaction do we want that?

@pinkisemils?

Copy link
Contributor

@buggmagnet buggmagnet left a comment

Choose a reason for hiding this comment

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

Reviewed 13 of 15 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 8 unresolved discussions (waiting on @pinkisemils and @SteffenErn)


ios/MullvadVPN/View controllers/CreationAccount/Welcome/WelcomeInteractor.swift line 31 at r2 (raw file):

Previously, rablador (Jon Petersson) wrote…

@pinkisemils?

Since there's no requestAccessToStore method to find for now, I'd say let's delete this ?

Regarding the popup, in general we try to not show popups without user interaction in the first place.


ios/MullvadVPN/View controllers/OutOfTime/OutOfTimeViewController.swift line 229 at r2 (raw file):

    @objc private func requestStoreProducts() {
        guard let accountData = interactor.deviceState.accountData else {

You can do guard interactor.deviceState.accountData != nil instead to avoid the warning here


ios/MullvadVPN.xcodeproj/project.pbxproj line 5994 at r2 (raw file):

				7A1A26472A29CF0800B978AA /* RelayFilterDataSource.swift in Sources */,
				5864AF0929C78850005B0CD9 /* VPNSettingsCellFactory.swift in Sources */,
				F998EFFA2D3656BA00D88D01 /* SKProduct+Sorting.swift in Sources */,

We try to keep things more or less organized by alphabetical order in the project structure, you can use the Sort by Name function on the Extensions folder to that effect.

@SteffenErn SteffenErn force-pushed the add-action-sheet-with-payment-options-for-30-and-90-days-ios-990 branch from 5aa7664 to 1abac1b Compare January 20, 2025 09:49
Copy link
Contributor Author

@SteffenErn SteffenErn left a comment

Choose a reason for hiding this comment

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

Reviewable status: 6 of 15 files reviewed, 8 unresolved discussions (waiting on @buggmagnet, @pinkisemils, and @rablador)


ios/MullvadVPN/Coordinators/OutOfTimeCoordinator.swift line 87 at r2 (raw file):

Previously, rablador (Jon Petersson) wrote…

Showing purchases options is done the same way in multiple places. Could we move this logic into a view model, helper or something similar to reduce code duplication?

Good point, I will move the creation of the action sheet into one place


ios/MullvadVPN/View controllers/Account/AccountViewController.swift line 199 at r2 (raw file):

Previously, rablador (Jon Petersson) wrote…

Remove if not used.

Done.


ios/MullvadVPN/View controllers/Account/AccountViewController.swift line 269 at r2 (raw file):

Previously, rablador (Jon Petersson) wrote…

No need to use a Set here.

requestProducts functions requires a Set


ios/MullvadVPN/View controllers/Account/AccountViewController.swift line 270 at r2 (raw file):

Previously, rablador (Jon Petersson) wrote…

Requesting products is done in multiple places. Could we perhaps move most of the body/validation into the interactor instead? That way we don't risk validating differently in various places. Also reduces code duplication.

I don't think there is much we could extract from the viewcontrollers. The only check that could be moved is if the result was successful but empty and instead return a failure. But since this is not a final design or flow I would wait with that since we might want to display a different error message in that case.


ios/MullvadVPN/View controllers/CreationAccount/Welcome/WelcomeContentView.swift line 113 at r2 (raw file):

Previously, rablador (Jon Petersson) wrote…

Rename to ADD_TIME_BUTTON.

Done.


ios/MullvadVPN/View controllers/CreationAccount/Welcome/WelcomeInteractor.swift line 31 at r2 (raw file):

Previously, buggmagnet wrote…

Since there's no requestAccessToStore method to find for now, I'd say let's delete this ?

Regarding the popup, in general we try to not show popups without user interaction in the first place.

Done.


ios/MullvadVPN/View controllers/OutOfTime/OutOfTimeViewController.swift line 229 at r2 (raw file):

Previously, buggmagnet wrote…

You can do guard interactor.deviceState.accountData != nil instead to avoid the warning here

Done.


ios/MullvadVPN.xcodeproj/project.pbxproj line 5994 at r2 (raw file):

Previously, buggmagnet wrote…

We try to keep things more or less organized by alphabetical order in the project structure, you can use the Sort by Name function on the Extensions folder to that effect.

Done.

rablador
rablador previously approved these changes Jan 20, 2025
Copy link
Contributor

@rablador rablador left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 9 files at r3, 6 of 6 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @buggmagnet)

buggmagnet
buggmagnet previously approved these changes Jan 20, 2025
Copy link
Contributor

@buggmagnet buggmagnet left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 9 files at r3, 6 of 6 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@SteffenErn SteffenErn dismissed stale reviews from buggmagnet and rablador via 91cb3e5 January 20, 2025 14:58
@SteffenErn SteffenErn force-pushed the add-action-sheet-with-payment-options-for-30-and-90-days-ios-990 branch from 7ca198c to 91cb3e5 Compare January 20, 2025 14:58
Copy link
Contributor

@buggmagnet buggmagnet left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 2 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@buggmagnet buggmagnet merged commit cb538fc into main Jan 20, 2025
11 checks passed
@buggmagnet buggmagnet deleted the add-action-sheet-with-payment-options-for-30-and-90-days-ios-990 branch January 20, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iOS Issues related to iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants