Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement default zoom per site #2566

Merged
merged 28 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
17822f1
implement default zoom per site
SabrinaTardio Apr 8, 2024
08faec9
fix UI
SabrinaTardio Apr 8, 2024
f1a026b
Merge branch 'main' into sabrina/improve-zoom-feature
SabrinaTardio May 7, 2024
d52c969
remove zoom button on hover, fix bar button treatment
SabrinaTardio May 7, 2024
123b604
fix test in CI
SabrinaTardio May 7, 2024
0dd9cfc
little UI fix
SabrinaTardio May 7, 2024
22a9cbb
fix tests in CI
SabrinaTardio May 7, 2024
c91f1ee
fix test
SabrinaTardio May 7, 2024
4d74971
improve tests
SabrinaTardio May 8, 2024
5d584d2
adjust popover position
SabrinaTardio May 8, 2024
0dedd2c
Merge branch 'main' into sabrina/improve-zoom-feature
SabrinaTardio May 8, 2024
3484758
add tranlsations
SabrinaTardio May 8, 2024
e505e90
make test more robust
SabrinaTardio May 8, 2024
4c310ce
clean up
SabrinaTardio May 8, 2024
b878c29
fix tests in CI
SabrinaTardio May 8, 2024
0f9aa02
improve icon
SabrinaTardio May 8, 2024
ead4ad3
fix tests
SabrinaTardio May 8, 2024
1c358c5
address ship review comments
SabrinaTardio May 13, 2024
715b3f2
connect zoom to right setting
SabrinaTardio May 13, 2024
8727e41
make popover indipendent from preferences
SabrinaTardio May 13, 2024
b281135
set up zoom for fire window
SabrinaTardio May 13, 2024
47cbfc4
refactor
SabrinaTardio May 13, 2024
c0311e7
Merge branch 'main' into sabrina/improve-zoom-feature
SabrinaTardio May 13, 2024
17d3739
fix test
SabrinaTardio May 13, 2024
97b1d8c
fix internal link on new tab
SabrinaTardio May 14, 2024
3ffe2d0
fix button open/close
SabrinaTardio May 14, 2024
014eec4
Merge branch 'main' into sabrina/improve-zoom-feature
SabrinaTardio May 15, 2024
a09f90e
add test
SabrinaTardio May 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -3269,10 +3273,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 @@ -6944,6 +6950,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 @@ -7062,6 +7069,7 @@
isa = PBXGroup;
children = (
AAC9C01B24CB594C00AD1325 /* TabViewModelTests.swift */,
5625329D2BC069100034D316 /* ZoomPopoverViewModelTests.swift */,
);
path = ViewModel;
sourceTree = "<group>";
Expand Down Expand Up @@ -9509,6 +9517,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 @@ -10344,6 +10353,7 @@
3706FE27293F661700E42796 /* AppPrivacyConfigurationTests.swift in Sources */,
B626A7652992506A00053070 /* SerpHeadersNavigationResponderTests.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 @@ -11490,6 +11500,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 @@ -11767,6 +11778,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
Loading