Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Fix #8459: Accounts tab modals reset when returning from background #8460

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 5 additions & 29 deletions Sources/BraveWallet/Crypto/Accounts/AccountsHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ struct AccountsHeaderView: View {
var settingsStore: SettingsStore
var networkStore: NetworkStore

@State private var isPresentingBackup: Bool = false
@State private var isPresentingAddAccount: Bool = false
@Binding var isPresentingBackup: Bool
@Binding var isPresentingAddAccount: Bool

var body: some View {
HStack {
Expand All @@ -27,20 +27,6 @@ struct AccountsHeaderView: View {
.foregroundColor(Color(.braveBlurpleTint))
}
}
.background(
Color.clear
.sheet(isPresented: $isPresentingBackup) {
NavigationView {
BackupWalletView(
password: nil,
keyringStore: keyringStore
)
}
.navigationViewStyle(StackNavigationViewStyle())
.environment(\.modalPresentationMode, $isPresentingBackup)
.accentColor(Color(.braveBlurpleTint))
}
)
Spacer()
HStack(spacing: 16) {
Button(action: {
Expand All @@ -49,18 +35,6 @@ struct AccountsHeaderView: View {
Label(Strings.Wallet.addAccountTitle, systemImage: "plus")
.labelStyle(.iconOnly)
}
.background(
Color.clear
.sheet(isPresented: $isPresentingAddAccount) {
NavigationView {
AddAccountView(
keyringStore: keyringStore,
networkStore: networkStore
)
}
.navigationViewStyle(StackNavigationViewStyle())
}
)
NavigationLink(
destination: Web3SettingsView(
settingsStore: settingsStore,
Expand All @@ -83,7 +57,9 @@ struct AccountsHeaderView_Previews: PreviewProvider {
AccountsHeaderView(
keyringStore: .previewStore,
settingsStore: .previewStore,
networkStore: .previewStore
networkStore: .previewStore,
isPresentingBackup: .constant(false),
isPresentingAddAccount: .constant(false)
)
.previewLayout(.sizeThatFits)
.previewColorSchemes()
Expand Down
32 changes: 31 additions & 1 deletion Sources/BraveWallet/Crypto/Accounts/AccountsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ struct AccountsView: View {
var cryptoStore: CryptoStore
@ObservedObject var keyringStore: KeyringStore
@State private var selectedAccount: BraveWallet.AccountInfo?
@State private var isPresentingBackup: Bool = false
@State private var isPresentingAddAccount: Bool = false

private var primaryAccounts: [BraveWallet.AccountInfo] {
keyringStore.allAccounts.filter(\.isPrimary)
Expand All @@ -29,7 +31,9 @@ struct AccountsView: View {
header: AccountsHeaderView(
keyringStore: keyringStore,
settingsStore: cryptoStore.settingsStore,
networkStore: cryptoStore.networkStore
networkStore: cryptoStore.networkStore,
isPresentingBackup: $isPresentingBackup,
isPresentingAddAccount: $isPresentingAddAccount
)
.resetListHeaderStyle()
) {
Expand Down Expand Up @@ -106,6 +110,32 @@ struct AccountsView: View {
)
.listStyle(InsetGroupedListStyle())
.listBackgroundColor(Color(UIColor.braveGroupedBackground))
.background(
Color.clear
.sheet(isPresented: $isPresentingBackup) {
NavigationView {
BackupWalletView(
password: nil,
keyringStore: keyringStore
)
}
.navigationViewStyle(StackNavigationViewStyle())
.environment(\.modalPresentationMode, $isPresentingBackup)
.accentColor(Color(.braveBlurpleTint))
}
)
.background(
Color.clear
.sheet(isPresented: $isPresentingAddAccount) {
NavigationView {
AddAccountView(
keyringStore: keyringStore,
networkStore: cryptoStore.networkStore
)
}
.navigationViewStyle(StackNavigationViewStyle())
}
)
}
}

Expand Down
Loading