Refactor: Remove NavigationController if it's no longer needed #2245

pull/2247/head
Vladyslav shepitko 4 years ago committed by Hwee-Boon Yar
parent 1da7d68fec
commit 1af2bd3b6d
  1. 12
      AlphaWallet.xcodeproj/project.pbxproj
  2. 2
      AlphaWallet/Activities/Coordinators/ActivitiesCoordinator.swift
  3. 4
      AlphaWallet/Browser/Coordinators/DappBrowserCoordinator.swift
  4. 2
      AlphaWallet/Extensions/UIAlertController.swift
  5. 2
      AlphaWallet/InCoordinator.swift
  6. 4
      AlphaWallet/Settings/Coordinators/HelpUsCoordinator.swift
  7. 2
      AlphaWallet/Settings/Coordinators/SettingsCoordinator.swift
  8. 2
      AlphaWallet/Transactions/Coordinators/TransactionCoordinator.swift
  9. 2
      AlphaWallet/Transfer/Coordinators/ConfirmCoordinator.swift
  10. 2
      AlphaWallet/Transfer/ViewControllers/SendViewController.swift
  11. 2
      AlphaWallet/Transfer/ViewControllers/TransferTokensCardViaWalletAddressViewController.swift
  12. 6
      AlphaWallet/Transfer/ViewControllers/UIViewController+ensureHasDeviceAuthorization.swift
  13. 9
      AlphaWallet/UI/NavigationController.swift
  14. 2
      AlphaWallet/Wallet/ViewControllers/ImportWalletViewController.swift

