Skip to content

Commit

Permalink
add text to autocomplete settings
Browse files Browse the repository at this point in the history
  • Loading branch information
brindy committed Mar 14, 2024
1 parent d1520ca commit 7f2b7ec
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions Core/DefaultVariantManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ public struct VariantIOS: Variant {
/// The list of cohorts in active ATB experiments.
///
/// Variants set to `doNotAllocate` are active, but not adding users to a new cohort, do not change them unless you're sure the experiment is finished.
#warning("Do not merge commented out variant")
public static let defaultVariants: [Variant] = [
VariantIOS(name: "sc", weight: doNotAllocate, isIncluded: When.always, features: []),
VariantIOS(name: "sd", weight: doNotAllocate, isIncluded: When.always, features: []),
VariantIOS(name: "se", weight: doNotAllocate, isIncluded: When.always, features: []),

VariantIOS(name: "mc", weight: 1, isIncluded: When.always, features: []),
VariantIOS(name: "md", weight: 1, isIncluded: When.always, features: [.history]),
// TODO comment this back in before merging
// VariantIOS(name: "mc", weight: 1, isIncluded: When.inEnglish, features: []),
VariantIOS(name: "md", weight: 1, isIncluded: When.inEnglish, features: [.history]),

returningUser
]
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/SettingsCustomizeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct SettingsCustomizeView: View {
isButton: true)

SettingsCellView(label: UserText.settingsAutocomplete,
subtitle: viewModel.autocompleteSubtitle,
accesory: .toggle(isOn: viewModel.autocompleteBinding))

if viewModel.state.speechRecognitionAvailable {
Expand Down
7 changes: 6 additions & 1 deletion DuckDuckGo/SettingsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ final class SettingsViewModel: ObservableObject {
}

var shouldShowNoMicrophonePermissionAlert: Bool = false

var autocompleteSubtitle: String?

// Used to automatically navigate on Appear to a specific section
enum SettingsSection: String {
case none, netP, dbp, itr, subscriptionFlow
Expand Down Expand Up @@ -216,6 +217,7 @@ final class SettingsViewModel: ObservableObject {
legacyViewProvider: SettingsLegacyViewProvider,
accountManager: AccountManager,
voiceSearchHelper: VoiceSearchHelperProtocol = AppDependencyProvider.shared.voiceSearchHelper,
variantManager: VariantManager = AppDependencyProvider.shared.variantManager,
navigateOnAppearDestination: SettingsSection = .none) {
self.state = SettingsState.defaults
self.legacyViewProvider = legacyViewProvider
Expand All @@ -224,6 +226,7 @@ final class SettingsViewModel: ObservableObject {
self.onAppearNavigationTarget = navigateOnAppearDestination

setupNotificationObservers()
autocompleteSubtitle = variantManager.isSupported(feature: .history) ? UserText.settingsAutocompleteSubtitle : nil
}

deinit {
Expand All @@ -235,11 +238,13 @@ final class SettingsViewModel: ObservableObject {
init(state: SettingsState? = nil,
legacyViewProvider: SettingsLegacyViewProvider,
voiceSearchHelper: VoiceSearchHelperProtocol = AppDependencyProvider.shared.voiceSearchHelper,
variantManager: VariantManager = AppDependencyProvider.shared.variantManager,
navigateOnAppearDestination: SettingsSection = .none) {
self.state = SettingsState.defaults
self.legacyViewProvider = legacyViewProvider
self.voiceSearchHelper = voiceSearchHelper
self.onAppearNavigationTarget = navigateOnAppearDestination
autocompleteSubtitle = variantManager.isSupported(feature: .history) ? UserText.settingsAutocompleteSubtitle : nil
}
#endif

Expand Down
4 changes: 3 additions & 1 deletion DuckDuckGo/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1018,12 +1018,14 @@ But if you *do* want a peek under the hood, you can find more information about
public static let settingsPProActivationPendingTitle = NSLocalizedString("settings.subscription.activation.pending.title", value: "Your Subscription is Being Activated", comment: "Subscription activation pending title")
public static let settingsPProActivationPendingDescription = NSLocalizedString("settings.subscription.activation.pending.description", value: "This is taking longer than usual, please check back later.", comment: "Subscription activation pending description")


// Customize Section
public static let settingsCustomizeSection = NSLocalizedString("settings.customize", value: "Customize", comment: "Settings title for the customize section")
public static let settingsKeyboard = NSLocalizedString("settings.keyboard", value: "Keyboard", comment: "Settings screen cell for Keyboard")
public static let settingsPreviews = NSLocalizedString("settings.previews", value: "Long-Press Previews", comment: "Settings screen cell for long press previews")
public static let settingsAutocomplete = NSLocalizedString("settings.autocomplete", value: "Autocomplete Suggestions", comment: "Settings screen cell for autocomplete")

// Hardcoded for the experiment
public static let settingsAutocompleteSubtitle = "See search suggestions, including your bookmarks and recently visited sites"
public static let settingsVoiceSearch = NSLocalizedString("settings.voice.search", value: "Private Voice Search", comment: "Settings screen cell for voice search")
public static let settingsAssociatedApps = NSLocalizedString("settings.associated.apps", value: "Open Links in Associated Apps", comment: "Settings screen cell for opening links in associated apps")
public static let settingsAssociatedAppsDescription = NSLocalizedString("settings.associated.apps.description", value: "Disable to prevent links from automatically opening in other installed apps.", comment: "Description for associated apps description")
Expand Down

0 comments on commit 7f2b7ec

Please sign in to comment.