[#1058] Cleanup dependency injection in reducers
- All work here is just cleanup of obsolete dependency injection. #981 introduced a brand new approach of DI for token name and SDK constants. That allowed me to deliver expected values directly in the TCA fashion so all reducers no longer needed those values to be passed via initializers.
This commit is contained in:
parent
48536e5fa0
commit
9b683651cf
|
@ -112,6 +112,7 @@ let package = Package(
|
|||
"UIComponents",
|
||||
"Utils",
|
||||
"WalletStorage",
|
||||
"ZcashSDKEnvironment",
|
||||
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
|
||||
.product(name: "ZcashLightClientKit", package: "ZcashLightClientKit")
|
||||
],
|
||||
|
@ -322,6 +323,7 @@ let package = Package(
|
|||
"RestoreWalletStorage",
|
||||
"UIComponents",
|
||||
"Utils",
|
||||
"ZcashSDKEnvironment",
|
||||
.product(name: "ComposableArchitecture", package: "swift-composable-architecture")
|
||||
],
|
||||
path: "Sources/Features/PrivateDataConsent"
|
||||
|
@ -410,6 +412,7 @@ let package = Package(
|
|||
"URIParser",
|
||||
"UIComponents",
|
||||
"Utils",
|
||||
"ZcashSDKEnvironment",
|
||||
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
|
||||
.product(name: "ZcashLightClientKit", package: "ZcashLightClientKit")
|
||||
],
|
||||
|
|
|
@ -16,8 +16,6 @@ public typealias AddressDetailsStore = Store<AddressDetailsReducer.State, Addres
|
|||
public typealias AddressDetailsViewStore = ViewStore<AddressDetailsReducer.State, AddressDetailsReducer.Action>
|
||||
|
||||
public struct AddressDetailsReducer: Reducer {
|
||||
let networkType: NetworkType
|
||||
|
||||
public struct State: Equatable {
|
||||
public var addressToShare: RedactableString?
|
||||
public var uAddress: UnifiedAddress?
|
||||
|
@ -61,9 +59,7 @@ public struct AddressDetailsReducer: Reducer {
|
|||
|
||||
@Dependency(\.pasteboard) var pasteboard
|
||||
|
||||
public init(networkType: NetworkType) {
|
||||
self.networkType = networkType
|
||||
}
|
||||
public init() { }
|
||||
|
||||
public func reduce(into state: inout State, action: Action) -> ComposableArchitecture.Effect<Action> {
|
||||
switch action {
|
||||
|
@ -98,6 +94,6 @@ extension AddressDetailsStore {
|
|||
public static let placeholder = AddressDetailsStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
AddressDetailsReducer(networkType: .testnet)
|
||||
AddressDetailsReducer()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,13 +18,13 @@ import SDKSynchronizer
|
|||
import Models
|
||||
import SyncProgress
|
||||
import RestoreWalletStorage
|
||||
import ZcashSDKEnvironment
|
||||
|
||||
public typealias BalanceBreakdownStore = Store<BalanceBreakdownReducer.State, BalanceBreakdownReducer.Action>
|
||||
public typealias BalanceBreakdownViewStore = ViewStore<BalanceBreakdownReducer.State, BalanceBreakdownReducer.Action>
|
||||
|
||||
public struct BalanceBreakdownReducer: Reducer {
|
||||
private enum CancelId { case timer }
|
||||
let networkType: NetworkType
|
||||
|
||||
public struct State: Equatable {
|
||||
@PresentationState public var alert: AlertState<Action>?
|
||||
|
@ -93,10 +93,9 @@ public struct BalanceBreakdownReducer: Reducer {
|
|||
@Dependency(\.restoreWalletStorage) var restoreWalletStorage
|
||||
@Dependency(\.sdkSynchronizer) var sdkSynchronizer
|
||||
@Dependency(\.walletStorage) var walletStorage
|
||||
@Dependency(\.zcashSDKEnvironment) var zcashSDKEnvironment
|
||||
|
||||
public init(networkType: NetworkType) {
|
||||
self.networkType = networkType
|
||||
}
|
||||
public init() { }
|
||||
|
||||
public var body: some Reducer<State, Action> {
|
||||
Scope(state: \.syncProgressState, action: /Action.syncProgress) {
|
||||
|
@ -143,7 +142,7 @@ public struct BalanceBreakdownReducer: Reducer {
|
|||
do {
|
||||
let storedWallet = try walletStorage.exportWallet()
|
||||
let seedBytes = try mnemonic.toSeed(storedWallet.seedPhrase.value())
|
||||
let spendingKey = try derivationTool.deriveSpendingKey(seedBytes, 0, networkType)
|
||||
let spendingKey = try derivationTool.deriveSpendingKey(seedBytes, 0, zcashSDKEnvironment.network.networkType)
|
||||
|
||||
let transaction = try await sdkSynchronizer.shieldFunds(spendingKey, Memo(string: ""), state.autoShieldingThreshold)
|
||||
|
||||
|
@ -224,6 +223,6 @@ extension BalanceBreakdownStore {
|
|||
public static let placeholder = BalanceBreakdownStore(
|
||||
initialState: .placeholder
|
||||
) {
|
||||
BalanceBreakdownReducer(networkType: .testnet)
|
||||
BalanceBreakdownReducer()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -278,7 +278,7 @@ extension BalanceBreakdownView {
|
|||
transparentBalance: Zatoshi(25_234_778)
|
||||
)
|
||||
) {
|
||||
BalanceBreakdownReducer(networkType: .testnet)
|
||||
BalanceBreakdownReducer()
|
||||
},
|
||||
tokenName: "ZEC"
|
||||
)
|
||||
|
|
|
@ -20,7 +20,6 @@ public typealias HomeViewStore = ViewStore<HomeReducer.State, HomeReducer.Action
|
|||
public struct HomeReducer: Reducer {
|
||||
private enum CancelStateId { case timer }
|
||||
private enum CancelEventId { case timer }
|
||||
let networkType: NetworkType
|
||||
|
||||
public struct State: Equatable {
|
||||
public enum Destination: Equatable {
|
||||
|
@ -109,9 +108,7 @@ public struct HomeReducer: Reducer {
|
|||
@Dependency(\.sdkSynchronizer) var sdkSynchronizer
|
||||
@Dependency(\.zcashSDKEnvironment) var zcashSDKEnvironment
|
||||
|
||||
public init(networkType: NetworkType) {
|
||||
self.networkType = networkType
|
||||
}
|
||||
public init() { }
|
||||
|
||||
public var body: some Reducer<State, Action> {
|
||||
Scope(state: \.transactionListState, action: /Action.transactionList) {
|
||||
|
@ -303,7 +300,7 @@ extension HomeStore {
|
|||
HomeStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
HomeReducer(networkType: .testnet)
|
||||
HomeReducer()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -320,7 +317,7 @@ extension HomeStore {
|
|||
walletConfig: .initial
|
||||
)
|
||||
) {
|
||||
HomeReducer(networkType: .testnet)
|
||||
HomeReducer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ struct HomeView_Previews: PreviewProvider {
|
|||
walletConfig: .initial
|
||||
)
|
||||
) {
|
||||
HomeReducer(networkType: .testnet)
|
||||
HomeReducer()
|
||||
},
|
||||
tokenName: "ZEC"
|
||||
)
|
||||
|
|
|
@ -18,8 +18,6 @@ public typealias ImportWalletStore = Store<ImportWalletReducer.State, ImportWall
|
|||
public typealias ImportWalletViewStore = ViewStore<ImportWalletReducer.State, ImportWalletReducer.Action>
|
||||
|
||||
public struct ImportWalletReducer: Reducer {
|
||||
let saplingActivationHeight: BlockHeight
|
||||
|
||||
public struct State: Equatable {
|
||||
public enum Destination: Equatable {
|
||||
case birthday
|
||||
|
@ -87,9 +85,7 @@ public struct ImportWalletReducer: Reducer {
|
|||
@Dependency(\.walletStorage) var walletStorage
|
||||
@Dependency(\.zcashSDKEnvironment) var zcashSDKEnvironment
|
||||
|
||||
public init(saplingActivationHeight: BlockHeight) {
|
||||
self.saplingActivationHeight = saplingActivationHeight
|
||||
}
|
||||
public init() { }
|
||||
|
||||
public var body: some Reducer<State, Action> {
|
||||
Reduce { state, action in
|
||||
|
@ -113,7 +109,7 @@ public struct ImportWalletReducer: Reducer {
|
|||
return .none
|
||||
|
||||
case .birthdayInputChanged(let redactedBirthday):
|
||||
let saplingActivation = saplingActivationHeight
|
||||
let saplingActivation = zcashSDKEnvironment.network.constants.saplingActivationHeight
|
||||
|
||||
state.birthdayHeight = redactedBirthday
|
||||
|
||||
|
@ -141,7 +137,7 @@ public struct ImportWalletReducer: Reducer {
|
|||
|
||||
// store it to the keychain, if the user did not input a height,
|
||||
// fall back to sapling activation
|
||||
let birthday = state.birthdayHeightValue ?? saplingActivationHeight.redacted
|
||||
let birthday = state.birthdayHeightValue ?? zcashSDKEnvironment.network.constants.saplingActivationHeight.redacted
|
||||
|
||||
try walletStorage.importWallet(state.importedSeedPhrase.data, birthday.data, .english, false)
|
||||
|
||||
|
@ -232,6 +228,6 @@ extension ImportWalletStore {
|
|||
public static let demo = Store(
|
||||
initialState: .initial
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 0)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,6 @@ public typealias OnboardingFlowStore = Store<OnboardingFlowReducer.State, Onboar
|
|||
public typealias OnboardingFlowViewStore = ViewStore<OnboardingFlowReducer.State, OnboardingFlowReducer.Action>
|
||||
|
||||
public struct OnboardingFlowReducer: Reducer {
|
||||
let saplingActivationHeight: BlockHeight
|
||||
let zcashNetwork: ZcashNetwork
|
||||
|
||||
public struct State: Equatable {
|
||||
public enum Destination: Equatable, CaseIterable {
|
||||
case createNewWallet
|
||||
|
@ -54,18 +51,15 @@ public struct OnboardingFlowReducer: Reducer {
|
|||
case updateDestination(OnboardingFlowReducer.State.Destination?)
|
||||
}
|
||||
|
||||
public init(saplingActivationHeight: BlockHeight, zcashNetwork: ZcashNetwork) {
|
||||
self.saplingActivationHeight = saplingActivationHeight
|
||||
self.zcashNetwork = zcashNetwork
|
||||
}
|
||||
public init() { }
|
||||
|
||||
public var body: some Reducer<State, Action> {
|
||||
Scope(state: \.importWalletState, action: /Action.importWallet) {
|
||||
ImportWalletReducer(saplingActivationHeight: saplingActivationHeight)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
Scope(state: \.securityWarningState, action: /Action.securityWarning) {
|
||||
SecurityWarningReducer(zcashNetwork: zcashNetwork)
|
||||
SecurityWarningReducer()
|
||||
}
|
||||
|
||||
Reduce { state, action in
|
||||
|
|
|
@ -85,10 +85,7 @@ public struct PlainOnboardingView: View {
|
|||
securityWarningState: .initial
|
||||
)
|
||||
) {
|
||||
OnboardingFlowReducer(
|
||||
saplingActivationHeight: 0,
|
||||
zcashNetwork: ZcashNetworkBuilder.network(for: .testnet)
|
||||
)
|
||||
OnboardingFlowReducer()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
@ -16,13 +16,12 @@ import ExportLogs
|
|||
import DatabaseFiles
|
||||
import ExportLogs
|
||||
import RestoreWalletStorage
|
||||
import ZcashSDKEnvironment
|
||||
|
||||
public typealias PrivateDataConsentStore = Store<PrivateDataConsentReducer.State, PrivateDataConsentReducer.Action>
|
||||
public typealias PrivateDataConsentViewStore = ViewStore<PrivateDataConsentReducer.State, PrivateDataConsentReducer.Action>
|
||||
|
||||
public struct PrivateDataConsentReducer: Reducer {
|
||||
let networkType: NetworkType
|
||||
|
||||
public struct State: Equatable {
|
||||
public var exportBinding: Bool
|
||||
public var exportOnlyLogs = true
|
||||
|
@ -75,12 +74,11 @@ public struct PrivateDataConsentReducer: Reducer {
|
|||
case shareFinished
|
||||
}
|
||||
|
||||
public init(networkType: NetworkType) {
|
||||
self.networkType = networkType
|
||||
}
|
||||
public init() { }
|
||||
|
||||
@Dependency(\.databaseFiles) var databaseFiles
|
||||
@Dependency(\.restoreWalletStorage) var restoreWalletStorage
|
||||
@Dependency(\.zcashSDKEnvironment) var zcashSDKEnvironment
|
||||
|
||||
public var body: some Reducer<State, Action> {
|
||||
BindingReducer()
|
||||
|
@ -92,7 +90,7 @@ public struct PrivateDataConsentReducer: Reducer {
|
|||
Reduce { state, action in
|
||||
switch action {
|
||||
case .onAppear:
|
||||
state.dataDbURL = [databaseFiles.dataDbURLFor(ZcashNetworkBuilder.network(for: networkType))]
|
||||
state.dataDbURL = [databaseFiles.dataDbURLFor(zcashSDKEnvironment.network)]
|
||||
return .none
|
||||
|
||||
case .exportLogs(.finished):
|
||||
|
@ -145,7 +143,7 @@ extension PrivateDataConsentStore {
|
|||
public static var demo = PrivateDataConsentStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
PrivateDataConsentReducer(networkType: .testnet)
|
||||
PrivateDataConsentReducer()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,8 @@ private extension RootReducer {
|
|||
deeplink: DeeplinkClient,
|
||||
derivationTool: DerivationToolClient
|
||||
) async throws -> RootReducer.Action {
|
||||
let deeplink = try deeplink.resolveDeeplinkURL(url, zcashNetwork.networkType, derivationTool)
|
||||
@Dependency(\.zcashSDKEnvironment) var zcashSDKEnvironment
|
||||
let deeplink = try deeplink.resolveDeeplinkURL(url, zcashSDKEnvironment.network.networkType, derivationTool)
|
||||
|
||||
switch deeplink {
|
||||
case .home:
|
||||
|
|
|
@ -175,7 +175,7 @@ extension RootReducer {
|
|||
let walletState = RootReducer.walletInitializationState(
|
||||
databaseFiles: databaseFiles,
|
||||
walletStorage: walletStorage,
|
||||
zcashNetwork: zcashNetwork
|
||||
zcashNetwork: zcashSDKEnvironment.network
|
||||
)
|
||||
return Effect.send(.initialization(.respondToWalletInitializationState(walletState)))
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@ public struct RootReducer: Reducer {
|
|||
enum CancelStateId { case timer }
|
||||
enum SynchronizerCancelId { case timer }
|
||||
enum WalletConfigCancelId { case timer }
|
||||
let tokenName: String
|
||||
let zcashNetwork: ZcashNetwork
|
||||
|
||||
public struct State: Equatable {
|
||||
@PresentationState public var alert: AlertState<Action>?
|
||||
|
@ -122,19 +120,16 @@ public struct RootReducer: Reducer {
|
|||
@Dependency(\.userStoredPreferences) var userStoredPreferences
|
||||
@Dependency(\.walletConfigProvider) var walletConfigProvider
|
||||
@Dependency(\.walletStorage) var walletStorage
|
||||
@Dependency(\.zcashSDKEnvironment) var zcashSDKEnvironment
|
||||
@Dependency(\.readTransactionsStorage) var readTransactionsStorage
|
||||
@Dependency(\.restoreWalletStorage) var restoreWalletStorage
|
||||
@Dependency(\.zcashSDKEnvironment) var zcashSDKEnvironment
|
||||
|
||||
public init(tokenName: String, zcashNetwork: ZcashNetwork) {
|
||||
self.tokenName = tokenName
|
||||
self.zcashNetwork = zcashNetwork
|
||||
}
|
||||
public init() { }
|
||||
|
||||
@ReducerBuilder<State, Action>
|
||||
var core: some Reducer<State, Action> {
|
||||
Scope(state: \.tabsState, action: /Action.tabs) {
|
||||
TabsReducer(tokenName: tokenName, networkType: zcashNetwork.networkType)
|
||||
TabsReducer()
|
||||
}
|
||||
|
||||
Scope(state: \.exportLogsState, action: /Action.exportLogs) {
|
||||
|
@ -142,10 +137,7 @@ public struct RootReducer: Reducer {
|
|||
}
|
||||
|
||||
Scope(state: \.onboardingState, action: /Action.onboarding) {
|
||||
OnboardingFlowReducer(
|
||||
saplingActivationHeight: zcashNetwork.constants.saplingActivationHeight,
|
||||
zcashNetwork: zcashNetwork
|
||||
)
|
||||
OnboardingFlowReducer()
|
||||
}
|
||||
|
||||
Scope(state: \.sandboxState, action: /Action.sandbox) {
|
||||
|
@ -191,9 +183,7 @@ extension RootReducer {
|
|||
var keysPresent = false
|
||||
do {
|
||||
keysPresent = try walletStorage.areKeysPresent()
|
||||
let databaseFilesPresent = databaseFiles.areDbFilesPresentFor(
|
||||
zcashNetwork
|
||||
)
|
||||
let databaseFilesPresent = databaseFiles.areDbFilesPresentFor(zcashNetwork)
|
||||
|
||||
switch (keysPresent, databaseFilesPresent) {
|
||||
case (false, false):
|
||||
|
@ -352,10 +342,8 @@ extension RootStore {
|
|||
RootStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(
|
||||
tokenName: "ZEC",
|
||||
zcashNetwork: ZcashNetworkBuilder.network(for: .testnet)
|
||||
).logging()
|
||||
RootReducer()
|
||||
.logging()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ struct RootView_Previews: PreviewProvider {
|
|||
store: RootStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
},
|
||||
tokenName: "ZEC",
|
||||
networkType: .testnet
|
||||
|
|
|
@ -35,7 +35,7 @@ public struct SandboxView: View {
|
|||
store: .init(
|
||||
initialState: .initial
|
||||
) {
|
||||
SendFlowReducer(networkType: networkType)
|
||||
SendFlowReducer()
|
||||
},
|
||||
tokenName: tokenName
|
||||
)
|
||||
|
|
|
@ -12,13 +12,13 @@ import Utils
|
|||
import URIParser
|
||||
import ZcashLightClientKit
|
||||
import Generated
|
||||
import ZcashSDKEnvironment
|
||||
|
||||
public typealias ScanStore = Store<ScanReducer.State, ScanReducer.Action>
|
||||
public typealias ScanViewStore = ViewStore<ScanReducer.State, ScanReducer.Action>
|
||||
|
||||
public struct ScanReducer: Reducer {
|
||||
private enum CancelId { case timer }
|
||||
let networkType: NetworkType
|
||||
|
||||
public struct State: Equatable {
|
||||
public enum ScanStatus: Equatable {
|
||||
|
@ -61,6 +61,7 @@ public struct ScanReducer: Reducer {
|
|||
@Dependency(\.captureDevice) var captureDevice
|
||||
@Dependency(\.mainQueue) var mainQueue
|
||||
@Dependency(\.uriParser) var uriParser
|
||||
@Dependency(\.zcashSDKEnvironment) var zcashSDKEnvironment
|
||||
|
||||
public enum Action: Equatable {
|
||||
case alert(PresentationAction<Action>)
|
||||
|
@ -72,9 +73,7 @@ public struct ScanReducer: Reducer {
|
|||
case torchPressed
|
||||
}
|
||||
|
||||
public init(networkType: NetworkType) {
|
||||
self.networkType = networkType
|
||||
}
|
||||
public init() { }
|
||||
|
||||
// swiftlint:disable:next cyclomatic_complexity
|
||||
public var body: some ReducerOf<Self> {
|
||||
|
@ -117,7 +116,7 @@ public struct ScanReducer: Reducer {
|
|||
if let prevCode = state.scannedValue, prevCode == code.data {
|
||||
return .none
|
||||
}
|
||||
if uriParser.isValidURI(code.data, networkType) {
|
||||
if uriParser.isValidURI(code.data, zcashSDKEnvironment.network.networkType) {
|
||||
state.scanStatus = .value(code)
|
||||
// once valid URI is scanned we want to start the timer to deliver the code
|
||||
// any new code cancels the schedule and fires new one
|
||||
|
@ -172,6 +171,6 @@ extension ScanStore {
|
|||
public static let placeholder = ScanStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
ScanReducer(networkType: .testnet)
|
||||
ScanReducer()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@ public typealias SecurityWarningStore = Store<SecurityWarningReducer.State, Secu
|
|||
public typealias SecurityWarningViewStore = ViewStore<SecurityWarningReducer.State, SecurityWarningReducer.Action>
|
||||
|
||||
public struct SecurityWarningReducer: Reducer {
|
||||
let zcashNetwork: ZcashNetwork
|
||||
|
||||
public struct State: Equatable {
|
||||
public enum Destination: Equatable, CaseIterable {
|
||||
case createNewWallet
|
||||
|
@ -64,9 +62,7 @@ public struct SecurityWarningReducer: Reducer {
|
|||
@Dependency(\.walletStorage) var walletStorage
|
||||
@Dependency(\.zcashSDKEnvironment) var zcashSDKEnvironment
|
||||
|
||||
public init(zcashNetwork: ZcashNetwork) {
|
||||
self.zcashNetwork = zcashNetwork
|
||||
}
|
||||
public init() { }
|
||||
|
||||
public var body: some Reducer<State, Action> {
|
||||
BindingReducer()
|
||||
|
@ -137,7 +133,7 @@ extension SecurityWarningStore {
|
|||
public static var demo = SecurityWarningStore(
|
||||
initialState: .placeholder
|
||||
) {
|
||||
SecurityWarningReducer(zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
SecurityWarningReducer()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ public struct SendFlowConfirmationView: View {
|
|||
transactionAmountInputState: .initial
|
||||
)
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
},
|
||||
tokenName: "ZEC"
|
||||
)
|
||||
|
|
|
@ -25,7 +25,6 @@ public typealias SendFlowViewStore = ViewStore<SendFlowReducer.State, SendFlowRe
|
|||
|
||||
public struct SendFlowReducer: Reducer {
|
||||
private enum SyncStatusUpdatesID { case timer }
|
||||
let networkType: NetworkType
|
||||
|
||||
public struct State: Equatable {
|
||||
public enum Destination: Equatable {
|
||||
|
@ -149,9 +148,7 @@ public struct SendFlowReducer: Reducer {
|
|||
@Dependency(\.walletStorage) var walletStorage
|
||||
@Dependency(\.zcashSDKEnvironment) var zcashSDKEnvironment
|
||||
|
||||
public init(networkType: NetworkType) {
|
||||
self.networkType = networkType
|
||||
}
|
||||
public init() { }
|
||||
|
||||
public var body: some Reducer<State, Action> {
|
||||
Scope(state: \.memoState, action: /Action.memo) {
|
||||
|
@ -159,7 +156,7 @@ public struct SendFlowReducer: Reducer {
|
|||
}
|
||||
|
||||
Scope(state: \.transactionAddressInputState, action: /Action.transactionAddressInput) {
|
||||
TransactionAddressTextFieldReducer(networkType: networkType)
|
||||
TransactionAddressTextFieldReducer()
|
||||
}
|
||||
|
||||
Scope(state: \.transactionAmountInputState, action: /Action.transactionAmountInput) {
|
||||
|
@ -167,7 +164,7 @@ public struct SendFlowReducer: Reducer {
|
|||
}
|
||||
|
||||
Scope(state: \.scanState, action: /Action.scan) {
|
||||
ScanReducer(networkType: networkType)
|
||||
ScanReducer()
|
||||
}
|
||||
|
||||
Reduce { state, action in
|
||||
|
@ -214,7 +211,8 @@ public struct SendFlowReducer: Reducer {
|
|||
do {
|
||||
let storedWallet = try walletStorage.exportWallet()
|
||||
let seedBytes = try mnemonic.toSeed(storedWallet.seedPhrase.value())
|
||||
let spendingKey = try derivationTool.deriveSpendingKey(seedBytes, 0, networkType)
|
||||
let network = zcashSDKEnvironment.network.networkType
|
||||
let spendingKey = try derivationTool.deriveSpendingKey(seedBytes, 0, network)
|
||||
|
||||
let memo: Memo?
|
||||
if state.transactionAddressInputState.isValidTransparentAddress {
|
||||
|
@ -225,7 +223,7 @@ public struct SendFlowReducer: Reducer {
|
|||
memo = nil
|
||||
}
|
||||
|
||||
let recipient = try Recipient(state.address, network: networkType)
|
||||
let recipient = try Recipient(state.address, network: network)
|
||||
state.isSending = true
|
||||
|
||||
return .run { [state] send in
|
||||
|
@ -279,7 +277,7 @@ public struct SendFlowReducer: Reducer {
|
|||
state.transactionAddressInputState.isValidAddress = true
|
||||
state.transactionAddressInputState.isValidTransparentAddress = derivationTool.isTransparentAddress(
|
||||
address.data,
|
||||
networkType
|
||||
zcashSDKEnvironment.network.networkType
|
||||
)
|
||||
audioServices.systemSoundVibrate()
|
||||
return Effect.send(.updateDestination(nil))
|
||||
|
@ -371,7 +369,7 @@ extension SendFlowStore {
|
|||
SendFlowStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ public struct SendFlowView: View {
|
|||
transactionAmountInputState: .initial
|
||||
)
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
},
|
||||
tokenName: "ZEC"
|
||||
)
|
||||
|
|
|
@ -15,8 +15,6 @@ public typealias AdvancedSettingsStore = Store<AdvancedSettingsReducer.State, Ad
|
|||
public typealias AdvancedSettingsViewStore = ViewStore<AdvancedSettingsReducer.State, AdvancedSettingsReducer.Action>
|
||||
|
||||
public struct AdvancedSettingsReducer: Reducer {
|
||||
let networkType: NetworkType
|
||||
|
||||
public struct State: Equatable {
|
||||
public enum Destination {
|
||||
case backupPhrase
|
||||
|
@ -58,9 +56,7 @@ public struct AdvancedSettingsReducer: Reducer {
|
|||
@Dependency(\.localAuthentication) var localAuthentication
|
||||
@Dependency(\.restoreWalletStorage) var restoreWalletStorage
|
||||
|
||||
public init(networkType: NetworkType) {
|
||||
self.networkType = networkType
|
||||
}
|
||||
public init() { }
|
||||
|
||||
public var body: some Reducer<State, Action> {
|
||||
Reduce { state, action in
|
||||
|
@ -115,7 +111,7 @@ public struct AdvancedSettingsReducer: Reducer {
|
|||
}
|
||||
|
||||
Scope(state: \.privateDataConsentState, action: /Action.privateDataConsent) {
|
||||
PrivateDataConsentReducer(networkType: networkType)
|
||||
PrivateDataConsentReducer()
|
||||
}
|
||||
|
||||
Scope(state: \.serverSetupState, action: /Action.serverSetup) {
|
||||
|
@ -199,7 +195,7 @@ extension AdvancedSettingsStore {
|
|||
public static let placeholder = AdvancedSettingsStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
AdvancedSettingsReducer(networkType: .testnet)
|
||||
AdvancedSettingsReducer()
|
||||
}
|
||||
|
||||
public static let demo = AdvancedSettingsStore(
|
||||
|
@ -213,6 +209,6 @@ extension AdvancedSettingsStore {
|
|||
serverSetupState: ServerSetup.State()
|
||||
)
|
||||
) {
|
||||
AdvancedSettingsReducer(networkType: .testnet)
|
||||
AdvancedSettingsReducer()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@ public typealias SettingsStore = Store<SettingsReducer.State, SettingsReducer.Ac
|
|||
public typealias SettingsViewStore = ViewStore<SettingsReducer.State, SettingsReducer.Action>
|
||||
|
||||
public struct SettingsReducer: Reducer {
|
||||
let networkType: NetworkType
|
||||
|
||||
public struct State: Equatable {
|
||||
public enum Destination {
|
||||
case about
|
||||
|
@ -60,9 +58,7 @@ public struct SettingsReducer: Reducer {
|
|||
@Dependency(\.appVersion) var appVersion
|
||||
@Dependency(\.restoreWalletStorage) var restoreWalletStorage
|
||||
|
||||
public init(networkType: NetworkType) {
|
||||
self.networkType = networkType
|
||||
}
|
||||
public init() { }
|
||||
|
||||
public var body: some Reducer<State, Action> {
|
||||
Reduce { state, action in
|
||||
|
@ -116,7 +112,7 @@ public struct SettingsReducer: Reducer {
|
|||
.ifLet(\.$alert, action: /Action.alert)
|
||||
|
||||
Scope(state: \.advancedSettingsState, action: /Action.advancedSettings) {
|
||||
AdvancedSettingsReducer(networkType: networkType)
|
||||
AdvancedSettingsReducer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -185,7 +181,7 @@ extension SettingsStore {
|
|||
public static let placeholder = SettingsStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
SettingsReducer(networkType: .testnet)
|
||||
SettingsReducer()
|
||||
}
|
||||
|
||||
public static let demo = SettingsStore(
|
||||
|
@ -195,6 +191,6 @@ extension SettingsStore {
|
|||
appBuild: "54"
|
||||
)
|
||||
) {
|
||||
SettingsReducer(networkType: .testnet)
|
||||
SettingsReducer()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,6 @@ public typealias TabsStore = Store<TabsReducer.State, TabsReducer.Action>
|
|||
public typealias TabsViewStore = ViewStore<TabsReducer.State, TabsReducer.Action>
|
||||
|
||||
public struct TabsReducer: Reducer {
|
||||
let tokenName: String
|
||||
let networkType: NetworkType
|
||||
|
||||
public struct State: Equatable {
|
||||
public enum Destination: Equatable {
|
||||
case settings
|
||||
|
@ -94,30 +91,27 @@ public struct TabsReducer: Reducer {
|
|||
|
||||
@Dependency(\.restoreWalletStorage) var restoreWalletStorage
|
||||
|
||||
public init(tokenName: String, networkType: NetworkType) {
|
||||
self.tokenName = tokenName
|
||||
self.networkType = networkType
|
||||
}
|
||||
public init() { }
|
||||
|
||||
public var body: some Reducer<State, Action> {
|
||||
Scope(state: \.sendState, action: /Action.send) {
|
||||
SendFlowReducer(networkType: networkType)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
Scope(state: \.addressDetailsState, action: /Action.addressDetails) {
|
||||
AddressDetailsReducer(networkType: networkType)
|
||||
AddressDetailsReducer()
|
||||
}
|
||||
|
||||
Scope(state: \.balanceBreakdownState, action: /Action.balanceBreakdown) {
|
||||
BalanceBreakdownReducer(networkType: networkType)
|
||||
BalanceBreakdownReducer()
|
||||
}
|
||||
|
||||
Scope(state: \.homeState, action: /Action.home) {
|
||||
HomeReducer(networkType: networkType)
|
||||
HomeReducer()
|
||||
}
|
||||
|
||||
Scope(state: \.settingsState, action: /Action.settings) {
|
||||
SettingsReducer(networkType: networkType)
|
||||
SettingsReducer()
|
||||
}
|
||||
|
||||
Reduce { state, action in
|
||||
|
@ -179,10 +173,7 @@ extension TabsStore {
|
|||
public static var demo = TabsStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
TabsReducer(
|
||||
tokenName: "TAZ",
|
||||
networkType: ZcashNetworkBuilder.network(for: .testnet).networkType
|
||||
)
|
||||
TabsReducer()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ struct TransactionAddressTextField_Previews: PreviewProvider {
|
|||
)
|
||||
)
|
||||
) {
|
||||
TransactionAddressTextFieldReducer(networkType: .testnet)
|
||||
TransactionAddressTextFieldReducer()
|
||||
}
|
||||
)
|
||||
.preferredColorScheme(.light)
|
||||
|
|
|
@ -14,8 +14,6 @@ import ZcashSDKEnvironment
|
|||
public typealias TransactionAddressTextFieldStore = Store<TransactionAddressTextFieldReducer.State, TransactionAddressTextFieldReducer.Action>
|
||||
|
||||
public struct TransactionAddressTextFieldReducer: Reducer {
|
||||
let networkType: NetworkType
|
||||
|
||||
public struct State: Equatable {
|
||||
public var isValidAddress = false
|
||||
public var isValidTransparentAddress = false
|
||||
|
@ -37,9 +35,7 @@ public struct TransactionAddressTextFieldReducer: Reducer {
|
|||
@Dependency(\.derivationTool) var derivationTool
|
||||
@Dependency(\.zcashSDKEnvironment) var zcashSDKEnvironment
|
||||
|
||||
public init(networkType: NetworkType) {
|
||||
self.networkType = networkType
|
||||
}
|
||||
public init() { }
|
||||
|
||||
public var body: some Reducer<State, Action> {
|
||||
Reduce { state, action in
|
||||
|
@ -52,8 +48,9 @@ public struct TransactionAddressTextFieldReducer: Reducer {
|
|||
return .none
|
||||
|
||||
case .textField(.set(let address)):
|
||||
state.isValidAddress = derivationTool.isZcashAddress(address.data, networkType)
|
||||
state.isValidTransparentAddress = derivationTool.isTransparentAddress(address.data, networkType)
|
||||
let network = zcashSDKEnvironment.network.networkType
|
||||
state.isValidAddress = derivationTool.isZcashAddress(address.data, network)
|
||||
state.isValidTransparentAddress = derivationTool.isTransparentAddress(address.data, network)
|
||||
return .none
|
||||
}
|
||||
}
|
||||
|
@ -76,6 +73,6 @@ extension TransactionAddressTextFieldStore {
|
|||
public static let placeholder = TransactionAddressTextFieldStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
TransactionAddressTextFieldReducer(networkType: .testnet)
|
||||
TransactionAddressTextFieldReducer()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,10 +24,8 @@ final class AppDelegate: NSObject, UIApplicationDelegate {
|
|||
let rootStore = RootStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(
|
||||
tokenName: TargetConstants.tokenName,
|
||||
zcashNetwork: TargetConstants.zcashNetwork
|
||||
).logging()
|
||||
RootReducer()
|
||||
.logging()
|
||||
}
|
||||
|
||||
func application(
|
||||
|
|
|
@ -24,7 +24,7 @@ class AddressDetailsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: AddressDetailsReducer.State(uAddress: uAddress)
|
||||
) {
|
||||
AddressDetailsReducer(networkType: .testnet)
|
||||
AddressDetailsReducer()
|
||||
}
|
||||
|
||||
store.dependencies.pasteboard = testPasteboard
|
||||
|
@ -49,7 +49,7 @@ class AddressDetailsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: AddressDetailsReducer.State(uAddress: uAddress)
|
||||
) {
|
||||
AddressDetailsReducer(networkType: .testnet)
|
||||
AddressDetailsReducer()
|
||||
}
|
||||
|
||||
store.dependencies.pasteboard = testPasteboard
|
||||
|
@ -72,7 +72,7 @@ class AddressDetailsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: AddressDetailsReducer.State(uAddress: uAddress)
|
||||
) {
|
||||
AddressDetailsReducer(networkType: .testnet)
|
||||
AddressDetailsReducer()
|
||||
}
|
||||
|
||||
store.dependencies.pasteboard = testPasteboard
|
||||
|
@ -96,7 +96,7 @@ class AddressDetailsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: AddressDetailsReducer.State(uAddress: uAddress)
|
||||
) {
|
||||
AddressDetailsReducer(networkType: .testnet)
|
||||
AddressDetailsReducer()
|
||||
}
|
||||
|
||||
let expectedAddress = try uAddress.transparentReceiver().stringEncoded
|
||||
|
@ -114,7 +114,7 @@ class AddressDetailsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: AddressDetailsReducer.State(uAddress: uAddress)
|
||||
) {
|
||||
AddressDetailsReducer(networkType: .testnet)
|
||||
AddressDetailsReducer()
|
||||
}
|
||||
|
||||
await store.send(.shareQR(uAddress.stringEncoded.redacted)) { state in
|
||||
|
@ -130,7 +130,7 @@ class AddressDetailsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: AddressDetailsReducer.State(uAddress: uAddress)
|
||||
) {
|
||||
AddressDetailsReducer(networkType: .testnet)
|
||||
AddressDetailsReducer()
|
||||
}
|
||||
|
||||
let expectedAddress = try uAddress.saplingReceiver().stringEncoded
|
||||
|
|
|
@ -21,7 +21,7 @@ class BalanceBreakdownTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .placeholder
|
||||
) {
|
||||
BalanceBreakdownReducer(networkType: .testnet)
|
||||
BalanceBreakdownReducer()
|
||||
}
|
||||
|
||||
store.dependencies.sdkSynchronizer = .mocked()
|
||||
|
@ -44,7 +44,7 @@ class BalanceBreakdownTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .placeholder
|
||||
) {
|
||||
BalanceBreakdownReducer(networkType: .testnet)
|
||||
BalanceBreakdownReducer()
|
||||
}
|
||||
|
||||
store.dependencies.sdkSynchronizer = .mocked(shieldFunds: { _, _, _ in throw ZcashError.synchronizerNotPrepared })
|
||||
|
@ -72,7 +72,7 @@ class BalanceBreakdownTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
BalanceBreakdownReducer(networkType: .testnet)
|
||||
BalanceBreakdownReducer()
|
||||
}
|
||||
|
||||
XCTAssertFalse(store.state.isShieldingFunds)
|
||||
|
@ -93,7 +93,7 @@ class BalanceBreakdownTests: XCTestCase {
|
|||
transparentBalance: Zatoshi(1_000_000)
|
||||
)
|
||||
) {
|
||||
BalanceBreakdownReducer(networkType: .testnet)
|
||||
BalanceBreakdownReducer()
|
||||
}
|
||||
|
||||
XCTAssertFalse(store.state.isShieldingFunds)
|
||||
|
@ -114,7 +114,7 @@ class BalanceBreakdownTests: XCTestCase {
|
|||
transparentBalance: Zatoshi(1_000_000)
|
||||
)
|
||||
) {
|
||||
BalanceBreakdownReducer(networkType: .testnet)
|
||||
BalanceBreakdownReducer()
|
||||
}
|
||||
|
||||
XCTAssertTrue(store.state.isShieldingFunds)
|
||||
|
@ -129,7 +129,7 @@ class BalanceBreakdownTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: initialState
|
||||
) {
|
||||
BalanceBreakdownReducer(networkType: .testnet)
|
||||
BalanceBreakdownReducer()
|
||||
}
|
||||
|
||||
store.dependencies.restoreWalletStorage = .noOp
|
||||
|
@ -156,7 +156,7 @@ class BalanceBreakdownTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: initialState
|
||||
) {
|
||||
BalanceBreakdownReducer(networkType: .testnet)
|
||||
BalanceBreakdownReducer()
|
||||
}
|
||||
|
||||
await store.send(.updateHintBoxVisibility(true)) { state in
|
||||
|
@ -173,7 +173,7 @@ class BalanceBreakdownTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: initialState
|
||||
) {
|
||||
BalanceBreakdownReducer(networkType: .testnet)
|
||||
BalanceBreakdownReducer()
|
||||
}
|
||||
|
||||
await store.send(.updateHintBoxVisibility(false)) { state in
|
||||
|
|
|
@ -23,7 +23,7 @@ class DeeplinkTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: appState
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
await store.send(.destination(.deeplinkHome)) { state in
|
||||
|
@ -40,7 +40,7 @@ class DeeplinkTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: appState
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
await store.send(.destination(.deeplinkHome)) { state in
|
||||
|
@ -57,7 +57,7 @@ class DeeplinkTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: appState
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
let amount = Zatoshi(123_000_000)
|
||||
|
@ -93,7 +93,7 @@ class DeeplinkTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: appState
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.deeplink = DeeplinkClient(
|
||||
|
@ -139,7 +139,7 @@ class DeeplinkTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: appState
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.deeplink = DeeplinkClient(
|
||||
|
|
|
@ -31,7 +31,7 @@ class HomeTests: XCTestCase {
|
|||
walletConfig: .initial
|
||||
)
|
||||
) {
|
||||
HomeReducer(networkType: .testnet)
|
||||
HomeReducer()
|
||||
}
|
||||
|
||||
XCTAssertTrue(store.state.isSendButtonDisabled)
|
||||
|
@ -43,7 +43,7 @@ class HomeTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
HomeReducer(networkType: .testnet)
|
||||
HomeReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mainQueue = .immediate
|
||||
|
@ -76,7 +76,7 @@ class HomeTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
HomeReducer(networkType: .testnet)
|
||||
HomeReducer()
|
||||
}
|
||||
|
||||
store.dependencies.diskSpaceChecker = .mockFullDisk
|
||||
|
@ -110,7 +110,7 @@ class HomeTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
HomeReducer(networkType: .testnet)
|
||||
HomeReducer()
|
||||
}
|
||||
|
||||
await store.send(.synchronizerStateChanged(state)) { state in
|
||||
|
@ -130,7 +130,7 @@ class HomeTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: initialState
|
||||
) {
|
||||
HomeReducer(networkType: .testnet)
|
||||
HomeReducer()
|
||||
}
|
||||
|
||||
store.dependencies.restoreWalletStorage = .noOp
|
||||
|
|
|
@ -18,7 +18,7 @@ class ImportWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 0)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
await store.send(.onAppear) { state in
|
||||
|
@ -32,7 +32,7 @@ class ImportWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 0)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mnemonic = .noOp
|
||||
|
@ -53,7 +53,7 @@ class ImportWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: ImportWalletReducer.State(maxWordsCount: 24)
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 0)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mnemonic = .noOp
|
||||
|
@ -75,7 +75,7 @@ class ImportWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: ImportWalletReducer.State(maxWordsCount: 24)
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 0)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mnemonic = .noOp
|
||||
|
@ -102,7 +102,7 @@ class ImportWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 280_000)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
let birthday = "200000".redacted
|
||||
|
@ -118,7 +118,7 @@ class ImportWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 0)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
let birthday = "abc".redacted
|
||||
|
@ -134,7 +134,7 @@ class ImportWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 0)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
let birthday = "1700000".redacted
|
||||
|
@ -151,7 +151,7 @@ class ImportWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: ImportWalletReducer.State(maxWordsCount: 24)
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 0)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mnemonic = .noOp
|
||||
|
@ -184,7 +184,7 @@ class ImportWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: ImportWalletReducer.State(maxWordsCount: 24)
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 280_000)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mnemonic = .noOp
|
||||
|
@ -216,7 +216,7 @@ class ImportWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: ImportWalletReducer.State(maxWordsCount: 24)
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 280_000)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mnemonic = .noOp
|
||||
|
@ -253,7 +253,7 @@ class ImportWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: ImportWalletReducer.State(maxWordsCount: 24)
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 0)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mnemonic = .noOp
|
||||
|
@ -291,7 +291,7 @@ class ImportWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: ImportWalletReducer.State(maxWordsCount: 24)
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 0)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mnemonic = .noOp
|
||||
|
@ -335,7 +335,7 @@ class ImportWalletTests: XCTestCase {
|
|||
wordsCount: 24
|
||||
)
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 0)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mnemonic = .noOp
|
||||
|
|
|
@ -16,7 +16,7 @@ final class PrivateDataConsentTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
PrivateDataConsentReducer(networkType: .testnet)
|
||||
PrivateDataConsentReducer()
|
||||
}
|
||||
|
||||
let URL = URL(string: "https://electriccoin.co")!
|
||||
|
@ -39,7 +39,7 @@ final class PrivateDataConsentTests: XCTestCase {
|
|||
exportOnlyLogs: true
|
||||
)
|
||||
) {
|
||||
PrivateDataConsentReducer(networkType: .testnet)
|
||||
PrivateDataConsentReducer()
|
||||
}
|
||||
|
||||
store.dependencies.logsHandler = .noOp
|
||||
|
@ -71,7 +71,7 @@ final class PrivateDataConsentTests: XCTestCase {
|
|||
exportOnlyLogs: false
|
||||
)
|
||||
) {
|
||||
PrivateDataConsentReducer(networkType: .testnet)
|
||||
PrivateDataConsentReducer()
|
||||
}
|
||||
|
||||
store.dependencies.logsHandler = .noOp
|
||||
|
@ -103,7 +103,7 @@ final class PrivateDataConsentTests: XCTestCase {
|
|||
isExportingLogs: true
|
||||
)
|
||||
) {
|
||||
PrivateDataConsentReducer(networkType: .testnet)
|
||||
PrivateDataConsentReducer()
|
||||
}
|
||||
|
||||
await store.send(.shareFinished) { state in
|
||||
|
@ -122,7 +122,7 @@ final class PrivateDataConsentTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: initialState
|
||||
) {
|
||||
PrivateDataConsentReducer(networkType: .testnet)
|
||||
PrivateDataConsentReducer()
|
||||
}
|
||||
|
||||
store.dependencies.restoreWalletStorage = .noOp
|
||||
|
|
|
@ -27,7 +27,7 @@ final class ReviewRequestTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
HomeReducer(networkType: .testnet)
|
||||
HomeReducer()
|
||||
}
|
||||
|
||||
let now = Date.now
|
||||
|
@ -64,7 +64,7 @@ final class ReviewRequestTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
HomeReducer(networkType: .testnet)
|
||||
HomeReducer()
|
||||
}
|
||||
|
||||
let now = Date.now
|
||||
|
|
|
@ -30,7 +30,7 @@ class AppInitializationTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: appState
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
let testQueue = DispatchQueue.test
|
||||
|
@ -104,7 +104,7 @@ class AppInitializationTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: appState
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
let testQueue = DispatchQueue.test
|
||||
|
@ -180,7 +180,7 @@ class AppInitializationTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: initialState
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.databaseFiles = .noOp
|
||||
|
@ -220,7 +220,7 @@ class AppInitializationTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.databaseFiles = .noOp
|
||||
|
@ -283,7 +283,7 @@ class AppInitializationTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.databaseFiles = .noOp
|
||||
|
|
|
@ -17,7 +17,7 @@ class DebugTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
await store.send(.debug(.rescanBlockchain)) { state in
|
||||
|
@ -33,7 +33,7 @@ class DebugTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: mockState
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
await store.send(.debug(.cancelRescan)) { state in
|
||||
|
@ -49,7 +49,7 @@ class DebugTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: mockState
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mainQueue = .immediate
|
||||
|
@ -72,7 +72,7 @@ class DebugTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: mockState
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mainQueue = .immediate
|
||||
|
|
|
@ -19,7 +19,7 @@ final class RestoreWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mainQueue = .immediate
|
||||
|
@ -53,10 +53,7 @@ final class RestoreWalletTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: state
|
||||
) {
|
||||
RootReducer(
|
||||
tokenName: "ZEC",
|
||||
zcashNetwork: ZcashNetworkBuilder.network(for: .testnet)
|
||||
)
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mainQueue = .immediate
|
||||
|
|
|
@ -101,7 +101,7 @@ class RootTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mainQueue = .immediate
|
||||
|
@ -123,7 +123,7 @@ class RootTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mainQueue = .immediate
|
||||
|
@ -160,7 +160,7 @@ class RootTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.walletStorage = .noOp
|
||||
|
@ -195,7 +195,7 @@ class RootTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.walletStorage = .noOp
|
||||
|
@ -222,7 +222,7 @@ class RootTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mainQueue = .immediate
|
||||
|
|
|
@ -19,7 +19,7 @@ final class WalletNukeTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
await store.send(.initialization(.nukeWalletRequest)) { state in
|
||||
|
@ -33,7 +33,7 @@ final class WalletNukeTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
store.dependencies.sdkSynchronizer = .noOp
|
||||
|
@ -57,7 +57,7 @@ final class WalletNukeTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
var readIds: [RedactableString: Bool] = ["id1".redacted: true]
|
||||
|
|
|
@ -22,7 +22,7 @@ class ScanTests: XCTestCase {
|
|||
scanStatus: .value("t1gXqfSSQt6WfpwyuCU3Wi7sSVZ66DYQ3Po".redacted)
|
||||
)
|
||||
) {
|
||||
ScanReducer(networkType: .testnet)
|
||||
ScanReducer()
|
||||
}
|
||||
|
||||
store.dependencies.captureDevice = .noOp
|
||||
|
@ -40,7 +40,7 @@ class ScanTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: ScanReducer.State()
|
||||
) {
|
||||
ScanReducer(networkType: .testnet)
|
||||
ScanReducer()
|
||||
}
|
||||
|
||||
store.dependencies.captureDevice = .noOp
|
||||
|
@ -58,7 +58,7 @@ class ScanTests: XCTestCase {
|
|||
isTorchOn: true
|
||||
)
|
||||
) {
|
||||
ScanReducer(networkType: .testnet)
|
||||
ScanReducer()
|
||||
}
|
||||
|
||||
store.dependencies.captureDevice = .noOp
|
||||
|
@ -74,7 +74,7 @@ class ScanTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: ScanReducer.State()
|
||||
) {
|
||||
ScanReducer(networkType: .testnet)
|
||||
ScanReducer()
|
||||
}
|
||||
|
||||
store.dependencies.uriParser.isValidURI = { _, _ in false }
|
||||
|
@ -92,7 +92,7 @@ class ScanTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: ScanReducer.State()
|
||||
) {
|
||||
ScanReducer(networkType: .testnet)
|
||||
ScanReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mainQueue = .immediate
|
||||
|
@ -113,7 +113,7 @@ class ScanTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: ScanReducer.State()
|
||||
) {
|
||||
ScanReducer(networkType: .testnet)
|
||||
ScanReducer()
|
||||
}
|
||||
|
||||
await store.send(.scanFailed) { state in
|
||||
|
|
|
@ -50,7 +50,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: initialState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.derivationTool = .liveValue
|
||||
|
@ -104,7 +104,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: initialState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
let error = "send failed".toZcashError()
|
||||
|
@ -146,7 +146,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: initialState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.derivationTool = .liveValue
|
||||
|
@ -173,7 +173,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.derivationTool = .noOp
|
||||
|
@ -198,7 +198,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.derivationTool = .noOp
|
||||
|
@ -226,7 +226,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: state
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.numberFormatter = .noOp
|
||||
|
@ -242,7 +242,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.derivationTool = .noOp
|
||||
|
@ -282,7 +282,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: sendState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.numberFormatter = .noOp
|
||||
|
@ -325,7 +325,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: sendState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.numberFormatter = .noOp
|
||||
|
@ -352,6 +352,9 @@ class SendTests: XCTestCase {
|
|||
}
|
||||
|
||||
func testDifferentNumberFormats_LiveNumberFormatter() throws {
|
||||
let zcashNumberFormatter = NumberFormatter.zcashNumberFormatter
|
||||
zcashNumberFormatter.locale = Locale(identifier: "en_US")
|
||||
|
||||
try numberFormatTest("1.234", NSNumber(1.234))
|
||||
try numberFormatTest("1,234", NSNumber(1_234))
|
||||
try numberFormatTest("1 234", NSNumber(1_234))
|
||||
|
@ -388,7 +391,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: sendState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.derivationTool = .noOp
|
||||
|
@ -431,7 +434,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: sendState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.derivationTool = .noOp
|
||||
|
@ -473,7 +476,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: sendState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.derivationTool = .noOp
|
||||
|
@ -515,7 +518,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: sendState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.derivationTool = .noOp
|
||||
|
@ -556,7 +559,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: sendState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.derivationTool = .noOp
|
||||
|
@ -610,7 +613,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: sendState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
let value = "test".redacted
|
||||
|
@ -645,7 +648,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: sendState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.mainQueue = .immediate
|
||||
|
@ -672,7 +675,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: sendState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
store.dependencies.audioServices = AudioServicesClient(systemSoundVibrate: { })
|
||||
|
@ -702,7 +705,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: sendState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
await store.send(.reviewPressed) { state in
|
||||
|
@ -724,13 +727,16 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: sendState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
XCTAssertEqual(store.state.message, testMessage.data)
|
||||
}
|
||||
|
||||
func testFeeFormat() throws {
|
||||
let zashiBalanceFormatter = NumberFormatter.zashiBalanceFormatter
|
||||
zashiBalanceFormatter.locale = Locale(identifier: "en_US")
|
||||
|
||||
let feeFormat = "(Fee < 0.001)"
|
||||
|
||||
let sendState = SendFlowReducer.State(
|
||||
|
@ -744,7 +750,7 @@ class SendTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: sendState
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
}
|
||||
|
||||
XCTAssertEqual(store.state.feeFormat, feeFormat)
|
||||
|
@ -756,7 +762,7 @@ private extension SendTests {
|
|||
_ amount: String,
|
||||
_ expectedResult: NSNumber?
|
||||
) throws {
|
||||
if let number = NumberFormatterClient.liveValue.number(amount) {
|
||||
if let number = NumberFormatter.zcashNumberFormatter.number(from: amount) {
|
||||
XCTAssertEqual(number, expectedResult)
|
||||
return
|
||||
} else {
|
||||
|
|
|
@ -23,7 +23,7 @@ class TransactionAddressTextFieldTests: XCTestCase {
|
|||
)
|
||||
)
|
||||
) {
|
||||
TransactionAddressTextFieldReducer(networkType: .testnet)
|
||||
TransactionAddressTextFieldReducer()
|
||||
}
|
||||
|
||||
await store.send(.clearAddress) { state in
|
||||
|
|
|
@ -59,7 +59,7 @@ class SettingsTests: XCTestCase {
|
|||
serverSetupState: .initial
|
||||
)
|
||||
) {
|
||||
AdvancedSettingsReducer(networkType: .testnet)
|
||||
AdvancedSettingsReducer()
|
||||
}
|
||||
|
||||
store.dependencies.localAuthentication = .mockAuthenticationSucceeded
|
||||
|
@ -78,7 +78,7 @@ class SettingsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
AdvancedSettingsReducer(networkType: .testnet)
|
||||
AdvancedSettingsReducer()
|
||||
}
|
||||
|
||||
store.dependencies.localAuthentication = .mockAuthenticationFailed
|
||||
|
@ -95,7 +95,7 @@ class SettingsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: initialState
|
||||
) {
|
||||
SettingsReducer(networkType: .testnet)
|
||||
SettingsReducer()
|
||||
}
|
||||
|
||||
store.dependencies.restoreWalletStorage = .noOp
|
||||
|
|
|
@ -25,7 +25,7 @@ class AddressDetailsSnapshotTests: XCTestCase {
|
|||
let store = Store(
|
||||
initialState: AddressDetailsReducer.State(uAddress: uAddress)
|
||||
) {
|
||||
AddressDetailsReducer(networkType: networkType)
|
||||
AddressDetailsReducer()
|
||||
.dependency(\.walletConfigProvider, .noOp)
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ class AddressDetailsSnapshotTests: XCTestCase {
|
|||
let store = Store(
|
||||
initialState: AddressDetailsReducer.State(uAddress: uAddress)
|
||||
) {
|
||||
AddressDetailsReducer(networkType: networkType)
|
||||
AddressDetailsReducer()
|
||||
.dependency(\.walletConfigProvider, .noOp)
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class BalanceBreakdownSnapshotTests: XCTestCase {
|
|||
transparentBalance: Zatoshi(850_000_000)
|
||||
)
|
||||
) {
|
||||
BalanceBreakdownReducer(networkType: .testnet)
|
||||
BalanceBreakdownReducer()
|
||||
.dependency(\.sdkSynchronizer, .noOp)
|
||||
.dependency(\.mainQueue, .immediate)
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class BalanceBreakdownSnapshotTests: XCTestCase {
|
|||
transparentBalance: Zatoshi(850_000_000)
|
||||
)
|
||||
) {
|
||||
BalanceBreakdownReducer(networkType: .testnet)
|
||||
BalanceBreakdownReducer()
|
||||
.dependency(\.sdkSynchronizer, .noOp)
|
||||
.dependency(\.mainQueue, .immediate)
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class HomeSnapshotTests: XCTestCase {
|
|||
walletConfig: .initial
|
||||
)
|
||||
) {
|
||||
HomeReducer(networkType: .testnet)
|
||||
HomeReducer()
|
||||
.dependency(\.diskSpaceChecker, .mockEmptyDisk)
|
||||
.dependency(\.sdkSynchronizer, .noOp)
|
||||
.dependency(\.mainQueue, .immediate)
|
||||
|
|
|
@ -15,7 +15,7 @@ class ImportWalletSnapshotTests: XCTestCase {
|
|||
let store = ImportWalletStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 0)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
addAttachments(ImportWalletView(store: store))
|
||||
|
@ -25,7 +25,7 @@ class ImportWalletSnapshotTests: XCTestCase {
|
|||
let store = ImportWalletStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
ImportWalletReducer(saplingActivationHeight: 0)
|
||||
ImportWalletReducer()
|
||||
}
|
||||
|
||||
addAttachments(ImportBirthdayView(store: store))
|
||||
|
|
|
@ -15,7 +15,7 @@ class PrivateDataConsentSnapshotTests: XCTestCase {
|
|||
let store = Store(
|
||||
initialState: .initial
|
||||
) {
|
||||
PrivateDataConsentReducer(networkType: .mainnet)
|
||||
PrivateDataConsentReducer()
|
||||
.dependency(\.databaseFiles, .noOp)
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class SecurityWarningSnapshotTests: XCTestCase {
|
|||
let store = Store(
|
||||
initialState: .initial
|
||||
) {
|
||||
SecurityWarningReducer(zcashNetwork: ZcashNetworkBuilder.network(for: .mainnet))
|
||||
SecurityWarningReducer()
|
||||
.dependency(\.appVersion, .mock)
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class SendSnapshotTests: XCTestCase {
|
|||
let store = Store(
|
||||
initialState: state
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
.dependency(\.derivationTool, .live())
|
||||
.dependency(\.mainQueue, DispatchQueue.main.eraseToAnyScheduler())
|
||||
.dependency(\.numberFormatter, .live())
|
||||
|
@ -77,7 +77,7 @@ class SendSnapshotTests: XCTestCase {
|
|||
)
|
||||
)
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
.dependency(\.derivationTool, .live())
|
||||
.dependency(\.mainQueue, DispatchQueue.main.eraseToAnyScheduler())
|
||||
.dependency(\.numberFormatter, .live())
|
||||
|
@ -116,7 +116,7 @@ class SendSnapshotTests: XCTestCase {
|
|||
)
|
||||
)
|
||||
) {
|
||||
SendFlowReducer(networkType: .testnet)
|
||||
SendFlowReducer()
|
||||
.dependency(\.derivationTool, .live())
|
||||
.dependency(\.mainQueue, DispatchQueue.main.eraseToAnyScheduler())
|
||||
.dependency(\.numberFormatter, .live())
|
||||
|
|
|
@ -16,7 +16,7 @@ class SettingsSnapshotTests: XCTestCase {
|
|||
let store = Store(
|
||||
initialState: .initial
|
||||
) {
|
||||
SettingsReducer(networkType: .mainnet)
|
||||
SettingsReducer()
|
||||
.dependency(\.localAuthentication, .mockAuthenticationFailed)
|
||||
.dependency(\.sdkSynchronizer, .noOp)
|
||||
.dependency(\.walletStorage, .noOp)
|
||||
|
@ -30,7 +30,7 @@ class SettingsSnapshotTests: XCTestCase {
|
|||
let store = Store(
|
||||
initialState: .initial
|
||||
) {
|
||||
SettingsReducer(networkType: .mainnet)
|
||||
SettingsReducer()
|
||||
.dependency(\.localAuthentication, .mockAuthenticationFailed)
|
||||
.dependency(\.sdkSynchronizer, .noOp)
|
||||
.dependency(\.walletStorage, .noOp)
|
||||
|
|
|
@ -21,7 +21,7 @@ class TabsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
TabsReducer(tokenName: "TAZ", networkType: .testnet)
|
||||
TabsReducer()
|
||||
}
|
||||
|
||||
await store.send(.home(.balanceBreakdown)) { state in
|
||||
|
@ -33,7 +33,7 @@ class TabsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
TabsReducer(tokenName: "TAZ", networkType: .testnet)
|
||||
TabsReducer()
|
||||
}
|
||||
|
||||
await store.send(.selectedTabChanged(.send)) { state in
|
||||
|
@ -45,7 +45,7 @@ class TabsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
TabsReducer(tokenName: "TAZ", networkType: .testnet)
|
||||
TabsReducer()
|
||||
}
|
||||
|
||||
await store.send(.updateDestination(.settings)) { state in
|
||||
|
@ -60,7 +60,7 @@ class TabsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: placeholderState
|
||||
) {
|
||||
TabsReducer(tokenName: "TAZ", networkType: .testnet)
|
||||
TabsReducer()
|
||||
}
|
||||
|
||||
await store.send(.updateDestination(nil)) { state in
|
||||
|
@ -75,7 +75,7 @@ class TabsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: initialState
|
||||
) {
|
||||
TabsReducer(tokenName: "TAZ", networkType: .testnet)
|
||||
TabsReducer()
|
||||
}
|
||||
|
||||
store.dependencies.restoreWalletStorage = .noOp
|
||||
|
@ -153,7 +153,7 @@ class TabsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: placeholderState
|
||||
) {
|
||||
TabsReducer(tokenName: "TAZ", networkType: .testnet)
|
||||
TabsReducer()
|
||||
}
|
||||
|
||||
let transaction = TransactionState.placeholder(uuid: "3")
|
||||
|
@ -178,7 +178,7 @@ class TabsTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: placeholderState
|
||||
) {
|
||||
TabsReducer(tokenName: "TAZ", networkType: .testnet)
|
||||
TabsReducer()
|
||||
}
|
||||
|
||||
store.dependencies.sdkSynchronizer = .mock
|
||||
|
|
|
@ -124,7 +124,7 @@ class WalletConfigProviderTests: XCTestCase {
|
|||
let store = TestStore(
|
||||
initialState: .initial
|
||||
) {
|
||||
RootReducer(tokenName: "ZEC", zcashNetwork: ZcashNetworkBuilder.network(for: .testnet))
|
||||
RootReducer()
|
||||
}
|
||||
|
||||
// Change any of the flags from the default value
|
||||
|
|
Loading…
Reference in New Issue