From b99a388ca415e01a4ae88c16a0780e568c91db0d Mon Sep 17 00:00:00 2001 From: StephenHeaps <5314553+StephenHeaps@users.noreply.github.com> Date: Thu, 1 Feb 2024 14:43:45 -0500 Subject: [PATCH] Fix brave/brave-ios#8721: Approve transaction does not show confirmation after editing allowance (brave/brave-ios#8725) * Fix case where `TransactionConfirmationStore` is torn down from observation when opening a detail view to edit approve tx permissions, which can cause spinner to show until transaction confirmation modal is dismissed because we miss the transaction updated observation method callback. * Close stores on dismiss of modal to cover case where user manually dismisses modal RequestContainerView --- .../BraveWallet/Panels/RequestContainerView.swift | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Sources/BraveWallet/Panels/RequestContainerView.swift b/Sources/BraveWallet/Panels/RequestContainerView.swift index 9f5d83707d69..5f3c0d2cea77 100644 --- a/Sources/BraveWallet/Panels/RequestContainerView.swift +++ b/Sources/BraveWallet/Panels/RequestContainerView.swift @@ -28,9 +28,6 @@ struct RequestContainerView: View { keyringStore: keyringStore, onDismiss: onDismiss ) - .onDisappear { - cryptoStore.closeConfirmationStore() - } case .addSuggestedToken(let request): AddSuggestedTokenView( token: request.token, @@ -62,9 +59,6 @@ struct RequestContainerView: View { networkStore: cryptoStore.networkStore, onDismiss: onDismiss ) - .onDisappear { - cryptoStore.closeSignMessageRequestStore() - } case let .signMessageError(signMessageErrors): SignMessageErrorView( signMessageErrors: signMessageErrors, @@ -108,8 +102,11 @@ struct RequestContainerView: View { } } .navigationViewStyle(.stack) - .onAppear { - // TODO: Fetch pending requests + .onDisappear { + // `onDisappear` on individual views will trigger for navigation pushes. + // Close stores when navigation covers manual dismiss & onDismiss() cases. + cryptoStore.closeConfirmationStore() + cryptoStore.closeSignMessageRequestStore() } } }