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-3976] Shield Setup - Recovery & Confirmation #1442

Merged
merged 83 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
855b052
WIP
matiasbzurovski Dec 3, 2024
83c90d8
WIP
matiasbzurovski Dec 3, 2024
9461ca4
wip
matiasbzurovski Dec 3, 2024
91a7750
WIP
matiasbzurovski Dec 3, 2024
7075d5a
WIP
matiasbzurovski Dec 3, 2024
afec155
WIP
matiasbzurovski Dec 4, 2024
42cdda1
WIP
matiasbzurovski Dec 4, 2024
047c39b
renames
matiasbzurovski Dec 4, 2024
8a159c0
add assets
matiasbzurovski Dec 4, 2024
e8cb1ad
WIP
matiasbzurovski Dec 4, 2024
03fcc1e
latest renames
matiasbzurovski Dec 4, 2024
3750ff0
remove test code
matiasbzurovski Dec 4, 2024
39fe0f7
lint
matiasbzurovski Dec 4, 2024
bcd3688
WIP
matiasbzurovski Dec 4, 2024
78ef00b
Almost working
matiasbzurovski Dec 5, 2024
6e15922
add new Path view
matiasbzurovski Dec 5, 2024
27611b4
Revert "add new Path view"
matiasbzurovski Dec 5, 2024
a51d2a7
fix by manually scoping
matiasbzurovski Dec 5, 2024
d326aae
localisation
matiasbzurovski Dec 5, 2024
11d72ef
show todo when selecting other factor
matiasbzurovski Dec 5, 2024
958f10c
feedback
matiasbzurovski Dec 5, 2024
b207add
local Sargon
matiasbzurovski Dec 5, 2024
9d5d89f
use Sargon
matiasbzurovski Dec 5, 2024
acf76d3
updates to compile
matiasbzurovski Dec 6, 2024
4d788d4
renames
matiasbzurovski Dec 6, 2024
c539993
wip
danvleju-rdx Dec 6, 2024
aac36db
wip
danvleju-rdx Dec 6, 2024
c9f32cd
Merge branch 'main' into ABW-3970-shield-setup-select-factors
danvleju-rdx Dec 8, 2024
08414fd
wip
danvleju-rdx Dec 9, 2024
da548c6
Merge branch 'main' into ABW-3970-shield-setup-select-factors
danvleju-rdx Dec 9, 2024
8d1510a
wip
danvleju-rdx Dec 9, 2024
56101fb
lint
danvleju-rdx Dec 9, 2024
d096512
remove temp strings
danvleju-rdx Dec 9, 2024
266bfe7
Merge branch 'main' into ABW-3970-shield-setup-select-factors
danvleju-rdx Dec 9, 2024
906e909
Merge branch 'main' into ABW-3970-shield-setup-select-factors
danvleju-rdx Dec 18, 2024
80588ee
[no ci] wip
danvleju-rdx Jan 6, 2025
b9e3487
wip
danvleju-rdx Jan 6, 2025
96d257f
wip
danvleju-rdx Jan 6, 2025
7e48a75
[no ci] onboarding image updates
danvleju-rdx Jan 6, 2025
47798b5
[no ci] wip
danvleju-rdx Jan 6, 2025
94afa9b
[no ci] wip
danvleju-rdx Jan 6, 2025
dd7d87b
Merge branch 'main' into ABW-3970-shield-setup-select-factors
danvleju-rdx Jan 6, 2025
16827c1
fix
danvleju-rdx Jan 6, 2025
522b006
address feedback
danvleju-rdx Jan 7, 2025
aca11ad
Merge branch 'main' into ABW-3970-shield-setup-select-factors
danvleju-rdx Jan 7, 2025
9d67d6d
strings
danvleju-rdx Jan 7, 2025
415c393
wip
danvleju-rdx Jan 7, 2025
369ee67
address feedback
danvleju-rdx Jan 7, 2025
59b7c6f
Merge branch 'ABW-3970-shield-setup-select-factors' into ABW-3973-shi…
danvleju-rdx Jan 7, 2025
515fac8
wip
danvleju-rdx Jan 8, 2025
f44ee15
wip
danvleju-rdx Jan 8, 2025
9fd6acb
wip
danvleju-rdx Jan 8, 2025
b48ba08
wip
danvleju-rdx Jan 9, 2025
4ece1c8
Merge branch 'main' into ABW-3973-shield-setup-regular-access
danvleju-rdx Jan 9, 2025
ae5aae4
wip
danvleju-rdx Jan 9, 2025
ed104a4
wip
danvleju-rdx Jan 9, 2025
c21de1b
wip
danvleju-rdx Jan 9, 2025
7b96f3e
wip
danvleju-rdx Jan 9, 2025
5811340
wip
danvleju-rdx Jan 9, 2025
e9fddc0
rename
danvleju-rdx Jan 9, 2025
fc9e9a0
address feedback
danvleju-rdx Jan 9, 2025
c3e2caa
Update RadixWallet/Core/DesignSystem/Styles/SecondaryRectangularButto…
danvleju-rdx Jan 9, 2025
19e76c6
Merge branch 'main' into ABW-3973-shield-setup-regular-access
danvleju-rdx Jan 10, 2025
57df67c
fix
danvleju-rdx Jan 10, 2025
a04c09a
add chooseFactorSource
danvleju-rdx Jan 10, 2025
5dc5bd7
wip
danvleju-rdx Jan 13, 2025
3fca6cb
wip
danvleju-rdx Jan 13, 2025
a363015
Merge branch 'main' into ABW-3976-shield-setup-recovery
danvleju-rdx Jan 13, 2025
d33d9d8
wip
danvleju-rdx Jan 14, 2025
b3a465b
sargon updates
danvleju-rdx Jan 15, 2025
f3e200c
wip
danvleju-rdx Jan 15, 2025
f539def
wip
danvleju-rdx Jan 15, 2025
4b84fd3
add TODOs
danvleju-rdx Jan 15, 2025
812bb17
Merge branch 'main' into ABW-3976-shield-setup-recovery
danvleju-rdx Jan 16, 2025
8038105
wip
danvleju-rdx Jan 21, 2025
d00d400
Revert "wip"
danvleju-rdx Jan 21, 2025
a8dc84e
1.11.1 hotfix (#1417)
GhenadieVP Jan 17, 2025
89bd574
Debug Only: Inspect `FactorInstancesCache` (#1391)
CyonAlexRDX Jan 20, 2025
7efd3ca
New Crowdin updates (#1439)
radixbot Jan 21, 2025
602fb0d
sargon bump
danvleju-rdx Jan 21, 2025
68dfebc
New Crowdin updates (#1439)
radixbot Jan 21, 2025
3d23bf3
strings
danvleju-rdx Jan 21, 2025
f9502af
strings
danvleju-rdx Jan 21, 2025
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
22 changes: 21 additions & 1 deletion RadixWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,9 @@
E791F2A32D2EDFDE001A007B /* SelectNumberOfFactorsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E791F2A22D2EDFDE001A007B /* SelectNumberOfFactorsView.swift */; };
E791F2A52D2FED42001A007B /* RolesSetupCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E791F2A42D2FED42001A007B /* RolesSetupCoordinator.swift */; };
E791F2A72D2FED51001A007B /* RolesSetupCoordinator+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = E791F2A62D2FED51001A007B /* RolesSetupCoordinator+View.swift */; };
E791F2AA2D3151E7001A007B /* RecoveryRoleSetup+Reducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E791F2A92D3151E7001A007B /* RecoveryRoleSetup+Reducer.swift */; };
E791F2AC2D3151ED001A007B /* RecoveryRoleSetup+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = E791F2AB2D3151ED001A007B /* RecoveryRoleSetup+View.swift */; };
E791F2AE2D365A76001A007B /* SelectEmergencyFallbackPeriodView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E791F2AD2D365A76001A007B /* SelectEmergencyFallbackPeriodView.swift */; };
E79DD1B12CE365CF00B1EB86 /* ChooseReceivingAccountOnDelete+Reducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E79DD1B02CE365CF00B1EB86 /* ChooseReceivingAccountOnDelete+Reducer.swift */; };
E79DD1B32CE365D600B1EB86 /* ChooseReceivingAccountOnDelete+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = E79DD1B22CE365D600B1EB86 /* ChooseReceivingAccountOnDelete+View.swift */; };
E79DD1B62CE4933100B1EB86 /* DeleteAccountConfirmation+Reducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E79DD1B52CE4933100B1EB86 /* DeleteAccountConfirmation+Reducer.swift */; };
Expand Down Expand Up @@ -2566,6 +2569,9 @@
E791F2A22D2EDFDE001A007B /* SelectNumberOfFactorsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectNumberOfFactorsView.swift; sourceTree = "<group>"; };
E791F2A42D2FED42001A007B /* RolesSetupCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RolesSetupCoordinator.swift; sourceTree = "<group>"; };
E791F2A62D2FED51001A007B /* RolesSetupCoordinator+View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RolesSetupCoordinator+View.swift"; sourceTree = "<group>"; };
E791F2A92D3151E7001A007B /* RecoveryRoleSetup+Reducer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RecoveryRoleSetup+Reducer.swift"; sourceTree = "<group>"; };
E791F2AB2D3151ED001A007B /* RecoveryRoleSetup+View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RecoveryRoleSetup+View.swift"; sourceTree = "<group>"; };
E791F2AD2D365A76001A007B /* SelectEmergencyFallbackPeriodView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectEmergencyFallbackPeriodView.swift; sourceTree = "<group>"; };
E79DD1B02CE365CF00B1EB86 /* ChooseReceivingAccountOnDelete+Reducer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ChooseReceivingAccountOnDelete+Reducer.swift"; sourceTree = "<group>"; };
E79DD1B22CE365D600B1EB86 /* ChooseReceivingAccountOnDelete+View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ChooseReceivingAccountOnDelete+View.swift"; sourceTree = "<group>"; };
E79DD1B52CE4933100B1EB86 /* DeleteAccountConfirmation+Reducer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DeleteAccountConfirmation+Reducer.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -7113,10 +7119,21 @@
isa = PBXGroup;
children = (
E791F2992D2BEF1A001A007B /* PrimaryRoleSetup */,
E791F2A82D300E3B001A007B /* RecoveryRoleSetup */,
);
path = Children;
sourceTree = "<group>";
};
E791F2A82D300E3B001A007B /* RecoveryRoleSetup */ = {
isa = PBXGroup;
children = (
E791F2A92D3151E7001A007B /* RecoveryRoleSetup+Reducer.swift */,
E791F2AB2D3151ED001A007B /* RecoveryRoleSetup+View.swift */,
E791F2AD2D365A76001A007B /* SelectEmergencyFallbackPeriodView.swift */,
);
path = RecoveryRoleSetup;
sourceTree = "<group>";
};
E79DD1B42CE492E800B1EB86 /* DeleteAccount */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -7655,6 +7672,7 @@
A41557532B7645E70040AD4E /* TransactionHistory+Reducer.swift in Sources */,
A408165B2C7E0D08005E65B9 /* ValidatorCollectionItem.swift in Sources */,
E6A2D9E72AFA7132001857EC /* Mnemonics+Utils.swift in Sources */,
E791F2AA2D3151E7001A007B /* RecoveryRoleSetup+Reducer.swift in Sources */,
48CFC28A2ADC10D900E77A5C /* TransactionReviewGuarantees.swift in Sources */,
48CFC5772ADC10DA00E77A5C /* MetadataTypedValue.swift in Sources */,
48CFC44B2ADC10DA00E77A5C /* MnemonicClient+Interface.swift in Sources */,
Expand All @@ -7670,6 +7688,7 @@
48CFC4772ADC10DA00E77A5C /* GatewaysClient+Interface.swift in Sources */,
A408161E2C7E0D08005E65B9 /* StateEntityNonFungiblesPageResponse.swift in Sources */,
A40816432C7E0D08005E65B9 /* TransactionFungibleFeeBalanceChangeType.swift in Sources */,
E791F2AE2D365A76001A007B /* SelectEmergencyFallbackPeriodView.swift in Sources */,
A40815862C7E0D08005E65B9 /* LedgerStateMixin.swift in Sources */,
48CFC59D2ADC10DA00E77A5C /* UIKeyboardType+Extra.swift in Sources */,
48CFC5E12ADC10DA00E77A5C /* Validation+Extra.swift in Sources */,
Expand Down Expand Up @@ -7866,6 +7885,7 @@
48CFC26A2ADC10D900E77A5C /* Signing+View.swift in Sources */,
48CFC3262ADC10D900E77A5C /* LocalNetworkPermission+Reducer.swift in Sources */,
E657773D2B0BAB35002DB237 /* RecoverWalletControlWithBDFSOnly.swift in Sources */,
E791F2AC2D3151ED001A007B /* RecoveryRoleSetup+View.swift in Sources */,
48CFC4482ADC10DA00E77A5C /* AccountsClient+Test.swift in Sources */,
A408158C2C7E0D08005E65B9 /* MetadataDecimalValue.swift in Sources */,
48CFC42D2ADC10DA00E77A5C /* AsyncExtension+Sendable.swift in Sources */,
Expand Down Expand Up @@ -9382,7 +9402,7 @@
repositoryURL = "https://github.com/radixdlt/sargon";
requirement = {
kind = exactVersion;
version = 1.1.106;
version = 1.1.107;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/radixdlt/sargon",
"state" : {
"revision" : "dc3ecf6bcfc260846e661e7b85fa9a60315385e9",
"version" : "1.1.106"
"revision" : "84acb9525993de833fc16cfddfb2ccb12706efbf",
"version" : "1.1.107"
}
},
{
Expand Down
3 changes: 3 additions & 0 deletions RadixWallet/Core/DesignSystem/Colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ extension Color.App {
var alert: Color { .init(hex: .alert) }
var lightAlert: Color { .init(hex: .lightAlert) }
var error: Color { .init(hex: .error) }
var lightError: Color { .init(hex: .lightError) }
var notification: Color { .init(hex: .notification) }

var background: Color { .dynamic(light: .white, dark: .black) }
Expand Down Expand Up @@ -165,6 +166,8 @@ extension Color {

case error = 0xC82020

case lightError = 0xFCEBEB

case notification = 0xF81B1B

// gradient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ internal enum AssetResource {
internal static let prepareFactorSourcesAdd = ImageAsset(name: "prepareFactorSourcesAdd")
internal static let prepareFactorSourcesCompletion = ImageAsset(name: "prepareFactorSourcesCompletion")
internal static let prepareFactorSourcesIntro = ImageAsset(name: "prepareFactorSourcesIntro")
internal static let emergencyFallbackCalendar = ImageAsset(name: "emergencyFallbackCalendar")
internal static let recoverySetup = ImageAsset(name: "recoverySetup")
internal static let regularAccessSetup = ImageAsset(name: "regularAccessSetup")
internal static let selectFactorSources = ImageAsset(name: "selectFactorSources")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "emergencyFallbackCalendar.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ extension InfoLinkSheet {
case passwords
case securityshields
case buildingshield
case emergencyfallback
}
}

Expand Down Expand Up @@ -180,6 +181,8 @@ extension InfoLinkSheet.GlossaryItem {
L10n.InfoLink.Glossary.securityshields
case .buildingshield:
L10n.InfoLink.Glossary.buildingshield
case .emergencyfallback:
"TODO"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,13 @@ struct PrimaryRoleSetup: FeatureReducer, Sendable {

case let .removeThresholdFactorTapped(id):
state.$shieldBuilder.withLock { builder in
// TODO: use removeFactorFromPrimaryThreshold
builder = builder.removeFactorFromPrimary(factorSourceId: id)
builder = builder.removeFactorFromPrimary(factorSourceId: id, factorListKind: .threshold)
}
return .none

case let .removeOverrideFactorTapped(id):
state.$shieldBuilder.withLock { builder in
// TODO: use removeFactorFromPrimaryOverride
builder = builder.removeFactorFromPrimary(factorSourceId: id)
builder = builder.removeFactorFromPrimary(factorSourceId: id, factorListKind: .override)
}
return .none

Expand All @@ -111,7 +109,7 @@ struct PrimaryRoleSetup: FeatureReducer, Sendable {
state.$shieldBuilder.withLock { builder in
// TODO: use removeAllFactorsFromPrimaryOverride
for overrideFactor in state.overrideFactors {
builder = builder.removeFactorFromPrimary(factorSourceId: overrideFactor.factorSourceID)
builder = builder.removeFactorFromPrimary(factorSourceId: overrideFactor.factorSourceID, factorListKind: .override)
}
}
return .none
Expand Down Expand Up @@ -141,15 +139,10 @@ struct PrimaryRoleSetup: FeatureReducer, Sendable {
case .selectNumberOfFactorsView(.close):
state.destination = nil
return .none
case let .selectNumberOfFactorsView(.set(value)):
case let .selectNumberOfFactorsView(.set(threshold)):
state.destination = nil
state.$shieldBuilder.withLock { builder in
switch value {
case .all:
builder = builder.setThreshold(threshold: UInt8(builder.primaryRoleThresholdFactors.count))
case let .specific(numberOfFactors):
builder = builder.setThreshold(threshold: UInt8(numberOfFactors))
}
builder = builder.setThreshold(threshold: threshold)
}
return .none
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extension PrimaryRoleSetup.State {
if threshold == shieldBuilder.primaryRoleThresholdFactors.count {
return .all
} else {
return .specific(threshold)
return .specific(UInt8(threshold))
}
}
}
Expand Down Expand Up @@ -181,10 +181,10 @@ extension PrimaryRoleSetup {

private var thresholdSelectorView: some SwiftUI.View {
HStack(spacing: .zero) {
// TODO: Add a new key for "**%@**"
let thresholdTitle = store.threshold.titleShort
let title = L10n.ShieldWizardRegularAccess.ThresholdDescription.title(thresholdTitle)
let parts = title.components(separatedBy: "**\(thresholdTitle)**")
let separator = L10n.ShieldWizardRegularAccess.ThresholdDescription.selection(thresholdTitle)
let title = L10n.ShieldWizardRegularAccess.ThresholdDescription.title(separator)
let parts = title.components(separatedBy: separator)

if parts.count == 2 {
Text(parts[0])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ struct SelectNumberOfFactorsView: View {
ForEach(pickerItems, id: \.self) { threshold in
Text(threshold.title)
.tag(threshold)
.foregroundStyle(.app.gray1)
.textStyle(.body1Regular)
}
}
.pickerStyle(.wheel)
Expand All @@ -45,7 +47,7 @@ struct SelectNumberOfFactorsView: View {
var values: [Threshold] = []

for i in 1 ..< maxAvailableFactors {
values.insert(.specific(i), at: 0)
values.insert(.specific(UInt8(i)), at: 0)
}

values.insert(.all, at: 0)
Expand All @@ -62,13 +64,6 @@ extension SelectNumberOfFactorsView {
}
}

// MARK: - Threshold
// TODO: Move to Sargon - https://radixdlt.atlassian.net/browse/ABW-4047
enum Threshold: Hashable {
case all
case specific(Int)
}

private extension Threshold {
var title: String {
switch self {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import ComposableArchitecture

// MARK: - RecoveryRoleSetup
@Reducer
struct RecoveryRoleSetup: FeatureReducer, Sendable {
@ObservableState
struct State: Hashable, Sendable {
@Shared(.shieldBuilder) var shieldBuilder

var factorSourcesFromProfile: [FactorSource] = []

@Presents
var destination: Destination.State? = nil
}

typealias Action = FeatureAction<Self>

@CasePathable
enum ViewAction: Equatable, Sendable {
case task
case continueButtonTapped
case addFactorSourceButtonTapped(ChooseFactorSourceContext)
case removeRecoveryFactorTapped(FactorSourceID)
case removeConfirmationFactorTapped(FactorSourceID)
case invalidCombinationReadMoreTapped
case selectFallbackButtonTapped
case fallbackInfoButtonTapped
}

enum InternalAction: Equatable, Sendable {
case setFactorSources([FactorSource])
}

enum DelegateAction: Equatable, Sendable {
case chooseFactorSource(ChooseFactorSourceContext)
case finished
}

struct Destination: DestinationReducer {
@CasePathable
enum State: Sendable, Hashable {
case selectEmergencyFallbackPeriod
}

@CasePathable
enum Action: Sendable, Equatable {
case selectEmergencyFallbackPeriod(SelectEmergencyFallbackPeriodView.Action)
}

var body: some ReducerOf<Self> {
EmptyReducer()
}
}

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

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

@Dependency(\.factorSourcesClient) var factorSourcesClient
@Dependency(\.overlayWindowClient) var overlayWindowClient
@Dependency(\.errorQueue) var errorQueue

func reduce(into state: inout State, viewAction: ViewAction) -> Effect<Action> {
switch viewAction {
case .task:
return .run { send in
let factorSources = try await factorSourcesClient.getFactorSources().elements
await send(.internal(.setFactorSources(factorSources)))
} catch: { error, _ in
errorQueue.schedule(error)
}

case .invalidCombinationReadMoreTapped:
overlayWindowClient.showInfoLink(.init(glossaryItem: .buildingshield))
return .none

case let .removeRecoveryFactorTapped(id):
state.$shieldBuilder.withLock { builder in
builder = builder.removeFactorFromRecovery(factorSourceId: id)
}
return .none

case let .removeConfirmationFactorTapped(id):
state.$shieldBuilder.withLock { builder in
builder = builder.removeFactorFromConfirmation(factorSourceId: id)
}
return .none

case let .addFactorSourceButtonTapped(context):
return .send(.delegate(.chooseFactorSource(context)))

case .selectFallbackButtonTapped:
state.destination = .selectEmergencyFallbackPeriod
return .none

case .fallbackInfoButtonTapped:
overlayWindowClient.showInfoLink(.init(glossaryItem: .emergencyfallback))
return .none

case .continueButtonTapped:
return .send(.delegate(.finished))
}
}

func reduce(into state: inout State, internalAction: InternalAction) -> Effect<Action> {
switch internalAction {
case let .setFactorSources(factorSources):
state.factorSourcesFromProfile = factorSources
return .none
}
}

func reduce(into state: inout State, presentedAction: Destination.Action) -> Effect<Action> {
switch presentedAction {
case .selectEmergencyFallbackPeriod(.close):
state.destination = nil
return .none
case let .selectEmergencyFallbackPeriod(.set(period)):
state.destination = nil
state.$shieldBuilder.withLock { builder in
// TODO: use `builder.setPeriodUntilAutoConfirm(..)`
builder = builder.setNumberOfDaysUntilAutoConfirm(numberOfDays: UInt16(period.days))
}
return .none
}
}
}
Loading
Loading