Skip to content

Commit

Permalink
Fix bookmarks toolbar behaviour with Sync Promo on iOS 15 (#3313)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/414709148257752/1208220515829639/f
Tech Design URL:
CC:

Description:
Fixes a SwiftUI issue which caused the toolbar to not appear correctly on the bookmarks screen (iOS 15 only)
  • Loading branch information
amddg44 authored Sep 4, 2024
1 parent f817540 commit a5c4738
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
14 changes: 10 additions & 4 deletions DuckDuckGo/BookmarksViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -897,9 +897,18 @@ class BookmarksViewController: UIViewController, UITableViewDelegate {
}

syncPromoViewHostingController.view.translatesAutoresizingMaskIntoConstraints = false
addChild(syncPromoViewHostingController)

// This is needed to ensure the toolbar displays correctly on iOS 15
if #available(iOS 16.0, *) {
addChild(syncPromoViewHostingController)
}

headerView.addSubview(syncPromoViewHostingController.view)

if #available(iOS 16.0, *) {
syncPromoViewHostingController.didMove(toParent: self)
}

NSLayoutConstraint.deactivate([
searchBarBottomConstraint
])
Expand All @@ -920,9 +929,6 @@ class BookmarksViewController: UIViewController, UITableViewDelegate {
headerView.frame = CGRect(x: 0, y: 0, width: tableView.bounds.width, height: totalHeight)

tableView.tableHeaderView = headerView
syncPromoViewHostingController.didMove(toParent: self)

tableView.layoutIfNeeded()
} else if !headerView.subviews.contains(searchBar) || headerView.subviews.count != 1 {

if syncPromoViewHostingController.view != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}

0 comments on commit a5c4738

Please sign in to comment.