Skip to content

Commit 1659dd4

Browse files
committed
Merge branch 'feature/ui_updates' into develop
2 parents b908d99 + 6bc6111 commit 1659dd4

File tree

6 files changed

+44
-25
lines changed

6 files changed

+44
-25
lines changed

Kukai Mobile/Modules/ConnectedApps/WalletConnectSignViewController.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ class WalletConnectSignViewController: UIViewController, BottomSheetCustomFixedP
7777

7878
self.hideLoadingModal(completion: { [weak self] in
7979
TransactionService.shared.resetWalletConnectState()
80-
HomeTabBarController.recordWalletConnectOperationAsComplete()
81-
self?.presentingViewController?.dismiss(animated: true)
80+
self?.presentingViewController?.dismiss(animated: true, completion: {
81+
HomeTabBarController.recordWalletConnectOperationAsComplete()
82+
})
8283
})
8384

8485
} catch {
@@ -103,11 +104,12 @@ class WalletConnectSignViewController: UIViewController, BottomSheetCustomFixedP
103104
Logger.app.info("WC Reject Request: \(request.id)")
104105
Task {
105106
do {
106-
try WalletConnectService.reject(topic: request.topic, requestId: request.id)
107+
try WalletConnectService.reject(topic: request.topic, requestId: request.id, autoMarkOpComplete: false)
107108
self.hideLoadingModal(completion: { [weak self] in
108109
TransactionService.shared.resetWalletConnectState()
109-
HomeTabBarController.recordWalletConnectOperationAsComplete()
110-
self?.presentingViewController?.dismiss(animated: true)
110+
self?.presentingViewController?.dismiss(animated: true, completion: {
111+
HomeTabBarController.recordWalletConnectOperationAsComplete()
112+
})
111113
})
112114

113115
} catch {

Kukai Mobile/Modules/Home/HomeTabBarController.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,9 @@ extension HomeTabBarController: WalletConnectServiceDelegate {
522522
Logger.app.error("WC2 error message: \(message) - error: \(error)")
523523

524524
self.hideLoadingView {
525-
WalletConnectService.shared.requestDidComplete = true
525+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
526+
WalletConnectService.shared.requestDidComplete = true
527+
}
526528
WalletConnectService.shared.proposalInProgress = false
527529
WalletConnectService.shared.requestInProgress = false
528530
}

Kukai Mobile/Modules/Send/SendCollectibleConfirmViewController.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,17 @@ class SendCollectibleConfirmViewController: UIViewController, SlideButtonDelegat
266266
}
267267

268268
func dismissAndReturn() {
269-
if isWalletConnectOp {
270-
TransactionService.shared.resetWalletConnectState()
271-
HomeTabBarController.recordWalletConnectOperationAsComplete()
272-
} else {
269+
if !isWalletConnectOp {
273270
TransactionService.shared.resetAllState()
274271
}
275272

276-
self.dismiss(animated: true, completion: nil)
273+
self.dismiss(animated: true) { [weak self] in
274+
if self?.isWalletConnectOp == true {
275+
TransactionService.shared.resetWalletConnectState()
276+
HomeTabBarController.recordWalletConnectOperationAsComplete()
277+
}
278+
}
279+
277280
(self.presentingViewController as? UINavigationController)?.popToHome()
278281
}
279282

Kukai Mobile/Modules/Send/SendContractConfirmViewController.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,17 @@ class SendContractConfirmViewController: UIViewController, SlideButtonDelegate,
274274
}
275275

276276
func dismissAndReturn() {
277-
if isWalletConnectOp {
278-
TransactionService.shared.resetWalletConnectState()
279-
HomeTabBarController.recordWalletConnectOperationAsComplete()
280-
} else {
277+
if !isWalletConnectOp {
281278
TransactionService.shared.resetAllState()
282279
}
283280

284-
self.dismiss(animated: true, completion: nil)
281+
self.dismiss(animated: true) { [weak self] in
282+
if self?.isWalletConnectOp == true {
283+
TransactionService.shared.resetWalletConnectState()
284+
HomeTabBarController.recordWalletConnectOperationAsComplete()
285+
}
286+
}
287+
285288
(self.presentingViewController as? UINavigationController)?.popToHome()
286289
}
287290

Kukai Mobile/Modules/Send/SendTokenConfirmViewController.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,17 @@ class SendTokenConfirmViewController: UIViewController, SlideButtonDelegate, Edi
300300
}
301301

302302
func dismissAndReturn() {
303-
if isWalletConnectOp {
304-
TransactionService.shared.resetWalletConnectState()
305-
HomeTabBarController.recordWalletConnectOperationAsComplete()
306-
} else {
303+
if !isWalletConnectOp {
307304
TransactionService.shared.resetAllState()
308305
}
309306

310-
self.dismiss(animated: true, completion: nil)
307+
self.dismiss(animated: true) { [weak self] in
308+
if self?.isWalletConnectOp == true {
309+
TransactionService.shared.resetWalletConnectState()
310+
HomeTabBarController.recordWalletConnectOperationAsComplete()
311+
}
312+
}
313+
311314
(self.presentingViewController as? UINavigationController)?.popToHome()
312315
}
313316

Kukai Mobile/Services/WalletConnectService.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,14 @@ public class WalletConnectService {
364364
TransactionService.shared.resetWalletConnectState()
365365
}
366366

367-
WalletConnectService.shared.proposalInProgress = false
367+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
368+
WalletConnectService.shared.proposalInProgress = false
369+
}
368370
}
369371
}
370372

371373
@MainActor
372-
public static func reject(topic: String, requestId: RPCID, clearState: Bool = true) throws {
374+
public static func reject(topic: String, requestId: RPCID, clearState: Bool = true, autoMarkOpComplete: Bool = true) throws {
373375
Logger.app.info("WC Reject Request topic: \(topic), id: \(requestId.description)")
374376
Task {
375377
try await Sign.instance.respond(topic: topic, requestId: requestId, response: .error(.init(code: 0, message: "")))
@@ -378,8 +380,12 @@ public class WalletConnectService {
378380
TransactionService.shared.resetWalletConnectState()
379381
}
380382

381-
WalletConnectService.shared.requestDidComplete = true
382-
WalletConnectService.shared.requestInProgress = false
383+
if autoMarkOpComplete {
384+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
385+
WalletConnectService.shared.requestDidComplete = true
386+
WalletConnectService.shared.requestInProgress = false
387+
}
388+
}
383389
}
384390
}
385391

0 commit comments

Comments
 (0)