From 19ec44215052083f546ea1c7cf696995a64241ca Mon Sep 17 00:00:00 2001 From: Simon Mcloughlin Date: Wed, 23 Oct 2024 16:03:32 +0100 Subject: [PATCH] - bump library version to prevent connection subject from cancelling - allow confirmation pages to recheck ledger state after returning from background --- .../xcshareddata/swiftpm/Package.resolved | 2 +- .../ConnectedApps/WalletConnectSignViewController.swift | 8 ++++++++ .../Modules/Send/SendAbstractConfirmViewController.swift | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 9f9a62a9..5dac9c6a 100644 --- a/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -70,7 +70,7 @@ "location" : "https://github.com/kukai-wallet/kukai-core-swift", "state" : { "branch" : "develop", - "revision" : "f770faee2bd4115bb7871bd87641587ac3434f70" + "revision" : "d6cd2708de8520f53a0450ddb5e2b64fae7a3709" } }, { diff --git a/Kukai Mobile/Modules/ConnectedApps/WalletConnectSignViewController.swift b/Kukai Mobile/Modules/ConnectedApps/WalletConnectSignViewController.swift index e4d42fb2..83eab74a 100644 --- a/Kukai Mobile/Modules/ConnectedApps/WalletConnectSignViewController.swift +++ b/Kukai Mobile/Modules/ConnectedApps/WalletConnectSignViewController.swift @@ -66,6 +66,10 @@ class WalletConnectSignViewController: UIViewController, BottomSheetCustomFixedP } .store(in: &bag) */ + + NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification).sink { [weak self] _ in + self?.ledgerCheck() + }.store(in: &bag) } override func viewWillAppear(_ animated: Bool) { @@ -88,6 +92,10 @@ class WalletConnectSignViewController: UIViewController, BottomSheetCustomFixedP override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) + ledgerCheck() + } + + private func ledgerCheck() { if let meta = DependencyManager.shared.walletList.metadata(forAddress: accountToSign), meta.type == .ledger { AccountsViewModel.askToConnectToLedgerIfNeeded(walletMetadata: meta) { success in if !success { diff --git a/Kukai Mobile/Modules/Send/SendAbstractConfirmViewController.swift b/Kukai Mobile/Modules/Send/SendAbstractConfirmViewController.swift index 17afde65..65e1ac0c 100644 --- a/Kukai Mobile/Modules/Send/SendAbstractConfirmViewController.swift +++ b/Kukai Mobile/Modules/Send/SendAbstractConfirmViewController.swift @@ -42,6 +42,10 @@ class SendAbstractConfirmViewController: UIViewController { } .store(in: &bag) */ + + NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification).sink { [weak self] _ in + self?.ledgerCheck() + }.store(in: &bag) } override func viewWillAppear(_ animated: Bool) { @@ -66,6 +70,10 @@ class SendAbstractConfirmViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) + ledgerCheck() + } + + private func ledgerCheck() { if let meta = selectedMetadata, meta.type == .ledger { AccountsViewModel.askToConnectToLedgerIfNeeded(walletMetadata: meta) { success in if !success {