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

1.11.3 hotfix #1428

Merged
merged 9 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion Aux/Config/Common.xcconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// MARK: - Custom flags

/// Application version shared across all targets and flavours
APP_VERSION = 1.11.2
APP_VERSION = 1.11.3

/// App Icon base name
APP_ICON = AppIcon
Expand Down
2 changes: 1 addition & 1 deletion RadixWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9295,7 +9295,7 @@
repositoryURL = "https://github.com/radixdlt/sargon";
requirement = {
kind = exactVersion;
version = 1.1.86;
version = 1.1.89;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/radixdlt/sargon",
"state" : {
"revision" : "750d49a106a6bf359bfed3bc76d1c81a963c7bf5",
"version" : "1.1.86"
"revision" : "dcdad3e588fa5fdc1a5d5d093c26a7e350630d00",
"version" : "1.1.89"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,7 @@ extension DeviceFactorSourceClient {

switch signerEntity.securityState {
case let .unsecured(control):
let factorInstance = switch purpose {
case .signAuth:
control.authenticationSigning ?? control.transactionSigning
case .signTransaction, .signPreAuthorization:
control.transactionSigning
}
let factorInstance = control.transactionSigning

guard
let deviceFactorSource = try await factorSourcesClient.getDeviceFactorSource(of: factorInstance)
Expand Down Expand Up @@ -180,12 +175,7 @@ extension DeviceFactorSourceClient {
switch entity.securityState {
case let .unsecured(unsecuredControl):

let factorInstance = switch purpose {
case .signAuth:
unsecuredControl.authenticationSigning ?? unsecuredControl.transactionSigning
case .signTransaction, .signPreAuthorization:
unsecuredControl.transactionSigning
}
let factorInstance = unsecuredControl.transactionSigning

let derivationPath = factorInstance.derivationPath

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,7 @@ func signingFactors(
switch entity.securityState {
case let .unsecured(unsecuredEntityControl):

let factorInstance = switch signingPurpose {
case .signAuth:
unsecuredEntityControl.authenticationSigning ?? unsecuredEntityControl.transactionSigning
case .signTransaction, .signPreAuthorization:
unsecuredEntityControl.transactionSigning
}
let factorInstance = unsecuredEntityControl.transactionSigning

let id = factorInstance.factorSourceID
guard let factorSource = allFactorSources[id: id.asGeneral] else {
Expand Down
60 changes: 57 additions & 3 deletions RadixWallet/Features/ClaimWallet/ClaimWallet+Reducer.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ComposableArchitecture
import SwiftUI

// MARK: - ClaimWallet
@Reducer
struct ClaimWallet: Sendable, FeatureReducer {
@ObservableState
Expand All @@ -10,6 +11,9 @@ struct ClaimWallet: Sendable, FeatureReducer {
isLoading ? .loading(.global(text: nil)) : .enabled
}

@Presents
var destination: Destination.State? = nil

init() {}
}

Expand All @@ -26,24 +30,74 @@ struct ClaimWallet: Sendable, FeatureReducer {
case transferBack
}

struct Destination: DestinationReducer {
@CasePathable
enum State: Sendable, Hashable {
case confirmReset(AlertState<Action.ConfirmReset>)
}

@CasePathable
enum Action: Sendable, Hashable {
case confirmReset(ConfirmReset)

enum ConfirmReset: Sendable, Hashable {
case confirm
}
}

var body: some Reducer<State, Action> {
EmptyReducer()
}
}

@Dependency(\.resetWalletClient) var resetWalletClient

init() {}

var body: some ReducerOf<Self> {
var body: some ReducerOf<ClaimWallet> {
Reduce(core)
.ifLet(destinationPath, action: /Action.destination) {
Destination()
}
}

private let destinationPath: WritableKeyPath<State, PresentationState<Destination.State>> = \.$destination

func reduce(into state: inout State, viewAction: ViewAction) -> Effect<Action> {
switch viewAction {
case .clearWalletButtonTapped:
state.destination = Destination.confirmResetState
return .none

case .transferBackButtonTapped:
return .send(.delegate(.transferBack))
}
}

func reduce(into state: inout State, presentedAction: Destination.Action) -> Effect<Action> {
switch presentedAction {
case .confirmReset(.confirm):
state.isLoading = true
return .run { send in
await resetWalletClient.resetWallet()
await send(.delegate(.didClearWallet))
}
case .transferBackButtonTapped:
return .send(.delegate(.transferBack))
}
}
}

extension ClaimWallet.Destination {
static let confirmResetState: State = .confirmReset(.init(
title: {
TextState(L10n.FactoryReset.Dialog.title)
},
actions: {
ButtonState(role: .destructive, action: .confirm) {
TextState(L10n.Common.confirm)
}
},
message: {
TextState(L10n.FactoryReset.Dialog.message)
}
))
}
34 changes: 28 additions & 6 deletions RadixWallet/Features/ClaimWallet/ClaimWallet+View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,53 @@ extension ClaimWallet {
.foregroundColor(.app.gray2)
.textStyle(.secondaryHeader)
.multilineTextAlignment(.center)
.padding(.bottom, .medium1)
.padding(.bottom, .small1)

Text(L10n.ConfigurationBackup.Automated.walletTransferredExplanation1 + "\n\n" + L10n.ConfigurationBackup.Automated.walletTransferredExplanation2)
.textStyle(.body1Regular)
.multilineTextAlignment(.center)
.padding(.bottom, .small1)

Spacer()

VStack {
Button(L10n.ConfigurationBackup.Automated.walletTransferredClearButton) {
VStack(spacing: .medium1) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increased the spacing between button, these were too close.

Button(L10n.FactoryReset.resetWallet) {
store.send(.view(.clearWalletButtonTapped))
}
.buttonStyle(.primaryRectangular)
.padding(.bottom, .small2)
.buttonStyle(.primaryRectangular(isDestructive: true))

Button(L10n.ConfigurationBackup.Automated.walletTransferredTransferBackButton) {
store.send(.view(.transferBackButtonTapped))
}
.buttonStyle(.primaryText())
}
}
.padding(.horizontal, .large1)
.padding(.horizontal, .medium3)
.padding(.vertical, .medium3)
.controlState(store.screenState)
}
.destinations(with: store)
}
}
}

private extension StoreOf<ClaimWallet> {
var destination: PresentationStoreOf<ClaimWallet.Destination> {
func scopeState(state: State) -> PresentationState<ClaimWallet.Destination.State> {
state.$destination
}
return scope(state: scopeState, action: Action.destination)
}
}

@MainActor
private extension View {
func destinations(with store: StoreOf<ClaimWallet>) -> some View {
let destination = store.destination
return confirmReset(with: destination)
}

private func confirmReset(with destinationStore: PresentationStoreOf<ClaimWallet.Destination>) -> some View {
alert(store: destinationStore.scope(state: \.confirmReset, action: \.confirmReset))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -657,13 +657,6 @@ extension UnsecuredEntityControlView {
factorInstance: unsecuredControl.transactionSigning,
indentation: inOneLevel
)
if let authenticationSigning = unsecuredControl.authenticationSigning {
HierarchicalDeterministicFactorInstanceView(
description: "Auth Signing",
factorInstance: authenticationSigning,
indentation: inOneLevel
)
}
}
}
}
Expand Down
Loading