Skip to content

Commit

Permalink
Fix UI glitches
Browse files Browse the repository at this point in the history
  • Loading branch information
jaceklyp committed May 9, 2024
1 parent 8d2450b commit 230e895
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions DuckDuckGo/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,7 @@ class MainViewController: UIViewController {

self.notificationView = contentView

view.layoutIfNeeded()
view.layoutSubviews()
viewCoordinator.showTopSlideContainer()
UIView.animate(withDuration: 0.3) {
Expand Down Expand Up @@ -1271,14 +1272,12 @@ class MainViewController: UIViewController {

@objc func attemptToShowBrokenSitePrompt(_ notification: Notification) {
guard /*userDidInteractWithBrokenSitePrompt,*/
let event = notification.userInfo?[UserBehaviorEvent.Key.event] as? UserBehaviorEvent,
let url = currentTab?.url, !url.isDuckDuckGo,
notificationView == nil,
!isPad,
DefaultTutorialSettings().hasSeenOnboarding else { return }
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.showBrokenSitePrompt(after: event)
}
let event = notification.userInfo?[UserBehaviorEvent.Key.event] as? UserBehaviorEvent,
let url = currentTab?.url, !url.isDuckDuckGo,
notificationView == nil,
!isPad,
DefaultTutorialSettings().hasSeenOnboarding else { return }
self.showBrokenSitePrompt(after: event)
}

private func showBrokenSitePrompt(after event: UserBehaviorEvent) {
Expand All @@ -1303,7 +1302,7 @@ class MainViewController: UIViewController {
self?.brokenSitePromptViewHostingController = nil
Pixel.fire(pixel: .siteNotWorkingWebsiteIsBroken, withAdditionalParameters: parameters)
})
return UIHostingController(rootView: BrokenSitePromptView(viewModel: viewModel))
return UIHostingController(rootView: BrokenSitePromptView(viewModel: viewModel), ignoreSafeArea: true)
}

func animateBackgroundTab() {
Expand Down Expand Up @@ -1717,7 +1716,7 @@ extension MainViewController: OmniBarDelegate {
Pixel.fire(pixel: .siteNotWorkingDismissByNavigation,
withAdditionalParameters: [UserBehaviorEvent.Parameter.event: event])
}
hideNotification()
// hideNotification()
showHomeRowReminder()
}

Expand Down Expand Up @@ -1876,7 +1875,7 @@ extension MainViewController: OmniBarDelegate {
hideSuggestionTray()
currentTab?.refresh()
if brokenSitePromptViewHostingController != nil, let event = brokenSitePromptEvent?.rawValue {
hideNotification()
// hideNotification()
Pixel.fire(pixel: .siteNotWorkingDismissByRefresh,
withAdditionalParameters: [UserBehaviorEvent.Parameter.event: event])
}
Expand Down

0 comments on commit 230e895

Please sign in to comment.