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

[ABW-3477] WalletInteraction - Pre-select Persona #1202

Merged
merged 1 commit into from
Jul 8, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public struct NewPersonaCompletion: Sendable, FeatureReducer {
}

public enum DelegateAction: Sendable, Equatable {
case completed
case completed(Persona)
}

public init() {}

public func reduce(into state: inout State, viewAction: ViewAction) -> Effect<Action> {
switch viewAction {
case .goToDestination:
.send(.delegate(.completed))
.send(.delegate(.completed(state.persona)))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public struct CreatePersonaCoordinator: Sendable, FeatureReducer {

public enum DelegateAction: Sendable, Equatable {
case dismissed
case completed
case completed(Persona)
}

public enum InternalAction: Sendable, Equatable {
Expand Down Expand Up @@ -152,9 +152,9 @@ extension CreatePersonaCoordinator {

return .send(.internal(.derivePublicKey))

case .path(.element(_, action: .step2_completion(.delegate(.completed)))):
case let .path(.element(_, action: .step2_completion(.delegate(.completed(persona))))):
return .run { send in
await send(.delegate(.completed))
await send(.delegate(.completed(persona)))
await dismiss()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ struct Login: Sendable, FeatureReducer {
}

enum InternalAction: Sendable, Equatable {
typealias SelectedPersonaID = IdentityAddress

case personasLoaded(
Personas,
SelectedPersonaID?,
AuthorizedDapp?,
AuthorizedPersonaSimple?
)
Expand Down Expand Up @@ -76,7 +79,7 @@ struct Login: Sendable, FeatureReducer {
func reduce(into state: inout State, viewAction: ViewAction) -> Effect<Action> {
switch viewAction {
case .appeared:
return loadPersonas(state: &state).concatenate(with: determinePersonaPrimacy())
return loadPersonas(state: state).concatenate(with: determinePersonaPrimacy())

case let .selectedPersonaChanged(persona):