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-3479] Link Connector updates #1198

Merged
merged 4 commits into from
Jul 4, 2024
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
16 changes: 8 additions & 8 deletions RadixWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@
48CFC3282ADC10D900E77A5C /* ScanQRCoordinator+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFBDD92ADC10D800E77A5C /* ScanQRCoordinator+View.swift */; };
48CFC3292ADC10D900E77A5C /* CameraPermission+Reducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFBDDC2ADC10D800E77A5C /* CameraPermission+Reducer.swift */; };
48CFC32A2ADC10D900E77A5C /* CameraPermission+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFBDDD2ADC10D800E77A5C /* CameraPermission+View.swift */; };
48CFC32B2ADC10D900E77A5C /* DoScanQR+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFBDDF2ADC10D800E77A5C /* DoScanQR+View.swift */; };
48CFC32C2ADC10D900E77A5C /* DoScanQR+Reducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFBDE02ADC10D800E77A5C /* DoScanQR+Reducer.swift */; };
48CFC32B2ADC10D900E77A5C /* ScanQR+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFBDDF2ADC10D800E77A5C /* ScanQR+View.swift */; };
48CFC32C2ADC10D900E77A5C /* ScanQR+Reducer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFBDE02ADC10D800E77A5C /* ScanQR+Reducer.swift */; };
48CFC3302ADC10D900E77A5C /* ImportMnemonicWord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFBDE72ADC10D800E77A5C /* ImportMnemonicWord.swift */; };
48CFC3312ADC10D900E77A5C /* ImportMnemonicWord+View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFBDE82ADC10D800E77A5C /* ImportMnemonicWord+View.swift */; };
48CFC3322ADC10D900E77A5C /* ImportMnemonic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48CFBDE92ADC10D800E77A5C /* ImportMnemonic.swift */; };
Expand Down Expand Up @@ -1415,8 +1415,8 @@
48CFBDD92ADC10D800E77A5C /* ScanQRCoordinator+View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ScanQRCoordinator+View.swift"; sourceTree = "<group>"; };
48CFBDDC2ADC10D800E77A5C /* CameraPermission+Reducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CameraPermission+Reducer.swift"; sourceTree = "<group>"; };
48CFBDDD2ADC10D800E77A5C /* CameraPermission+View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CameraPermission+View.swift"; sourceTree = "<group>"; };
48CFBDDF2ADC10D800E77A5C /* DoScanQR+View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DoScanQR+View.swift"; sourceTree = "<group>"; };
48CFBDE02ADC10D800E77A5C /* DoScanQR+Reducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "DoScanQR+Reducer.swift"; sourceTree = "<group>"; };
48CFBDDF2ADC10D800E77A5C /* ScanQR+View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ScanQR+View.swift"; sourceTree = "<group>"; };
48CFBDE02ADC10D800E77A5C /* ScanQR+Reducer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ScanQR+Reducer.swift"; sourceTree = "<group>"; };
48CFBDE72ADC10D800E77A5C /* ImportMnemonicWord.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImportMnemonicWord.swift; sourceTree = "<group>"; };
48CFBDE82ADC10D800E77A5C /* ImportMnemonicWord+View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ImportMnemonicWord+View.swift"; sourceTree = "<group>"; };
48CFBDE92ADC10D800E77A5C /* ImportMnemonic.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImportMnemonic.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3599,8 +3599,8 @@
48CFBDDE2ADC10D800E77A5C /* ScanQR */ = {
isa = PBXGroup;
children = (
48CFBDDF2ADC10D800E77A5C /* DoScanQR+View.swift */,
48CFBDE02ADC10D800E77A5C /* DoScanQR+Reducer.swift */,
48CFBDDF2ADC10D800E77A5C /* ScanQR+View.swift */,
48CFBDE02ADC10D800E77A5C /* ScanQR+Reducer.swift */,
);
path = ScanQR;
sourceTree = "<group>";
Expand Down Expand Up @@ -7479,7 +7479,7 @@
831F0CF42C294BAA00D6F5BF /* DeepLinkHandlerClient+Live.swift in Sources */,
48CFC5602ADC10DA00E77A5C /* ValidationErrorsAtPath.swift in Sources */,
48CFC4452ADC10DA00E77A5C /* OnboardingClient+Test.swift in Sources */,
48CFC32C2ADC10D900E77A5C /* DoScanQR+Reducer.swift in Sources */,
48CFC32C2ADC10D900E77A5C /* ScanQR+Reducer.swift in Sources */,
48CFC37A2ADC10D900E77A5C /* PoolUnitDetails.swift in Sources */,
83EE47A02AF0EECD00155F03 /* TransactionNonFungibleBalanceChanges.swift in Sources */,
48CFC28E2ADC10D900E77A5C /* TransactionReviewRawTransaction.swift in Sources */,
Expand Down Expand Up @@ -7733,7 +7733,7 @@
48CFC4982ADC10DA00E77A5C /* MetadataUrlValue.swift in Sources */,
83EE48DE2B8F4081006CE672 /* AccountPortfoliosClient+State.swift in Sources */,
48CFC41E2ADC10DA00E77A5C /* NonEmpty+Extra.swift in Sources */,
48CFC32B2ADC10D900E77A5C /* DoScanQR+View.swift in Sources */,
48CFC32B2ADC10D900E77A5C /* ScanQR+View.swift in Sources */,
48CFC42B2ADC10DA00E77A5C /* Identifiable+RawRepresentable.swift in Sources */,
48D5F3902BD8DDB9000DE964 /* DebugUserDefaultsContents.swift in Sources */,
83EE47852AF0EE3C00155F03 /* ProgrammaticScryptoSborValueString.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public struct ChooseReceivingAccount: Sendable, FeatureReducer {
public func reduce(into state: inout State, viewAction: ViewAction) -> Effect<Action> {
switch viewAction {
case .scanQRCode:
state.destination = .scanAccountAddress(.init(scanInstructions: L10n.AssetTransfer.qrScanInstructions))
state.destination = .scanAccountAddress(.init(kind: .account))
return .none

case .closeButtonTapped:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,7 @@ public struct NewConnection: Sendable, FeatureReducer {
switch childAction {
case let .root(.localNetworkPermission(.delegate(.permissionResponse(allowed)))):
if allowed {
let string = L10n.LinkedConnectors.NewConnection.subtitle
state.root = .scanQR(.init(scanInstructions: string))
state.root = .scanQR(.init(kind: .connectorExtension))
return .none
} else {
return .run { _ in
Expand Down Expand Up @@ -235,8 +234,7 @@ public struct NewConnection: Sendable, FeatureReducer {
case let .approveExisitingConnection(connectionName):
return .send(.internal(.establishConnection(connectionName)))
case .approveRelinkAfterProfileRestore, .approveRelinkAfterUpdate:
let string = L10n.LinkedConnectors.NewConnection.subtitle
state.root = .scanQR(.init(scanInstructions: string))
state.root = .scanQR(.init(kind: .connectorExtension))
return .none
}

Expand Down
152 changes: 0 additions & 152 deletions RadixWallet/Features/ScanQR/Children/ScanQR/DoScanQR+View.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,33 @@ import SwiftUI

// MARK: - ScanQR
public struct ScanQR: Sendable, FeatureReducer {
@ObservableState
public struct State: Sendable, Hashable {
public let scanInstructions: String
public let scanMode: QRScanMode
public let kind: Kind
#if targetEnvironment(simulator)
public var manualQRContent: String

public init(
scanInstructions: String,
scanMode: QRScanMode = .default,
kind: Kind,
manualQRContent: String = ""
) {
self.scanInstructions = scanInstructions
self.scanMode = scanMode
self.kind = kind
self.manualQRContent = manualQRContent
}
#else
public init(
scanInstructions: String,
scanMode: QRScanMode = .default
kind: Kind
) {
self.scanInstructions = scanInstructions
self.scanMode = scanMode
self.kind = kind
}
#endif // sim
}

@CasePathable
public enum ViewAction: Sendable, Equatable {
case scanned(TaskResult<String>)
#if targetEnvironment(simulator)
case macInputQRContentChanged(String)
case manualQRContentChanged(String)
case macConnectButtonTapped
#endif // sim
}
Expand All @@ -48,7 +45,7 @@ public struct ScanQR: Sendable, FeatureReducer {
public func reduce(into state: inout State, viewAction: ViewAction) -> Effect<Action> {
switch viewAction {
#if targetEnvironment(simulator)
case let .macInputQRContentChanged(manualQRContent):
case let .manualQRContentChanged(manualQRContent):
state.manualQRContent = manualQRContent
return .none

Expand All @@ -65,3 +62,12 @@ public struct ScanQR: Sendable, FeatureReducer {
}
}
}

// MARK: ScanQR.Kind
extension ScanQR {
public enum Kind: Sendable, Hashable {
case connectorExtension
case account
case importOlympia
}
}
Loading
Loading