Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CreateNewAccount from AssetTransferFlow #552

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ extension TransferAccountList {
let chooseAccount: ChooseReceivingAccount.State = .init(
chooseAccounts: .init(
selectionRequirement: .exactly(1),
filteredAccounts: filteredAccounts
filteredAccounts: filteredAccounts,
// Create account is very buggy when started from AssetTransfer, disable it for now.
canCreateNewAccount: false
)
)

Expand Down
6 changes: 5 additions & 1 deletion Sources/Features/ChooseAccounts/ChooseAccounts+Reducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,23 @@ public struct ChooseAccounts: Sendable, FeatureReducer {
public let filteredAccounts: [AccountAddress]
public var availableAccounts: IdentifiedArrayOf<Profile.Network.Account>
public var selectedAccounts: [ChooseAccountsRow.State]?
public var canCreateNewAccount: Bool

@PresentationState
var destination: Destinations.State? = nil

public init(
selectionRequirement: SelectionRequirement,
filteredAccounts: [AccountAddress] = [],
availableAccounts: IdentifiedArrayOf<Profile.Network.Account> = [],
selectedAccounts: [ChooseAccountsRow.State]? = nil
selectedAccounts: [ChooseAccountsRow.State]? = nil,
canCreateNewAccount: Bool = true
) {
self.selectionRequirement = selectionRequirement
self.filteredAccounts = filteredAccounts
self.availableAccounts = availableAccounts
self.selectedAccounts = selectedAccounts
self.canCreateNewAccount = canCreateNewAccount
}
}

Expand Down
10 changes: 7 additions & 3 deletions Sources/Features/ChooseAccounts/ChooseAccounts+View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extension ChooseAccounts {
let availableAccounts: [ChooseAccountsRow.State]
let selectionRequirement: SelectionRequirement
let selectedAccounts: [ChooseAccountsRow.State]?
let canCreateNewAccount: Bool

init(state: ChooseAccounts.State) {
let selectionRequirement = state.selectionRequirement
Expand All @@ -19,6 +20,7 @@ extension ChooseAccounts {
}
self.selectionRequirement = selectionRequirement
self.selectedAccounts = state.selectedAccounts
self.canCreateNewAccount = state.canCreateNewAccount
}
}

Expand Down Expand Up @@ -55,10 +57,12 @@ extension ChooseAccounts {
}
}

Button(L10n.DAppRequest.ChooseAccounts.createNewAccount) {
viewStore.send(.createAccountButtonTapped)
if viewStore.canCreateNewAccount {
Button(L10n.DAppRequest.ChooseAccounts.createNewAccount) {
viewStore.send(.createAccountButtonTapped)
}
.buttonStyle(.secondaryRectangular(shouldExpand: false))
GhenadieVP marked this conversation as resolved.
Show resolved Hide resolved
}
.buttonStyle(.secondaryRectangular(shouldExpand: false))
}
}
.onAppear {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,26 @@ extension NameAccount {
send: { .textFieldChanged($0) }
)

AppTextField(
placeholder: viewStore.namePlaceholder,
text: nameBinding,
hint: .info(L10n.CreateEntity.NameNewEntity.explanation)
)
#if os(iOS)
.textFieldCharacterLimit(Profile.Network.Account.nameMaxLength, forText: nameBinding)
#endif
.keyboardType(.asciiCapable)
.autocorrectionDisabled()
.padding(.bottom, .medium3)
TextField("asd", text: nameBinding)
GhenadieVP marked this conversation as resolved.
Show resolved Hide resolved
GhenadieVP marked this conversation as resolved.
Show resolved Hide resolved
// AppTextField(
// placeholder: viewStore.namePlaceholder,
// text: nameBinding,
// hint: .info(L10n.CreateEntity.NameNewEntity.explanation)
// )
// #if os(iOS)
// .textFieldCharacterLimit(Profile.Network.Account.nameMaxLength, forText: nameBinding)
// #endif
// .keyboardType(.asciiCapable)
// .autocorrectionDisabled()
// .padding(.bottom, .medium3)

useLedgerAsFactorSource(with: viewStore)
}
.padding([.bottom, .horizontal], .medium1)
}
#if os(iOS)
.toolbar(.visible, for: .navigationBar)
#endif
// #if os(iOS)
// .toolbar(.visible, for: .navigationBar)
// #endif
.footer {
WithControlRequirements(
viewStore.sanitizedNameRequirement,
Expand Down