Skip to content

Commit

Permalink
Rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kugel3 committed Jun 2, 2023
1 parent 9d71bb0 commit 4d960cc
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ extension LedgerHardwareWalletFactorSource {
throw UnrecognizedLedgerModel(model: hint.model.rawValue)
}
return P2P.LedgerHardwareWallet.LedgerDevice(
name: NonEmptyString(maybeString: self.hint.name.rawValue),
name: NonEmptyString(maybeString: hint.name),
id: Data(id.hexCodable.data.dropFirst()).hex, // Connector Extension only cares about the hash not the factor source ID prefix.
model: model
)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Core/FeaturePrelude/LedgerRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public struct LedgerRowView: View {
let lastUsedOn: Date

public init(factorSource: LedgerHardwareWalletFactorSource) {
self.description = factorSource.hint.name.rawValue
self.description = factorSource.hint.name
self.addedOn = factorSource.addedOn
self.lastUsedOn = factorSource.lastUsedOn
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ extension LedgerHardwareWalletFactorSource {
) throws -> Self {
try Self.model(
.init(model: device.model),
name: .init(rawValue: name),
name: name,
deviceID: device.id
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public struct DeviceFactorSouceView: View {
public struct LedgerFactorSourceView: View {
public let ledgerFactorSource: LedgerHardwareWalletFactorSource
public var body: some View {
Labeled("Name", value: ledgerFactorSource.hint.name.rawValue)
Labeled("Name", value: ledgerFactorSource.hint.name)
Labeled("Model", value: ledgerFactorSource.hint.model.rawValue)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ extension DerivePublicKeys.State {
extension DerivePublicKeys {
public struct ViewState: Equatable {
public let ledger: LedgerHardwareWalletFactorSource?
public let purpose: UseLedgerView.Purpose
}

@MainActor
Expand All @@ -26,7 +25,7 @@ extension DerivePublicKeys {
WithViewStore(store, observe: \.viewState, send: { .view($0) }) { viewStore in
Group {
if let ledger = viewStore.ledger {
Text(ledger.name)
Text(ledger.hint.name)
.border(.green)
} else {
Color.white
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public struct ImportOlympiaLedgerAccountsAndFactorSources: Sendable, FeatureRedu
_ state: State
) -> EffectTask<Action> {
loggerGlobal.notice("Converting hardware accounts to babylon...")
let ledgerName = ledger.hint.name.rawValue
let ledgerName = ledger.hint.name

let model = ledger.hint.model

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ extension SignWithFactorSourcesOfKindLedger.State {
}

// MARK: - SignWithFactorSourcesOfKindLedger.View

extension SignWithFactorSourcesOfKindLedger {
public struct ViewState: Equatable {
let currentSigningFactor: SigningFactor?

var ledger: LedgerHardwareWalletFactorSource? {
currentSigningFactor.flatMap {
currentSigningFactor.factorSource.extract(LedgerHardwareWalletFactorSource.self)
}
currentSigningFactor.flatMap { $0.factorSource.extract() }
}
}

Expand Down Expand Up @@ -59,8 +58,10 @@ extension SignWithFactorSourcesOfKindLedger {
.frame(.smallest)
.padding(.trailing, .small1)

Text(ledger.name)
Text(ledger.hint.name)
.minimumScaleFactor(0.7)
.textStyle(.secondaryHeader)
.foregroundColor(.app.gray1)
}
.padding(.horizontal, .medium2)
.padding(.vertical, .medium3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,16 @@ extension LedgerHardwareWalletFactorSource {
// MARK: LedgerHardwareWalletFactorSource.Hint
extension LedgerHardwareWalletFactorSource {
public struct Hint: Sendable, Hashable, Codable {
public typealias Name = Tagged<(Self, name: ()), String>
public typealias Model = LedgerHardwareWalletFactorSource.DeviceModel

/// "Orange, scratched"
public let name: Name
public let name: String

/// "nanoS+"
public let model: Model

public init(
name: Name,
name: String,
model: Model
) {
self.name = name
Expand Down Expand Up @@ -69,7 +68,7 @@ extension LedgerHardwareWalletFactorSource {
/// Ledger model, name and `deviceID` (hash of public key)
public static func model(
_ model: DeviceModel,
name: Hint.Name,
name: String,
deviceID: HexCodable32Bytes
) throws -> Self {
try .init(
Expand Down

0 comments on commit 4d960cc

Please sign in to comment.