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-3959] Factor Source Card component #1402

Merged
merged 15 commits into from
Dec 3, 2024
43 changes: 29 additions & 14 deletions RadixWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objectVersion = 60;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -541,7 +541,7 @@
48CFC5A92ADC10DA00E77A5C /* SecondaryRectangularButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFC0FB2ADC10D900E77A5C /* SecondaryRectangularButtonStyle.swift */; };
48CFC5AA2ADC10DA00E77A5C /* PrimaryRectangularButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFC0FC2ADC10D900E77A5C /* PrimaryRectangularButtonStyle.swift */; };
48CFC5AB2ADC10DA00E77A5C /* InertButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFC0FD2ADC10D900E77A5C /* InertButtonStyle.swift */; };
48CFC5AD2ADC10DA00E77A5C /* WarningView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFC1002ADC10D900E77A5C /* WarningView.swift */; };
48CFC5AD2ADC10DA00E77A5C /* StatusMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFC1002ADC10D900E77A5C /* StatusMessageView.swift */; };
48CFC5AE2ADC10DA00E77A5C /* CheckmarkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFC1012ADC10D900E77A5C /* CheckmarkView.swift */; };
48CFC5AF2ADC10DA00E77A5C /* AssetIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFC1022ADC10D900E77A5C /* AssetIcon.swift */; };
48CFC5B22ADC10DA00E77A5C /* Footer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFC1052ADC10D900E77A5C /* Footer.swift */; };
Expand Down Expand Up @@ -1263,6 +1263,8 @@
E713204C2BCD372600AE6B3C /* UnknownCaseDecodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = E713204B2BCD372600AE6B3C /* UnknownCaseDecodable.swift */; };
E75C5F342C1C1632002E3DFF /* Stage1MigrateToSargon+SignedAuthChallenge.swift in Sources */ = {isa = PBXBuildFile; fileRef = E75C5F332C1C1632002E3DFF /* Stage1MigrateToSargon+SignedAuthChallenge.swift */; };
E76645A42C23138300065D9A /* Throwable.swift in Sources */ = {isa = PBXBuildFile; fileRef = E76645A32C23138300065D9A /* Throwable.swift */; };
E775A1B82CF4CA5500E72DB9 /* FactorSourceCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = E775A1B72CF4CA5500E72DB9 /* FactorSourceCard.swift */; };
E775A1BA2CF7326000E72DB9 /* FactorSourceCard+DataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = E775A1B92CF7326000E72DB9 /* FactorSourceCard+DataSource.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 @@ -1823,7 +1825,7 @@
48CFC0FB2ADC10D900E77A5C /* SecondaryRectangularButtonStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SecondaryRectangularButtonStyle.swift; sourceTree = "<group>"; };
48CFC0FC2ADC10D900E77A5C /* PrimaryRectangularButtonStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrimaryRectangularButtonStyle.swift; sourceTree = "<group>"; };
48CFC0FD2ADC10D900E77A5C /* InertButtonStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InertButtonStyle.swift; sourceTree = "<group>"; };
48CFC1002ADC10D900E77A5C /* WarningView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WarningView.swift; sourceTree = "<group>"; };
48CFC1002ADC10D900E77A5C /* StatusMessageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusMessageView.swift; sourceTree = "<group>"; };
48CFC1012ADC10D900E77A5C /* CheckmarkView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckmarkView.swift; sourceTree = "<group>"; };
48CFC1022ADC10D900E77A5C /* AssetIcon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetIcon.swift; sourceTree = "<group>"; };
48CFC1052ADC10D900E77A5C /* Footer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Footer.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2519,6 +2521,8 @@
E713204B2BCD372600AE6B3C /* UnknownCaseDecodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnknownCaseDecodable.swift; sourceTree = "<group>"; };
E75C5F332C1C1632002E3DFF /* Stage1MigrateToSargon+SignedAuthChallenge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Stage1MigrateToSargon+SignedAuthChallenge.swift"; sourceTree = "<group>"; };
E76645A32C23138300065D9A /* Throwable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Throwable.swift; sourceTree = "<group>"; };
E775A1B72CF4CA5500E72DB9 /* FactorSourceCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FactorSourceCard.swift; sourceTree = "<group>"; };
E775A1B92CF7326000E72DB9 /* FactorSourceCard+DataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FactorSourceCard+DataSource.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 @@ -5007,7 +5011,7 @@
isa = PBXGroup;
children = (
E6FA984D2B04E3D500748F20 /* NoContentView.swift */,
48CFC1002ADC10D900E77A5C /* WarningView.swift */,
48CFC1002ADC10D900E77A5C /* StatusMessageView.swift */,
48CFC1012ADC10D900E77A5C /* CheckmarkView.swift */,
48CFC1022ADC10D900E77A5C /* AssetIcon.swift */,
48CFC1052ADC10D900E77A5C /* Footer.swift */,
Expand Down Expand Up @@ -5069,6 +5073,7 @@
isa = PBXGroup;
children = (
5B6E11462C45834C00C20F2D /* AccountCard */,
E775A1B62CF4CA0700E72DB9 /* FactorSourceCard */,
48CFC1332ADC10D900E77A5C /* LedgerRowView.swift */,
A4F30C932C7CA71400F983D6 /* WithNavigationBar.swift */,
48CFC22C2ADC10D900E77A5C /* Radix+Dashboard.swift */,
Expand Down Expand Up @@ -6959,6 +6964,15 @@
path = EditPersonaAddEntryKinds;
sourceTree = "<group>";
};
E775A1B62CF4CA0700E72DB9 /* FactorSourceCard */ = {
isa = PBXGroup;
children = (
E775A1B72CF4CA5500E72DB9 /* FactorSourceCard.swift */,
E775A1B92CF7326000E72DB9 /* FactorSourceCard+DataSource.swift */,
);
path = FactorSourceCard;
sourceTree = "<group>";
};
E79DD1B42CE492E800B1EB86 /* DeleteAccount */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -7163,7 +7177,7 @@
8318BB172BC8403800057BCB /* XCRemoteSwiftPackageReference "swift-custom-dump" */,
E6A0B0492BF23C7000617DAC /* XCRemoteSwiftPackageReference "swift-identified-collections" */,
5B634A922C91D2A0004B2FBC /* XCRemoteSwiftPackageReference "ScreenshotPreventing-iOS" */,
E79DD1C72CEE08BA00B1EB86 /* XCRemoteSwiftPackageReference "sargon" */,
E775A1BB2CF9C09500E72DB9 /* XCLocalSwiftPackageReference "../sargon" */,
);
productRefGroup = 48CFBC502ADC106300E77A5C /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -7528,6 +7542,7 @@
5B4A1ABB2CBFEBB000679EE6 /* ProofOfOwnership.swift in Sources */,
48CFC3252ADC10D900E77A5C /* LocalNetworkPermission+View.swift in Sources */,
A40815B32C7E0D08005E65B9 /* NativeResourceMultiResourcePoolUnitValue.swift in Sources */,
E775A1B82CF4CA5500E72DB9 /* FactorSourceCard.swift in Sources */,
48CFC5D82ADC10DA00E77A5C /* TextStyleModifier.swift in Sources */,
A40816052C7E0D08005E65B9 /* StateEntityDetailsRequest.swift in Sources */,
48CFC6942ADC10DB00E77A5C /* MigratedSoftwareAccounts.swift in Sources */,
Expand Down Expand Up @@ -7945,6 +7960,7 @@
A408165E2C7E0D08005E65B9 /* ValidatorCollectionItemEffectiveFeeFactorCurrent.swift in Sources */,
484161472BCAD2D700D2B644 /* Stage1MigrateToSargon+HierarchicalDeterministicPublicKey.swift in Sources */,
48CFC3762ADC10D900E77A5C /* ValidatorStakeView.swift in Sources */,
E775A1BA2CF7326000E72DB9 /* FactorSourceCard+DataSource.swift in Sources */,
48CFC4612ADC10DA00E77A5C /* MakeTransactionHeaderInput.swift in Sources */,
5B8433AA2CD0131B00CA00F5 /* PreAuthorizationFailure.swift in Sources */,
A40815C62C7E0D08005E65B9 /* NonFungibleResourcesCollectionItemVaultAggregatedVault.swift in Sources */,
Expand Down Expand Up @@ -8098,7 +8114,7 @@
48CFC2642ADC10D900E77A5C /* EditPersona.swift in Sources */,
831F0CF62C294C0D00D6F5BF /* DeepLinkHandlerClient+Test.swift in Sources */,
5BBC7DA42C3D442800B04BD6 /* URLRequest+Extra.swift in Sources */,
48CFC5AD2ADC10DA00E77A5C /* WarningView.swift in Sources */,
48CFC5AD2ADC10DA00E77A5C /* StatusMessageView.swift in Sources */,
48CFC5982ADC10DA00E77A5C /* ControlState.swift in Sources */,
A41266F92B160F4C00EA38E9 /* ManualAccountRecoveryCoordinator+View.swift in Sources */,
A43F1E232BC72884001DD3FA /* AnyRange.swift in Sources */,
Expand Down Expand Up @@ -9001,6 +9017,13 @@
};
/* End XCConfigurationList section */

