From 750894f2a3d4749b64be466e77c50e86b802249b Mon Sep 17 00:00:00 2001 From: Simon McLoughlin Date: Fri, 5 Jan 2024 14:38:08 +0000 Subject: [PATCH] Bug fix: new loading getting stuck for getAccounts and submit expression --- Kukai Mobile/Modules/Home/HomeTabBarController.swift | 11 ++++++++++- Kukai Mobile/Services/WalletConnectService.swift | 8 +++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Kukai Mobile/Modules/Home/HomeTabBarController.swift b/Kukai Mobile/Modules/Home/HomeTabBarController.swift index 9e4a0ea0..5553b4dd 100644 --- a/Kukai Mobile/Modules/Home/HomeTabBarController.swift +++ b/Kukai Mobile/Modules/Home/HomeTabBarController.swift @@ -464,11 +464,20 @@ extension HomeTabBarController: WalletConnectServiceDelegate { } public func signRequested() { + self.loadingViewHideActivityAndFade(withDuration: 0.5) self.performSegue(withIdentifier: "wallet-connect-sign", sender: nil) } public func processingIncomingOperations() { - self.showLoadingView() + DispatchQueue.main.async { + self.showLoadingView() + } + } + + public func processingIncomingDone() { + DispatchQueue.main.async { + self.hideLoadingView() + } } public func processedOperations(ofType: WalletConnectOperationType) { diff --git a/Kukai Mobile/Services/WalletConnectService.swift b/Kukai Mobile/Services/WalletConnectService.swift index 53446cba..158e1868 100644 --- a/Kukai Mobile/Services/WalletConnectService.swift +++ b/Kukai Mobile/Services/WalletConnectService.swift @@ -24,6 +24,7 @@ public protocol WalletConnectServiceDelegate: AnyObject { func pairRequested() func signRequested() func processingIncomingOperations() + func processingIncomingDone() func processedOperations(ofType: WalletConnectOperationType) func error(message: String?, error: Error?) func connectionStatusChanged(status: SocketConnectionStatus) @@ -241,7 +242,8 @@ public class WalletConnectService { // Setup listener for completion status self.$requestDidComplete .dropFirst() - .sink(receiveValue: { value in + .sink(receiveValue: { [weak self] value in + self?.delegate?.processingIncomingDone() promise(.success(value)) }) .store(in: &self.bag) @@ -741,8 +743,8 @@ public class WalletConnectService { } private func mainThreadProcessedOperations(ofType type: WalletConnectOperationType) { - DispatchQueue.main.async { - self.delegate?.processedOperations(ofType: type) + DispatchQueue.main.async { [weak self] in + self?.delegate?.processedOperations(ofType: type) } } }