diff --git a/secant.xcodeproj/project.pbxproj b/secant.xcodeproj/project.pbxproj index 92a6190..2860972 100644 --- a/secant.xcodeproj/project.pbxproj +++ b/secant.xcodeproj/project.pbxproj @@ -2625,7 +2625,7 @@ repositoryURL = "https://github.com/pointfreeco/swift-composable-architecture"; requirement = { kind = exactVersion; - version = 0.46.0; + version = 0.50.2; }; }; 9E2AC0FD27D8EC120042AA47 /* XCRemoteSwiftPackageReference "MnemonicSwift" */ = { diff --git a/secant.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/secant.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 844281b..3ae7882 100644 --- a/secant.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/secant.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/combine-schedulers", "state" : { - "revision" : "aa3e575929f2bcc5bad012bd2575eae716cbcdf7", - "version" : "0.8.0" + "revision" : "882ac01eb7ef9e36d4467eb4b1151e74fcef85ab", + "version" : "0.9.1" } }, { @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/grpc/grpc-swift.git", "state" : { - "revision" : "4c63368b7462305903507e8acebd77264c0fb695", - "version" : "1.8.2" + "revision" : "783ed8ddcde07ac0332a5ec4647b665f82e95b78", + "version" : "1.14.0" } }, { @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/airbnb/lottie-ios", "state" : { - "revision" : "246bab7ef72bad56abefb88e84a08871cecf9cb8", - "version" : "3.4.0" + "revision" : "b4bd0604ded9574807f41b4004b57dd1226a30a4", + "version" : "3.5.0" } }, { @@ -45,13 +45,22 @@ "version" : "0.14.1" } }, + { + "identity" : "swift-atomics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-atomics.git", + "state" : { + "revision" : "ff3d2212b6b093db7f177d0855adbc4ef9c5f036", + "version" : "1.0.3" + } + }, { "identity" : "swift-case-paths", "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-case-paths", "state" : { - "revision" : "bb436421f57269fbcfe7360735985321585a86e5", - "version" : "0.10.1" + "revision" : "c3a42e8d1a76ff557cf565ed6d8b0aee0e6e75af", + "version" : "0.11.0" } }, { @@ -59,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-clocks", "state" : { - "revision" : "692ec4f5429a667bdd968c7260dfa2b23adfeffc", - "version" : "0.1.4" + "revision" : "20b25ca0dd88ebfb9111ec937814ddc5a8880172", + "version" : "0.2.0" } }, { @@ -68,8 +77,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-collections", "state" : { - "revision" : "48254824bb4248676bf7ce56014ff57b142b77eb", - "version" : "1.0.2" + "revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2", + "version" : "1.0.4" } }, { @@ -77,8 +86,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-composable-architecture", "state" : { - "revision" : "52dca7e5edd6ec9e0b529380843a8cb13f57d7d7", - "version" : "0.46.0" + "revision" : "a99024bbd171d85a92bccbcea23e7c66f05dc12b", + "version" : "0.50.2" } }, { @@ -86,8 +95,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "d9825fa541df64b1a7b182178d61b9a82730d01f", - "version" : "2.1.0" + "revision" : "75ec60b8b4cc0f085c3ac414f3dca5625fa3588e", + "version" : "2.2.4" } }, { @@ -95,8 +104,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-custom-dump", "state" : { - "revision" : "819d9d370cd721c9d87671e29d947279292e4541", - "version" : "0.6.0" + "revision" : "dd86159e25c749873f144577e5d18309bf57534f", + "version" : "0.8.0" + } + }, + { + "identity" : "swift-dependencies", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swift-dependencies", + "state" : { + "revision" : "8282b0c59662eb38946afe30eb403663fc2ecf76", + "version" : "0.1.4" } }, { @@ -104,8 +122,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-identified-collections", "state" : { - "revision" : "bfb0d43e75a15b6dfac770bf33479e8393884a36", - "version" : "0.4.1" + "revision" : "fd34c544ad27f3ba6b19142b348005bfa85b6005", + "version" : "0.6.0" } }, { @@ -113,8 +131,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log.git", "state" : { - "revision" : "5d66f7ba25daf4f94100e7022febf3c75e37a6c7", - "version" : "1.4.2" + "revision" : "32e8d724467f8fe623624570367e3d50c5638e46", + "version" : "1.5.2" } }, { @@ -122,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio.git", "state" : { - "revision" : "124119f0bb12384cef35aa041d7c3a686108722d", - "version" : "2.40.0" + "revision" : "45167b8006448c79dda4b7bd604e07a034c15c49", + "version" : "2.48.0" } }, { @@ -131,8 +149,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-extras.git", "state" : { - "revision" : "a75e92bde3683241c15df3dd905b7a6dcac4d551", - "version" : "1.12.1" + "revision" : "98378d1fe56527761c180f70b2d66a7b2307fc39", + "version" : "1.16.0" } }, { @@ -140,8 +158,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-http2.git", "state" : { - "revision" : "108ac15087ea9b79abb6f6742699cf31de0e8772", - "version" : "1.22.0" + "revision" : "22757ac305f3d44d2b99ba541193ff1d64e77d00", + "version" : "1.24.1" } }, { @@ -149,8 +167,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-ssl.git", "state" : { - "revision" : "c30c680c78c99afdabf84805a83c8745387c4ac7", - "version" : "2.20.2" + "revision" : "4fb7ead803e38949eb1d6fabb849206a72c580f3", + "version" : "2.23.0" } }, { @@ -158,8 +176,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-transport-services.git", "state" : { - "revision" : "2cb54f91ddafc90832c5fa247faf5798d0a7c204", - "version" : "1.13.0" + "revision" : "c0d9a144cfaec8d3d596aadde3039286a266c15c", + "version" : "1.15.0" } }, { @@ -167,8 +185,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-parsing", "state" : { - "revision" : "bc92e84968990b41640214b636667f35b6e5d44c", - "version" : "0.10.0" + "revision" : "4bb9192468c1a8be57f46b7d6fd4f561c88b2195", + "version" : "0.11.0" } }, { @@ -176,17 +194,26 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "e1499bc69b9040b29184f7f2996f7bab467c1639", - "version" : "1.19.0" + "revision" : "ab3a58b7209a17d781c0d1dbb3e1ff3da306bae8", + "version" : "1.20.3" } }, { "identity" : "swift-url-routing", "kind" : "remoteSourceControl", - "location" : "http://github.com/pointfreeco/swift-url-routing", + "location" : "https://github.com/pointfreeco/swift-url-routing", "state" : { - "revision" : "80e8a0257ccdd639e31f709954ceca6b690fdc67", - "version" : "0.3.1" + "revision" : "f54c4f74e7884f7930560c08387817ce28271770", + "version" : "0.4.0" + } + }, + { + "identity" : "swiftui-navigation", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swiftui-navigation", + "state" : { + "revision" : "270a754308f5440be52fc295242eb7031638bd15", + "version" : "0.6.1" } }, { @@ -194,8 +221,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/xctest-dynamic-overlay", "state" : { - "revision" : "16e6409ee82e1b81390bdffbf217b9c08ab32784", - "version" : "0.5.0" + "revision" : "ace21305e0dd3a9e749aef79fef14be79a3b4669", + "version" : "0.8.2" } }, { @@ -210,10 +237,10 @@ { "identity" : "zcashlightclientkit", "kind" : "remoteSourceControl", - "location" : "https://github.com/zcash/ZcashLightClientKit", + "location" : "https://github.com/zcash/ZcashLightClientKit/", "state" : { - "revision" : "731c7bbf4514a90b879c5c15968cdb41ac728e3a", - "version" : "0.18.0-beta" + "revision" : "2c211732e16d53fdcb1c94304bc4016af7f15c6c", + "version" : "0.18.1-beta" } } ], diff --git a/secant/Dependencies/SDKSynchronizer/SDKSynchronizerInterface.swift b/secant/Dependencies/SDKSynchronizer/SDKSynchronizerInterface.swift index 4c2efa1..6552d66 100644 --- a/secant/Dependencies/SDKSynchronizer/SDKSynchronizerInterface.swift +++ b/secant/Dependencies/SDKSynchronizer/SDKSynchronizerInterface.swift @@ -59,11 +59,11 @@ protocol SDKSynchronizerClient { func getShieldedBalance() -> WalletBalance? func getTransparentBalance() -> WalletBalance? - func getAllSentTransactions() -> Effect<[WalletEvent], Never> - func getAllReceivedTransactions() -> Effect<[WalletEvent], Never> - func getAllClearedTransactions() -> Effect<[WalletEvent], Never> - func getAllPendingTransactions() -> Effect<[WalletEvent], Never> - func getAllTransactions() -> Effect<[WalletEvent], Never> + func getAllSentTransactions() -> EffectTask<[WalletEvent]> + func getAllReceivedTransactions() -> EffectTask<[WalletEvent]> + func getAllClearedTransactions() -> EffectTask<[WalletEvent]> + func getAllPendingTransactions() -> EffectTask<[WalletEvent]> + func getAllTransactions() -> EffectTask<[WalletEvent]> func getUnifiedAddress(account: Int) -> UnifiedAddress? func getTransparentAddress(account: Int) -> TransparentAddress? @@ -74,7 +74,7 @@ protocol SDKSynchronizerClient { zatoshi: Zatoshi, to recipientAddress: Recipient, memo: Memo? - ) -> Effect, Never> + ) -> EffectTask> } extension SDKSynchronizerClient { diff --git a/secant/Dependencies/SDKSynchronizer/SDKSynchronizerLive.swift b/secant/Dependencies/SDKSynchronizer/SDKSynchronizerLive.swift index e986526..03e7026 100644 --- a/secant/Dependencies/SDKSynchronizer/SDKSynchronizerLive.swift +++ b/secant/Dependencies/SDKSynchronizer/SDKSynchronizerLive.swift @@ -113,9 +113,9 @@ class LiveSDKSynchronizerClient: SDKSynchronizerClient { latestScannedSynchronizerState?.transparentBalance } - func getAllSentTransactions() -> Effect<[WalletEvent], Never> { + func getAllSentTransactions() -> EffectTask<[WalletEvent]> { if let transactions = try? synchronizer?.allSentTransactions() { - return Effect(value: transactions.map { + return EffectTask(value: transactions.map { let memos = try? synchronizer?.getMemos(for: $0) let transaction = TransactionState.init(transaction: $0, memos: memos) return WalletEvent(id: transaction.id, state: .send(transaction), timestamp: transaction.timestamp) @@ -125,9 +125,9 @@ class LiveSDKSynchronizerClient: SDKSynchronizerClient { return .none } - func getAllReceivedTransactions() -> Effect<[WalletEvent], Never> { + func getAllReceivedTransactions() -> EffectTask<[WalletEvent]> { if let transactions = try? synchronizer?.allReceivedTransactions() { - return Effect(value: transactions.map { + return EffectTask(value: transactions.map { let memos = try? synchronizer?.getMemos(for: $0) let transaction = TransactionState.init(transaction: $0, memos: memos) return WalletEvent(id: transaction.id, state: .send(transaction), timestamp: transaction.timestamp) @@ -137,9 +137,9 @@ class LiveSDKSynchronizerClient: SDKSynchronizerClient { return .none } - func getAllClearedTransactions() -> Effect<[WalletEvent], Never> { + func getAllClearedTransactions() -> EffectTask<[WalletEvent]> { if let transactions = try? synchronizer?.allClearedTransactions() { - return Effect(value: transactions.map { + return EffectTask(value: transactions.map { let memos = try? synchronizer?.getMemos(for: $0) let transaction = TransactionState.init(transaction: $0, memos: memos) return WalletEvent(id: transaction.id, state: .send(transaction), timestamp: transaction.timestamp) @@ -149,10 +149,10 @@ class LiveSDKSynchronizerClient: SDKSynchronizerClient { return .none } - func getAllPendingTransactions() -> Effect<[WalletEvent], Never> { + func getAllPendingTransactions() -> EffectTask<[WalletEvent]> { if let transactions = try? synchronizer?.allPendingTransactions(), let syncedBlockHeight = synchronizer?.latestScannedHeight { - return Effect(value: transactions.map { + return EffectTask(value: transactions.map { let transaction = TransactionState.init(pendingTransaction: $0, latestBlockHeight: syncedBlockHeight) return WalletEvent(id: transaction.id, state: .pending(transaction), timestamp: transaction.timestamp) }) @@ -161,7 +161,7 @@ class LiveSDKSynchronizerClient: SDKSynchronizerClient { return .none } - func getAllTransactions() -> Effect<[WalletEvent], Never> { + func getAllTransactions() -> EffectTask<[WalletEvent]> { if let pendingTransactions = try? synchronizer?.allPendingTransactions(), let clearedTransactions = try? synchronizer?.allClearedTransactions(), let syncedBlockHeight = synchronizer?.latestScannedHeight { @@ -180,8 +180,8 @@ class LiveSDKSynchronizerClient: SDKSynchronizerClient { } return .merge( - Effect(value: cTxs), - Effect(value: pendingTxs) + EffectTask(value: cTxs), + EffectTask(value: pendingTxs) ) .flatMap(Publishers.Sequence.init(sequence:)) .collect() @@ -208,8 +208,8 @@ class LiveSDKSynchronizerClient: SDKSynchronizerClient { zatoshi: Zatoshi, to recipientAddress: Recipient, memo: Memo? - ) -> Effect, Never> { - return Effect.run { [weak self] send in + ) -> EffectTask> { + return .run { [weak self] send in do { guard let synchronizer = self?.synchronizer else { await send(.failure(SDKSynchronizerClientError.synchronizerNotInitialized as NSError)) diff --git a/secant/Dependencies/SDKSynchronizer/SDKSynchronizerMocks.swift b/secant/Dependencies/SDKSynchronizer/SDKSynchronizerMocks.swift index 3131adb..0d9c82f 100644 --- a/secant/Dependencies/SDKSynchronizer/SDKSynchronizerMocks.swift +++ b/secant/Dependencies/SDKSynchronizer/SDKSynchronizerMocks.swift @@ -47,7 +47,7 @@ class MockSDKSynchronizerClient: SDKSynchronizerClient { WalletBalance(verified: Zatoshi(12345000), total: Zatoshi(12345000)) } - func getAllSentTransactions() -> Effect<[WalletEvent], Never> { + func getAllSentTransactions() -> EffectTask<[WalletEvent]> { let mocked: [TransactionStateMockHelper] = [ TransactionStateMockHelper(date: 1651039202, amount: Zatoshi(1), status: .paid(success: false), uuid: "aa11"), TransactionStateMockHelper(date: 1651039101, amount: Zatoshi(2), uuid: "bb22"), @@ -56,7 +56,7 @@ class MockSDKSynchronizerClient: SDKSynchronizerClient { TransactionStateMockHelper(date: 1651039404, amount: Zatoshi(5), uuid: "ee55") ] - return Effect( + return EffectTask( value: mocked.map { let transaction = TransactionState.placeholder( @@ -72,7 +72,7 @@ class MockSDKSynchronizerClient: SDKSynchronizerClient { ) } - func getAllReceivedTransactions() -> Effect<[WalletEvent], Never> { + func getAllReceivedTransactions() -> EffectTask<[WalletEvent]> { let mocked: [TransactionStateMockHelper] = [ TransactionStateMockHelper(date: 1651039202, amount: Zatoshi(1), status: .paid(success: false), uuid: "aa11"), TransactionStateMockHelper(date: 1651039101, amount: Zatoshi(2), uuid: "bb22"), @@ -81,7 +81,7 @@ class MockSDKSynchronizerClient: SDKSynchronizerClient { TransactionStateMockHelper(date: 1651039404, amount: Zatoshi(5), uuid: "ee55") ] - return Effect( + return EffectTask( value: mocked.map { let transaction = TransactionState.placeholder( @@ -97,7 +97,7 @@ class MockSDKSynchronizerClient: SDKSynchronizerClient { ) } - func getAllClearedTransactions() -> Effect<[WalletEvent], Never> { + func getAllClearedTransactions() -> EffectTask<[WalletEvent]> { let mocked: [TransactionStateMockHelper] = [ TransactionStateMockHelper(date: 1651039202, amount: Zatoshi(1), status: .paid(success: false), uuid: "aa11"), TransactionStateMockHelper(date: 1651039101, amount: Zatoshi(2), uuid: "bb22"), @@ -106,7 +106,7 @@ class MockSDKSynchronizerClient: SDKSynchronizerClient { TransactionStateMockHelper(date: 1651039404, amount: Zatoshi(5), uuid: "ee55") ] - return Effect( + return EffectTask( value: mocked.map { let transaction = TransactionState.placeholder( @@ -122,7 +122,7 @@ class MockSDKSynchronizerClient: SDKSynchronizerClient { ) } - func getAllPendingTransactions() -> Effect<[WalletEvent], Never> { + func getAllPendingTransactions() -> EffectTask<[WalletEvent]> { let mocked: [TransactionStateMockHelper] = [ TransactionStateMockHelper( date: 1651039606, @@ -135,7 +135,7 @@ class MockSDKSynchronizerClient: SDKSynchronizerClient { TransactionStateMockHelper(date: 1651039808, amount: Zatoshi(9), uuid: "ii99") ] - return Effect( + return EffectTask( value: mocked.map { let transaction = TransactionState.placeholder( @@ -151,7 +151,7 @@ class MockSDKSynchronizerClient: SDKSynchronizerClient { ) } - func getAllTransactions() -> Effect<[WalletEvent], Never> { + func getAllTransactions() -> EffectTask<[WalletEvent]> { return .merge( getAllClearedTransactions(), getAllPendingTransactions() @@ -181,7 +181,7 @@ class MockSDKSynchronizerClient: SDKSynchronizerClient { zatoshi: Zatoshi, to recipientAddress: Recipient, memo: Memo? - ) -> Effect, Never> { + ) -> EffectTask> { var memos: [Memo]? = [] if let memo { memos?.append(memo) } @@ -198,6 +198,6 @@ class MockSDKSynchronizerClient: SDKSynchronizerClient { zecAmount: Zatoshi(10) ) - return Effect(value: Result.success(transactionState)) + return EffectTask(value: Result.success(transactionState)) } } diff --git a/secant/Dependencies/SDKSynchronizer/SDKSynchronizerTest.swift b/secant/Dependencies/SDKSynchronizer/SDKSynchronizerTest.swift index 9290c13..66b601d 100644 --- a/secant/Dependencies/SDKSynchronizer/SDKSynchronizerTest.swift +++ b/secant/Dependencies/SDKSynchronizer/SDKSynchronizerTest.swift @@ -42,15 +42,15 @@ class NoopSDKSynchronizer: SDKSynchronizerClient { func getTransparentBalance() -> WalletBalance? { nil } - func getAllSentTransactions() -> Effect<[WalletEvent], Never> { Effect(value: []) } + func getAllSentTransactions() -> EffectTask<[WalletEvent]> { EffectTask(value: []) } - func getAllReceivedTransactions() -> Effect<[WalletEvent], Never> { Effect(value: []) } + func getAllReceivedTransactions() -> EffectTask<[WalletEvent]> { EffectTask(value: []) } - func getAllClearedTransactions() -> Effect<[WalletEvent], Never> { Effect(value: []) } + func getAllClearedTransactions() -> EffectTask<[WalletEvent]> { EffectTask(value: []) } - func getAllPendingTransactions() -> Effect<[WalletEvent], Never> { Effect(value: []) } + func getAllPendingTransactions() -> EffectTask<[WalletEvent]> { EffectTask(value: []) } - func getAllTransactions() -> Effect<[WalletEvent], Never> { Effect(value: []) } + func getAllTransactions() -> EffectTask<[WalletEvent]> { EffectTask(value: []) } func getUnifiedAddress(account: Int) -> UnifiedAddress? { nil } @@ -63,8 +63,8 @@ class NoopSDKSynchronizer: SDKSynchronizerClient { zatoshi: Zatoshi, to recipientAddress: Recipient, memo: Memo? - ) -> Effect, Never> { - Effect(value: Result.failure(SynchronizerError.criticalError as NSError)) + ) -> EffectTask> { + EffectTask(value: Result.failure(SynchronizerError.criticalError as NSError)) } func updateStateChanged(_ newState: SDKSynchronizerState) { @@ -100,7 +100,7 @@ class TestSDKSynchronizerClient: SDKSynchronizerClient { func getTransparentBalance() -> WalletBalance? { nil } - func getAllSentTransactions() -> Effect<[WalletEvent], Never> { + func getAllSentTransactions() -> EffectTask<[WalletEvent]> { let mocked: [TransactionStateMockHelper] = [ TransactionStateMockHelper(date: 1651039202, amount: Zatoshi(1), status: .paid(success: false), uuid: "aa11"), TransactionStateMockHelper(date: 1651039101, amount: Zatoshi(2), uuid: "bb22"), @@ -109,7 +109,7 @@ class TestSDKSynchronizerClient: SDKSynchronizerClient { TransactionStateMockHelper(date: 1651039404, amount: Zatoshi(5), uuid: "ee55") ] - return Effect( + return EffectTask( value: mocked.map { let transaction = TransactionState.placeholder( @@ -125,7 +125,7 @@ class TestSDKSynchronizerClient: SDKSynchronizerClient { ) } - func getAllReceivedTransactions() -> Effect<[WalletEvent], Never> { + func getAllReceivedTransactions() -> EffectTask<[WalletEvent]> { let mocked: [TransactionStateMockHelper] = [ TransactionStateMockHelper(date: 1651039202, amount: Zatoshi(1), status: .paid(success: false), uuid: "aa11"), TransactionStateMockHelper(date: 1651039101, amount: Zatoshi(2), uuid: "bb22"), @@ -134,7 +134,7 @@ class TestSDKSynchronizerClient: SDKSynchronizerClient { TransactionStateMockHelper(date: 1651039404, amount: Zatoshi(5), uuid: "ee55") ] - return Effect( + return EffectTask( value: mocked.map { let transaction = TransactionState.placeholder( @@ -150,7 +150,7 @@ class TestSDKSynchronizerClient: SDKSynchronizerClient { ) } - func getAllClearedTransactions() -> Effect<[WalletEvent], Never> { + func getAllClearedTransactions() -> EffectTask<[WalletEvent]> { let mocked: [TransactionStateMockHelper] = [ TransactionStateMockHelper(date: 1651039202, amount: Zatoshi(1), status: .paid(success: false), uuid: "aa11"), TransactionStateMockHelper(date: 1651039101, amount: Zatoshi(2), uuid: "bb22"), @@ -159,7 +159,7 @@ class TestSDKSynchronizerClient: SDKSynchronizerClient { TransactionStateMockHelper(date: 1651039404, amount: Zatoshi(5), uuid: "ee55") ] - return Effect( + return EffectTask( value: mocked.map { let transaction = TransactionState.placeholder( @@ -175,7 +175,7 @@ class TestSDKSynchronizerClient: SDKSynchronizerClient { ) } - func getAllPendingTransactions() -> Effect<[WalletEvent], Never> { + func getAllPendingTransactions() -> EffectTask<[WalletEvent]> { let mocked: [TransactionStateMockHelper] = [ TransactionStateMockHelper( date: 1651039606, @@ -188,7 +188,7 @@ class TestSDKSynchronizerClient: SDKSynchronizerClient { TransactionStateMockHelper(date: 1651039808, amount: Zatoshi(9), uuid: "ii99") ] - return Effect( + return EffectTask( value: mocked.map { let transaction = TransactionState.placeholder( @@ -204,7 +204,7 @@ class TestSDKSynchronizerClient: SDKSynchronizerClient { ) } - func getAllTransactions() -> Effect<[WalletEvent], Never> { + func getAllTransactions() -> EffectTask<[WalletEvent]> { return .merge( getAllClearedTransactions(), getAllPendingTransactions() @@ -228,8 +228,8 @@ class TestSDKSynchronizerClient: SDKSynchronizerClient { zatoshi: Zatoshi, to recipientAddress: Recipient, memo: Memo? - ) -> Effect, Never> { - return Effect(value: Result.failure(SynchronizerError.criticalError as NSError)) + ) -> EffectTask> { + return EffectTask(value: Result.failure(SynchronizerError.criticalError as NSError)) } func updateStateChanged(_ newState: SDKSynchronizerState) { diff --git a/secant/Features/BalanceBreakdown/BalanceBreakdownStore.swift b/secant/Features/BalanceBreakdown/BalanceBreakdownStore.swift index f088b1a..c04e693 100644 --- a/secant/Features/BalanceBreakdown/BalanceBreakdownStore.swift +++ b/secant/Features/BalanceBreakdown/BalanceBreakdownStore.swift @@ -45,13 +45,13 @@ struct BalanceBreakdownReducer: ReducerProtocol { .cancellable(id: CancelId.self, cancelInFlight: true) case .onDisappear: - return Effect.cancel(id: CancelId.self) + return .cancel(id: CancelId.self) case .synchronizerStateChanged(.synced): - return Effect(value: .updateSynchronizerStatus) + return EffectTask(value: .updateSynchronizerStatus) case .synchronizerStateChanged: - return Effect(value: .updateSynchronizerStatus) + return EffectTask(value: .updateSynchronizerStatus) case .updateSynchronizerStatus: if let shieldedBalance = sdkSynchronizer.latestScannedSynchronizerState?.shieldedBalance { @@ -60,7 +60,7 @@ struct BalanceBreakdownReducer: ReducerProtocol { if let transparentBalance = sdkSynchronizer.latestScannedSynchronizerState?.transparentBalance { state.transparentBalance = transparentBalance } - return Effect(value: .updateLatestBlock) + return EffectTask(value: .updateLatestBlock) case .updateLatestBlock: guard let latestBlockNumber = sdkSynchronizer.latestScannedSynchronizerState?.latestScannedHeight, diff --git a/secant/Features/Home/HomeStore.swift b/secant/Features/Home/HomeStore.swift index 2e22f86..89133c9 100644 --- a/secant/Features/Home/HomeStore.swift +++ b/secant/Features/Home/HomeStore.swift @@ -110,13 +110,13 @@ struct HomeReducer: ReducerProtocol { .map(HomeReducer.Action.synchronizerStateChanged) .eraseToEffect() .cancellable(id: CancelId.self, cancelInFlight: true) - return .concatenate(Effect(value: .updateDestination(nil)), syncEffect) + return .concatenate(EffectTask(value: .updateDestination(nil)), syncEffect) } else { - return Effect(value: .updateDestination(.notEnoughFreeDiskSpace)) + return EffectTask(value: .updateDestination(.notEnoughFreeDiskSpace)) } case .onDisappear: - return Effect.cancel(id: CancelId.self) + return .cancel(id: CancelId.self) case .synchronizerStateChanged(.synced): return .merge( @@ -124,11 +124,11 @@ struct HomeReducer: ReducerProtocol { .receive(on: mainQueue) .map(HomeReducer.Action.updateWalletEvents) .eraseToEffect(), - Effect(value: .updateSynchronizerStatus) + EffectTask(value: .updateSynchronizerStatus) ) case .synchronizerStateChanged: - return Effect(value: .updateSynchronizerStatus) + return EffectTask(value: .updateSynchronizerStatus) case .updateDrawer(let drawerOverlay): state.drawerOverlay = drawerOverlay @@ -155,7 +155,7 @@ struct HomeReducer: ReducerProtocol { case .profile(.settings(.quickRescan)): state.destination = nil - return Effect.task { + return .task { do { try await sdkSynchronizer.rewind(.quick) return .rewindDone(true, .quickRescan) @@ -166,7 +166,7 @@ struct HomeReducer: ReducerProtocol { case .profile(.settings(.fullRescan)): state.destination = nil - return Effect.task { + return .task { do { try await sdkSynchronizer.rewind(.birthday) return .rewindDone(true, .fullRescan) @@ -186,23 +186,23 @@ struct HomeReducer: ReducerProtocol { return .none case .walletEvents(.updateDestination(.all)): - return state.drawerOverlay != .full ? Effect(value: .updateDrawer(.full)) : .none + return state.drawerOverlay != .full ? EffectTask(value: .updateDrawer(.full)) : .none case .walletEvents(.updateDestination(.latest)): - return state.drawerOverlay != .partial ? Effect(value: .updateDrawer(.partial)) : .none + return state.drawerOverlay != .partial ? EffectTask(value: .updateDrawer(.partial)) : .none case .walletEvents: return .none case .send(.updateDestination(.done)): - return Effect(value: .updateDestination(nil)) + return EffectTask(value: .updateDestination(nil)) case .send: return .none case .scan(.found): audioServices.systemSoundVibrate() - return Effect(value: .updateDestination(nil)) + return EffectTask(value: .updateDestination(nil)) case .scan: return .none diff --git a/secant/Features/ImportWallet/ImportWalletStore.swift b/secant/Features/ImportWallet/ImportWalletStore.swift index 7461f33..b6d1f04 100644 --- a/secant/Features/ImportWallet/ImportWalletStore.swift +++ b/secant/Features/ImportWallet/ImportWalletStore.swift @@ -13,9 +13,9 @@ typealias ImportWalletViewStore = ViewStore? - @BindableState var importedSeedPhrase: String = "" - @BindableState var birthdayHeight: String = "" + @BindingState var alert: AlertState? + @BindingState var importedSeedPhrase: String = "" + @BindingState var birthdayHeight: String = "" var wordsCount = 0 var maxWordsCount = 0 var isValidMnemonic = false @@ -111,7 +111,7 @@ struct ImportWalletReducer: ReducerProtocol { ) ) - return Effect(value: .initializeSDK) + return EffectTask(value: .initializeSDK) } catch { // TODO: [#221] Proper Error/Success handling (https://github.com/zcash/secant-ios-wallet/issues/221) state.alert = AlertState( @@ -130,7 +130,7 @@ struct ImportWalletReducer: ReducerProtocol { return .none case .successfullyRecovered: - return Effect(value: .dismissAlert) + return EffectTask(value: .dismissAlert) case .initializeSDK: return .none diff --git a/secant/Features/RecoveryPhraseValidationFlow/RecoveryPhraseValidationFlowStore.swift b/secant/Features/RecoveryPhraseValidationFlow/RecoveryPhraseValidationFlowStore.swift index c108ad8..08a02fb 100644 --- a/secant/Features/RecoveryPhraseValidationFlow/RecoveryPhraseValidationFlowStore.swift +++ b/secant/Features/RecoveryPhraseValidationFlow/RecoveryPhraseValidationFlowStore.swift @@ -83,7 +83,7 @@ struct RecoveryPhraseValidationFlowReducer: ReducerProtocol { return effect } else { return .concatenate( - Effect(value: .failureFeedback), + EffectTask(value: .failureFeedback), effect ) } diff --git a/secant/Features/Root/RootDestination.swift b/secant/Features/Root/RootDestination.swift index ee4a2f0..11dd03e 100644 --- a/secant/Features/Root/RootDestination.swift +++ b/secant/Features/Root/RootDestination.swift @@ -110,7 +110,7 @@ extension RootReducer { guard let url = URL(string: "zcash:\(address)") else { return .none } - return Effect(value: .destination(.deeplink(url))) + return EffectTask(value: .destination(.deeplink(url))) case .home, .initialization, .onboarding, .phraseDisplay, .phraseValidation, .sandbox, .welcome: return .none diff --git a/secant/Features/Root/RootInitialization.swift b/secant/Features/Root/RootInitialization.swift index 4423f58..a22fb71 100644 --- a/secant/Features/Root/RootInitialization.swift +++ b/secant/Features/Root/RootInitialization.swift @@ -28,7 +28,7 @@ extension RootReducer { // TODO: [#524] finish all the wallet events according to definition, https://github.com/zcash/secant-ios-wallet/issues/524 LoggerProxy.event(".appDelegate(.didFinishLaunching)") /// We need to fetch data from keychain, in order to be 100% sure the kecyhain can be read we delay the check a bit - return Effect(value: .initialization(.checkWalletInitialization)) + return EffectTask(value: .initialization(.checkWalletInitialization)) .delay(for: 0.02, scheduler: mainQueue) .eraseToEffect() @@ -39,7 +39,7 @@ extension RootReducer { walletStorage: walletStorage, zcashSDKEnvironment: zcashSDKEnvironment ) - return Effect(value: .initialization(.respondToWalletInitializationState(walletState))) + return EffectTask(value: .initialization(.respondToWalletInitializationState(walletState))) /// Respond to all possible states of the wallet and initiate appropriate side effects including errors handling case .initialization(.respondToWalletInitializationState(let walletState)): @@ -55,12 +55,12 @@ extension RootReducer { state.appInitializationState = .filesMissing } return .concatenate( - Effect(value: .initialization(.initializeSDK)), - Effect(value: .initialization(.checkBackupPhraseValidation)) + EffectTask(value: .initialization(.initializeSDK)), + EffectTask(value: .initialization(.checkBackupPhraseValidation)) ) case .uninitialized: state.appInitializationState = .uninitialized - return Effect(value: .destination(.updateDestination(.onboarding))) + return EffectTask(value: .destination(.updateDestination(.onboarding))) .delay(for: 3, scheduler: mainQueue) .eraseToEffect() .cancellable(id: CancelId.self, cancelInFlight: true) @@ -129,7 +129,7 @@ extension RootReducer { state.appInitializationState = .initialized - return Effect(value: .destination(.updateDestination(landingDestination))) + return EffectTask(value: .destination(.updateDestination(landingDestination))) .delay(for: 3, scheduler: mainQueue) .eraseToEffect() .cancellable(id: CancelId.self, cancelInFlight: true) @@ -150,8 +150,8 @@ extension RootReducer { state.phraseValidationState = randomRecoveryPhrase.random(recoveryPhrase) return .concatenate( - Effect(value: .initialization(.initializeSDK)), - Effect(value: .phraseValidation(.displayBackedUpPhrase)) + EffectTask(value: .initialization(.initializeSDK)), + EffectTask(value: .phraseValidation(.displayBackedUpPhrase)) ) } catch { // TODO: [#201] - merge with issue 221 (https://github.com/zcash/secant-ios-wallet/issues/221) and its Error States @@ -178,18 +178,18 @@ extension RootReducer { case .welcome(.debugMenuStartup), .home(.debugMenuStartup): return .concatenate( - Effect.cancel(id: CancelId.self), - Effect(value: .destination(.updateDestination(.startup))) + EffectTask.cancel(id: CancelId.self), + EffectTask(value: .destination(.updateDestination(.startup))) ) case .onboarding(.importWallet(.successfullyRecovered)): - return Effect(value: .destination(.updateDestination(.home))) + return EffectTask(value: .destination(.updateDestination(.home))) case .onboarding(.importWallet(.initializeSDK)): - return Effect(value: .initialization(.initializeSDK)) + return EffectTask(value: .initialization(.initializeSDK)) case .onboarding(.createNewWallet): - return Effect(value: .initialization(.createNewWallet)) + return EffectTask(value: .initialization(.createNewWallet)) case .home, .destination, .onboarding, .phraseDisplay, .phraseValidation, .sandbox, .welcome: return .none diff --git a/secant/Features/Scan/ScanStore.swift b/secant/Features/Scan/ScanStore.swift index 349efb4..76a3f45 100644 --- a/secant/Features/Scan/ScanStore.swift +++ b/secant/Features/Scan/ScanStore.swift @@ -65,7 +65,7 @@ struct ScanReducer: ReducerProtocol { return .none case .onDisappear: - return Effect.cancel(id: CancelId.self) + return .cancel(id: CancelId.self) case .found: return .none @@ -87,8 +87,8 @@ struct ScanReducer: ReducerProtocol { // 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 return .concatenate( - Effect.cancel(id: CancelId.self), - Effect(value: .found(code)) + EffectTask.cancel(id: CancelId.self), + EffectTask(value: .found(code)) .delay(for: 1.0, scheduler: mainQueue) .eraseToEffect() .cancellable(id: CancelId.self, cancelInFlight: true) @@ -97,7 +97,7 @@ struct ScanReducer: ReducerProtocol { } catch { state.scanStatus = .failed } - return Effect.cancel(id: CancelId.self) + return .cancel(id: CancelId.self) case .torchPressed: do { diff --git a/secant/Features/SendFlow/SendFlowStore.swift b/secant/Features/SendFlow/SendFlowStore.swift index 7c43177..cde5b4d 100644 --- a/secant/Features/SendFlow/SendFlowStore.swift +++ b/secant/Features/SendFlow/SendFlowStore.swift @@ -177,27 +177,27 @@ struct SendFlowReducer: ReducerProtocol { .eraseToEffect() return .concatenate( - Effect(value: .updateDestination(.inProgress)), + EffectTask(value: .updateDestination(.inProgress)), sendTransActionEffect ) } catch { - return Effect(value: .updateDestination(.failure)) + return EffectTask(value: .updateDestination(.failure)) } case .sendTransactionResult(let result): state.isSendingTransaction = false do { _ = try result.get() - return Effect(value: .updateDestination(.success)) + return EffectTask(value: .updateDestination(.success)) } catch { - return Effect(value: .updateDestination(.failure)) + return EffectTask(value: .updateDestination(.failure)) } case .transactionAmountInput: return .none case .transactionAddressInput(.scanQR): - return Effect(value: .updateDestination(.scanQR)) + return EffectTask(value: .updateDestination(.scanQR)) case .transactionAddressInput: return .none @@ -210,7 +210,7 @@ struct SendFlowReducer: ReducerProtocol { .cancellable(id: SyncStatusUpdatesID.self, cancelInFlight: true) case .onDisappear: - return Effect.cancel(id: SyncStatusUpdatesID.self) + return .cancel(id: SyncStatusUpdatesID.self) case .synchronizerStateChanged(.synced): if let shieldedBalance = sdkSynchronizer.latestScannedSynchronizerState?.shieldedBalance { @@ -231,7 +231,7 @@ struct SendFlowReducer: ReducerProtocol { // so we can be sure it's valid and thus `true` value here. state.transactionAddressInputState.isValidAddress = true audioServices.systemSoundVibrate() - return Effect(value: .updateDestination(nil)) + return EffectTask(value: .updateDestination(nil)) case .scan: return .none diff --git a/secant/Features/Settings/SettingsStore.swift b/secant/Features/Settings/SettingsStore.swift index 27350b2..b997054 100644 --- a/secant/Features/Settings/SettingsStore.swift +++ b/secant/Features/Settings/SettingsStore.swift @@ -71,7 +71,7 @@ struct SettingsReducer: ReducerProtocol { let phraseWords = try mnemonic.asWords(storedWallet.seedPhrase) let recoveryPhrase = RecoveryPhrase(words: phraseWords) state.phraseDisplayState.phrase = recoveryPhrase - return Effect(value: .updateDestination(.backupPhrase)) + return EffectTask(value: .updateDestination(.backupPhrase)) } catch { // TODO: [#221] - merge with issue 221 (https://github.com/zcash/secant-ios-wallet/issues/221) and its Error States return .none diff --git a/secant/Features/WalletEventsFlow/WalletEventsFlowStore.swift b/secant/Features/WalletEventsFlow/WalletEventsFlowStore.swift index 8b51366..85e1518 100644 --- a/secant/Features/WalletEventsFlow/WalletEventsFlowStore.swift +++ b/secant/Features/WalletEventsFlow/WalletEventsFlowStore.swift @@ -17,7 +17,7 @@ struct WalletEventsFlowReducer: ReducerProtocol { var destination: Destination? - @BindableState var alert: AlertState? + @BindingState var alert: AlertState? var latestMinedHeight: BlockHeight? var isScrollable = false var requiredTransactionConfirmations = 0 @@ -54,7 +54,7 @@ struct WalletEventsFlowReducer: ReducerProtocol { .cancellable(id: CancelId.self, cancelInFlight: true) case .onDisappear: - return Effect.cancel(id: CancelId.self) + return .cancel(id: CancelId.self) case .synchronizerStateChanged(.synced): if let latestMinedHeight = sdkSynchronizer.synchronizer?.latestScannedHeight { diff --git a/secant/UI Components/TextFields/TransactionAmount/TransactionAmountTextFieldStore.swift b/secant/UI Components/TextFields/TransactionAmount/TransactionAmountTextFieldStore.swift index 66c52e2..2afb409 100644 --- a/secant/UI Components/TextFields/TransactionAmount/TransactionAmountTextFieldStore.swift +++ b/secant/UI Components/TextFields/TransactionAmount/TransactionAmountTextFieldStore.swift @@ -56,14 +56,14 @@ struct TransactionAmountTextFieldReducer: ReducerProtocol { let decimalString = numberFormatter.string(maxCurrencyConvertedValue) ?? "" state.textFieldState.text = "\(decimalString)" - return Effect(value: .updateAmount) + return EffectTask(value: .updateAmount) case .clearValue: state.textFieldState.text = "" return .none case .textField(.set): - return Effect(value: .updateAmount) + return EffectTask(value: .updateAmount) case .updateAmount: guard let number = numberFormatter.number(state.textFieldState.text) else { @@ -93,7 +93,7 @@ struct TransactionAmountTextFieldReducer: ReducerProtocol { let decimalString = numberFormatter.string(NSDecimalNumber(decimal: newValue)) ?? "" state.textFieldState.text = "\(decimalString)" - return Effect(value: .updateAmount) + return EffectTask(value: .updateAmount) } } } diff --git a/secant/Utils/LottieAnimation.swift b/secant/Utils/LottieAnimation.swift index 9db4066..2fb9fe9 100644 --- a/secant/Utils/LottieAnimation.swift +++ b/secant/Utils/LottieAnimation.swift @@ -36,10 +36,10 @@ struct LottieAnimation: UIViewRepresentable { } } - func makeUIView(context: UIViewRepresentableContext) -> AnimationView { - let animationView = AnimationView() + func makeUIView(context: UIViewRepresentableContext) -> LottieAnimationView { + let animationView = LottieAnimationView() - let animation = Lottie.Animation.named(filename) + let animation = Lottie.LottieAnimation.named(filename) animationView.backgroundBehavior = .pauseAndRestore animationView.animation = animation @@ -52,7 +52,7 @@ struct LottieAnimation: UIViewRepresentable { Coordinator(parent: self) } - func updateUIView(_ uiView: AnimationView, context: UIViewRepresentableContext) { + func updateUIView(_ uiView: LottieAnimationView, context: UIViewRepresentableContext) { guard isPlaying else { uiView.stop() return