-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pete/feature/pir freemium entry points ux (#3164)
Task/Issue URL: https://app.asana.com/0/0/1208161235633538/f **Description**: This **PR to the feature branch** includes the following UX changes relating to Freemium PIR:
- Loading branch information
1 parent
8da7069
commit 7520b68
Showing
23 changed files
with
606 additions
and
17 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// FreemiumPIRPresenter.swift | ||
// | ||
// Copyright © 2024 DuckDuckGo. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Conforming types provide functionality to show Freemium PIR | ||
protocol FreemiumPIRPresenter { | ||
func showFreemiumPIR(didOnboard: Bool, windowControllerManager: WindowControllersManagerProtocol?) | ||
} | ||
|
||
/// Default implementation of `FreemiumPIRPresenter` | ||
struct DefaultFreemiumPIRPresenter: FreemiumPIRPresenter { | ||
|
||
@MainActor | ||
/// Displays Freemium PIR | ||
/// If the `didOnboard` parameter is true, opens PIR directly | ||
/// If the `didOnboard` parameter is false, opens Freemium PIR onboarding | ||
/// - Parameter didOnboard: Bool indicating if the user has onboarded already | ||
func showFreemiumPIR(didOnboard: Bool, windowControllerManager: WindowControllersManagerProtocol? = nil) { | ||
|
||
let windowControllerManager = windowControllerManager ?? WindowControllersManager.shared | ||
|
||
if didOnboard { | ||
windowControllerManager.showTab(with: .dataBrokerProtection) | ||
} else { | ||
// TODO: - Onboard (i.e Ts and Cs) | ||
showFreemiumPIROnboarding() | ||
} | ||
} | ||
} | ||
|
||
private extension DefaultFreemiumPIRPresenter { | ||
|
||
@MainActor | ||
func showFreemiumPIROnboarding() { | ||
// TODO: - Show onboarding if we decide to do this | ||
} | ||
} |
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,33 @@ | ||
// | ||
// PromotionView+FreemiumPIR.swift | ||
// | ||
// Copyright © 2024 DuckDuckGo. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import Foundation | ||
|
||
extension PromotionViewModel { | ||
static func freemiumPIRPromotion(proceedAction: @escaping () -> Void, closeAction: @escaping () -> Void) -> PromotionViewModel { | ||
|
||
let description = UserText.homePagePromotionFreemiumPIRDescription | ||
let actionButtonText = UserText.homePagePromotionFreemiumPIRButtonTitle | ||
|
||
return PromotionViewModel(image: .gift96, | ||
description: description, | ||
proceedButtonText: actionButtonText, | ||
proceedAction: proceedAction, | ||
closeAction: closeAction) | ||
} | ||
} |
Oops, something went wrong.