@ -23,7 +23,6 @@
291A1B671F98092F00ADEC80 /* ConfirmPaymentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 291A1B661F98092F00ADEC80 /* ConfirmPaymentViewController.swift */; };
291D73C61F7F500D00A8AB56 /* TransactionItemState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 291D73C51F7F500D00A8AB56 /* TransactionItemState.swift */; };
291E8FBF1F7DEA85003F0ECF /* EtherKeystoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 291E8FBE1F7DEA85003F0ECF /* EtherKeystoreTests.swift */; };
291EC9DF1F7053C50004EDD0 /* NavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 291EC9DE1F7053C50004EDD0 /* NavigationController.swift */; };
291ED08B1F6F5D2100E7E93A /* Bundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 291ED08A1F6F5D2100E7E93A /* Bundle.swift */; };
291ED08D1F6F5F0A00E7E93A /* KeyStoreError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 291ED08C1F6F5F0A00E7E93A /* KeyStoreError.swift */; };
291ED08F1F6F613200E7E93A /* GetTransactionRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 291ED08E1F6F613200E7E93A /* GetTransactionRequest.swift */; };
@ -218,7 +217,7 @@
442FCE0709E29BF233F32CAB /* GetERC875BalanceCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FC002CDEA792B8ECD3E13 /* GetERC875BalanceCoordinator.swift */; };
442FCE0DAE5527A93F54022C /* RedeemTokenCardQuantitySelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FCC17EAB857C58732831E /* RedeemTokenCardQuantitySelectionViewController.swift */; };
442FCE2BEE8D475C7DEB39C1 /* RedeemTokenCardQuantitySelectionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FC54DA900FA2F9BB73A63 /* RedeemTokenCardQuantitySelectionViewModel.swift */; };
5E7C700A0B11504AC44718DD /* CanScanQRCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C74159ED115D14384A1CB /* CanScanQRCode.swift */; };
5E7C700A0B11504AC44718DD /* UIViewController+ensureHasDeviceAuthorization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C74159ED115D14384A1CB /* UIViewController+ensureHasDeviceAuthorization.swift */; };
5E7C701BFF4469B35A074EB9 /* RequestViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C767497AD8DEE83F384D7 /* RequestViewModel.swift */; };
5E7C70275E403AADE88BD17F /* RPCServerOrAny.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7BE086F00DE44B4EDCED /* RPCServerOrAny.swift */; };
5E7C702C2DAB1DF984193D14 /* EventActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C737CC822F8143DE1FDC0 /* EventActivity.swift */; };
@ -797,7 +796,6 @@
291A1B661F98092F00ADEC80 /* ConfirmPaymentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmPaymentViewController.swift; sourceTree = "<group>"; };
291D73C51F7F500D00A8AB56 /* TransactionItemState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionItemState.swift; sourceTree = "<group>"; };
291E8FBE1F7DEA85003F0ECF /* EtherKeystoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EtherKeystoreTests.swift; sourceTree = "<group>"; };
291EC9DE1F7053C50004EDD0 /* NavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationController.swift; sourceTree = "<group>"; };
291ED08A1F6F5D2100E7E93A /* Bundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bundle.swift; sourceTree = "<group>"; };
291ED08C1F6F5F0A00E7E93A /* KeyStoreError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyStoreError.swift; sourceTree = "<group>"; };
291ED08E1F6F613200E7E93A /* GetTransactionRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetTransactionRequest.swift; sourceTree = "<group>"; };
@ -1081,7 +1079,7 @@
5E7C73EFA9494B31C683A287 /* TimeEntryField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TimeEntryField.swift; path = Views/TimeEntryField.swift; sourceTree = "<group>"; };
5E7C740BBC5AAF5C545CCC6A /* EventOrigin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventOrigin.swift; sourceTree = "<group>"; };
5E7C741196D9D9C9C3EE5E30 /* LockCreatePasscodeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LockCreatePasscodeViewController.swift; sourceTree = "<group>"; };
5E7C74159ED115D14384A1CB /* CanScanQRCode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CanScanQRCode.swift; sourceTree = "<group>"; };
5E7C74159ED115D14384A1CB /* UIViewController+ensureHasDeviceAuthorization.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIViewController+ensureHasDeviceAuthorization.swift"; sourceTree = "<group>"; };
5E7C7419F47CC8B2996AA8F9 /* TransferTokensCardQuantitySelectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferTokensCardQuantitySelectionViewController.swift; sourceTree = "<group>"; };
5E7C741DF75781BBB24CE6D0 /* TokenInstanceActionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenInstanceActionViewController.swift; sourceTree = "<group>"; };
5E7C74259A3F3B0277B0E8C5 /* SingleChainTransactionEtherscanDataCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SingleChainTransactionEtherscanDataCoordinator.swift; sourceTree = "<group>"; };
@ -1753,7 +1751,6 @@
isa = PBXGroup;
children = (
29FF12F91F74CC6C00AFD326 /* Form */,
291EC9DE1F7053C50004EDD0 /* NavigationController.swift */,
296421941F70C1EC00EB363B /* LoadingView.swift */,
296421961F70C1F200EB363B /* ErrorView.swift */,
296421981F70C1F900EB363B /* EmptyView.swift */,
@ -2385,7 +2382,7 @@
5E7C727433F7B8E322B3C68A /* SetTransferTokensCardExpiryDateViewController.swift */,
5E7C7D46C7CABC31A7477F37 /* GenerateTransferMagicLinkViewController.swift */,
5E7C78B63FDE2FAF25389260 /* TransferTokensCardViaWalletAddressViewController.swift */,
5E7C74159ED115D14384A1CB /* CanScanQRCode.swift */,
5E7C74159ED115D14384A1CB /* UIViewController+ensureHasDeviceAuthorization.swift */,
5E7C78421F01D14741DDF5BF /* ConfirmSignMessageViewController.swift */,
87A3020824BEE243000DF32E /* TransactionInProgressViewController.swift */,
);
@ -4226,7 +4223,6 @@
73C41C71201B46AD00243C6C /* LockEnterPasscodeViewModel.swift in Sources */,
291A1B671F98092F00ADEC80 /* ConfirmPaymentViewController.swift in Sources */,
29FA00D0201CA66A002F7DC5 /* DAppError.swift in Sources */,
291EC9DF1F7053C50004EDD0 /* NavigationController.swift in Sources */,
2995739F1FA1F294006F17FD /* QRCodeValueParser.swift in Sources */,
29C9F5F91F720BD30025C494 /* FloatLabelCell.swift in Sources */,
771AA960200D5E8800D25403 /* PassphraseView.swift in Sources */,
@ -4480,7 +4476,7 @@
76F1D7F08263A663C3A67926 /* GetIsERC721ContractCoordinator.swift in Sources */,
5E7C79DE8864702C51C0A7CC /* ResultResult.swift in Sources */,
5E7C7AE2EF04A23EC7C5ADFD /* ImportMagicTokenViewController.swift in Sources */,
5E7C700A0B11504AC44718DD /* CanScanQRCode.swift in Sources */,
5E7C700A0B11504AC44718DD /* UIViewController+ensureHasDeviceAuthorization.swift in Sources */,
5E7C70E4E194FEA5DA2F610C /* OpenSeaNonFungible.swift in Sources */,
5E7C724638271FD2FA0EB93C /* BaseTokenListFormatTableViewCell.swift in Sources */,
5E7C7813019A111443A542CA /* TokenListFormatTableViewCellWithoutCheckbox.swift in Sources */,

