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-2077 Sign Proof biometric authentication requires 2x biometric scan #695

Merged
merged 7 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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 @@ -14,6 +14,7 @@ public struct DappDetails: Sendable, FeatureReducer {
@Dependency(\.openURL) var openURL
@Dependency(\.authorizedDappsClient) var authorizedDappsClient
@Dependency(\.cacheClient) var cacheClient
@Dependency(\.continuousClock) var clock

public struct FailedToLoadMetadata: Error, Hashable {}

Expand Down Expand Up @@ -330,7 +331,7 @@ public struct DappDetails: Sendable, FeatureReducer {
let (dAppID, networkID) = (dApp.dAppDefinitionAddress, dApp.networkID)
return .run { send in
if let delay {
try await Task.sleep(for: delay)
try await clock.sleep(for: delay)
}
try await authorizedDappsClient.forgetAuthorizedDapp(dAppID, networkID)
await send(.delegate(.dAppForgotten))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ extension GatewayAPIClient {
// TODO: should be with(noop) — see GatewayAPIClient+Mock.swift for deets.
static let previewValueDappMetadataSuccess = update(previewValue) {
$0.getEntityMetadata = { @Sendable _, _ in
try await Task.sleep(for: .seconds(2))
@Dependency(\.continuousClock) var clock
maciek-rdx marked this conversation as resolved.
Show resolved Hide resolved
try await clock.sleep(for: .seconds(2))
return GatewayAPI.EntityMetadataCollection(
items: []
)
Expand All @@ -76,7 +77,8 @@ extension GatewayAPIClient {
// TODO: should be with(noop) — see GatewayAPIClient+Mock.swift for deets.
static let previewValueDappMetadataFailure = update(previewValue) {
$0.getEntityMetadata = { @Sendable _, _ in
try await Task.sleep(for: .seconds(2))
@Dependency(\.continuousClock) var clock
maciek-rdx marked this conversation as resolved.
Show resolved Hide resolved
try await clock.sleep(for: .seconds(2))
throw NoopError()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ struct DappInteractionFlow: Sendable, FeatureReducer {
)
case presentPersonaNotFoundErrorAlert(reason: String)
case autofillOngoingResponseItemsIfPossible(AutofillOngoingResponseItemsPayload)
case delayedAppendToPath(DappInteractionFlow.Destinations.State)

struct AutofillOngoingResponseItemsPayload: Sendable, Equatable {
struct AccountsPayload: Sendable, Equatable {
Expand Down Expand Up @@ -176,6 +177,7 @@ struct DappInteractionFlow: Sendable, FeatureReducer {
@Dependency(\.personasClient) var personasClient
@Dependency(\.accountsClient) var accountsClient
@Dependency(\.authorizedDappsClient) var authorizedDappsClient
@Dependency(\.continuousClock) var clock

func reduce(into state: inout State, viewAction: ViewAction) -> EffectTask<Action> {
switch viewAction {
Expand Down Expand Up @@ -248,6 +250,10 @@ struct DappInteractionFlow: Sendable, FeatureReducer {
}
return continueEffect(for: &state)

case let .delayedAppendToPath(destination):
state.path.append(destination)
return .none

case let .presentPersonaNotFoundErrorAlert(reason):
state.personaNotFoundErrorAlert = .init(
title: { TextState(L10n.Common.errorAlertTitle) },
Expand Down Expand Up @@ -514,7 +520,11 @@ struct DappInteractionFlow: Sendable, FeatureReducer {
if state.root == nil {
state.root = destination
} else if state.path.last != destination {
state.path.append(destination)
return .task {
/// For more information about that `sleep` and not setting it directly here please check [this discussion in Slack](https://rdxworks.slack.com/archives/C03QFAWBRNX/p1693395346047829?thread_ts=1693388110.800679&cid=C03QFAWBRNX)
try? await clock.sleep(for: .milliseconds(100))
maciek-rdx marked this conversation as resolved.
Show resolved Hide resolved
return .internal(.delayedAppendToPath(destination))
}
}
return .none
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ extension DerivePublicKeys {
.padding(.horizontal, .medium1)
.onFirstTask { @MainActor in
/// For more information about that `sleep` please check [this discussion in Slack](https://rdxworks.slack.com/archives/C03QFAWBRNX/p1687967412207119?thread_ts=1687964494.772899&cid=C03QFAWBRNX)
try? await Task.sleep(for: .seconds(0.7))
@Dependency(\.continuousClock) var clock
try? await clock.sleep(for: .milliseconds(700))

await viewStore.send(.onFirstTask).finish()
}
Expand Down
Loading