Skip to content

Commit

Permalink
implement default zoom per site (#2566)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/1177771139624306/1206933712061973/f

**Description**: Implements default Zoom per website
  • Loading branch information
SabrinaTardio authored May 17, 2024
1 parent 75e5ccc commit af516c7
Show file tree
Hide file tree
Showing 26 changed files with 1,166 additions and 53 deletions.
12 changes: 12 additions & 0 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,8 @@
560C3FFD2BC9911000F589CE /* PermanentSurveyManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560C3FFB2BC9911000F589CE /* PermanentSurveyManagerTests.swift */; };
560C3FFF2BCD5A1E00F589CE /* PermanentSurveyManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560C3FFE2BCD5A1E00F589CE /* PermanentSurveyManager.swift */; };
560C40002BCD5A1E00F589CE /* PermanentSurveyManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560C3FFE2BCD5A1E00F589CE /* PermanentSurveyManager.swift */; };
5614B3A12BBD639D009B5031 /* ZoomPopover.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5614B3A02BBD639D009B5031 /* ZoomPopover.swift */; };
5614B3A22BBD639D009B5031 /* ZoomPopover.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5614B3A02BBD639D009B5031 /* ZoomPopover.swift */; };
561D29C22BDA745A007B91D0 /* MockSyncPausedStateManaging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561D29C02BDA7430007B91D0 /* MockSyncPausedStateManaging.swift */; };
561D29C32BDA745B007B91D0 /* MockSyncPausedStateManaging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561D29C02BDA7430007B91D0 /* MockSyncPausedStateManaging.swift */; };
561D29C62BDA74ED007B91D0 /* MockDDGSyncing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561D29C42BDA749A007B91D0 /* MockDDGSyncing.swift */; };
Expand All @@ -1424,6 +1426,8 @@
561D29CB2BDA7530007B91D0 /* MockAppearancePreferencesPersistor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 561D29C82BDA751E007B91D0 /* MockAppearancePreferencesPersistor.swift */; };
561D66662B95C45A008ACC5C /* Suggestion.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 561D66692B95C45A008ACC5C /* Suggestion.storyboard */; };
561D66672B95C45A008ACC5C /* Suggestion.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 561D66692B95C45A008ACC5C /* Suggestion.storyboard */; };
562532A02BC069180034D316 /* ZoomPopoverViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5625329D2BC069100034D316 /* ZoomPopoverViewModelTests.swift */; };
562532A12BC069190034D316 /* ZoomPopoverViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5625329D2BC069100034D316 /* ZoomPopoverViewModelTests.swift */; };
562984702AC4610100AC20EB /* SyncPreferencesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5629846E2AC4610100AC20EB /* SyncPreferencesTests.swift */; };
562984712AC469E400AC20EB /* SyncPreferencesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5629846E2AC4610100AC20EB /* SyncPreferencesTests.swift */; };
56534DED29DF252C00121467 /* CapturingDefaultBrowserProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56534DEC29DF252C00121467 /* CapturingDefaultBrowserProvider.swift */; };
Expand Down Expand Up @@ -3281,10 +3285,12 @@
5603D90529B7B746007F9F01 /* MockTabViewItemDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockTabViewItemDelegate.swift; sourceTree = "<group>"; };
560C3FFB2BC9911000F589CE /* PermanentSurveyManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermanentSurveyManagerTests.swift; sourceTree = "<group>"; };
560C3FFE2BCD5A1E00F589CE /* PermanentSurveyManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermanentSurveyManager.swift; sourceTree = "<group>"; };
5614B3A02BBD639D009B5031 /* ZoomPopover.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZoomPopover.swift; sourceTree = "<group>"; };
561D29C02BDA7430007B91D0 /* MockSyncPausedStateManaging.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockSyncPausedStateManaging.swift; sourceTree = "<group>"; };
561D29C42BDA749A007B91D0 /* MockDDGSyncing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockDDGSyncing.swift; sourceTree = "<group>"; };
561D29C82BDA751E007B91D0 /* MockAppearancePreferencesPersistor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAppearancePreferencesPersistor.swift; sourceTree = "<group>"; };
561D66692B95C45A008ACC5C /* Suggestion.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Suggestion.storyboard; sourceTree = "<group>"; };
5625329D2BC069100034D316 /* ZoomPopoverViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZoomPopoverViewModelTests.swift; sourceTree = "<group>"; };
5629846E2AC4610100AC20EB /* SyncPreferencesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SyncPreferencesTests.swift; sourceTree = "<group>"; };
56534DEC29DF252C00121467 /* CapturingDefaultBrowserProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CapturingDefaultBrowserProvider.swift; sourceTree = "<group>"; };
565E46DD2B2725DC0013AC2A /* SyncE2EUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SyncE2EUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -6992,6 +6998,7 @@
AA7EB6EE27E880EA00036718 /* Animations */,
AAC5E4F025D6BF10007F5990 /* AddressBarButton.swift */,
AAC5E4F525D6BF2C007F5990 /* AddressBarButtonsViewController.swift */,
5614B3A02BBD639D009B5031 /* ZoomPopover.swift */,
AABEE6AE24AD22B90043105B /* AddressBarTextField.swift */,
B6676BE02AA986A700525A21 /* AddressBarTextEditor.swift */,
B60D64482AAF1B7C00B26F50 /* AddressBarTextSelectionNavigation.swift */,
Expand Down Expand Up @@ -7110,6 +7117,7 @@
isa = PBXGroup;
children = (
AAC9C01B24CB594C00AD1325 /* TabViewModelTests.swift */,
5625329D2BC069100034D316 /* ZoomPopoverViewModelTests.swift */,
);
path = ViewModel;
sourceTree = "<group>";
Expand Down Expand Up @@ -9557,6 +9565,7 @@
B6E3E5512BBFCDEE00A41922 /* OpenDownloadsCellView.swift in Sources */,
3706FAB0293F65D500E42796 /* BookmarkOutlineCellView.swift in Sources */,
3706FAB1293F65D500E42796 /* UnprotectedDomains.xcdatamodeld in Sources */,
5614B3A22BBD639D009B5031 /* ZoomPopover.swift in Sources */,
85393C872A6FF1B600F11EB3 /* BookmarksBarAppearance.swift in Sources */,
3706FAB2293F65D500E42796 /* TabInstrumentation.swift in Sources */,
3706FAB5293F65D500E42796 /* ConfigurationManager.swift in Sources */,
Expand Down Expand Up @@ -10397,6 +10406,7 @@
B626A7652992506A00053070 /* SerpHeadersNavigationResponderTests.swift in Sources */,
9F6434712BECBA2800D2D8A0 /* SubscriptionRedirectManagerTests.swift in Sources */,
9F26060C2B85C20B00819292 /* AddEditBookmarkDialogViewModelTests.swift in Sources */,
562532A12BC069190034D316 /* ZoomPopoverViewModelTests.swift in Sources */,
3706FE28293F661700E42796 /* BookmarkTests.swift in Sources */,
3706FE29293F661700E42796 /* SuggestionContainerViewModelTests.swift in Sources */,
1D8C2FEB2B70F5A7005E4BBD /* MockWebViewSnapshotRenderer.swift in Sources */,
Expand Down Expand Up @@ -11547,6 +11557,7 @@
AABEE69C24A902BB0043105B /* SuggestionContainer.swift in Sources */,
B6C00ECD292F89D9009C73A6 /* FindInPageTabExtension.swift in Sources */,
85589E8327BBB8630038AD11 /* HomePageViewController.swift in Sources */,
5614B3A12BBD639D009B5031 /* ZoomPopover.swift in Sources */,
B6A9E46B2614618A0067D1B9 /* OperatingSystemVersionExtension.swift in Sources */,
4BDFA4AE27BF19E500648192 /* ToggleableScrollView.swift in Sources */,
1D36F4242A3B85C50052B527 /* TabCleanupPreparer.swift in Sources */,
Expand Down Expand Up @@ -11827,6 +11838,7 @@
4BA1A6FE258C5C1300F6F690 /* EncryptedValueTransformerTests.swift in Sources */,
85F69B3C25EDE81F00978E59 /* URLExtensionTests.swift in Sources */,
4B9292BA2667103100AD2C21 /* BookmarkNodePathTests.swift in Sources */,
562532A02BC069180034D316 /* ZoomPopoverViewModelTests.swift in Sources */,
4B9292C02667103100AD2C21 /* BookmarkManagedObjectTests.swift in Sources */,
373A1AB228451ED400586521 /* BookmarksHTMLImporterTests.swift in Sources */,
4B723E0626B0003E00E14D75 /* CSVParserTests.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "Zoom-Page-Increase-16D.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ struct UserText {
static let mobileBookmarksImportedFolderTitle = NSLocalizedString("bookmarks.imported.mobile.folder.title", value: "Mobile bookmarks", comment: "Name of the \"Mobile bookmarks\" folder imported from other browser")

static let zoom = NSLocalizedString("zoom", value: "Zoom", comment: "Menu with Zooming commands")
static let resetZoom = NSLocalizedString("reset-zoom", value: "Reset", comment: "Button that allows the user to reset the zoom level of the browser page")

static let emailOptionsMenuItem = NSLocalizedString("email.optionsMenu", value: "Email Protection", comment: "Menu item email feature")
static let emailOptionsMenuCreateAddressSubItem = NSLocalizedString("email.optionsMenu.createAddress", value: "Generate Private Duck Address", comment: "Create an email alias sub menu item")
Expand Down
1 change: 1 addition & 0 deletions DuckDuckGo/Common/Utilities/UserDefaultsWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public struct UserDefaultsWrapper<T> {
case switchToNewTabWhenOpened = "preferences.tabs.switch-to-new-tab-when-opened"
case newTabPosition = "preferences.tabs.new-tab-position"
case defaultPageZoom = "preferences.appearance.default-page-zoom"
case websitePageZoom = "preferences.appearance.website-page-zoom"
case bookmarksBarAppearance = "preferences.appearance.bookmarks-bar"

case homeButtonPosition = "preferences.appeareance.home-button-position"
Expand Down
15 changes: 15 additions & 0 deletions DuckDuckGo/Fire/Model/Fire.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ final class Fire {
let webCacheManager: WebCacheManager
let historyCoordinating: HistoryCoordinating
let permissionManager: PermissionManagerProtocol
let savedZoomLevelsCoordinating: SavedZoomLevelsCoordinating
let downloadListCoordinator: DownloadListCoordinator
let windowControllerManager: WindowControllersManager
let faviconManagement: FaviconManagement
Expand Down Expand Up @@ -88,6 +89,7 @@ final class Fire {
init(cacheManager: WebCacheManager = WebCacheManager.shared,
historyCoordinating: HistoryCoordinating = HistoryCoordinator.shared,
permissionManager: PermissionManagerProtocol = PermissionManager.shared,
savedZoomLevelsCoordinating: SavedZoomLevelsCoordinating = AccessibilityPreferences.shared,
downloadListCoordinator: DownloadListCoordinator = DownloadListCoordinator.shared,
windowControllerManager: WindowControllersManager = WindowControllersManager.shared,
faviconManagement: FaviconManagement = FaviconManager.shared,
Expand All @@ -104,6 +106,7 @@ final class Fire {
self.webCacheManager = cacheManager
self.historyCoordinating = historyCoordinating
self.permissionManager = permissionManager
self.savedZoomLevelsCoordinating = savedZoomLevelsCoordinating
self.downloadListCoordinator = downloadListCoordinator
self.windowControllerManager = windowControllerManager
self.faviconManagement = faviconManagement
Expand Down Expand Up @@ -167,6 +170,7 @@ final class Fire {

self.burnRecentlyClosed(baseDomains: domains)
self.burnAutoconsentCache()
self.burnZoomLevels(of: domains)

group.notify(queue: .main) {
self.dispatchGroup = nil
Expand Down Expand Up @@ -218,6 +222,7 @@ final class Fire {

self.burnRecentlyClosed()
self.burnAutoconsentCache()
self.burnZoomLevels()

group.notify(queue: .main) {
self.dispatchGroup = nil
Expand Down Expand Up @@ -370,6 +375,16 @@ final class Fire {
historyCoordinating.burnAll(completion: completion)
}

// MARK: - Zoom levels

private func burnZoomLevels() {
savedZoomLevelsCoordinating.burnZoomLevels(except: FireproofDomains.shared)
}

private func burnZoomLevels(of baseDomains: Set<String>) {
savedZoomLevelsCoordinating.burnZoomLevel(of: baseDomains)
}

// MARK: - Permissions

private func burnPermissions(completion: @escaping () -> Void) {
Expand Down
60 changes: 60 additions & 0 deletions DuckDuckGo/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -47398,6 +47398,66 @@
}
}
},
"reset-zoom" : {
"comment" : "Button that allows the user to reset the zoom level of the browser page",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Zurücksetzen"
}
},
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Reset"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Reiniciar"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Réinitialiser"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ripristina"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Herstel"
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Resetowanie"
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
"value" : "Reset"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Сбросить"
}
}
}
},
"restart.bitwarden" : {
"comment" : "Button to restart Bitwarden application",
"extractionState" : "extracted_with_value",
Expand Down
Loading

0 comments on commit af516c7

Please sign in to comment.