Skip to content

Commit 1ad5965

Browse files
author
golson
committed
Background for full image/logo/clean up
1 parent 1c1a919 commit 1ad5965

File tree

4 files changed

+15
-42
lines changed

4 files changed

+15
-42
lines changed

WMFComponents/Sources/WMFComponents/Extensions/Navigation Bar/WMFNavigationBarHiding.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public extension WMFNavigationBarHiding where Self:UIViewController {
4747

4848
/// Call from UIViewController when the status bar height might change (like upon rotation)
4949
func calculateTopSafeAreaOverlayHeight() {
50-
let statusBarHeight = UIApplication.shared.statusBarFrame.height
50+
let statusBarHeight = view.window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0
5151
topSafeAreaOverlayHeightConstraint?.constant = statusBarHeight
5252
}
5353

@@ -74,10 +74,18 @@ public extension WMFNavigationBarHiding where Self:UIViewController {
7474

7575
private func swapLogoToCompact() {
7676
navigationItem.leftBarButtonItem?.image = UIImage(named: "W")
77+
if #available(iOS 26.0, *) {
78+
navigationItem.leftBarButtonItem?.hidesSharedBackground = false
79+
navigationItem.leftBarButtonItem?.sharesBackground = true
80+
}
7781
}
7882

7983
private func swapLogoToFull() {
8084
navigationItem.leftBarButtonItem?.image = UIImage(named: "wikipedia")
85+
if #available(iOS 26.0, *) {
86+
navigationItem.leftBarButtonItem?.hidesSharedBackground = true
87+
navigationItem.leftBarButtonItem?.sharesBackground = false
88+
}
8189
}
8290
}
8391

Wikipedia/Code/ColumnarCollectionViewController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import WMFComponents
33

44
class ColumnarCollectionViewController: ThemeableViewController, ColumnarCollectionViewLayoutDelegate, UICollectionViewDataSourcePrefetching, CollectionViewFooterDelegate, HintPresenting, WMFNavigationBarHiding {
55
var topSafeAreaOverlayView: UIView?
6-
76
var topSafeAreaOverlayHeightConstraint: NSLayoutConstraint?
87

98

Wikipedia/Code/ExploreViewController.swift

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,11 @@ class ExploreViewController: ColumnarCollectionViewController, ExploreCardViewCo
212212
// Set up logo as left bar button item
213213

214214
let logoBarButtonItem = UIBarButtonItem(image: UIImage(named: "wikipedia"), style: .plain, target: self, action: #selector(titleBarButtonPressed(_:)))
215-
logoBarButtonItem.accessibilityLabel = titleButton.accessibilityLabel
216-
logoBarButtonItem.accessibilityHint = titleButton.accessibilityHint
217-
logoBarButtonItem.accessibilityIdentifier = titleButton.accessibilityIdentifier
215+
if #available(iOS 26.0, *) {
216+
logoBarButtonItem.hidesSharedBackground = true
217+
logoBarButtonItem.sharesBackground = false
218+
}
219+
logoBarButtonItem.accessibilityLabel = WMFLocalizedString("home-title-accessibility-label", value: "Wikipedia, scroll to top of Explore", comment: "Accessibility heading for the Explore page, indicating that tapping it will scroll to the top of the explore page. \"Explore\" is the same as {{msg-wikimedia|Wikipedia-ios-welcome-explore-title}}.")
218220
navigationItem.leftBarButtonItem = logoBarButtonItem
219221
}
220222

@@ -236,39 +238,6 @@ class ExploreViewController: ColumnarCollectionViewController, ExploreCardViewCo
236238
@objc func titleBarButtonPressed(_ sender: UIButton?) {
237239
scrollToTop()
238240
}
239-
240-
@objc public var titleButton: UIView {
241-
return titleView
242-
}
243-
244-
lazy var longTitleButton: UIButton = {
245-
let longTitleButton = UIButton(type: .custom)
246-
var deprecatedLongTitleButton = longTitleButton as DeprecatedButton
247-
deprecatedLongTitleButton.deprecatedAdjustsImageWhenHighlighted = true
248-
longTitleButton.setImage(UIImage(named: "wikipedia"), for: .normal)
249-
longTitleButton.sizeToFit()
250-
longTitleButton.addTarget(self, action: #selector(titleBarButtonPressed), for: .touchUpInside)
251-
longTitleButton.isAccessibilityElement = false
252-
longTitleButton.translatesAutoresizingMaskIntoConstraints = false
253-
254-
return longTitleButton
255-
}()
256-
257-
lazy var titleView: UIView = {
258-
let titleView = UIView()
259-
titleView.translatesAutoresizingMaskIntoConstraints = false
260-
titleView.addSubview(longTitleButton)
261-
titleView.isAccessibilityElement = false
262-
263-
NSLayoutConstraint.activate([
264-
longTitleButton.leadingAnchor.constraint(equalTo: titleView.leadingAnchor),
265-
longTitleButton.trailingAnchor.constraint(equalTo: titleView.trailingAnchor),
266-
longTitleButton.topAnchor.constraint(equalTo: titleView.topAnchor),
267-
longTitleButton.bottomAnchor.constraint(equalTo: titleView.bottomAnchor)
268-
])
269-
270-
return titleView
271-
}()
272241

273242
@objc func userDidTapProfile() {
274243

Wikipedia/Code/WMFAppViewController.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,10 +1735,7 @@ - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectView
17351735
}
17361736

17371737
- (void)updateActiveTitleAccessibilityButton:(UIViewController *)viewController {
1738-
if ([viewController isKindOfClass:[ExploreViewController class]]) {
1739-
ExploreViewController *vc = (ExploreViewController *)viewController;
1740-
vc.titleButton.accessibilityLabel = WMFLocalizedStringWithDefaultValue(@"home-title-accessibility-label", nil, nil, @"Wikipedia, scroll to top of Explore", @"Accessibility heading for the Explore page, indicating that tapping it will scroll to the top of the explore page. \"Explore\" is the same as {{msg-wikimedia|Wikipedia-ios-welcome-explore-title}}.");
1741-
} else if ([viewController isKindOfClass:[WMFArticleViewController class]]) {
1738+
if ([viewController isKindOfClass:[WMFArticleViewController class]]) {
17421739
WMFArticleViewController *vc = (WMFArticleViewController *)viewController;
17431740
if (self.selectedIndex == WMFAppTabTypeMain) {
17441741
vc.navigationItem.titleView.accessibilityLabel = WMFLocalizedStringWithDefaultValue(@"home-button-explore-accessibility-label", nil, nil, @"Wikipedia, return to Explore", @"Accessibility heading for articles shown within the explore tab, indicating that tapping it will take you back to explore. \"Explore\" is the same as {{msg-wikimedia|Wikipedia-ios-welcome-explore-title}}.");

0 commit comments

Comments
 (0)