Skip to content

Commit

Permalink
Added to the Dock confirmation in onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasstrba committed May 7, 2024
1 parent e29ed15 commit c6abe5f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ struct UserText {
static let onboardingSetDefaultText = NSLocalizedString("onboarding.setdefault.text", value: "Next, try setting DuckDuckGo as your default️ browser, so you can open links with peace of mind, every time.", comment: "Call to action to set the browser as default")
static let onboardingAddToDockText = NSLocalizedString("onboarding.addtodock.text", value: "One last thing. Would you like to keep DuckDuckGo in your dock so the browser is always within reach?", comment: "Call to action to add the DuckDuckGo app icon to the macOS system dock")
static let onboardingStartBrowsingText = NSLocalizedString("onboarding.startbrowsing.text", value: "You’re all set!\n\nWant to see how I protect you? Try visiting one of your favorite sites 👆\n\nKeep watching the address bar as you go. I’ll be blocking trackers and upgrading the security of your connection when possible\u{00A0}🔒", comment: "Call to action to start using the app as a browser")
static let onboardingStartBrowsingAddedToDockText = NSLocalizedString("onboarding.startbrowsing.added-to-dock.text", value: "You’re all set! Find me in your Dock any time.\n\nWant to see how I protect you? Try visiting one of your favorite sites 👆\n\nKeep watching the address bar as you go. I’ll be blocking trackers and upgrading the security of your connection when possible\u{00A0}🔒", comment: "Call to action to start using the app as a browser")

static let onboardingStartButton = NSLocalizedString("onboarding.welcome.button", value: "Get Started", comment: "Start the onboarding flow")
static let onboardingImportDataButton = NSLocalizedString("onboarding.importdata.button", value: "Import", comment: "Launch the import data UI")
Expand Down
12 changes: 12 additions & 0 deletions DuckDuckGo/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -32906,6 +32906,18 @@
}
}
},
"onboarding.startbrowsing.added-to-dock.text" : {
"comment" : "Call to action to start using the app as a browser",
"extractionState" : "extracted_with_value",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "You’re all set! Find me in your Dock any time.\n\nWant to see how I protect you? Try visiting one of your favorite sites 👆\n\nKeep watching the address bar as you go. I’ll be blocking trackers and upgrading the security of your connection when possibleu{00A0}🔒"
}
}
}
},
"onboarding.startbrowsing.text" : {
"comment" : "Call to action to start using the app as a browser",
"extractionState" : "extracted_with_value",
Expand Down
10 changes: 9 additions & 1 deletion DuckDuckGo/Onboarding/View/OnboardingFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ struct OnboardingFlow: View {
@State var daxInSpeechPosition = false
@State var showDialogs = false

var startBrowsingText: String {
if model.addToDockPressed {
return UserText.onboardingStartBrowsingAddedToDockText
} else {
return UserText.onboardingStartBrowsingText
}
}

var body: some View {

VStack(alignment: daxInSpeechPosition ? .leading : .center) {
Expand Down Expand Up @@ -69,7 +77,7 @@ struct OnboardingFlow: View {
model.onAddToDockSkipped()
}.visibility(model.state == .addToDock ? .visible : .gone)

DaxSpeech(text: UserText.onboardingStartBrowsingText, onTypingFinished: nil)
DaxSpeech(text: startBrowsingText, onTypingFinished: nil)
.visibility(model.state == .startBrowsing ? .visible : .gone)

}.visibility(showDialogs ? .visible : .gone)
Expand Down
2 changes: 2 additions & 0 deletions DuckDuckGo/Onboarding/ViewModel/OnboardingViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ final class OnboardingViewModel: ObservableObject {
}

var typingDisabled = false
var addToDockPressed = false

@Published var skipTypingRequested = false
@Published var state: OnboardingPhase = .startFlow {
Expand Down Expand Up @@ -144,6 +145,7 @@ final class OnboardingViewModel: ObservableObject {
func onAddToDockPressed() {
PixelKit.fire(GeneralPixel.userAddedToDockDuringOnboarding,
includeAppVersionParameter: false)
addToDockPressed = true
delegate?.onboardingDidRequestAddToDock { [weak self] in
self?.state = .startBrowsing
Self.isOnboardingFinished = true
Expand Down

0 comments on commit c6abe5f

Please sign in to comment.