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

Debug Only: Inspect FactorInstancesCache #1391

Merged
merged 10 commits into from
Jan 20, 2025
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
74 changes: 33 additions & 41 deletions RadixWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,6 @@
48FFFA9F2ADC1F2700B2B213 /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = 48FFFA9E2ADC1F2700B2B213 /* KeychainAccess */; };
48FFFAA22ADC1F5D00B2B213 /* Algorithms in Frameworks */ = {isa = PBXBuildFile; productRef = 48FFFAA12ADC1F5D00B2B213 /* Algorithms */; };
48FFFAA52ADC1F9600B2B213 /* AsyncAlgorithms in Frameworks */ = {isa = PBXBuildFile; productRef = 48FFFAA42ADC1F9600B2B213 /* AsyncAlgorithms */; };
48FFFAA82ADC1FBE00B2B213 /* Atomics in Frameworks */ = {isa = PBXBuildFile; productRef = 48FFFAA72ADC1FBE00B2B213 /* Atomics */; };
48FFFAAB2ADC1FE900B2B213 /* DependenciesAdditions in Frameworks */ = {isa = PBXBuildFile; productRef = 48FFFAAA2ADC1FE900B2B213 /* DependenciesAdditions */; };
48FFFAB12ADC203700B2B213 /* WebRTC in Frameworks */ = {isa = PBXBuildFile; productRef = 48FFFAB02ADC203700B2B213 /* WebRTC */; };
48FFFABA2ADC209100B2B213 /* Nuke in Frameworks */ = {isa = PBXBuildFile; productRef = 48FFFAB92ADC209100B2B213 /* Nuke */; };
Expand All @@ -690,7 +689,6 @@
48FFFAF92ADC241A00B2B213 /* DequeModule in Frameworks */ = {isa = PBXBuildFile; productRef = 48FFFAF82ADC241A00B2B213 /* DequeModule */; };
48FFFAFB2ADC241A00B2B213 /* HashTreeCollections in Frameworks */ = {isa = PBXBuildFile; productRef = 48FFFAFA2ADC241A00B2B213 /* HashTreeCollections */; };
48FFFAFD2ADC241A00B2B213 /* HeapModule in Frameworks */ = {isa = PBXBuildFile; productRef = 48FFFAFC2ADC241A00B2B213 /* HeapModule */; };
48FFFB0A2ADC721800B2B213 /* Atomics in Frameworks */ = {isa = PBXBuildFile; productRef = 48FFFB092ADC721800B2B213 /* Atomics */; };
5B03E3CF2CC1223000E10A64 /* DisplayMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B03E3CE2CC1222D00E10A64 /* DisplayMode.swift */; };
5B03E3D12CC127B100E10A64 /* RawManifestView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B03E3D02CC127B100E10A64 /* RawManifestView.swift */; };
5B03E3D32CC141D100E10A64 /* InteractionReview+Extra.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B03E3D22CC141C200E10A64 /* InteractionReview+Extra.swift */; };
Expand Down Expand Up @@ -782,7 +780,6 @@
5B92AAC52D2ED0BE00486A9B /* ChooseFactorSourceKind+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B92AAC32D2ED0BE00486A9B /* ChooseFactorSourceKind+View.swift */; };
5B92AAC82D302A0E00486A9B /* ChangeMainFactorSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B92AAC62D302A0E00486A9B /* ChangeMainFactorSource.swift */; };
5B92AAC92D302A0E00486A9B /* ChangeMainFactorSource+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B92AAC72D302A0E00486A9B /* ChangeMainFactorSource+View.swift */; };
5B92AACC2D314CC400486A9B /* Sargon in Frameworks */ = {isa = PBXBuildFile; productRef = 5B92AACB2D314CC400486A9B /* Sargon */; };
5B96DD372BD917B300722882 /* Text+Extra.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B96DD362BD917B300722882 /* Text+Extra.swift */; };
5B9846BD2BBD5C8800E814F3 /* SensitiveInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 5B9846BC2BBD5C8800E814F3 /* SensitiveInfo.plist */; };
5B9846C02BBD5F0800E814F3 /* SensitiveInfoClient+Interface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B9846BF2BBD5F0800E814F3 /* SensitiveInfoClient+Interface.swift */; };
Expand Down Expand Up @@ -1196,6 +1193,8 @@
A4ECE27A2BEEB01800468BF6 /* CloudBackupClient+Live.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4ECE2762BEEB01800468BF6 /* CloudBackupClient+Live.swift */; };
A4ECE27B2BEEB01800468BF6 /* CloudBackupClient+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4ECE2772BEEB01800468BF6 /* CloudBackupClient+Test.swift */; };
A4F30C942C7CA71400F983D6 /* WithNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4F30C932C7CA71400F983D6 /* WithNavigationBar.swift */; };
E622FF902CE7984B00489BA5 /* DebugFactorInstancesCacheContents+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = E622FF8F2CE7984B00489BA5 /* DebugFactorInstancesCacheContents+View.swift */; };
E622FF912CE7984B00489BA5 /* DebugFactorInstancesCacheContents.swift in Sources */ = {isa = PBXBuildFile; fileRef = E622FF8E2CE7984B00489BA5 /* DebugFactorInstancesCacheContents.swift */; };
E62449D52AFBA61100272C67 /* Home+AccountRow+Reducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E62449D32AFBA61100272C67 /* Home+AccountRow+Reducer.swift */; };
E62449D62AFBA61100272C67 /* Home+AccountRow+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = E62449D42AFBA61100272C67 /* Home+AccountRow+View.swift */; };
E62BB7632AEA856300D46DAC /* ImportMnemonicTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E62BB7622AEA856300D46DAC /* ImportMnemonicTests.swift */; };
Expand All @@ -1219,6 +1218,7 @@
E6A2D9E52AFA6C1E001857EC /* AccountWithInfoHolder.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A2D9E42AFA6C1E001857EC /* AccountWithInfoHolder.swift */; };
E6A2D9E72AFA7132001857EC /* Mnemonics+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A2D9E62AFA7132001857EC /* Mnemonics+Utils.swift */; };
E6A98FA82AE15324003953E2 /* BuildConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6A98FA72AE15324003953E2 /* BuildConfiguration.swift */; };
E6BD41012D3E4A1B00D210DF /* Sargon in Frameworks */ = {isa = PBXBuildFile; productRef = E6BD41002D3E4A1B00D210DF /* Sargon */; };
E6DBA3192ADEBFB300A38425 /* PackagesEncodingDecodingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6DBA25A2ADEBFB200A38425 /* PackagesEncodingDecodingTests.swift */; };
E6DBA31A2ADEBFB300A38425 /* DataChannelClientTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6DBA25B2ADEBFB200A38425 /* DataChannelClientTests.swift */; };
E6DBA31C2ADEBFB300A38425 /* RadixConnectE2E.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6DBA25F2ADEBFB200A38425 /* RadixConnectE2E.swift */; };
Expand Down Expand Up @@ -2473,6 +2473,8 @@
A4ECE2762BEEB01800468BF6 /* CloudBackupClient+Live.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CloudBackupClient+Live.swift"; sourceTree = "<group>"; };
A4ECE2772BEEB01800468BF6 /* CloudBackupClient+Test.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CloudBackupClient+Test.swift"; sourceTree = "<group>"; };
A4F30C932C7CA71400F983D6 /* WithNavigationBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WithNavigationBar.swift; sourceTree = "<group>"; };
E622FF8E2CE7984B00489BA5 /* DebugFactorInstancesCacheContents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DebugFactorInstancesCacheContents.swift; sourceTree = "<group>"; };
E622FF8F2CE7984B00489BA5 /* DebugFactorInstancesCacheContents+View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DebugFactorInstancesCacheContents+View.swift"; sourceTree = "<group>"; };
E62449D32AFBA61100272C67 /* Home+AccountRow+Reducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Home+AccountRow+Reducer.swift"; sourceTree = "<group>"; };
E62449D42AFBA61100272C67 /* Home+AccountRow+View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Home+AccountRow+View.swift"; sourceTree = "<group>"; };
E62BB7622AEA856300D46DAC /* ImportMnemonicTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImportMnemonicTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2610,12 +2612,12 @@
48FFFADE2ADC21F500B2B213 /* FileLogging in Frameworks */,
48FFFACF2ADC216400B2B213 /* CollectionConcurrencyKit in Frameworks */,
48FFFAB12ADC203700B2B213 /* WebRTC in Frameworks */,
48FFFB0A2ADC721800B2B213 /* Atomics in Frameworks */,
A47571FF2B29B0860059A95D /* IOSSecuritySuite in Frameworks */,
48FFFAFB2ADC241A00B2B213 /* HashTreeCollections in Frameworks */,
48FFFAC52ADC211700B2B213 /* JSONTesting in Frameworks */,
5B1C4FD52BBB0B0C00B9436F /* AppsFlyerLib-Strict in Frameworks */,
5B634A942C91D2A0004B2FBC /* ScreenshotPreventing in Frameworks */,
E6BD41012D3E4A1B00D210DF /* Sargon in Frameworks */,
48FFFA992ADC1EEC00B2B213 /* AsyncExtensions in Frameworks */,
E63D123D2ADD1FC00001CBB1 /* SwiftUIIntrospect in Frameworks */,
48FFFABC2ADC209100B2B213 /* NukeExtensions in Frameworks */,
Expand All @@ -2626,8 +2628,6 @@
48FFFAE12ADC220F00B2B213 /* Tagged in Frameworks */,
48FFFAD22ADC218400B2B213 /* Either in Frameworks */,
48FFFAA52ADC1F9600B2B213 /* AsyncAlgorithms in Frameworks */,
48FFFAA82ADC1FBE00B2B213 /* Atomics in Frameworks */,
5B92AACC2D314CC400486A9B /* Sargon in Frameworks */,
48FFFAF02ADC229900B2B213 /* AnyCodable in Frameworks */,
48FFFAF52ADC241A00B2B213 /* BitCollections in Frameworks */,
48FFFABA2ADC209100B2B213 /* Nuke in Frameworks */,
Expand Down Expand Up @@ -5434,6 +5434,7 @@
48D5F3852BD8DDB9000DE964 /* Children */ = {
isa = PBXGroup;
children = (
E6027F1F2CE797500094139A /* DebugFactorInstancesCacheContents */,
48D5F37B2BD8DDB9000DE964 /* DebugKeychainContents */,
48D5F37E2BD8DDB9000DE964 /* DebugKeychainTest */,
48D5F3812BD8DDB9000DE964 /* DebugManageFactorSourcesFeature */,
Expand Down Expand Up @@ -6479,6 +6480,15 @@
path = CloudBackupClient;
sourceTree = "<group>";
};
E6027F1F2CE797500094139A /* DebugFactorInstancesCacheContents */ = {
isa = PBXGroup;
children = (
E622FF8E2CE7984B00489BA5 /* DebugFactorInstancesCacheContents.swift */,
E622FF8F2CE7984B00489BA5 /* DebugFactorInstancesCacheContents+View.swift */,
);
path = DebugFactorInstancesCacheContents;
sourceTree = "<group>";
};
E634CA2C2AFD259000C43DB7 /* DebugKeychainContents */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -7198,7 +7208,6 @@
48FFFA9E2ADC1F2700B2B213 /* KeychainAccess */,
48FFFAA12ADC1F5D00B2B213 /* Algorithms */,
48FFFAA42ADC1F9600B2B213 /* AsyncAlgorithms */,
48FFFAA72ADC1FBE00B2B213 /* Atomics */,
48FFFAAA2ADC1FE900B2B213 /* DependenciesAdditions */,
48FFFAB02ADC203700B2B213 /* WebRTC */,
48FFFAB92ADC209100B2B213 /* Nuke */,
Expand All @@ -7221,13 +7230,12 @@
48FFFAF82ADC241A00B2B213 /* DequeModule */,
48FFFAFA2ADC241A00B2B213 /* HashTreeCollections */,
48FFFAFC2ADC241A00B2B213 /* HeapModule */,
48FFFB092ADC721800B2B213 /* Atomics */,
E63D123C2ADD1FC00001CBB1 /* SwiftUIIntrospect */,
A47571FE2B29B0860059A95D /* IOSSecuritySuite */,
A415574F2B757C5E0040AD4E /* ComposableArchitecture */,
5B1C4FD42BBB0B0C00B9436F /* AppsFlyerLib-Strict */,
5B634A932C91D2A0004B2FBC /* ScreenshotPreventing */,
5B92AACB2D314CC400486A9B /* Sargon */,
E6BD41002D3E4A1B00D210DF /* Sargon */,
);
productName = RadixWallet;
productReference = 48CFBC4F2ADC106300E77A5C /* Radix Wallet Dev.app */;
Expand Down Expand Up @@ -7268,7 +7276,6 @@
48FFFA9D2ADC1F2700B2B213 /* XCRemoteSwiftPackageReference "KeychainAccess" */,
48FFFAA02ADC1F5D00B2B213 /* XCRemoteSwiftPackageReference "swift-algorithms" */,
48FFFAA32ADC1F9600B2B213 /* XCRemoteSwiftPackageReference "swift-async-algorithms" */,
48FFFAA62ADC1FBE00B2B213 /* XCRemoteSwiftPackageReference "swift-atomics" */,
48FFFAA92ADC1FE900B2B213 /* XCRemoteSwiftPackageReference "swift-dependencies-additions" */,
48FFFAAF2ADC203700B2B213 /* XCRemoteSwiftPackageReference "WebRTC" */,
48FFFAB22ADC206300B2B213 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */,
Expand All @@ -7291,7 +7298,7 @@
5B1C4FD32BBB0B0C00B9436F /* XCRemoteSwiftPackageReference "AppsFlyerFramework-Strict" */,
8318BB172BC8403800057BCB /* XCRemoteSwiftPackageReference "swift-custom-dump" */,
5B634A922C91D2A0004B2FBC /* XCRemoteSwiftPackageReference "ScreenshotPreventing-iOS" */,
5B2A0D7E2D3559100049C702 /* XCRemoteSwiftPackageReference "sargon" */,
E6BD40FF2D3E4A1B00D210DF /* XCRemoteSwiftPackageReference "sargon" */,
);
productRefGroup = 48CFBC502ADC106300E77A5C /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -7783,6 +7790,8 @@
E775A1D22D0327BF00E72DB9 /* SelectFactorSources+Reducer.swift in Sources */,
8308184E2B9F16AD002D8351 /* TokenPriceClient+Mock.swift in Sources */,
48CFC2852ADC10D900E77A5C /* SubmitTransaction+View.swift in Sources */,
E622FF902CE7984B00489BA5 /* DebugFactorInstancesCacheContents+View.swift in Sources */,
E622FF912CE7984B00489BA5 /* DebugFactorInstancesCacheContents.swift in Sources */,
A40815632C7E0D08005E65B9 /* AccountLockerVaultCollectionItemType.swift in Sources */,
48CFC47C2ADC10DA00E77A5C /* TransportProfileClient+Test.swift in Sources */,
48CFC2C92ADC10D900E77A5C /* FungibleResourceAsset+View.swift in Sources */,
Expand Down Expand Up @@ -9192,14 +9201,6 @@
version = 0.1.0;
};
};
48FFFAA62ADC1FBE00B2B213 /* XCRemoteSwiftPackageReference "swift-atomics" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/apple/swift-atomics.git";
requirement = {
kind = exactVersion;
version = 1.1.0;
};
};
48FFFAA92ADC1FE900B2B213 /* XCRemoteSwiftPackageReference "swift-dependencies-additions" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/tgrapperon/swift-dependencies-additions";
Expand Down Expand Up @@ -9344,14 +9345,6 @@
version = 6.13.2;
};
};
5B2A0D7E2D3559100049C702 /* XCRemoteSwiftPackageReference "sargon" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/radixdlt/sargon/";
requirement = {
kind = exactVersion;
version = 1.1.106;
};
};
5B634A922C91D2A0004B2FBC /* XCRemoteSwiftPackageReference "ScreenshotPreventing-iOS" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/Sajjon/ScreenshotPreventing-iOS";
Expand Down Expand Up @@ -9384,6 +9377,14 @@
version = 1.9.11;
};
};
E6BD40FF2D3E4A1B00D210DF /* XCRemoteSwiftPackageReference "sargon" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/radixdlt/sargon";
requirement = {
kind = exactVersion;
version = 1.1.106;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand All @@ -9407,11 +9408,6 @@
package = 48FFFAA32ADC1F9600B2B213 /* XCRemoteSwiftPackageReference "swift-async-algorithms" */;
productName = AsyncAlgorithms;
};
48FFFAA72ADC1FBE00B2B213 /* Atomics */ = {
isa = XCSwiftPackageProductDependency;
package = 48FFFAA62ADC1FBE00B2B213 /* XCRemoteSwiftPackageReference "swift-atomics" */;
productName = Atomics;
};
48FFFAAA2ADC1FE900B2B213 /* DependenciesAdditions */ = {
isa = XCSwiftPackageProductDependency;
package = 48FFFAA92ADC1FE900B2B213 /* XCRemoteSwiftPackageReference "swift-dependencies-additions" */;
Expand Down Expand Up @@ -9522,11 +9518,6 @@
package = 48FFFAF32ADC241A00B2B213 /* XCRemoteSwiftPackageReference "swift-collections" */;
productName = HeapModule;
};
48FFFB092ADC721800B2B213 /* Atomics */ = {
isa = XCSwiftPackageProductDependency;
package = 48FFFAA62ADC1FBE00B2B213 /* XCRemoteSwiftPackageReference "swift-atomics" */;
productName = Atomics;
};
5B1C4FD42BBB0B0C00B9436F /* AppsFlyerLib-Strict */ = {
isa = XCSwiftPackageProductDependency;
package = 5B1C4FD32BBB0B0C00B9436F /* XCRemoteSwiftPackageReference "AppsFlyerFramework-Strict" */;
Expand All @@ -9537,10 +9528,6 @@
package = 5B634A922C91D2A0004B2FBC /* XCRemoteSwiftPackageReference "ScreenshotPreventing-iOS" */;
productName = ScreenshotPreventing;
};
5B92AACB2D314CC400486A9B /* Sargon */ = {
isa = XCSwiftPackageProductDependency;
productName = Sargon;
};
A415574F2B757C5E0040AD4E /* ComposableArchitecture */ = {
isa = XCSwiftPackageProductDependency;
package = A415574E2B757C5E0040AD4E /* XCRemoteSwiftPackageReference "swift-composable-architecture" */;
Expand All @@ -9556,6 +9543,11 @@
package = 48FFFAB22ADC206300B2B213 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */;
productName = SwiftUIIntrospect;
};
E6BD41002D3E4A1B00D210DF /* Sargon */ = {
isa = XCSwiftPackageProductDependency;
package = E6BD40FF2D3E4A1B00D210DF /* XCRemoteSwiftPackageReference "sargon" */;
productName = Sargon;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 48CFBC472ADC106300E77A5C /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "fa0ccc46105ce4506ee426a54025794ee1322cffb38f54c107e48179e492ab78",
"originHash" : "07ce6e755e876609763519b759f734223d793640b402e06aedef4571a7f65e19",
"pins" : [
{
"identity" : "anycodable",
Expand Down Expand Up @@ -135,15 +135,6 @@
"version" : "0.1.0"
}
},
{
"identity" : "swift-atomics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics.git",
"state" : {
"revision" : "6c89474e62719ddcc1e9614989fff2f68208fe10",
"version" : "1.1.0"
}
},
{
"identity" : "swift-case-paths",
"kind" : "remoteSourceControl",
Expand Down
8 changes: 7 additions & 1 deletion RadixWallet/Clients/ProfileStore/ProfileStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ extension ProfileStore {

extension ProfileStore {
func createNewProfile() async throws {
try await SargonOS.shared.newWallet(shouldPreDeriveInstances: false)
let shouldPreDeriveInstances: Bool
#if DEBUG
shouldPreDeriveInstances = true
#else
shouldPreDeriveInstances = false
#endif
return try await SargonOS.shared.newWallet(shouldPreDeriveInstances: shouldPreDeriveInstances)
}

func finishOnboarding(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#if DEBUG
import Sargon
import SwiftUI

// MARK: - DebugFactorInstancesCacheContents.View
extension DebugFactorInstancesCacheContents {
CyonAlexRDX marked this conversation as resolved.
Show resolved Hide resolved
struct View: SwiftUI.View {
let store: StoreOf<DebugFactorInstancesCacheContents>

var body: some SwiftUI.View {
WithPerceptionTracking {
VStack(spacing: .small2) {
Button("Delete Cache File") {
store.send(.view(.deleteButtonTapped))
}
.buttonStyle(.primaryRectangular(isDestructive: true))
loadable(store.factorInstances) {
ProgressView()
} successContent: { instances in
content(instances: instances)
}
}
.padding()
.navigationTitle("FactorInstances cache")
}.task {
store.send(.view(.task))
}
}

@ViewBuilder
private func content(instances: Instances) -> some SwiftUI.View {
ScrollView {
VStack(alignment: .leading) {
ForEach(Array(instances.keys), id: \.self) { (key: FactorSourceIDFromHash) in
Section {
let listOfList: [[FactorInstanceForDebugPurposes]] = instances[key]!
ForEach(listOfList, id: \.self) { (instancesForFactorForPath: [FactorInstanceForDebugPurposes]) in
if let firstInstance = instancesForFactorForPath.first {
Section {
ForEach(instancesForFactorForPath, id: \.self) { (instance: FactorInstanceForDebugPurposes) in
VStack(alignment: .leading) {
Text("Index `\(instance.derivationEntityIndex)`")

Text("PublicKey `\(String(reflecting: instance.publicKeyHex.prefix(8)))`")
}
.frame(maxWidth: .infinity)
.padding(.horizontal, .medium3)
.padding(.vertical, .small2)
.border(Color.gray, width: 1)
}
} header: {
VStack {
Text("Agnostic `\(firstInstance.indexAgnosticDerivationPath)`").font(.title)
Text("#\(instancesForFactorForPath.count) instances")
}
.padding()
}
}
}
} header: {
Text("Source `\(key.idPrefix())`")
.font(.largeTitle)
}
}
}
}
}
}
}

extension FactorSourceIDFromHash {
fileprivate func idPrefix() -> String {
String(toString().prefix(10))
}
}
#endif // DEBUG
Loading
Loading