diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 6e0218453..13bdbd495 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -46,6 +46,7 @@ 5183CCE9226F68D90010922C /* AccountRefreshTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCE7226F68D90010922C /* AccountRefreshTimer.swift */; }; 5183CCED22711DCE0010922C /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5183CCEC22711DCE0010922C /* Settings.storyboard */; }; 5183CCEF227125970010922C /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5183CCEE227125970010922C /* SettingsViewController.swift */; }; + 51934CCB230F599B006127BE /* ThemedNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51934CC1230F5963006127BE /* ThemedNavigationController.swift */; }; 519B8D332143397200FA689C /* SharingServiceDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519B8D322143397200FA689C /* SharingServiceDelegate.swift */; }; 519E743D22C663F900A78E47 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 519E743422C663F900A78E47 /* SceneDelegate.swift */; }; 51C451A9226377C200C03939 /* ArticlesDatabase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8407167F2262A61100344432 /* ArticlesDatabase.framework */; }; @@ -699,6 +700,7 @@ 5183CCE7226F68D90010922C /* AccountRefreshTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountRefreshTimer.swift; sourceTree = ""; }; 5183CCEC22711DCE0010922C /* Settings.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Settings.storyboard; sourceTree = ""; }; 5183CCEE227125970010922C /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = ""; }; + 51934CC1230F5963006127BE /* ThemedNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemedNavigationController.swift; sourceTree = ""; }; 5194B5ED22B6965300144881 /* SettingsSubscriptionsImportDocumentPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsSubscriptionsImportDocumentPickerView.swift; sourceTree = ""; }; 5194B5F122B69FCC00144881 /* SettingsSubscriptionsExportDocumentPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsSubscriptionsExportDocumentPickerView.swift; sourceTree = ""; }; 519B8D322143397200FA689C /* SharingServiceDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharingServiceDelegate.swift; sourceTree = ""; }; @@ -1098,10 +1100,11 @@ 5183CCD9226E31A50010922C /* NonIntrinsicImageView.swift */, 5183CCCF226E1E880010922C /* NonIntrinsicLabel.swift */, 51C45250226506F400C03939 /* String-Extensions.swift */, + 51934CC1230F5963006127BE /* ThemedNavigationController.swift */, 51F85BF82274AA7B00C787DC /* UIBarButtonItem-Extensions.swift */, 51F85BF622749FA100C787DC /* UIFont-Extensions.swift */, - 51C4524E226506F400C03939 /* UIStoryboard-Extensions.swift */, 512E092B2268B25500BDCFDD /* UISplitViewController-Extensions.swift */, + 51C4524E226506F400C03939 /* UIStoryboard-Extensions.swift */, ); path = Extensions; sourceTree = ""; @@ -1982,7 +1985,7 @@ TargetAttributes = { 6581C73220CED60000F4AD34 = { DevelopmentTeam = SHJK2V3AJG; - ProvisioningStyle = Manual; + ProvisioningStyle = Automatic; }; 840D617B2029031C009BC708 = { CreatedOnToolsVersion = 9.3; @@ -1997,7 +2000,7 @@ 849C645F1ED37A5D003D8FC0 = { CreatedOnToolsVersion = 8.2.1; DevelopmentTeam = SHJK2V3AJG; - ProvisioningStyle = Manual; + ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.HardenedRuntime = { enabled = 1; @@ -2445,6 +2448,7 @@ 51C452782265091600C03939 /* MasterTimelineCellData.swift in Sources */, 51C45259226508D300C03939 /* AppDefaults.swift in Sources */, 51C45293226509C800C03939 /* StarredFeedDelegate.swift in Sources */, + 51934CCB230F599B006127BE /* ThemedNavigationController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/iOS/AppAssets.swift b/iOS/AppAssets.swift index ea549d4e6..6b18f8f42 100644 --- a/iOS/AppAssets.swift +++ b/iOS/AppAssets.swift @@ -14,6 +14,18 @@ struct AppAssets { return UIColor(named: "avatarBackgroundColor")! }() + static var barBackgroundColor: UIColor = { + return UIColor(named: "barBackgroundColor")! + }() + + static var barTintColor: UIColor = { + return UIColor(named: "barTintColor")! + }() + + static var barTitleColor: UIColor = { + return UIColor(named: "barTitleColor")! + }() + static var circleClosedImage: UIImage = { return UIImage(systemName: "circle.fill")! }() diff --git a/iOS/AppCoordinator.swift b/iOS/AppCoordinator.swift index f3f585fc8..a76490f60 100644 --- a/iOS/AppCoordinator.swift +++ b/iOS/AppCoordinator.swift @@ -237,6 +237,7 @@ class AppCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider { rootSplitViewController.delegate = self masterNavigationController = (rootSplitViewController.viewControllers.first as! UINavigationController) + masterFeedViewController = UIStoryboard.main.instantiateController(ofType: MasterFeedViewController.self) masterFeedViewController.coordinator = self masterNavigationController.pushViewController(masterFeedViewController, animated: false) @@ -1063,7 +1064,7 @@ private extension AppCoordinator { if rootSplitViewController.isCollapsed { return controller } else { - let navController = UINavigationController(rootViewController: controller) + let navController = ThemedNavigationController.template(rootViewController: controller) navController.isToolbarHidden = false if showButton { controller.navigationItem.leftBarButtonItem = rootSplitViewController.displayModeButtonItem diff --git a/iOS/Extensions/ThemedNavigationController.swift b/iOS/Extensions/ThemedNavigationController.swift new file mode 100644 index 000000000..1ec5dfbbf --- /dev/null +++ b/iOS/Extensions/ThemedNavigationController.swift @@ -0,0 +1,56 @@ +// +// ThemedNavigationController.swift +// NetNewsWire +// +// Created by Maurice Parker on 8/22/19. +// Copyright © 2019 Ranchero Software. All rights reserved. +// + +import UIKit + +class ThemedNavigationController: UINavigationController { + + static func template() -> UINavigationController { + let navController = ThemedNavigationController() + navController.configure() + return navController + } + + static func template(rootViewController: UIViewController) -> UINavigationController { + let navController = ThemedNavigationController(rootViewController: rootViewController) + navController.configure() + return navController + } + + override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + super.traitCollectionDidChange(previousTraitCollection) + if traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle { + configure() + } + } + + private func configure() { + isToolbarHidden = false + + if traitCollection.userInterfaceStyle == .dark { + navigationBar.standardAppearance = UINavigationBarAppearance() + navigationBar.tintColor = view.tintColor + toolbar.standardAppearance = UIToolbarAppearance() + toolbar.tintColor = view.tintColor + } else { + let navigationAppearance = UINavigationBarAppearance() + navigationAppearance.backgroundColor = AppAssets.barBackgroundColor + navigationAppearance.titleTextAttributes = [.foregroundColor: AppAssets.barTitleColor] + navigationAppearance.largeTitleTextAttributes = [.foregroundColor: AppAssets.barTitleColor] + navigationBar.standardAppearance = navigationAppearance + navigationBar.tintColor = AppAssets.barTintColor + + let toolbarAppearance = UIToolbarAppearance() + toolbarAppearance.backgroundColor = UIColor.white + toolbar.standardAppearance = toolbarAppearance + toolbar.tintColor = AppAssets.barTintColor + } + + } + +} diff --git a/iOS/Extensions/UISplitViewController-Extensions.swift b/iOS/Extensions/UISplitViewController-Extensions.swift index 2f3561ea0..979bdd1e7 100644 --- a/iOS/Extensions/UISplitViewController-Extensions.swift +++ b/iOS/Extensions/UISplitViewController-Extensions.swift @@ -13,11 +13,7 @@ extension UISplitViewController { static func template() -> UISplitViewController { let splitViewController = UISplitViewController() splitViewController.preferredDisplayMode = .automatic - - let navController = UINavigationController() - navController.isToolbarHidden = false - splitViewController.viewControllers = [navController] - + splitViewController.viewControllers = [ThemedNavigationController.template()] return splitViewController } diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 5298d435c..381a28e4e 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -29,7 +29,10 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner { super.viewDidLoad() - navigationController?.navigationBar.prefersLargeTitles = true + if traitCollection.userInterfaceIdiom == .phone { + navigationController?.navigationBar.prefersLargeTitles = true + } + navigationItem.rightBarButtonItem = editButtonItem tableView.register(MasterFeedTableViewSectionHeader.self, forHeaderFooterViewReuseIdentifier: "SectionHeader") diff --git a/iOS/Resources/Assets.xcassets/barBackgroundColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/barBackgroundColor.colorset/Contents.json new file mode 100644 index 000000000..c6e5d3d43 --- /dev/null +++ b/iOS/Resources/Assets.xcassets/barBackgroundColor.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "1.000", + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000" + } + } + } + ] +} \ No newline at end of file diff --git a/iOS/Resources/Assets.xcassets/barTintColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/barTintColor.colorset/Contents.json new file mode 100644 index 000000000..dd516dcd7 --- /dev/null +++ b/iOS/Resources/Assets.xcassets/barTintColor.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x08", + "alpha" : "1.000", + "blue" : "0xEE", + "green" : "0x6A" + } + } + } + ] +} \ No newline at end of file diff --git a/iOS/Resources/Assets.xcassets/barTitleColor.colorset/Contents.json b/iOS/Resources/Assets.xcassets/barTitleColor.colorset/Contents.json new file mode 100644 index 000000000..dd516dcd7 --- /dev/null +++ b/iOS/Resources/Assets.xcassets/barTitleColor.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + }, + "colors" : [ + { + "idiom" : "universal", + "color" : { + "color-space" : "srgb", + "components" : { + "red" : "0x08", + "alpha" : "1.000", + "blue" : "0xEE", + "green" : "0x6A" + } + } + } + ] +} \ No newline at end of file