From cd7850b332197eb588beb65616d79ccceecf8a9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20=C5=9Apiewak?= Date: Mon, 29 Jul 2024 22:20:07 +0200 Subject: [PATCH] Unify naming --- DuckDuckGo.xcodeproj/project.pbxproj | 37 +++++++++---------- DuckDuckGo/EditableShortcutsView.swift | 4 +- .../NewTabPageSectionsSettingsModel.swift | 4 +- ...el.swift => NewTabPageSettingsModel.swift} | 26 ++++++------- ...> NewTabPageSettingsSectionItemView.swift} | 6 +-- ...iew.swift => NewTabPageSettingsView.swift} | 22 +++++------ .../NewTabPageShortcutsSettingsModel.swift | 4 +- DuckDuckGo/NewTabPageView.swift | 8 ++-- DuckDuckGo/UserText.swift | 8 ++-- DuckDuckGo/en.lproj/Localizable.strings | 8 ++-- 10 files changed, 62 insertions(+), 65 deletions(-) rename DuckDuckGo/{NewTabPagePreferencesModel.swift => NewTabPageSettingsModel.swift} (64%) rename DuckDuckGo/{NTPPreferencesSectionItemView.swift => NewTabPageSettingsSectionItemView.swift} (82%) rename DuckDuckGo/{NewTabPagePreferencesView.swift => NewTabPageSettingsView.swift} (88%) diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index a735089d41..587648154e 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -260,10 +260,9 @@ 6F03CB092C32F331004179A8 /* PixelFiringAsync.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F03CB082C32F331004179A8 /* PixelFiringAsync.swift */; }; 6F0FEF6B2C516D540090CDE4 /* NewTabPageSettingsStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F0FEF6A2C516D540090CDE4 /* NewTabPageSettingsStorage.swift */; }; 6F0FEF6D2C52639E0090CDE4 /* ReorderableForEach.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F0FEF6C2C52639E0090CDE4 /* ReorderableForEach.swift */; }; - 6F35379E2C4AAF2E009F8717 /* NewTabPagePreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F35379D2C4AAF2E009F8717 /* NewTabPagePreferencesView.swift */; }; - 6F3537A02C4AAFD2009F8717 /* NTPPreferencesSectionItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F35379F2C4AAFD2009F8717 /* NTPPreferencesSectionItemView.swift */; }; - 6F3537A22C4AB97A009F8717 /* NewTabPagePreferencesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F3537A12C4AB97A009F8717 /* NewTabPagePreferencesModel.swift */; }; - 6F3537A02C4AAFD2009F8717 /* NTPPreferencesSectionItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F35379F2C4AAFD2009F8717 /* NTPPreferencesSectionItemView.swift */; }; + 6F35379E2C4AAF2E009F8717 /* NewTabPageSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F35379D2C4AAF2E009F8717 /* NewTabPageSettingsView.swift */; }; + 6F3537A02C4AAFD2009F8717 /* NewTabPageSettingsSectionItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F35379F2C4AAFD2009F8717 /* NewTabPageSettingsSectionItemView.swift */; }; + 6F3537A22C4AB97A009F8717 /* NewTabPageSettingsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F3537A12C4AB97A009F8717 /* NewTabPageSettingsModel.swift */; }; 6F3537A42C4AC140009F8717 /* NTPDaxLogoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F3537A32C4AC140009F8717 /* NTPDaxLogoView.swift */; }; 6F40D15B2C34423800BF22F0 /* HomePageDisplayDailyPixelBucket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F40D15A2C34423800BF22F0 /* HomePageDisplayDailyPixelBucket.swift */; }; 6F40D15E2C34436500BF22F0 /* HomePageDisplayDailyPixelBucketTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F40D15C2C34436200BF22F0 /* HomePageDisplayDailyPixelBucketTests.swift */; }; @@ -280,9 +279,9 @@ 6F96FF102C2B128500162692 /* NewTabPageCustomizeButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F96FF0F2C2B128500162692 /* NewTabPageCustomizeButtonView.swift */; }; 6F9FFE262C579BCD00A238BE /* NewTabPageShortcutsSettingsStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F9FFE252C579BCD00A238BE /* NewTabPageShortcutsSettingsStorage.swift */; }; 6F9FFE282C579DEA00A238BE /* NewTabPageSectionsSettingsStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F9FFE272C579DEA00A238BE /* NewTabPageSectionsSettingsStorage.swift */; }; + 6F9FFE2A2C57ADB100A238BE /* EditableShortcutsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F9FFE292C57ADB100A238BE /* EditableShortcutsView.swift */; }; 6F9FFE2D2C57AE8F00A238BE /* NewTabPageShortcutsSettingsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F9FFE2C2C57AE8F00A238BE /* NewTabPageShortcutsSettingsModel.swift */; }; 6F9FFE302C57B34800A238BE /* NewTabPageSectionsSettingsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F9FFE2F2C57B34800A238BE /* NewTabPageSectionsSettingsModel.swift */; }; - 6F9FFE2A2C57ADB100A238BE /* EditableShortcutsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F9FFE292C57ADB100A238BE /* EditableShortcutsView.swift */; }; 6FA3438F2C3D3BC300470677 /* Favorite.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FA3438E2C3D3BC300470677 /* Favorite.swift */; }; 6FA343922C3D3C3B00470677 /* FavoriteIconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FA343912C3D3C3B00470677 /* FavoriteIconView.swift */; }; 6FB1FE9E2C24D41D0075B68B /* NewTabPageSectionsDebugView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FB1FE9D2C24D41D0075B68B /* NewTabPageSectionsDebugView.swift */; }; @@ -1427,10 +1426,9 @@ 6F03CB082C32F331004179A8 /* PixelFiringAsync.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PixelFiringAsync.swift; sourceTree = ""; }; 6F0FEF6A2C516D540090CDE4 /* NewTabPageSettingsStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTabPageSettingsStorage.swift; sourceTree = ""; }; 6F0FEF6C2C52639E0090CDE4 /* ReorderableForEach.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReorderableForEach.swift; sourceTree = ""; }; - 6F35379D2C4AAF2E009F8717 /* NewTabPagePreferencesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTabPagePreferencesView.swift; sourceTree = ""; }; - 6F35379F2C4AAFD2009F8717 /* NTPPreferencesSectionItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NTPPreferencesSectionItemView.swift; sourceTree = ""; }; - 6F3537A12C4AB97A009F8717 /* NewTabPagePreferencesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTabPagePreferencesModel.swift; sourceTree = ""; }; - 6F35379F2C4AAFD2009F8717 /* NTPPreferencesSectionItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NTPPreferencesSectionItemView.swift; sourceTree = ""; }; + 6F35379D2C4AAF2E009F8717 /* NewTabPageSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTabPageSettingsView.swift; sourceTree = ""; }; + 6F35379F2C4AAFD2009F8717 /* NewTabPageSettingsSectionItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTabPageSettingsSectionItemView.swift; sourceTree = ""; }; + 6F3537A12C4AB97A009F8717 /* NewTabPageSettingsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTabPageSettingsModel.swift; sourceTree = ""; }; 6F3537A32C4AC140009F8717 /* NTPDaxLogoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NTPDaxLogoView.swift; sourceTree = ""; }; 6F40D15A2C34423800BF22F0 /* HomePageDisplayDailyPixelBucket.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomePageDisplayDailyPixelBucket.swift; sourceTree = ""; }; 6F40D15C2C34436200BF22F0 /* HomePageDisplayDailyPixelBucketTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomePageDisplayDailyPixelBucketTests.swift; sourceTree = ""; }; @@ -1447,9 +1445,9 @@ 6F96FF0F2C2B128500162692 /* NewTabPageCustomizeButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTabPageCustomizeButtonView.swift; sourceTree = ""; }; 6F9FFE252C579BCD00A238BE /* NewTabPageShortcutsSettingsStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTabPageShortcutsSettingsStorage.swift; sourceTree = ""; }; 6F9FFE272C579DEA00A238BE /* NewTabPageSectionsSettingsStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTabPageSectionsSettingsStorage.swift; sourceTree = ""; }; + 6F9FFE292C57ADB100A238BE /* EditableShortcutsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditableShortcutsView.swift; sourceTree = ""; }; 6F9FFE2C2C57AE8F00A238BE /* NewTabPageShortcutsSettingsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTabPageShortcutsSettingsModel.swift; sourceTree = ""; }; 6F9FFE2F2C57B34800A238BE /* NewTabPageSectionsSettingsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewTabPageSectionsSettingsModel.swift; sourceTree = ""; }; - 6F9FFE292C57ADB100A238BE /* EditableShortcutsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditableShortcutsView.swift; sourceTree = ""; }; 6FA3438E2C3D3BC300470677 /* Favorite.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Favorite.swift; sourceTree = ""; }; 6FA343912C3D3C3B00470677 /* FavoriteIconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteIconView.swift; sourceTree = ""; }; 6FB030C7234331B400A10DB9 /* Configuration.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Configuration.xcconfig; path = Configuration/Configuration.xcconfig; sourceTree = ""; }; @@ -3524,14 +3522,14 @@ name = NewTabPage; sourceTree = ""; }; - 6F35379C2C4AAF1C009F8717 /* Preferences */ = { + 6F35379C2C4AAF1C009F8717 /* Settings */ = { isa = PBXGroup; children = ( 6F9FFE2E2C57B14100A238BE /* Model */, 6F9FFE2B2C57AE4200A238BE /* Storage */, - 6F35379F2C4AAFD2009F8717 /* NTPPreferencesSectionItemView.swift */, + 6F35379F2C4AAFD2009F8717 /* NewTabPageSettingsSectionItemView.swift */, ); - name = Preferences; + name = Settings; sourceTree = ""; }; 6F691CC82C4979DD002E9553 /* Tooltip */ = { @@ -3549,8 +3547,7 @@ 6F5345AE2C53F2DE00424A43 /* NewTabPageSettingsPersistentStorage.swift */, 6F9FFE252C579BCD00A238BE /* NewTabPageShortcutsSettingsStorage.swift */, 6F9FFE272C579DEA00A238BE /* NewTabPageSectionsSettingsStorage.swift */, - 6F35379D2C4AAF2E009F8717 /* NewTabPagePreferencesView.swift */, - 6F35379F2C4AAFD2009F8717 /* NTPPreferencesSectionItemView.swift */, + 6F35379D2C4AAF2E009F8717 /* NewTabPageSettingsView.swift */, ); name = Storage; sourceTree = ""; @@ -3560,7 +3557,7 @@ children = ( 6F9FFE2C2C57AE8F00A238BE /* NewTabPageShortcutsSettingsModel.swift */, 6F9FFE2F2C57B34800A238BE /* NewTabPageSectionsSettingsModel.swift */, - 6F3537A12C4AB97A009F8717 /* NewTabPagePreferencesModel.swift */, + 6F3537A12C4AB97A009F8717 /* NewTabPageSettingsModel.swift */, ); name = Model; sourceTree = ""; @@ -3631,7 +3628,7 @@ 6FE1273B2C204C0D00EB5724 /* Subviews */ = { isa = PBXGroup; children = ( - 6F35379C2C4AAF1C009F8717 /* Preferences */, + 6F35379C2C4AAF1C009F8717 /* Settings */, 6FE127472C20941A00EB5724 /* Shortcuts */, 6FE127412C204DE900EB5724 /* Favorites */, 6F5CC0802C2AFFE400AFC840 /* ToggleExpandButtonView.swift */, @@ -6960,7 +6957,7 @@ 83BE9BC3215D69C1009844D9 /* AppConfigurationFetch.swift in Sources */, 37CF91622BB474AA00BADCAE /* CrashCollectionOnboardingView.swift in Sources */, 1EEC460627A9499600E75FCB /* DownloadsList.swift in Sources */, - 6F3537A22C4AB97A009F8717 /* NewTabPagePreferencesModel.swift in Sources */, + 6F3537A22C4AB97A009F8717 /* NewTabPageSettingsModel.swift in Sources */, 9F23B8032C2BCD0000950875 /* DaxDialogStyles.swift in Sources */, C1641EAF2BC2F5140012607A /* ImportPasswordsViewController.swift in Sources */, D63FF8982C1B6A45006DE24D /* DuckPlayer.swift in Sources */, @@ -7115,7 +7112,7 @@ 311BD1AD2836BB3900AEF6C1 /* AutofillItemsEmptyView.swift in Sources */, C1F341C52A6924000032057B /* EmailAddressPromptView.swift in Sources */, 316931D727BD10BB0095F5ED /* SaveToDownloadsAlert.swift in Sources */, - 6F35379E2C4AAF2E009F8717 /* NewTabPagePreferencesView.swift in Sources */, + 6F35379E2C4AAF2E009F8717 /* NewTabPageSettingsView.swift in Sources */, 31C70B5B2804C61000FB6AD1 /* SaveAutofillLoginManager.swift in Sources */, 982123502B6D233E00F08C57 /* UserSession.swift in Sources */, 85449EFD23FDA71F00512AAF /* KeyboardSettings.swift in Sources */, @@ -7292,7 +7289,7 @@ CBD4F13F279EBFAF00B20FD7 /* HomeMessageViewModel.swift in Sources */, 1E4DCF4A27B6A38000961E25 /* DownloadListRepresentable.swift in Sources */, 1DEAADFB2BA71E9A00E25A97 /* SettingsPrivacyProtectionDescriptionView.swift in Sources */, - 6F3537A02C4AAFD2009F8717 /* NTPPreferencesSectionItemView.swift in Sources */, + 6F3537A02C4AAFD2009F8717 /* NewTabPageSettingsSectionItemView.swift in Sources */, 2DC3FC65C6D9DA634426672D /* AutofillNoAuthAvailableView.swift in Sources */, 6F03CAFC2C32C6F6004179A8 /* NewTabPageMessagesModel.swift in Sources */, ); diff --git a/DuckDuckGo/EditableShortcutsView.swift b/DuckDuckGo/EditableShortcutsView.swift index 3a2f569311..f907a06d5b 100644 --- a/DuckDuckGo/EditableShortcutsView.swift +++ b/DuckDuckGo/EditableShortcutsView.swift @@ -50,7 +50,7 @@ private extension View { } } -extension NewTabPagePreferencesModel.NTPSetting: Reorderable, Hashable, Equatable { +extension NewTabPageSettingsModel.NTPSetting: Reorderable, Hashable, Equatable { var dropItemProvider: NSItemProvider { NSItemProvider(object: item.id as NSString) @@ -58,7 +58,7 @@ extension NewTabPagePreferencesModel.NTPSetting: Reorderable var dropType: UTType { .text } - static func == (lhs: NewTabPagePreferencesModel.NTPSetting, rhs: NewTabPagePreferencesModel.NTPSetting) -> Bool { + static func == (lhs: Self, rhs: Self) -> Bool { lhs.item == rhs.item } diff --git a/DuckDuckGo/NewTabPageSectionsSettingsModel.swift b/DuckDuckGo/NewTabPageSectionsSettingsModel.swift index 680c8afb05..37f27339ef 100644 --- a/DuckDuckGo/NewTabPageSectionsSettingsModel.swift +++ b/DuckDuckGo/NewTabPageSectionsSettingsModel.swift @@ -19,10 +19,10 @@ import Foundation -typealias NewTabPageSectionsSettingsModel = NewTabPagePreferencesModel +typealias NewTabPageSectionsSettingsModel = NewTabPageSettingsModel extension NewTabPageSectionsSettingsModel { convenience init(storage: NewTabPageSectionsSettingsStorage = NewTabPageSectionsSettingsStorage()) { - self.init(preferencesStorage: storage) + self.init(settingsStorage: storage) } } diff --git a/DuckDuckGo/NewTabPagePreferencesModel.swift b/DuckDuckGo/NewTabPageSettingsModel.swift similarity index 64% rename from DuckDuckGo/NewTabPagePreferencesModel.swift rename to DuckDuckGo/NewTabPageSettingsModel.swift index 9a79cb6ec6..4e359bc883 100644 --- a/DuckDuckGo/NewTabPagePreferencesModel.swift +++ b/DuckDuckGo/NewTabPageSettingsModel.swift @@ -1,5 +1,5 @@ // -// NewTabPagePreferencesModel.swift +// NewTabPageSettingsModel.swift // DuckDuckGo // // Copyright © 2024 DuckDuckGo. All rights reserved. @@ -20,29 +20,29 @@ import Foundation import SwiftUI -final class NewTabPagePreferencesModel: ObservableObject where Storage.SettingItem == SettingItem { +final class NewTabPageSettingsModel: ObservableObject where Storage.SettingItem == SettingItem { - /// Preferences page settings collection with bindings + /// Settings page settings collection with bindings @Published private(set) var itemsSettings: [NTPSetting] = [] /// Enabled items, ordered. @Published private(set) var enabledItems: [SettingItem] = [] - private let preferencesStorage: Storage + private let settingsStorage: Storage - init(preferencesStorage: Storage) { - self.preferencesStorage = preferencesStorage + init(settingsStorage: Storage) { + self.settingsStorage = settingsStorage updatePublishedValues() } func moveItems(from: IndexSet, to: Int) { - preferencesStorage.moveItems(from, toOffset: to) + settingsStorage.moveItems(from, toOffset: to) updatePublishedValues() } func save() { - preferencesStorage.save() + settingsStorage.save() } private func updatePublishedValues() { @@ -51,22 +51,22 @@ final class NewTabPagePreferencesModel { let item: Item let isEnabled: Binding diff --git a/DuckDuckGo/NTPPreferencesSectionItemView.swift b/DuckDuckGo/NewTabPageSettingsSectionItemView.swift similarity index 82% rename from DuckDuckGo/NTPPreferencesSectionItemView.swift rename to DuckDuckGo/NewTabPageSettingsSectionItemView.swift index d92523bb0f..4f0bce3515 100644 --- a/DuckDuckGo/NTPPreferencesSectionItemView.swift +++ b/DuckDuckGo/NewTabPageSettingsSectionItemView.swift @@ -1,5 +1,5 @@ // -// NTPPreferencesSectionItemView.swift +// NewTabPageSettingsSectionItemView.swift // DuckDuckGo // // Copyright © 2024 DuckDuckGo. All rights reserved. @@ -19,7 +19,7 @@ import SwiftUI -struct NTPPreferencesSectionItemView: View { +struct NewTabPageSettingsSectionItemView: View { let title: String let iconResource: ImageResource @@ -43,5 +43,5 @@ struct NTPPreferencesSectionItemView: View { #Preview { @State var isEnabled: Bool = false - return NTPPreferencesSectionItemView(title: "Foo", iconResource: .favorite24, isEnabled: $isEnabled).fixedSize(horizontal: false, vertical: true) + return NewTabPageSettingsSectionItemView(title: "Foo", iconResource: .favorite24, isEnabled: $isEnabled).fixedSize(horizontal: false, vertical: true) } diff --git a/DuckDuckGo/NewTabPagePreferencesView.swift b/DuckDuckGo/NewTabPageSettingsView.swift similarity index 88% rename from DuckDuckGo/NewTabPagePreferencesView.swift rename to DuckDuckGo/NewTabPageSettingsView.swift index 9698713a9e..ea7ab8538d 100644 --- a/DuckDuckGo/NewTabPagePreferencesView.swift +++ b/DuckDuckGo/NewTabPageSettingsView.swift @@ -1,5 +1,5 @@ // -// NewTabPagePreferencesView.swift +// NewTabPageSettingsView.swift // DuckDuckGo // // Copyright © 2024 DuckDuckGo. All rights reserved. @@ -20,7 +20,7 @@ import SwiftUI import Common -struct NewTabPagePreferencesView: View { +struct NewTabPageSettingsView: View { @Environment(\.dismiss) var dismiss @ObservedObject var shortcutsSettingsModel: NewTabPageShortcutsSettingsModel @@ -36,7 +36,7 @@ struct NewTabPagePreferencesView: View { mainView .applyBackground() .tintIfAvailable(Color(designSystemColor: .accent)) - .navigationTitle(UserText.newTabPagePreferencesTitle) + .navigationTitle(UserText.newTabPageSettingsTitle) .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .confirmationAction) { @@ -73,9 +73,9 @@ struct NewTabPagePreferencesView: View { private func sectionsList(withFrameUpdates: Bool) -> some View { List { Section { - sectionsPreferenceSectionContentView + sectionsSettingsContentView } header: { - Text(UserText.newTabPagePreferencesSectionsSettingsHeaderTitle) + Text(UserText.newTabPageSettingsSectionsHeaderTitle) .if(withFrameUpdates) { $0.onFrameUpdate(in: Constant.scrollCoordinateSpace, using: FirstSectionFrameKey.self) { frame in self.firstSectionFrame = frame @@ -83,13 +83,13 @@ struct NewTabPagePreferencesView: View { } } } footer: { - Text(UserText.newTabPagePreferencesSectionsSettingsDescription) + Text(UserText.newTabPageSettingsSectionsDescription) } if sectionsSettingsModel.enabledItems.contains(.shortcuts) { Section { } header: { - Text(UserText.newTabPagePreferencesShortcutsHeaderTitle) + Text(UserText.newTabPageSettingsShortcutsHeaderTitle) .if(withFrameUpdates) { $0.onFrameUpdate(in: Constant.scrollCoordinateSpace, using: LastSectionFrameKey.self) { frame in self.lastSectionFrame = frame @@ -104,15 +104,15 @@ struct NewTabPagePreferencesView: View { } @ViewBuilder - private var sectionsPreferenceSectionContentView: some View { + private var sectionsSettingsContentView: some View { ForEach(sectionsSettingsModel.itemsSettings, id: \.item) { setting in switch setting.item { case .favorites: - NTPPreferencesSectionItemView(title: "Favorites", + NewTabPageSettingsSectionItemView(title: "Favorites", iconResource: .favorite24, isEnabled: setting.isEnabled) case .shortcuts: - NTPPreferencesSectionItemView(title: "Shortcuts", + NewTabPageSettingsSectionItemView(title: "Shortcuts", iconResource: .shortcut24, isEnabled: setting.isEnabled) } @@ -143,7 +143,7 @@ private struct Metrics { #Preview { NavigationView { - NewTabPagePreferencesView( + NewTabPageSettingsView( shortcutsSettingsModel: NewTabPageShortcutsSettingsModel(), sectionsSettingsModel: NewTabPageSectionsSettingsModel() ) diff --git a/DuckDuckGo/NewTabPageShortcutsSettingsModel.swift b/DuckDuckGo/NewTabPageShortcutsSettingsModel.swift index 1ad779fa68..fd960f9009 100644 --- a/DuckDuckGo/NewTabPageShortcutsSettingsModel.swift +++ b/DuckDuckGo/NewTabPageShortcutsSettingsModel.swift @@ -19,10 +19,10 @@ import Foundation -typealias NewTabPageShortcutsSettingsModel = NewTabPagePreferencesModel +typealias NewTabPageShortcutsSettingsModel = NewTabPageSettingsModel extension NewTabPageShortcutsSettingsModel { convenience init(storage: NewTabPageShortcutsSettingsStorage = NewTabPageShortcutsSettingsStorage()) { - self.init(preferencesStorage: storage) + self.init(settingsStorage: storage) } } diff --git a/DuckDuckGo/NewTabPageView.swift b/DuckDuckGo/NewTabPageView.swift index d3420e20ab..97b7543d41 100644 --- a/DuckDuckGo/NewTabPageView.swift +++ b/DuckDuckGo/NewTabPageView.swift @@ -31,7 +31,7 @@ struct NewTabPageView: View { @ObservedObject private var sectionsSettingsModel: NewTabPageSectionsSettingsModel @State var isShowingTooltip: Bool = false - @State private var isShowingPreferences: Bool = false + @State private var isShowingSettings: Bool = false init(messagesModel: NewTabPageMessagesModel, favoritesModel: FavoritesModelType, @@ -79,7 +79,7 @@ struct NewTabPageView: View { Spacer() Button(action: { - isShowingPreferences = true + isShowingSettings = true }, label: { NewTabPageCustomizeButtonView() // Needed to reduce default button margins @@ -132,12 +132,12 @@ struct NewTabPageView: View { isShowingTooltip = false }) } - .sheet(isPresented: $isShowingPreferences, onDismiss: { + .sheet(isPresented: $isShowingSettings, onDismiss: { shortcutsSettingsModel.save() sectionsSettingsModel.save() }, content: { NavigationView { - NewTabPagePreferencesView(shortcutsSettingsModel: shortcutsSettingsModel, + NewTabPageSettingsView(shortcutsSettingsModel: shortcutsSettingsModel, sectionsSettingsModel: sectionsSettingsModel) } }) diff --git a/DuckDuckGo/UserText.swift b/DuckDuckGo/UserText.swift index 396ac0e6dc..6d3fba3ab3 100644 --- a/DuckDuckGo/UserText.swift +++ b/DuckDuckGo/UserText.swift @@ -1202,10 +1202,10 @@ But if you *do* want a peek under the hood, you can find more information about // MARK: Settings - public static let newTabPagePreferencesTitle = NSLocalizedString("new.tab.page.preferences.title", value: "Customize New Tab", comment: "Title of New Tab Page preferences page.") - public static let newTabPagePreferencesSectionsSettingsHeaderTitle = NSLocalizedString("new.tab.page.preferences.sections.settings.header.title", value: "SECTIONS", comment: "Header title of the group allowing for setting up new tab page sections") - public static let newTabPagePreferencesSectionsSettingsDescription = NSLocalizedString("new.tab.page.preferences.sections.settings.description", value: "Show, hide, and reorder sections on the new tab page", comment: "Footer of the group allowing for setting up new tab page sections") - public static let newTabPagePreferencesShortcutsHeaderTitle = NSLocalizedString("new.tab.page.preferences.shortcuts.header.title", value: "SHORTCUTS", comment: "Header title of the shortcuts in New Tab Page preferences.") + public static let newTabPageSettingsTitle = NSLocalizedString("new.tab.page.settings.title", value: "Customize New Tab", comment: "Title of New Tab Page preferences page.") + public static let newTabPageSettingsSectionsHeaderTitle = NSLocalizedString("new.tab.page.settings.sections.header.title", value: "SECTIONS", comment: "Header title of the group allowing for setting up new tab page sections") + public static let newTabPageSettingsSectionsDescription = NSLocalizedString("new.tab.page.settings.sections.description", value: "Show, hide, and reorder sections on the new tab page", comment: "Footer of the group allowing for setting up new tab page sections") + public static let newTabPageSettingsShortcutsHeaderTitle = NSLocalizedString("new.tab.page.settings.shortcuts.header.title", value: "SHORTCUTS", comment: "Header title of the shortcuts in New Tab Page preferences.") // MARK: - Dax Onboarding Experiment public enum DaxOnboardingExperiment { diff --git a/DuckDuckGo/en.lproj/Localizable.strings b/DuckDuckGo/en.lproj/Localizable.strings index 78ffe81a9f..88ca572a13 100644 --- a/DuckDuckGo/en.lproj/Localizable.strings +++ b/DuckDuckGo/en.lproj/Localizable.strings @@ -1586,16 +1586,16 @@ https://duckduckgo.com/mac"; "network.protection.vpn.settings.title" = "VPN Settings"; /* Footer of the group allowing for setting up new tab page sections */ -"new.tab.page.preferences.sections.settings.description" = "Show, hide, and reorder sections on the new tab page"; +"new.tab.page.settings.sections.description" = "Show, hide, and reorder sections on the new tab page"; /* Header title of the group allowing for setting up new tab page sections */ -"new.tab.page.preferences.sections.settings.header.title" = "SECTIONS"; +"new.tab.page.settings.sections.header.title" = "SECTIONS"; /* Header title of the shortcuts in New Tab Page preferences. */ -"new.tab.page.preferences.shortcuts.header.title" = "SHORTCUTS"; +"new.tab.page.settings.shortcuts.header.title" = "SHORTCUTS"; /* Title of New Tab Page preferences page. */ -"new.tab.page.preferences.title" = "Customize New Tab"; +"new.tab.page.settings.title" = "Customize New Tab"; /* Shortcut title leading to AI Chat */ "new.tab.page.shortcut.ai.chat" = "AI Chat";