@ -47,7 +47,7 @@ class ActivitiesCoordinator: Coordinator {
init(
config: Config,
sessions: ServerDictionary<WalletSession>,
navigationController: UINavigationController = NavigationController(),
navigationController: UINavigationController = UINavigationController(),
keystore: Keystore,
tokensStorages: ServerDictionary<TokensDataStore>,
assetDefinitionStore: AssetDefinitionStore,

@ -102,7 +102,7 @@ final class DappBrowserCoordinator: NSObject, Coordinator {
}
var coordinators: [Coordinator] = []
let navigationController: NavigationController
let navigationController: UINavigationController
lazy var rootViewController: DappsHomeViewController = {
let vc = DappsHomeViewController(bookmarksStore: bookmarksStore)
@ -119,7 +119,7 @@ final class DappBrowserCoordinator: NSObject, Coordinator {
sharedRealm: Realm,
browserOnly: Bool
) {
self.navigationController = NavigationController(navigationBarClass: DappBrowserNavigationBar.self, toolbarClass: nil)
self.navigationController = UINavigationController(navigationBarClass: DappBrowserNavigationBar.self, toolbarClass: nil)
self.sessions = sessions
self.keystore = keystore
self.config = config

@ -91,7 +91,7 @@ extension UIAlertController {
title: String? = .none,
message: String? = .none,
style: UIAlertController.Style,
in navigationController: NavigationController
in navigationController: UINavigationController
) -> UIAlertController {
let alertController = UIAlertController(title: title, message: message, preferredStyle: style)
alertController.popoverPresentationController?.sourceView = navigationController.view

@ -104,7 +104,7 @@ class InCoordinator: NSObject, Coordinator {
}
init(
navigationController: UINavigationController = NavigationController(),
navigationController: UINavigationController = UINavigationController(),
wallet: Wallet,
keystore: Keystore,
assetDefinitionStore: AssetDefinitionStore,

@ -11,7 +11,7 @@ class HelpUsCoordinator: Coordinator {
var coordinators: [Coordinator] = []
init(
navigationController: UINavigationController = NavigationController(),
navigationController: UINavigationController = UINavigationController(),
appTracker: AppTracker = AppTracker()
) {
self.navigationController = navigationController
@ -39,7 +39,7 @@ class HelpUsCoordinator: Coordinator {
controller.navigationItem.title = viewModel.title
controller.navigationItem.leftBarButtonItem = UIBarButtonItem(title: R.string.localizable.done(), style: .done, target: self, action: #selector(dismiss))
controller.delegate = self
let nav = NavigationController(rootViewController: controller)
let nav = UINavigationController(rootViewController: controller)
nav.makePresentationFullScreenForiOS13Migration()
navigationController.present(nav, animated: true, completion: nil)
}

@ -44,7 +44,7 @@ class SettingsCoordinator: Coordinator {
}()
init(
navigationController: UINavigationController = NavigationController(),
navigationController: UINavigationController = UINavigationController(),
keystore: Keystore,
config: Config,
sessions: ServerDictionary<WalletSession>,

@ -35,7 +35,7 @@ class TransactionCoordinator: Coordinator {
init(
sessions: ServerDictionary<WalletSession>,
navigationController: UINavigationController = NavigationController(),
navigationController: UINavigationController = UINavigationController(),
transactionsCollection: TransactionCollection,
keystore: Keystore,
tokensStorages: ServerDictionary<TokensDataStore>,

@ -21,7 +21,7 @@ class ConfirmCoordinator: Coordinator {
weak var delegate: ConfirmCoordinatorDelegate?
init(
navigationController: UINavigationController = NavigationController(),
navigationController: UINavigationController = UINavigationController(),
session: WalletSession,
configurator: TransactionConfigurator,
keystore: Keystore,

@ -16,7 +16,7 @@ protocol SendViewControllerDelegate: class, CanOpenURL {
}
// swiftlint:disable type_body_length
class SendViewController: UIViewController, CanScanQRCode {
class SendViewController: UIViewController {
private let roundedBackground = RoundedBackground()
private let scrollView = UIScrollView()
private let recipientHeader = SendViewSectionHeader()

@ -8,7 +8,7 @@ protocol TransferTokensCardViaWalletAddressViewControllerDelegate: class, CanOpe
func openQRCode(in controller: TransferTokensCardViaWalletAddressViewController)
}
class TransferTokensCardViaWalletAddressViewController: UIViewController, TokenVerifiableStatusViewController, CanScanQRCode {
class TransferTokensCardViaWalletAddressViewController: UIViewController, TokenVerifiableStatusViewController {
private let token: TokenObject
private let roundedBackground = RoundedBackground()
private let header = TokensCardViewControllerTitleHeader()

@ -3,11 +3,7 @@
import UIKit
import AVFoundation
protocol CanScanQRCode: class {
func promptUserOpenSettingsToChangeCameraPermission()
}
extension CanScanQRCode where Self: UIViewController {
extension UIViewController {
func ensureHasDeviceAuthorization() -> Bool {
guard AVCaptureDevice.authorizationStatus(for: .video) != .denied else {
promptUserOpenSettingsToChangeCameraPermission()

@ -1,9 +0,0 @@
// Copyright SIX DAY LLC. All rights reserved.
import Foundation
import UIKit
class NavigationController: UINavigationController { }
extension UINavigationController: CanScanQRCode {
}

@ -9,7 +9,7 @@ protocol ImportWalletViewControllerDelegate: class {
}
// swiftlint:disable type_body_length
class ImportWalletViewController: UIViewController, CanScanQRCode {
class ImportWalletViewController: UIViewController {
struct ValidationError: LocalizedError {
var msg: String
var errorDescription: String? {

Loading…
Cancel
Save