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

swipe tabs #2370

Merged
merged 46 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
16db9cb
use uicollection view for the navigation bar
brindy Jan 19, 2024
234faea
handle swiping and snapping the view
brindy Jan 19, 2024
27955e6
use tabs model
brindy Jan 22, 2024
0c2029c
super basic rough swiping
brindy Jan 22, 2024
fb9b657
use fake omnibar
brindy Jan 22, 2024
edf9d8e
todo items
brindy Jan 22, 2024
5b49a7f
Merge branch 'main' into brindy/swipe-tabs
brindy Jan 22, 2024
49cffd1
move layout to other class and fix constraint warnings
brindy Jan 23, 2024
7af8a74
use paging instead of custom layout
brindy Jan 23, 2024
e7d8348
back to basics for scrolling logic
brindy Jan 23, 2024
0a011a6
get correct item when the collection view finishes decelerating
brindy Jan 23, 2024
dd329de
Merge branch 'main' into brindy/swipe-tabs
brindy Jan 26, 2024
c575714
swiping with previews
brindy Jan 26, 2024
9b569dd
clean up code, add feature flag, update preview on swipe
brindy Jan 29, 2024
3ec72c1
support orientation change
brindy Jan 29, 2024
5239257
handle orientation change
brindy Jan 29, 2024
c08d73d
handle ipad
brindy Jan 29, 2024
c570744
be more explicit about the disabling the swipe coordinator
brindy Jan 29, 2024
88980a5
Merge branch 'main' into brindy/swipe-tabs
brindy Jan 30, 2024
23080fd
add some haptic feedback
brindy Jan 30, 2024
921cf16
trying to get 10px gap
brindy Jan 30, 2024
960030d
Merge branch 'main' into brindy/swipe-tabs
brindy Jan 30, 2024
6423ed4
move views proportionally
brindy Jan 30, 2024
6d9c12c
handle swipe to/from home screen
brindy Jan 30, 2024
fda4b56
allow swipe area of navigation bar to be increased, and adjust scroll…
brindy Jan 30, 2024
0f45433
handle change swipe direction mid swipe (Jackson's comment/video)
brindy Jan 31, 2024
f66b382
clean up
brindy Jan 31, 2024
c04ff1c
prevent a gap appearing behind the keyboard when it goes away and ref…
brindy Jan 31, 2024
9210a12
swiftlint
brindy Jan 31, 2024
6746513
Merge branch 'main' into brindy/swipe-tabs
brindy Jan 31, 2024
9edbfc9
show new tab when swiping far enough to the right
brindy Jan 31, 2024
804e6dc
apply scroll bar tweaking
brindy Jan 31, 2024
cc424da
handle new tab / home screen transition
brindy Jan 31, 2024
103dcd3
add pixel and only fire / change tabs when the index is different
brindy Feb 1, 2024
229de25
prepare / use appropriate previews for the home screen / favorites
brindy Feb 1, 2024
a83f693
tweak scroll bar position
brindy Feb 1, 2024
a94198c
control omnibar padding from the swipe controller
brindy Feb 1, 2024
b1362db
fix background colour when over-swiping
brindy Feb 2, 2024
6c766de
fix opening tab keyboard
brindy Feb 2, 2024
7cf72ca
ensure launching as new tab with keyboard happens by delaying it slig…
brindy Feb 2, 2024
4806426
make swiping a bit more robust
brindy Feb 2, 2024
181c269
use aspect fill for the previews to handle orientation change
brindy Feb 2, 2024
9251cf1
Merge branch 'main' into brindy/swipe-tabs
brindy Feb 2, 2024
7b4fd09
fix ghost logo
brindy Feb 5, 2024
4dcc442
remove print statements
brindy Feb 5, 2024
d117156
Merge branch 'main' into brindy/swipe-tabs
brindy Feb 5, 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
3 changes: 2 additions & 1 deletion Core/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ public enum FeatureFlag: String {
case networkProtectionWaitlistAccess
case networkProtectionWaitlistActive
case subscription
case swipeTabs
case autoconsentOnByDefault
}

extension FeatureFlag: FeatureFlagSourceProviding {
public var source: FeatureFlagSource {
switch self {
case .debugMenu, .appTrackingProtection, .subscription:
case .debugMenu, .appTrackingProtection, .subscription, .swipeTabs:
return .internalOnly
case .sync:
return .remoteReleasable(.subfeature(SyncSubfeature.level0ShowSync))
Expand Down
5 changes: 5 additions & 0 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,9 @@ extension Pixel {
case syncDeleteAccountError
case syncLoginExistingAccountError

case swipeTabsUsed
case swipeTabsUsedDaily

case bookmarksCleanupFailed
case bookmarksCleanupAttemptedWhileSyncWasEnabled
case favoritesCleanupFailed
Expand Down Expand Up @@ -989,6 +992,8 @@ extension Pixel.Event {
case .syncDeleteAccountError: return "m_d_sync_delete_account_error"
case .syncLoginExistingAccountError: return "m_d_sync_login_existing_account_error"

case .swipeTabsUsed: return "m_swipe-tabs-used"
case .swipeTabsUsedDaily: return "m_swipe-tabs-used-daily"

case .bookmarksCleanupFailed: return "m_d_bookmarks_cleanup_failed"
case .bookmarksCleanupAttemptedWhileSyncWasEnabled: return "m_d_bookmarks_cleanup_attempted_while_sync_was_enabled"
Expand Down
13 changes: 13 additions & 0 deletions Core/UIViewExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,17 @@ extension UIView {
view.removeFromSuperview()
}
}

@MainActor
public func createImageSnapshot(inBounds bounds: CGRect? = nil) -> UIImage? {
let bounds = bounds ?? self.frame
let size = bounds.size
UIGraphicsBeginImageContextWithOptions(size, false, UIScreen.main.scale)
UIGraphicsGetCurrentContext()?.translateBy(x: -bounds.origin.x, y: -bounds.origin.y)
drawHierarchy(in: frame, afterScreenUpdates: true)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
samsymons marked this conversation as resolved.
Show resolved Hide resolved

}
8 changes: 8 additions & 0 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@
85AE668E2097206E0014CF04 /* NotificationView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 85AE668D2097206E0014CF04 /* NotificationView.xib */; };
85AE6690209724120014CF04 /* NotificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85AE668F209724120014CF04 /* NotificationView.swift */; };
85AFA1212B45D14F0028A504 /* BookmarksMigrationAssertionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85AFA1202B45D14F0028A504 /* BookmarksMigrationAssertionTests.swift */; };
85B9814E2B5EB618009AC9A6 /* SwipeTabsCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85B9814D2B5EB618009AC9A6 /* SwipeTabsCoordinator.swift */; };
85B9CB8921AEBDD5009001F1 /* FavoriteHomeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85B9CB8821AEBDD5009001F1 /* FavoriteHomeCell.swift */; };
85BA58551F34F49E00C6E8CA /* AppUserDefaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85BA58541F34F49E00C6E8CA /* AppUserDefaults.swift */; };
85BA58581F34F72F00C6E8CA /* AppUserDefaultsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85BA58561F34F61C00C6E8CA /* AppUserDefaultsTests.swift */; };
Expand Down Expand Up @@ -491,6 +492,7 @@
85DB12EB2A1FE2A4000A4A72 /* LockScreenWidgets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85DB12EA2A1FE2A4000A4A72 /* LockScreenWidgets.swift */; };
85DB12ED2A1FED0C000A4A72 /* AppDelegate+AppDeepLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85DB12EC2A1FED0C000A4A72 /* AppDelegate+AppDeepLinks.swift */; };
85DDE0402AC6FF65006ABCA2 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85DDE03F2AC6FF65006ABCA2 /* MainView.swift */; };
85DE681A2B6A8BB000DED4FE /* MainViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85DE68192B6A8BB000DED4FE /* MainViewCoordinator.swift */; };
85DF714624F7FE6100C89288 /* Core.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F143C2E41E4A4CD400CFDE3A /* Core.framework */; };
85DFEDED24C7CCA500973FE7 /* AppWidthObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85DFEDEC24C7CCA500973FE7 /* AppWidthObserver.swift */; };
85DFEDEF24C7EA3B00973FE7 /* SmallOmniBarState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85DFEDEE24C7EA3B00973FE7 /* SmallOmniBarState.swift */; };
Expand Down Expand Up @@ -1545,6 +1547,7 @@
85AE668D2097206E0014CF04 /* NotificationView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NotificationView.xib; sourceTree = "<group>"; };
85AE668F209724120014CF04 /* NotificationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationView.swift; sourceTree = "<group>"; };
85AFA1202B45D14F0028A504 /* BookmarksMigrationAssertionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarksMigrationAssertionTests.swift; sourceTree = "<group>"; };
85B9814D2B5EB618009AC9A6 /* SwipeTabsCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwipeTabsCoordinator.swift; sourceTree = "<group>"; };
85B9CB8821AEBDD5009001F1 /* FavoriteHomeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteHomeCell.swift; sourceTree = "<group>"; };
85BA58541F34F49E00C6E8CA /* AppUserDefaults.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppUserDefaults.swift; sourceTree = "<group>"; };
85BA58561F34F61C00C6E8CA /* AppUserDefaultsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppUserDefaultsTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1578,6 +1581,7 @@
85DB12EA2A1FE2A4000A4A72 /* LockScreenWidgets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockScreenWidgets.swift; sourceTree = "<group>"; };
85DB12EC2A1FED0C000A4A72 /* AppDelegate+AppDeepLinks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppDelegate+AppDeepLinks.swift"; sourceTree = "<group>"; };
85DDE03F2AC6FF65006ABCA2 /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = "<group>"; };
85DE68192B6A8BB000DED4FE /* MainViewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewCoordinator.swift; sourceTree = "<group>"; };
85DFEDEC24C7CCA500973FE7 /* AppWidthObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppWidthObserver.swift; sourceTree = "<group>"; };
85DFEDEE24C7EA3B00973FE7 /* SmallOmniBarState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmallOmniBarState.swift; sourceTree = "<group>"; };
85DFEDF024C7EEA400973FE7 /* LargeOmniBarState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LargeOmniBarState.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5390,6 +5394,8 @@
85864FBB24D31EF300E756FF /* SuggestionTrayViewController.swift */,
851DFD86212C39D300D95F20 /* TabSwitcherButton.swift */,
CBEFB9102ADFFE7900DEDE7B /* CriticalAlerts.swift */,
85B9814D2B5EB618009AC9A6 /* SwipeTabsCoordinator.swift */,
85DE68192B6A8BB000DED4FE /* MainViewCoordinator.swift */,
);
name = Main;
sourceTree = "<group>";
Expand Down Expand Up @@ -6663,6 +6669,7 @@
3151F0EE2735800800226F58 /* VoiceSearchFeedbackView.swift in Sources */,
857EEB752095FFAC008A005C /* HomeRowInstructionsViewController.swift in Sources */,
311BD1AF2836BB4200AEF6C1 /* AutofillItemsLockedView.swift in Sources */,
85DE681A2B6A8BB000DED4FE /* MainViewCoordinator.swift in Sources */,
0290472A29E867800008FE3C /* AppTPTrackerDetailView.swift in Sources */,
F1617C151E57336D00DEDCAF /* TabManager.swift in Sources */,
85449EF523FDA02800512AAF /* KeyboardSettingsViewController.swift in Sources */,
Expand Down Expand Up @@ -6886,6 +6893,7 @@
3151F0EA27357FBA00226F58 /* SpeechRecognizer.swift in Sources */,
F17922E21E71CD67006E3D97 /* NoSuggestionsTableViewCell.swift in Sources */,
0290472229E723260008FE3C /* AppTPManageTrackerCell.swift in Sources */,
85B9814E2B5EB618009AC9A6 /* SwipeTabsCoordinator.swift in Sources */,
985AAE4524899369007A43EC /* HomeScreenTransition.swift in Sources */,
85E58C2C28FDA94F006A801A /* FavoritesViewController.swift in Sources */,
1E8AD1CF27C000A000ABA377 /* CompleteDownloadRow.swift in Sources */,
Expand Down
Loading
Loading