[#790] Adopt latest SDK (#791)

- The SDK updated to the latest main (commit hash)
- Fixes for a few texts
- UX improvement: Upgrading databases... label for cases when it takes a few seconds, most of the times it is so quick that the label is even not visible to the user. It simple dismisses before user lands on a home page from the welcome screen
- fixed tests after adding the flag for migration
This commit is contained in:
Lukas Korba 2023-07-31 18:07:44 +02:00 committed by GitHub
parent ae2c18006d
commit 0206641fc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 17 deletions

View File

@ -60,7 +60,7 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/swift-case-paths", from: "0.14.1"),
.package(url: "https://github.com/pointfreeco/swift-url-routing", from: "0.5.0"),
.package(url: "https://github.com/SwiftGen/SwiftGenPlugin", from: "6.6.0"),
.package(url: "https://github.com/zcash/ZcashLightClientKit", revision: "ee3d082155bf542aa3580c84e6140a329633319a"),
.package(url: "https://github.com/zcash/ZcashLightClientKit", revision: "e4cea0c265e803ad2820d358c1daa565c3107497"),
.package(url: "https://github.com/zcash-hackworks/MnemonicSwift", from: "2.2.4")
],
targets: [

View File

@ -46,6 +46,7 @@ public struct HomeReducer: ReducerProtocol {
public var synchronizerStatusSnapshot: SyncStatusSnapshot
public var walletConfig: WalletConfig
public var walletEventsState: WalletEventsFlowReducer.State
public var migratingDatabase = true
// TODO: [#311] - Get the ZEC price from the SDK, https://github.com/zcash/secant-ios-wallet/issues/311
public var zecPrice = Decimal(140.0)
@ -196,10 +197,14 @@ public struct HomeReducer: ReducerProtocol {
case .synchronizerStateChanged(let latestState):
let snapshot = SyncStatusSnapshot.snapshotFor(state: latestState.syncStatus)
guard snapshot != state.synchronizerStatusSnapshot else {
guard snapshot.syncStatus != state.synchronizerStatusSnapshot.syncStatus else {
return .none
}
if snapshot.syncStatus != .unprepared {
state.migratingDatabase = false
}
state.synchronizerStatusSnapshot = snapshot
state.shieldedBalance = latestState.shieldedBalance.redacted

View File

@ -141,10 +141,14 @@ extension HomeView {
.font(.system(size: 20))
}
Text(viewStore.synchronizerStatusSnapshot.message)
.accessDebugMenuWithHiddenGesture {
viewStore.send(.debugMenuStartup)
}
if viewStore.migratingDatabase {
Text(L10n.Home.migratingDatabases)
} else {
Text(viewStore.synchronizerStatusSnapshot.message)
.accessDebugMenuWithHiddenGesture {
viewStore.send(.debugMenuStartup)
}
}
}
.foregroundColor(Asset.Colors.Mfp.primary.color)
}

View File

@ -147,6 +147,8 @@ public enum L10n {
public static let yes = L10n.tr("Localizable", "general.yes", fallback: "Yes")
}
public enum Home {
/// Upgrading databases
public static let migratingDatabases = L10n.tr("Localizable", "home.migratingDatabases", fallback: "Upgrading databases…")
/// Receive %@
public static func receiveZec(_ p1: Any) -> String {
return L10n.tr("Localizable", "home.receiveZec", String(describing: p1), fallback: "Receive %@")
@ -485,12 +487,12 @@ public enum L10n {
/// Send Zcash
public static let title = L10n.tr("Localizable", "send.title", fallback: "Send Zcash")
public enum Error {
/// insufficient funds
public static let insufficientFunds = L10n.tr("Localizable", "send.error.insufficientFunds", fallback: "insufficient funds")
/// invalid address
public static let invalidAddress = L10n.tr("Localizable", "send.error.invalidAddress", fallback: "invalid address")
/// invalid amount
public static let invalidAmount = L10n.tr("Localizable", "send.error.invalidAmount", fallback: "invalid amount")
/// Insufficient funds
public static let insufficientFunds = L10n.tr("Localizable", "send.error.insufficientFunds", fallback: "Insufficient funds")
/// Invalid address
public static let invalidAddress = L10n.tr("Localizable", "send.error.invalidAddress", fallback: "Invalid address")
/// Invalid amount
public static let invalidAmount = L10n.tr("Localizable", "send.error.invalidAmount", fallback: "Invalid amount")
}
}
public enum Settings {

View File

@ -75,6 +75,8 @@
"home.syncFailed.title" = "Sync failed!";
"home.syncFailed.dismiss" = "Dismiss";
"home.syncFailed.retry" = "Retry";
"home.migratingDatabases" = "Upgrading databases…";
// MARK: - Receive ZEC (Formerly Profile Screen)
"receiveZec.yourAddress" = "Your Address";
"receiveZec.error.cantExtractUnifiedAddress" = "could not extract UA";

View File

@ -230,7 +230,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/zcash-hackworks/zcash-light-client-ffi",
"state" : {
"revision" : "cdbc06f10b2d7cbe0d6362b30f68167825942e86"
"revision" : "7718b764027c2a4b9f654ed0b712b87ce881348f"
}
},
{
@ -238,7 +238,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/zcash/ZcashLightClientKit",
"state" : {
"revision" : "ee3d082155bf542aa3580c84e6140a329633319a"
"revision" : "e4cea0c265e803ad2820d358c1daa565c3107497"
}
}
],

View File

@ -59,9 +59,7 @@ class HomeTests: XCTestCase {
// expected side effects as a result of .onAppear registration
store.receive(.updateDestination(nil))
store.receive(.synchronizerStateChanged(.zero)) { state in
state.synchronizerStatusSnapshot = SyncStatusSnapshot.snapshotFor(state: .unprepared)
}
store.receive(.synchronizerStateChanged(.zero))
// long-living (cancelable) effects need to be properly canceled.
// the .onDisappear action cancels the observer of the synchronizer status change.
@ -107,6 +105,7 @@ class HomeTests: XCTestCase {
store.send(.synchronizerStateChanged(state)) { state in
state.synchronizerStatusSnapshot = errorSnapshot
state.migratingDatabase = false
}
store.receive(.showSynchronizerErrorAlert(testError)) { state in

View File

@ -47,6 +47,7 @@ final class ReviewRequestTests: XCTestCase {
await store.send(.synchronizerStateChanged(syncState)) { state in
state.synchronizerStatusSnapshot = snapshot
state.migratingDatabase = false
}
let storedDate = userDefaultsClient.objectForKey(ReviewRequestClient.Constants.latestSyncKey) as? TimeInterval