/* Begin XCLocalSwiftPackageReference section */
E775A1BB2CF9C09500E72DB9 /* XCLocalSwiftPackageReference "../sargon" */ = {
danvleju-rdx marked this conversation as resolved.
Show resolved Hide resolved
isa = XCLocalSwiftPackageReference;
relativePath = ../sargon;
};
/* End XCLocalSwiftPackageReference section */

/* Begin XCRemoteSwiftPackageReference section */
48FFFA972ADC1EEC00B2B213 /* XCRemoteSwiftPackageReference "AsyncExtensions" */ = {
isa = XCRemoteSwiftPackageReference;
Expand Down Expand Up @@ -9274,14 +9297,6 @@
version = 1.0.2;
};
};
E79DD1C72CEE08BA00B1EB86 /* XCRemoteSwiftPackageReference "sargon" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/radixdlt/sargon";
requirement = {
kind = exactVersion;
version = 1.1.68;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "7d3590b225945abb1bc0ab6c684b005c28c64bdc204afcc2d34c3e379ef8a3c8",
"originHash" : "1d033d2d9728e181322e687c87550e30c6bcdac33f59fe631e1e37780502d076",
"pins" : [
{
"identity" : "anycodable",
Expand Down Expand Up @@ -109,15 +109,6 @@
"version" : "11.6.4"
}
},
{
"identity" : "sargon",
"kind" : "remoteSourceControl",
"location" : "https://github.com/radixdlt/sargon",
"state" : {
"revision" : "18dd3e2bc0c4ea8ceafb2c9bd73af78ce1578e0b",
"version" : "1.1.68"
}
},
{
"identity" : "screenshotpreventing-ios",
"kind" : "remoteSourceControl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ extension DeviceFactorSourceClient {
}
let curve = factorInstance.publicKey.curve

loggerGlobal.debug("🔏 Signing data with device, with entity=\(entity.displayName), curve=\(curve), factor source hint.name=\(deviceFactorSource.hint.name), hint.model=\(deviceFactorSource.hint.model)")
loggerGlobal.debug("🔏 Signing data with device, with entity=\(entity.displayName), curve=\(curve), factor source hint.label=\(deviceFactorSource.hint.label), hint.deviceName=\(deviceFactorSource.hint.deviceName), hint.model=\(deviceFactorSource.hint.model)")

let signatureWithPublicKey = try await self.signatureFromOnDeviceHD(SignatureFromOnDeviceHDRequest(
mnemonicWithPassphrase: loadedMnemonicWithPassphrase,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ extension FactorSourceKind: Comparable {
case .offDeviceMnemonic: 2
case .securityQuestions: 3
case .trustedContact: 4
case .passphrase: 5
case .password: 5
// we want to sign with device last, since it would allow for us to stop using
// ephemeral notary and allow us to implement a AutoPurgingMnemonicCache which
// deletes items after 1 sec, thus `device` must come last.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ extension LedgerHardwareWalletFactorSource {
}

return P2P.LedgerHardwareWallet.LedgerDevice(
name: NonEmptyString(maybeString: hint.name),
name: NonEmptyString(maybeString: hint.label),
id: id.body.data.data.hex,
model: model
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ extension SecureStorageClient: DependencyKey {
accessibility: mostSecureAccesibilityAndAuthenticationPolicy.accessibility,
authenticationPolicy: mostSecureAccesibilityAndAuthenticationPolicy.authenticationPolicy,
label: importantKeychainIdentifier("Radix Wallet Factor Secret")!,
comment: .init("Created on \(factorSource.hint.name) \(factorSource.supportsOlympia ? " (Olympia)" : "")")
comment: .init("Created on \(factorSource.hint.deviceName) \(factorSource.supportsOlympia ? " (Olympia)" : "")")
)
)
}
Expand Down
19 changes: 10 additions & 9 deletions RadixWallet/Core/DesignSystem/Components/PlainListRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ struct PlainListRowCore: View {
private extension PlainListRowCore.ViewState {
var titleTextStyle: TextStyle {
switch context {
case .toggle, .settings, .dappAndPersona:
case .toggle, .settings, .dappAndPersona, .compactPersona:
.body1Header
case .hiddenPersona:
.body1HighImportance
Expand All @@ -203,7 +203,7 @@ private extension PlainListRowCore.ViewState {
switch context {
case .toggle, .hiddenPersona:
.body2Regular
case .settings, .dappAndPersona:
case .settings, .dappAndPersona, .compactPersona:
detail == nil ? .body1Regular : .body2Regular
}
}
Expand All @@ -212,14 +212,14 @@ private extension PlainListRowCore.ViewState {
switch context {
case .toggle, .hiddenPersona:
.app.gray2
case .settings, .dappAndPersona:
case .settings, .dappAndPersona, .compactPersona:
.app.gray1
}
}

var titleLineLimit: Int? {
switch context {
case .settings, .dappAndPersona, .hiddenPersona:
case .settings, .dappAndPersona, .hiddenPersona, .compactPersona:
1
case .toggle:
nil
Expand All @@ -228,7 +228,7 @@ private extension PlainListRowCore.ViewState {

var subtitleLineLimit: Int {
switch context {
case .toggle, .hiddenPersona:
case .toggle, .hiddenPersona, .compactPersona:
2
case .settings, .dappAndPersona:
3
Expand All @@ -241,16 +241,16 @@ private extension PlainListRowCore.ViewState {
.zero
case .settings:
.medium1
case .dappAndPersona:
.medium3
case .hiddenPersona:
case .dappAndPersona, .hiddenPersona:
.medium3
case .compactPersona:
.small1
}
}

var horizontalPadding: CGFloat {
switch context {
case .toggle, .settings, .hiddenPersona:
case .toggle, .settings, .hiddenPersona, .compactPersona:
.medium3
case .dappAndPersona:
.medium1
Expand All @@ -265,6 +265,7 @@ extension PlainListRowCore.ViewState {
case toggle
case dappAndPersona
case hiddenPersona
case compactPersona
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// MARK: - WarningErrorView
struct WarningErrorView: View {
// MARK: - StatusMessageView
struct StatusMessageView: View {
let text: String
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

let type: ViewType
let spacing: CGFloat
Expand All @@ -20,11 +20,12 @@ struct WarningErrorView: View {
enum ViewType {
case warning
case error
case success
}

var body: some View {
HStack(spacing: spacing) {
Image(.error)
Image(icon)
Text(text)
.lineSpacing(-.small3)
.textStyle(textStyle)
Expand All @@ -33,20 +34,31 @@ struct WarningErrorView: View {
.foregroundColor(color)
}

var icon: ImageResource {
switch type {
case .warning, .error:
.error
case .success:
.checkCircleOutline
}
}

var color: Color {
switch type {
case .warning:
.app.alert
case .error:
.app.red1
case .success:
.app.green1
}
}
}

extension WarningErrorView {
extension StatusMessageView {
static func transactionIntroducesNewAccount() -> some View {
HStack(alignment: .center, spacing: .small1) {
WarningErrorView(text: L10n.TransactionReview.FeePayerValidation.linksNewAccount, type: .warning)
StatusMessageView(text: L10n.TransactionReview.FeePayerValidation.linksNewAccount, type: .warning)
InfoButton(.payingaccount)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct EntitySecurityProblemsView: SwiftUI.View {
case .account:
AccountBannerView(kind: .securityProblem(message: problem.accountCard))
case .persona:
WarningErrorView(text: problem.personas, type: .warning, useNarrowSpacing: true)
StatusMessageView(text: problem.personas, type: .warning, useNarrowSpacing: true)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.bottom, .small3)
}
Expand Down
Loading
Loading