Skip to content

Commit

Permalink
Fix barTintColor when sharing via UIActivityController (trustwallet#597)
Browse files Browse the repository at this point in the history
* Fix bar title for mail/messages

* Fix UIActivity tint issues

Use a UINavigationController, then set the appearance proxy for that class.

* Remove unneeded Extension

* Went back to Cocoapods version 1.5.0

* requested changes
  • Loading branch information
MillerApps authored and vikmeup committed Apr 13, 2018
1 parent 5fcf775 commit bdc2fb2
Show file tree
Hide file tree
Showing 31 changed files with 87 additions and 90 deletions.
8 changes: 4 additions & 4 deletions Trust.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@
732E0F522022754600B39C1F /* FakeLockProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 732E0F512022754600B39C1F /* FakeLockProtocol.swift */; };
732E0F542022786400B39C1F /* LockCreatePasscodeCoordinatorTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 732E0F532022786400B39C1F /* LockCreatePasscodeCoordinatorTest.swift */; };
7374ED2E2059A6A3004A8BC2 /* SectionHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7374ED2D2059A6A3004A8BC2 /* SectionHeader.swift */; };
737D1675202BDCB400B42DDE /* UINavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 737D1674202BDCB400B42DDE /* UINavigationController.swift */; };
737EEDDA201BE3A8009D9D5D /* Lock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 737EEDD9201BE3A8009D9D5D /* Lock.swift */; };
7391DC8C203715DF002C5ADE /* Pair.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7391DC8B203715DF002C5ADE /* Pair.swift */; };
7391DC922038C0AC002C5ADE /* BrowserURLParserTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7391DC912038C0AC002C5ADE /* BrowserURLParserTests.swift */; };
Expand Down Expand Up @@ -399,6 +398,7 @@
A2B7ECAA2038122200828E7D /* ExportPrivateKeyCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2B7ECA92038122200828E7D /* ExportPrivateKeyCoordinator.swift */; };
A2B7ECAC2038FFBC00828E7D /* ExportPrivateKeyViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2B7ECAB2038FFBC00828E7D /* ExportPrivateKeyViewModel.swift */; };
A2B7ECAE2039001300828E7D /* ExportPrivateKeyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2B7ECAD2039001300828E7D /* ExportPrivateKeyViewController.swift */; };
A2E43B4E20802879001FAD3D /* UINavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2E43B4D20802879001FAD3D /* UINavigationController.swift */; };
BB03A86D20416AF600649DA0 /* BalanceStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB03A86C20416AF600649DA0 /* BalanceStatus.swift */; };
BB03A8712042B01300649DA0 /* BalanceStatusTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB03A8702042B01300649DA0 /* BalanceStatusTests.swift */; };
BB1CC266203BA4440042E56C /* SendMaxAmountTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1CC265203BA4440042E56C /* SendMaxAmountTest.swift */; };
Expand Down Expand Up @@ -755,7 +755,6 @@
732E0F512022754600B39C1F /* FakeLockProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakeLockProtocol.swift; sourceTree = "<group>"; };
732E0F532022786400B39C1F /* LockCreatePasscodeCoordinatorTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockCreatePasscodeCoordinatorTest.swift; sourceTree = "<group>"; };
7374ED2D2059A6A3004A8BC2 /* SectionHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SectionHeader.swift; sourceTree = "<group>"; };
737D1674202BDCB400B42DDE /* UINavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UINavigationController.swift; sourceTree = "<group>"; };
737EEDD9201BE3A8009D9D5D /* Lock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Lock.swift; sourceTree = "<group>"; };
7391DC8B203715DF002C5ADE /* Pair.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pair.swift; sourceTree = "<group>"; };
7391DC912038C0AC002C5ADE /* BrowserURLParserTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BrowserURLParserTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -873,6 +872,7 @@
A2B7ECA92038122200828E7D /* ExportPrivateKeyCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExportPrivateKeyCoordinator.swift; sourceTree = "<group>"; };
A2B7ECAB2038FFBC00828E7D /* ExportPrivateKeyViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExportPrivateKeyViewModel.swift; sourceTree = "<group>"; };
A2B7ECAD2039001300828E7D /* ExportPrivateKeyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExportPrivateKeyViewController.swift; sourceTree = "<group>"; };
A2E43B4D20802879001FAD3D /* UINavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UINavigationController.swift; sourceTree = "<group>"; };
A3B747245A27436E621E7E41 /* Pods-TrustUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TrustUITests.release.xcconfig"; path = "Pods/Target Support Files/Pods-TrustUITests/Pods-TrustUITests.release.xcconfig"; sourceTree = "<group>"; };
A48A17FC2CC895AF2BB871D0 /* Pods_TrustTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_TrustTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B13A87D3BA5167741E5D0801 /* Pods-Trust.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Trust.release.xcconfig"; path = "Pods/Target Support Files/Pods-Trust/Pods-Trust.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1622,8 +1622,8 @@
29F1C85020032688003780D8 /* Address.swift */,
29FA00D3201EC662002F7DC5 /* NSObject.swift */,
7721A6BD202A5677004DB16C /* DecryptError.swift */,
737D1674202BDCB400B42DDE /* UINavigationController.swift */,
73ED85A62034BFEF00593BF3 /* UITextFieldAdditions.swift */,
A2E43B4D20802879001FAD3D /* UINavigationController.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -2912,6 +2912,7 @@
29AD8A041F93D6CD008E10E7 /* Constants.swift in Sources */,
29FF12FE1F75EA3F00AFD326 /* Keystore.swift in Sources */,
73B1A6B8204B4893001F546C /* WalletViewController.swift in Sources */,
A2E43B4E20802879001FAD3D /* UINavigationController.swift in Sources */,
2963B6B11F9891F5003063C1 /* UIButton.swift in Sources */,
29F114F21FA7966300114A29 /* PrivateKeyRule.swift in Sources */,
77E81D962036883B00534C99 /* NotificationsViewModel.swift in Sources */,
Expand Down Expand Up @@ -2988,7 +2989,6 @@
29F114F01FA6D53700114A29 /* ImportSelectionType.swift in Sources */,
77B806AB20776781005FDCBE /* HistoryViewController.swift in Sources */,
29850D251F6B27A800791A49 /* R.generated.swift in Sources */,
737D1675202BDCB400B42DDE /* UINavigationController.swift in Sources */,
296105931FA2AA2100292494 /* SignTransaction.swift in Sources */,
296105951FA2DEF000292494 /* TransactionDirection.swift in Sources */,
291ED08B1F6F5D2100E7E93A /* Bundle.swift in Sources */,
Expand Down
4 changes: 2 additions & 2 deletions Trust/Accounts/Coordinators/AccountsCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protocol AccountsCoordinatorDelegate: class {

class AccountsCoordinator: Coordinator {

let navigationController: UINavigationController
let navigationController: NavigationController
let keystore: Keystore
let session: WalletSession
let balanceCoordinator: TokensBalanceService
Expand All @@ -30,7 +30,7 @@ class AccountsCoordinator: Coordinator {
weak var delegate: AccountsCoordinatorDelegate?

init(
navigationController: UINavigationController,
navigationController: NavigationController,
keystore: Keystore,
session: WalletSession,
balanceCoordinator: TokensBalanceService
Expand Down
4 changes: 2 additions & 2 deletions Trust/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import UIKit
import URLNavigator

class AppCoordinator: NSObject, Coordinator {
let navigationController: UINavigationController
let navigationController: NavigationController
lazy var welcomeViewController: WelcomeViewController = {
let controller = WelcomeViewController()
controller.delegate = self
Expand All @@ -23,7 +23,7 @@ class AppCoordinator: NSObject, Coordinator {
window: UIWindow,
keystore: Keystore,
navigator: Navigator = Navigator(),
navigationController: UINavigationController = NavigationController()
navigationController: NavigationController = NavigationController()
) {
self.navigationController = navigationController
self.keystore = keystore
Expand Down
6 changes: 3 additions & 3 deletions Trust/Browser/Coordinators/BrowserCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BrowserCoordinator: Coordinator {
var coordinators: [Coordinator] = []
let session: WalletSession
let keystore: Keystore
let navigationController: UINavigationController
let navigationController: NavigationController

lazy var bookmarksViewController: BookmarkViewController = {
let controller = BookmarkViewController(bookmarksStore: bookmarksStore)
Expand Down Expand Up @@ -68,7 +68,7 @@ class BrowserCoordinator: Coordinator {
navigator: Navigator,
sharedRealm: Realm
) {
self.navigationController = UINavigationController(navigationBarClass: BrowserNavigationBar.self, toolbarClass: nil)
self.navigationController = NavigationController(navigationBarClass: BrowserNavigationBar.self, toolbarClass: nil)
self.session = session
self.keystore = keystore
self.sharedRealm = sharedRealm
Expand All @@ -90,7 +90,7 @@ class BrowserCoordinator: Coordinator {
transaction: transaction
)
let coordinator = ConfirmCoordinator(
navigationController: UINavigationController(),
navigationController: NavigationController(),
session: session,
configurator: configurator,
keystore: keystore,
Expand Down
4 changes: 2 additions & 2 deletions Trust/Browser/Coordinators/ScanQRCodeCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ScanQRCodeCoordinator: NSObject, Coordinator {
var coordinators: [Coordinator] = []
weak var delegate: ScanQRCodeCoordinatorDelegate?

let navigationController: UINavigationController
let navigationController: NavigationController
lazy var qrcodeController: QRCodeReaderViewController = {
let controller = QRCodeReaderViewController(cancelButtonTitle: "Cancel")
controller.delegate = self
Expand All @@ -22,7 +22,7 @@ class ScanQRCodeCoordinator: NSObject, Coordinator {
}()

init(
navigationController: UINavigationController = NavigationController()
navigationController: NavigationController = NavigationController()
) {
self.navigationController = navigationController
}
Expand Down
6 changes: 3 additions & 3 deletions Trust/Browser/ViewControllers/BrowserViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ extension BrowserViewController: WKUIDelegate {
title: .none,
message: message,
style: .alert,
in: navigationController!
in: navigationController! as! NavigationController
)
alertController.addAction(UIAlertAction(title: NSLocalizedString("OK", value: "OK", comment: ""), style: .default, handler: { _ in
completionHandler()
Expand All @@ -296,7 +296,7 @@ extension BrowserViewController: WKUIDelegate {
title: .none,
message: message,
style: .alert,
in: navigationController!
in: navigationController! as! NavigationController
)
alertController.addAction(UIAlertAction(title: NSLocalizedString("OK", value: "OK", comment: ""), style: .default, handler: { _ in
completionHandler(true)
Expand All @@ -312,7 +312,7 @@ extension BrowserViewController: WKUIDelegate {
title: .none,
message: prompt,
style: .alert,
in: navigationController!
in: navigationController! as! NavigationController
)
alertController.addTextField { (textField) in
textField.text = defaultText
Expand Down
4 changes: 2 additions & 2 deletions Trust/Core/Coordinators/CheckDeviceCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import UIKit
class CheckDeviceCoordinator: Coordinator {
var coordinators: [Coordinator] = []

let navigationController: UINavigationController
let navigationController: NavigationController

let jailbreakChecker: JailbreakChecker

Expand All @@ -27,7 +27,7 @@ class CheckDeviceCoordinator: Coordinator {
}()

init(
navigationController: UINavigationController,
navigationController: NavigationController,
jailbreakChecker: JailbreakChecker
) {
self.navigationController = navigationController
Expand Down
4 changes: 2 additions & 2 deletions Trust/Deposit/Coordinators/DepositCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import UIKit

class DepositCoordinator: Coordinator {

let navigationController: UINavigationController
let navigationController: NavigationController
let account: Wallet
var coordinators: [Coordinator] = []

init(
navigationController: UINavigationController,
navigationController: NavigationController,
account: Wallet
) {
self.navigationController = navigationController
Expand Down
4 changes: 2 additions & 2 deletions Trust/Export/Coordinators/BackupCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ protocol BackupCoordinatorDelegate: class {

class BackupCoordinator: Coordinator {

let navigationController: UINavigationController
let navigationController: NavigationController
weak var delegate: BackupCoordinatorDelegate?
let keystore: Keystore
let account: Account
var coordinators: [Coordinator] = []

init(
navigationController: UINavigationController,
navigationController: NavigationController,
keystore: Keystore,
account: Account
) {
Expand Down
4 changes: 2 additions & 2 deletions Trust/Export/Coordinators/ExportPrivateKeyCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ protocol ExportPrivateKeyCoordinatorDelegate: class {

class ExportPrivateKeyCoordinator: Coordinator {

let navigationController: UINavigationController
let navigationController: NavigationController
weak var delegate: ExportPrivateKeyCoordinatorDelegate?
let keystore: Keystore
let account: Account
Expand All @@ -24,7 +24,7 @@ class ExportPrivateKeyCoordinator: Coordinator {
}()

init(
navigationController: UINavigationController = NavigationController(),
navigationController: NavigationController = NavigationController(),
keystore: Keystore,
account: Account
) {
Expand Down
2 changes: 1 addition & 1 deletion Trust/Extensions/UIAlertController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extension UIAlertController {
title: String? = .none,
message: String? = .none,
style: UIAlertControllerStyle,
in navigationController: UINavigationController
in navigationController: NavigationController
) -> UIAlertController {
let alertController = UIAlertController(title: title, message: message, preferredStyle: style)
alertController.popoverPresentationController?.sourceView = navigationController.view
Expand Down
27 changes: 0 additions & 27 deletions Trust/Extensions/UINavigationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,4 @@ extension UINavigationController {
navigationBar.tintAdjustmentMode = .normal
navigationBar.tintAdjustmentMode = .automatic
}

@discardableResult
static func openFormSheet(
for controller: UIViewController,
in navigationController: UINavigationController,
barItem: UIBarButtonItem
) -> UIViewController {
if UIDevice.current.userInterfaceIdiom == .pad {
controller.navigationItem.leftBarButtonItem = barItem
let nav = UINavigationController(rootViewController: controller)
nav.modalPresentationStyle = .formSheet
navigationController.present(nav, animated: true, completion: nil)
} else {
navigationController.pushViewController(controller, animated: true)
}
return controller
}

open override var preferredStatusBarStyle: UIStatusBarStyle {
var preferredStyle: UIStatusBarStyle
if topViewController is MasterBrowserViewController {
preferredStyle = .default
} else {
preferredStyle = .lightContent
}
return preferredStyle
}
}
4 changes: 2 additions & 2 deletions Trust/InCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ protocol InCoordinatorDelegate: class {

class InCoordinator: Coordinator {

let navigationController: UINavigationController
let navigationController: NavigationController
var coordinators: [Coordinator] = []
let initialWallet: Wallet
var keystore: Keystore
Expand Down Expand Up @@ -45,7 +45,7 @@ class InCoordinator: Coordinator {
}()

init(
navigationController: UINavigationController = NavigationController(),
navigationController: NavigationController = NavigationController(),
wallet: Wallet,
keystore: Keystore,
config: Config = Config(),
Expand Down
4 changes: 2 additions & 2 deletions Trust/Lock/Coordinators/LockCreatePasscodeCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ protocol LockCreatePasscodeCoordinatorDelegate: class {
class LockCreatePasscodeCoordinator: Coordinator {
var coordinators: [Coordinator] = []
private let model: LockCreatePasscodeViewModel
let navigationController: UINavigationController
let navigationController: NavigationController
weak var delegate: LockCreatePasscodeCoordinatorDelegate?

lazy var lockViewController: LockCreatePasscodeViewController = {
Expand All @@ -19,7 +19,7 @@ class LockCreatePasscodeCoordinator: Coordinator {
}()

init(
navigationController: UINavigationController = NavigationController(),
navigationController: NavigationController = NavigationController(),
model: LockCreatePasscodeViewModel
) {
self.navigationController = navigationController
Expand Down
4 changes: 2 additions & 2 deletions Trust/Settings/Coordinators/AddCustomNetworkCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ protocol AddCustomNetworkCoordinatorDelegate: class {
}

class AddCustomNetworkCoordinator: Coordinator {
let navigationController: UINavigationController
let navigationController: NavigationController
var coordinators: [Coordinator] = []
weak var delegate: AddCustomNetworkCoordinatorDelegate?

Expand All @@ -28,7 +28,7 @@ class AddCustomNetworkCoordinator: Coordinator {
}()

init(
navigationController: UINavigationController = NavigationController()
navigationController: NavigationController = NavigationController()
) {
self.navigationController = navigationController
self.navigationController.modalPresentationStyle = .formSheet
Expand Down
4 changes: 2 additions & 2 deletions Trust/Settings/Coordinators/HelpUsCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import StoreKit

class HelpUsCoordinator: Coordinator {

let navigationController: UINavigationController
let navigationController: NavigationController
let appTracker: AppTracker
var coordinators: [Coordinator] = []

private let viewModel = HelpUsViewModel()
init(
navigationController: UINavigationController = NavigationController(),
navigationController: NavigationController = NavigationController(),
appTracker: AppTracker = AppTracker()
) {
self.navigationController = navigationController
Expand Down
4 changes: 2 additions & 2 deletions Trust/Settings/Coordinators/SettingsCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ protocol SettingsCoordinatorDelegate: class {

class SettingsCoordinator: Coordinator {

let navigationController: UINavigationController
let navigationController: NavigationController
let keystore: Keystore
let session: WalletSession
let storage: TransactionsStorage
Expand Down Expand Up @@ -45,7 +45,7 @@ class SettingsCoordinator: Coordinator {
}()

init(
navigationController: UINavigationController = NavigationController(),
navigationController: NavigationController = NavigationController(),
keystore: Keystore,
session: WalletSession,
storage: TransactionsStorage,
Expand Down
8 changes: 4 additions & 4 deletions Trust/Style/AppStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ func applyStyle() {

if #available(iOS 11, *) {
} else {
UINavigationBar.appearance().isTranslucent = false
UINavigationBar.appearance(whenContainedInInstancesOf: [NavigationController.self]).isTranslucent = false
}
UINavigationBar.appearance().tintColor = AppStyle.navigationBarTintColor
UINavigationBar.appearance().barTintColor = Colors.darkBlue
UINavigationBar.appearance(whenContainedInInstancesOf: [NavigationController.self]).tintColor = AppStyle.navigationBarTintColor
UINavigationBar.appearance(whenContainedInInstancesOf: [NavigationController.self]).barTintColor = Colors.darkBlue

UINavigationBar.appearance().titleTextAttributes = [
UINavigationBar.appearance(whenContainedInInstancesOf: [NavigationController.self]).titleTextAttributes = [
.foregroundColor: UIColor.white,
]

Expand Down
Loading

0 comments on commit bdc2fb2

Please sign in to comment.