diff --git a/DashWallet.xcodeproj/project.pbxproj b/DashWallet.xcodeproj/project.pbxproj index e764b1b19..e8e0f1c51 100644 --- a/DashWallet.xcodeproj/project.pbxproj +++ b/DashWallet.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 53; + objectVersion = 48; objects = { /* Begin PBXBuildFile section */ @@ -5899,10 +5899,9 @@ 75D5F3B6191EC270004AB296 /* Project object */ = { isa = PBXProject; attributes = { - BuildIndependentTargetsInParallel = YES; CLASSPREFIX = DW; LastSwiftUpdateCheck = 1020; - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1400; ORGANIZATIONNAME = "Dash Core"; TargetAttributes = { 2A4662FF2279DC2F0027533B = { @@ -7172,11 +7171,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = DashWalletScreenshotsUITests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.DashWalletScreenshotsUITests; @@ -7209,11 +7204,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = DashWalletScreenshotsUITests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.DashWalletScreenshotsUITests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -7245,11 +7236,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = DashWalletScreenshotsUITests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.DashWalletScreenshotsUITests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -7281,11 +7268,7 @@ GCC_WARN_UNUSED_VARIABLE = YES; INFOPLIST_FILE = DashWalletScreenshotsUITests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.DashWalletScreenshotsUITests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -7417,8 +7400,7 @@ "-Wno-gnu", ); SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; WATCHOS_DEPLOYMENT_TARGET = 2.0; @@ -7461,11 +7443,8 @@ INFOPLIST_FILE = DashWallet/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Dash; IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - MARKETING_VERSION = 7.0.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; @@ -7522,11 +7501,8 @@ INFOPLIST_FILE = DashWallet/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Dash; IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - MARKETING_VERSION = 7.0.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "DashWallet/dashwallet-Bridging-Header.h"; @@ -7561,11 +7537,7 @@ ); INFOPLIST_FILE = DashWalletTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.TodayExtension; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "DashWalletTests/DashWalletTests-Bridging-Header.h"; @@ -7596,11 +7568,7 @@ ); INFOPLIST_FILE = DashWalletTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.TodayExtension; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "DashWalletTests/DashWalletTests-Bridging-Header.h"; @@ -7619,7 +7587,7 @@ EXCLUDED_ARCHS = ""; IBSC_MODULE = WatchApp_Extension; INFOPLIST_FILE = WatchApp/Info.plist; - MARKETING_VERSION = 7.0.4; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; @@ -7641,7 +7609,7 @@ EXCLUDED_ARCHS = ""; IBSC_MODULE = WatchApp_Extension; INFOPLIST_FILE = WatchApp/Info.plist; - MARKETING_VERSION = 7.0.4; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; @@ -7661,12 +7629,8 @@ ENABLE_BITCODE = NO; EXCLUDED_ARCHS = ""; INFOPLIST_FILE = "WatchApp Extension/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - MARKETING_VERSION = 7.0.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp.watchkitextension; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; @@ -7688,12 +7652,8 @@ ENABLE_BITCODE = NO; EXCLUDED_ARCHS = ""; INFOPLIST_FILE = "WatchApp Extension/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - MARKETING_VERSION = 7.0.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp.watchkitextension; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; @@ -7720,12 +7680,8 @@ GCC_WARN_UNUSED_FUNCTION = YES; INFOPLIST_FILE = TodayExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - MARKETING_VERSION = 7.0.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.TodayExtension; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -7749,12 +7705,8 @@ GCC_WARN_UNUSED_FUNCTION = YES; INFOPLIST_FILE = TodayExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - MARKETING_VERSION = 7.0.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.TodayExtension; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -7818,8 +7770,7 @@ ); OTHER_SWIFT_FLAGS = "-DTestflight"; SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; WATCHOS_DEPLOYMENT_TARGET = 2.0; @@ -7871,11 +7822,8 @@ INFOPLIST_FILE = DashWallet/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Dash; IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - MARKETING_VERSION = 7.0.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "DashWallet/dashwallet-Bridging-Header.h"; @@ -7902,12 +7850,8 @@ GCC_WARN_UNUSED_FUNCTION = YES; INFOPLIST_FILE = TodayExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - MARKETING_VERSION = 7.0.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.TodayExtension; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -7940,11 +7884,7 @@ ); INFOPLIST_FILE = DashWalletTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.TodayExtension; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "DashWalletTests/DashWalletTests-Bridging-Header.h"; @@ -7963,7 +7903,7 @@ EXCLUDED_ARCHS = ""; IBSC_MODULE = WatchApp_Extension; INFOPLIST_FILE = WatchApp/Info.plist; - MARKETING_VERSION = 7.0.4; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; @@ -7983,12 +7923,8 @@ ENABLE_BITCODE = NO; EXCLUDED_ARCHS = ""; INFOPLIST_FILE = "WatchApp Extension/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - MARKETING_VERSION = 7.0.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp.watchkitextension; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; @@ -8103,11 +8039,8 @@ INFOPLIST_FILE = DashWallet/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = Dash; IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - MARKETING_VERSION = 7.0.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "DashWallet/dashwallet-Bridging-Header.h"; @@ -8133,12 +8066,8 @@ GCC_WARN_UNUSED_FUNCTION = YES; INFOPLIST_FILE = TodayExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - MARKETING_VERSION = 7.0.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.TodayExtension; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -8170,11 +8099,7 @@ ); INFOPLIST_FILE = DashWalletTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.TodayExtension; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "DashWalletTests/DashWalletTests-Bridging-Header.h"; @@ -8193,7 +8118,7 @@ EXCLUDED_ARCHS = ""; IBSC_MODULE = WatchApp_Extension; INFOPLIST_FILE = WatchApp/Info.plist; - MARKETING_VERSION = 7.0.4; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = watchos; @@ -8213,12 +8138,8 @@ ENABLE_BITCODE = NO; EXCLUDED_ARCHS = ""; INFOPLIST_FILE = "WatchApp Extension/Info.plist"; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@executable_path/../../Frameworks", - ); - MARKETING_VERSION = 7.0.4; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; + MARKETING_VERSION = 7.0.5; PRODUCT_BUNDLE_IDENTIFIER = org.dashfoundation.dash.watchkitapp.watchkitextension; PRODUCT_NAME = "${TARGET_NAME}"; SDKROOT = watchos; diff --git a/DashWallet/Sources/UI/Home/DWHomeViewController+DWShortcuts.m b/DashWallet/Sources/UI/Home/DWHomeViewController+DWShortcuts.m index 47d0341bc..7fd26ede1 100644 --- a/DashWallet/Sources/UI/Home/DWHomeViewController+DWShortcuts.m +++ b/DashWallet/Sources/UI/Home/DWHomeViewController+DWShortcuts.m @@ -51,7 +51,7 @@ - (void)performActionForShortcut:(DWShortcutAction *)action sender:(UIView *)sen break; } case DWShortcutActionTypePayToAddress: { - [self payToAddressAction:sender]; + [self.delegate showPaymentsControllerWithActivePage:DWPaymentsViewControllerIndex_EnterAddress]; break; } case DWShortcutActionTypeBuySellDash: { @@ -167,10 +167,6 @@ - (void)showImportPrivateKey { [self presentControllerModallyInNavigationController:controller]; } -- (void)payToAddressAction:(UIView *)sender { - [self payToAddressAction]; -} - - (void)showCreateUsername { DWDashPaySetupFlowController *controller = [[DWDashPaySetupFlowController alloc] initWithDashPayModel:self.model.dashPayModel]; diff --git a/DashWallet/Sources/UI/Main/MainTabbarController.swift b/DashWallet/Sources/UI/Main/MainTabbarController.swift index b81dfb540..f01bd1271 100644 --- a/DashWallet/Sources/UI/Main/MainTabbarController.swift +++ b/DashWallet/Sources/UI/Main/MainTabbarController.swift @@ -176,31 +176,17 @@ extension MainTabbarController { private func closePayments(completion: (() -> Void)? = nil) { paymentButton.isOpened = false - guard let currentController = selectedViewController, - currentController.topController() is PaymentsViewController else { - tabBar.isUserInteractionEnabled = true + guard let top = selectedViewController?.topController(), + top != selectedViewController + else { completion?() return } - tabBar.isUserInteractionEnabled = false - - currentController.topController().dismiss(animated: true) { - self.tabBar.isUserInteractionEnabled = true + top.dismiss(animated: true) { completion?() } } - -// private func contactsNavigationController() -> DWNavigationController { -// if contactsNavigationController == nil { -// let contactsController = DWContactsViewController(payModel: homeModel.payModel, dataProvider: homeModel.getDataProvider) -// -// contactsNavigationController = DWNavigationController(rootViewController: contactsController) -// contactsNavigationController.delegate = self -// } -// -// return contactsNavigationController! -// } } // MARK: - Public @@ -262,9 +248,22 @@ extension MainTabbarController: DWWipeDelegate { // MARK: PaymentsViewControllerDelegate extension MainTabbarController: PaymentsViewControllerDelegate { + func paymentsViewControllerDidFinishPayment(_ controller: PaymentsViewController, tx: DSTransaction, contact: DWDPBasicUserItem?) { + closePayments { [weak self] in + self?.presentTxDetails(for: tx, contact: contact) + } + } + + private func presentTxDetails(for tx: DSTransaction, contact: DWDPBasicUserItem?) { + let model = TxDetailModel(transaction: Transaction(transaction: tx)) + let vc = SuccessTxDetailViewController(model: model) + vc.modalPresentationStyle = .fullScreen + vc.contactItem = contact + vc.delegate = self + selectedViewController?.topController().present(vc, animated: true) + } + func paymentsViewControllerWantsToImportPrivateKey(_ controller: PaymentsViewController) { - // Make sure we enable tabbar before showing the scanner - tabBar.isUserInteractionEnabled = true paymentButton.isOpened = false controller.dismiss(animated: true) { @@ -275,20 +274,6 @@ extension MainTabbarController: PaymentsViewControllerDelegate { func paymentsViewControllerDidCancel(_ controller: PaymentsViewController) { closePayments() } - - func paymentsViewControllerDidFinishPayment(_ controller: PaymentsViewController, contact: DWDPBasicUserItem?) { - closePayments { - // TODO: DashPay -// guard let contact else { -// return -// } -// -// let profile = DWModalUserProfileViewController(item: contact, -// payModel: self.homeModel.payModel, -// dataProvider: self.homeModel.getDataProvider) -// self.present(profile, animated: true, completion: nil) - } - } } // MARK: DWHomeViewControllerDelegate @@ -299,7 +284,6 @@ extension MainTabbarController: DWHomeViewControllerDelegate { } func showPaymentsController(withActivePage pageIndex: PaymentsViewControllerState) { - tabBar.isUserInteractionEnabled = false paymentButton.isOpened = true let receiveModel = DWReceiveModel() @@ -319,9 +303,7 @@ extension MainTabbarController: DWHomeViewControllerDelegate { if isDemoMode { demoDelegate?.presentModalController(navigationController, sender: self) } else { - selectedViewController?.topController().present(navigationController, animated: true) { - self.tabBar.isUserInteractionEnabled = true - } + selectedViewController?.topController().present(navigationController, animated: true) } } } @@ -337,3 +319,9 @@ extension MainTabbarController: UITabBarControllerDelegate { // MARK: - EmptyController private final class EmptyController: UIViewController { } + +// MARK: - MainTabbarController + SuccessTxDetailViewControllerDelegate + +extension MainTabbarController: SuccessTxDetailViewControllerDelegate { + func txDetailViewControllerDidFinish(controller: SuccessTxDetailViewController) { } +} diff --git a/DashWallet/Sources/UI/Menu/Security/Advanced Security/DWAdvancedSecurityViewController.m b/DashWallet/Sources/UI/Menu/Security/Advanced Security/DWAdvancedSecurityViewController.m index 81b482143..854477e96 100644 --- a/DashWallet/Sources/UI/Menu/Security/Advanced Security/DWAdvancedSecurityViewController.m +++ b/DashWallet/Sources/UI/Menu/Security/Advanced Security/DWAdvancedSecurityViewController.m @@ -357,6 +357,10 @@ - (void)updateSecurityLevel { self.securityStatusView.securityLevel = self.model.securityLevel; } +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + @end NS_ASSUME_NONNULL_END diff --git a/DashWallet/Sources/UI/Menu/Tools/Masternode Keys/DerivationPathKeys/DerivationPathKeysViewController.swift b/DashWallet/Sources/UI/Menu/Tools/Masternode Keys/DerivationPathKeys/DerivationPathKeysViewController.swift index 75f28e9ad..2dabcc0b9 100644 --- a/DashWallet/Sources/UI/Menu/Tools/Masternode Keys/DerivationPathKeys/DerivationPathKeysViewController.swift +++ b/DashWallet/Sources/UI/Menu/Tools/Masternode Keys/DerivationPathKeys/DerivationPathKeysViewController.swift @@ -45,10 +45,24 @@ final class DerivationPathKeysViewController: BaseViewController, NavigationStac tableView.insertSections([model.visibleIndexes], with: .automatic) } + @objc + func applicationWillResignActiveNotification() { + navigationController?.popViewController(animated: false) + } + override func viewDidLoad() { super.viewDidLoad() configureHierarchy() + + NotificationCenter.default.addObserver(self, + selector: #selector(applicationWillResignActiveNotification), + name: UIApplication.willResignActiveNotification, + object: nil) + } + + deinit { + NotificationCenter.default.removeObserver(self) } } diff --git a/DashWallet/Sources/UI/Menu/Tools/Masternode Keys/Overview/KeysOverviewViewController.swift b/DashWallet/Sources/UI/Menu/Tools/Masternode Keys/Overview/KeysOverviewViewController.swift index d6291ddcf..b8678f846 100644 --- a/DashWallet/Sources/UI/Menu/Tools/Masternode Keys/Overview/KeysOverviewViewController.swift +++ b/DashWallet/Sources/UI/Menu/Tools/Masternode Keys/Overview/KeysOverviewViewController.swift @@ -97,15 +97,10 @@ extension KeysOverviewViewController: UITableViewDataSource, UITableViewDelegate wSelf.navigationController?.pushViewController(vc, animated: true) } - if DSAuthenticationManager.sharedInstance().didAuthenticate { - showVcBlock() - } - else { - DSAuthenticationManager.sharedInstance().authenticate(withPrompt: nil, usingBiometricAuthentication: false, alertIfLockout: true) { authenticatedOrSuccess, _, _ in + DSAuthenticationManager.sharedInstance().authenticate(withPrompt: nil, usingBiometricAuthentication: false, alertIfLockout: true) { authenticatedOrSuccess, _, _ in - guard authenticatedOrSuccess else { return } - showVcBlock() - } + guard authenticatedOrSuccess else { return } + showVcBlock() } } } diff --git a/DashWallet/Sources/UI/Payment Controller/PaymentController.swift b/DashWallet/Sources/UI/Payment Controller/PaymentController.swift index 441dba899..e747b67b7 100644 --- a/DashWallet/Sources/UI/Payment Controller/PaymentController.swift +++ b/DashWallet/Sources/UI/Payment Controller/PaymentController.swift @@ -208,21 +208,23 @@ extension PaymentController: DWPaymentProcessorDelegate { transaction: DSTransaction, contactItem: DWDPBasicUserItem?) { presentationAnchor?.topController().view.dw_hideProgressHUD() - if let vc = confirmViewController { - vc.dismiss(animated: true) { - if let vc = self.presentationContextProvider as? UIViewController, - vc.navigationController?.topViewController is ProvideAmountViewController { - vc.navigationController?.popToRootViewController(animated: true) + let finishBlock = { + if let vc = self.presentationAnchor?.navigationController?.topViewController as? AmountProviding { + vc.navigationController?.popViewController(animated: true) + + DispatchQueue.main.async { + self.delegate?.paymentControllerDidFinishTransaction(self, transaction: transaction) } - self.delegate?.paymentControllerDidFinishTransaction(self, transaction: transaction) - } - } else { - if let vc = presentationContextProvider as? UIViewController, - vc.navigationController?.topViewController is ProvideAmountViewController { - vc.navigationController?.popToRootViewController(animated: true) } + } + + guard let vc = confirmViewController else { + finishBlock() + return + } - delegate?.paymentControllerDidFinishTransaction(self, transaction: transaction) + vc.dismiss(animated: true) { + finishBlock() } } diff --git a/DashWallet/Sources/UI/Payments/Enter Address/EnterAddressViewController.swift b/DashWallet/Sources/UI/Payments/Enter Address/EnterAddressViewController.swift index ac0baf362..e4ed4b46c 100644 --- a/DashWallet/Sources/UI/Payments/Enter Address/EnterAddressViewController.swift +++ b/DashWallet/Sources/UI/Payments/Enter Address/EnterAddressViewController.swift @@ -17,10 +17,15 @@ import UIKit +// MARK: - EnterAddressViewControllerDelegate + +protocol EnterAddressViewControllerDelegate: AnyObject { + func enterAddressViewControllerDidPreparePaymentInput(_ viewController: EnterAddressViewController, input: DWPaymentInput) +} + // MARK: - EnterAddressViewController -@objc(DWEnterAddressViewController) -final class EnterAddressViewController: BaseViewController, PayableViewController { +final class EnterAddressViewController: BaseViewController { private var addressField: DashInputField! private var showPasteboardContentButton: TintedButton! private var pasteboardContentView: PasteboardContentView! @@ -31,27 +36,31 @@ final class EnterAddressViewController: BaseViewController, PayableViewControlle private var model = EnterAddressModel() var payModel: DWPayModelProtocol! { model } - internal var paymentController: PaymentController! - @objc - weak var paymentControllerDelegate: PaymentControllerDelegate? + weak var delegate: EnterAddressViewControllerDelegate? // MARK: Actions private func continueButtonAction() { payModel.payToAddress(from: addressField.text) { [weak self] success in guard let self else { return } - if success { - self.performPayToPasteboardAction() - } else { + guard success, let paymentInput = payModel?.pasteboardPaymentInput else { self.addressField.errorMessage = NSLocalizedString("Invalid Dash address", comment: "") + return } + + self.delegate?.enterAddressViewControllerDidPreparePaymentInput(self, input: paymentInput) } } + override func viewWillDisappear(_ animated: Bool) { + addressField.resignFirstResponder() + + super.viewWillDisappear(animated) + } + override func viewDidLoad() { super.viewDidLoad() - configurePaymentController() configureHierarchy() updateView() @@ -59,12 +68,6 @@ final class EnterAddressViewController: BaseViewController, PayableViewControlle } extension EnterAddressViewController { - private func configurePaymentController() { - paymentController = PaymentController() - paymentController.delegate = paymentControllerDelegate - paymentController.presentationContextProvider = self - } - private func configureHierarchy() { view.backgroundColor = .dw_secondaryBackground() @@ -168,18 +171,31 @@ extension EnterAddressViewController { private func showPasteboardContentIfNeeded() { guard let string = model.extraxtPasteboardStrings() else { return } - pasteboardContentView.update(with: string) pasteboardContentView.isHidden = false showPasteboardContentButton.isHidden = true + + pasteboardContentView.update(with: string) } } // MARK: DWQRScanModelDelegate extension EnterAddressViewController: DWQRScanModelDelegate { + func performScanQRCodeAction(delegate: DWQRScanModelDelegate) { + if let vc = presentedViewController, vc is DWQRScanViewController { + return; + } + + let controller = DWQRScanViewController() + controller.model.delegate = delegate + present(controller, animated: true, completion: nil) + } + func qrScanModel(_ viewModel: DWQRScanModel, didScanPaymentInput paymentInput: DWPaymentInput) { dismiss(animated: true) { [weak self] in - self?.paymentController.performPayment(with: paymentInput) + guard let self else { return } + + self.delegate?.enterAddressViewControllerDidPreparePaymentInput(self, input: paymentInput) } } @@ -188,11 +204,3 @@ extension EnterAddressViewController: DWQRScanModelDelegate { } } -// MARK: PaymentControllerPresentationContextProviding - -extension EnterAddressViewController: PaymentControllerPresentationContextProviding { - func presentationAnchorForPaymentController(_ controller: PaymentController) -> PaymentControllerPresentationAnchor { - self - } -} - diff --git a/DashWallet/Sources/UI/Payments/Enter Address/Views/PasteboardContentView.swift b/DashWallet/Sources/UI/Payments/Enter Address/Views/PasteboardContentView.swift index deac73ad7..774f2f0b9 100644 --- a/DashWallet/Sources/UI/Payments/Enter Address/Views/PasteboardContentView.swift +++ b/DashWallet/Sources/UI/Payments/Enter Address/Views/PasteboardContentView.swift @@ -37,8 +37,28 @@ final class PasteboardContentView: UIView { fatalError("init(coder:) has not been implemented") } + @discardableResult + override func becomeFirstResponder() -> Bool { + textView.becomeFirstResponder() + } + + @discardableResult + override func resignFirstResponder() -> Bool { + textView.resignFirstResponder() + } + + override var canBecomeFirstResponder: Bool { + textView.canBecomeFirstResponder + } + + override var canResignFirstResponder: Bool { + textView.canResignFirstResponder + } + public func update(with string: String) { textView.text = string + textView.setNeedsLayout() + textView.layoutIfNeeded() let chain = DWEnvironment.sharedInstance().currentChain diff --git a/DashWallet/Sources/UI/Payments/Pay/DWBasePayViewController.h b/DashWallet/Sources/UI/Payments/Pay/DWBasePayViewController.h index 3856790f8..59e3135d4 100644 --- a/DashWallet/Sources/UI/Payments/Pay/DWBasePayViewController.h +++ b/DashWallet/Sources/UI/Payments/Pay/DWBasePayViewController.h @@ -37,8 +37,6 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign) BOOL locksBalance; - (void)performScanQRCodeAction; -/// Check pasteboard and pay -- (void)payToAddressAction; /// Assume pasteboard contains needed data and pay - (void)performPayToPasteboardAction; - (void)performNFCReadingAction; diff --git a/DashWallet/Sources/UI/Payments/Pay/DWBasePayViewController.m b/DashWallet/Sources/UI/Payments/Pay/DWBasePayViewController.m index 85183a34a..7536ada33 100644 --- a/DashWallet/Sources/UI/Payments/Pay/DWBasePayViewController.m +++ b/DashWallet/Sources/UI/Payments/Pay/DWBasePayViewController.m @@ -69,13 +69,6 @@ - (void)performScanQRCodeAction { [self presentViewController:controller animated:YES completion:nil]; } -- (void)payToAddressAction { - DWEnterAddressViewController *vc = [[DWEnterAddressViewController alloc] init]; - vc.paymentControllerDelegate = self; - DWNavigationController *nvc = [[DWNavigationController alloc] initWithRootViewController: vc]; - [self presentViewController:nvc animated:YES completion:nil]; -} - - (void)performPayToPasteboardAction { DWPaymentInput *paymentInput = self.payModel.pasteboardPaymentInput; NSParameterAssert(paymentInput); @@ -160,7 +153,7 @@ - (void)paymentControllerDidFinishTransaction:(PaymentController *_Nonnull)contr [self dismissViewControllerAnimated:true completion:^{ TxDetailModel *model = [[TxDetailModel alloc] initWithTransaction:transaction]; SuccessTxDetailViewController *vc = [[SuccessTxDetailViewController alloc] initWithModel:model]; - vc.contactItem = _paymentController.contactItem; + vc.contactItem = self->_paymentController.contactItem; vc.delegate = self; [self presentViewController:vc animated:YES diff --git a/DashWallet/Sources/UI/Payments/Pay/PayViewController.swift b/DashWallet/Sources/UI/Payments/Pay/PayViewController.swift index e88d69dc7..1d09bcbdb 100644 --- a/DashWallet/Sources/UI/Payments/Pay/PayViewController.swift +++ b/DashWallet/Sources/UI/Payments/Pay/PayViewController.swift @@ -20,7 +20,7 @@ import UIKit // MARK: - PayViewControllerDelegate protocol PayViewControllerDelegate: AnyObject { - func payViewControllerDidFinishPayment(_ controller: PayViewController, contact: DWDPBasicUserItem?) + func payViewControllerDidFinishPayment(_ controller: PayViewController, tx: DSTransaction, contact: DWDPBasicUserItem?) } // MARK: - PayViewController @@ -38,20 +38,13 @@ class PayViewController: BaseViewController, PayableViewController { var delegate: PayViewControllerDelegate? - static func controller(with payModel: DWPayModelProtocol) -> PayViewController { - let storyboard = UIStoryboard(name: "Pay", bundle: nil) - let controller = storyboard.instantiateInitialViewController() as! PayViewController - controller.payModel = payModel - - return controller - } // MARK: Actions - private func showEnterAddressController() { + public func showEnterAddressController(animated: Bool = true) { let vc = EnterAddressViewController() - vc.paymentControllerDelegate = self - navigationController?.pushViewController(vc, animated: true) + vc.delegate = self + navigationController?.pushViewController(vc, animated: animated) } override func viewDidLoad() { @@ -70,6 +63,14 @@ class PayViewController: BaseViewController, PayableViewController { } } } + + static func controller(with payModel: DWPayModelProtocol) -> PayViewController { + let storyboard = UIStoryboard(name: "Pay", bundle: nil) + let controller = storyboard.instantiateInitialViewController() as! PayViewController + controller.payModel = payModel + + return controller + } } extension PayViewController { @@ -146,16 +147,11 @@ extension PayViewController: DWQRScanModelDelegate { extension PayViewController: PaymentControllerDelegate, PaymentControllerPresentationContextProviding { func presentationAnchorForPaymentController(_ controller: PaymentController) -> PaymentControllerPresentationAnchor { - self + navigationController?.visibleViewController ?? self } func paymentControllerDidFinishTransaction(_ controller: PaymentController, transaction: DSTransaction) { - let model = TxDetailModel(transaction: transaction) - let vc = SuccessTxDetailViewController(model: model) - vc.modalPresentationStyle = .fullScreen - vc.contactItem = paymentController.contactItem - vc.delegate = self - present(vc, animated: true) + delegate?.payViewControllerDidFinishPayment(self, tx: transaction, contact: paymentController.contactItem) } func paymentControllerDidCancelTransaction(_ controller: PaymentController) { } @@ -163,10 +159,10 @@ extension PayViewController: PaymentControllerDelegate, PaymentControllerPresent func paymentControllerDidFailTransaction(_ controller: PaymentController) { } } -// MARK: SuccessTxDetailViewControllerDelegate +// MARK: EnterAddressViewControllerDelegate -extension PayViewController: SuccessTxDetailViewControllerDelegate { - func txDetailViewControllerDidFinish(controller: SuccessTxDetailViewController) { - delegate?.payViewControllerDidFinishPayment(self, contact: paymentController.contactItem) +extension PayViewController: EnterAddressViewControllerDelegate { + func enterAddressViewControllerDidPreparePaymentInput(_ viewController: EnterAddressViewController, input: DWPaymentInput) { + processPaymentInput(input) } } diff --git a/DashWallet/Sources/UI/Payments/PaymentsViewController.swift b/DashWallet/Sources/UI/Payments/PaymentsViewController.swift index 5fdacf819..cd3441f50 100644 --- a/DashWallet/Sources/UI/Payments/PaymentsViewController.swift +++ b/DashWallet/Sources/UI/Payments/PaymentsViewController.swift @@ -29,6 +29,9 @@ enum PaymentsViewControllerState: Int { @objc(DWPaymentsViewControllerIndex_Pay) case pay = 1 + + @objc(DWPaymentsViewControllerIndex_EnterAddress) + case enterAddress = 2 } // MARK: - PaymentsViewControllerDelegate @@ -37,7 +40,7 @@ enum PaymentsViewControllerState: Int { protocol PaymentsViewControllerDelegate: AnyObject { func paymentsViewControllerWantsToImportPrivateKey(_ controller: PaymentsViewController) func paymentsViewControllerDidCancel(_ controller: PaymentsViewController) - func paymentsViewControllerDidFinishPayment(_ controller: PaymentsViewController, contact: DWDPBasicUserItem?) + func paymentsViewControllerDidFinishPayment(_ controller: PaymentsViewController, tx: DSTransaction, contact: DWDPBasicUserItem?) } // MARK: - PaymentsViewController @@ -60,6 +63,11 @@ class PaymentsViewController: BaseViewController { @objc var currentState: PaymentsViewControllerState = .pay { didSet { + if currentState == .enterAddress { + forceShowingEnterAddress = true + currentState = .pay + } + if currentState == .none { currentState = PaymentsViewControllerState(rawValue: DWGlobalOptions.sharedInstance().paymentsScreenCurrentTab)! } @@ -79,6 +87,8 @@ class PaymentsViewController: BaseViewController { private var pageController: SendReceivePageController! + private var forceShowingEnterAddress = false + @IBAction func segmentedControlAction() { let idx = segmentedControl.selectedSegmentIndex @@ -98,6 +108,17 @@ class PaymentsViewController: BaseViewController { configureHierarchy() } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + DispatchQueue.main.async { + if self.forceShowingEnterAddress { + self.payViewController.showEnterAddressController(animated: false) + self.forceShowingEnterAddress = false + } + } + } + override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) } @@ -169,8 +190,8 @@ extension PaymentsViewController: SendReceivePageControllerDelegate { // MARK: PayViewControllerDelegate extension PaymentsViewController: PayViewControllerDelegate { - func payViewControllerDidFinishPayment(_ controller: PayViewController, contact: DWDPBasicUserItem?) { - delegate?.paymentsViewControllerDidFinishPayment(self, contact: contact) + func payViewControllerDidFinishPayment(_ controller: PayViewController, tx: DSTransaction, contact: DWDPBasicUserItem?) { + delegate?.paymentsViewControllerDidFinishPayment(self, tx: tx, contact: contact) } } diff --git a/DashWallet/Sources/UI/Setup/SecureWallet/Seed/DWPreviewSeedPhraseViewController.m b/DashWallet/Sources/UI/Setup/SecureWallet/Seed/DWPreviewSeedPhraseViewController.m index 66fd23ce4..154dbbf85 100644 --- a/DashWallet/Sources/UI/Setup/SecureWallet/Seed/DWPreviewSeedPhraseViewController.m +++ b/DashWallet/Sources/UI/Setup/SecureWallet/Seed/DWPreviewSeedPhraseViewController.m @@ -102,6 +102,11 @@ - (void)setupView { selector:@selector(userDidTakeScreenshotNotification:) name:UIApplicationUserDidTakeScreenshotNotification object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationWillResignActiveNotification) + name:UIApplicationWillResignActiveNotification + object:nil]; } - (void)setupContentViewModel { @@ -175,6 +180,14 @@ - (void)userDidTakeScreenshotNotification:(NSNotification *)notification { [self presentViewController:alert animated:YES completion:nil]; } +- (void)applicationWillResignActiveNotification { + [self.navigationController popViewControllerAnimated:NO]; +} + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + @end NS_ASSUME_NONNULL_END diff --git a/DashWallet/explore.db b/DashWallet/explore.db index 7ea9e2eb4..9823fb132 100644 Binary files a/DashWallet/explore.db and b/DashWallet/explore.db differ