Skip to content

Commit

Permalink
show correct tab and ensure keyboard shown on launch is supported
Browse files Browse the repository at this point in the history
  • Loading branch information
brindy committed Mar 20, 2024
1 parent d9c9a43 commit 1953f3d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 3 additions & 1 deletion DuckDuckGo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

private func showKeyboardOnLaunch() {
guard KeyboardSettings().onAppLaunch && showKeyboardIfSettingOn && shouldShowKeyboardOnLaunch() else { return }
self.mainViewController?.enterSearch()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.mainViewController?.enterSearch()
}
showKeyboardIfSettingOn = false
}

Expand Down
6 changes: 3 additions & 3 deletions DuckDuckGo/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ class MainViewController: UIViewController {

startOnboardingFlowIfNotSeenBefore()
tabsBarController?.refresh(tabsModel: tabManager.model)
swipeTabsCoordinator?.refresh(tabsModel: tabManager.model)
swipeTabsCoordinator?.refresh(tabsModel: tabManager.model, scrollToSelected: true)

_ = AppWidthObserver.shared.willResize(toWidth: view.frame.width)
applyWidth()

Expand Down Expand Up @@ -1284,7 +1284,7 @@ class MainViewController: UIViewController {
}
attachHomeScreen()
tabsBarController?.refresh(tabsModel: tabManager.model)
swipeTabsCoordinator?.refresh(tabsModel: tabManager.model)
swipeTabsCoordinator?.refresh(tabsModel: tabManager.model, scrollToSelected: true)
homeController?.openedAsNewTab(allowingKeyboard: allowingKeyboard)
}

Expand Down
2 changes: 0 additions & 2 deletions DuckDuckGo/SwipeTabsCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ class SwipeTabsCoordinator: NSObject {
}

private func scrollToCurrent() {
guard isEnabled else { return }

let targetOffset = collectionView.frame.width * CGFloat(tabsModel.currentIndex)

guard targetOffset != collectionView.contentOffset.x else {
Expand Down

0 comments on commit 1953f3d

Please sign in to comment.