[#628] TAZ vs ZEC builds (#637)

- all instances of hardcoded ZEC are now dynamic depending on a target
- debug menu fixed
This commit is contained in:
Lukas Korba 2023-03-08 19:50:09 +01:00 committed by GitHub
parent ff58ae718c
commit dea5b19621
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 93 additions and 65 deletions

View File

@ -24,7 +24,7 @@ struct BalanceBreakdownView: View {
.padding(.horizontal, 50) .padding(.horizontal, 50)
VStack(alignment: .leading, spacing: 10) { VStack(alignment: .leading, spacing: 10) {
balanceView( balanceView(
title: L10n.BalanceBreakdown.shieldedZec, title: L10n.BalanceBreakdown.shieldedZec(TargetConstants.tokenName),
viewStore.shieldedBalance.data.total, viewStore.shieldedBalance.data.total,
titleColor: Asset.Colors.Mfp.fontDark.color titleColor: Asset.Colors.Mfp.fontDark.color
) )
@ -37,8 +37,13 @@ struct BalanceBreakdownView: View {
HStack { HStack {
Spacer() Spacer()
Text(L10n.BalanceBreakdown.autoShieldingThreshold(viewStore.autoShieldingThreshold.decimalString())) Text(
.foregroundColor(Asset.Colors.Mfp.fontLight.color) L10n.BalanceBreakdown.autoShieldingThreshold(
viewStore.autoShieldingThreshold.decimalString(),
TargetConstants.tokenName
)
)
.foregroundColor(Asset.Colors.Mfp.fontLight.color)
} }
.padding(.horizontal, 50) .padding(.horizontal, 50)
} }
@ -58,10 +63,15 @@ extension BalanceBreakdownView {
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text("\(title)") Text("\(title)")
.foregroundColor(titleColor) .foregroundColor(titleColor)
Text(L10n.balance(balance.decimalString(formatter: NumberFormatter.zcashNumberFormatter8FractionDigits))) Text(
.font(.system(size: 32)) L10n.balance(
.fontWeight(.bold) balance.decimalString(formatter: NumberFormatter.zcashNumberFormatter8FractionDigits),
.foregroundColor(Asset.Colors.Mfp.fontDark.color) TargetConstants.tokenName
)
)
.font(.system(size: 32))
.fontWeight(.bold)
.foregroundColor(Asset.Colors.Mfp.fontDark.color)
} }
} }
} }

View File

@ -78,7 +78,7 @@ extension HomeView {
Button(action: { Button(action: {
viewStore.send(.updateDestination(.send)) viewStore.send(.updateDestination(.send))
}, label: { }, label: {
Text(L10n.Home.sendZec) Text(L10n.Home.sendZec(TargetConstants.tokenName))
}) })
.activeButtonStyle .activeButtonStyle
.padding(.bottom, 30) .padding(.bottom, 30)
@ -90,7 +90,7 @@ extension HomeView {
Button(action: { Button(action: {
viewStore.send(.updateDestination(.profile)) viewStore.send(.updateDestination(.profile))
}, label: { }, label: {
Text(L10n.Home.receiveZec) Text(L10n.Home.receiveZec(TargetConstants.tokenName))
}) })
.activeButtonStyle .activeButtonStyle
.padding(.bottom, 30) .padding(.bottom, 30)
@ -101,12 +101,9 @@ extension HomeView {
Button { Button {
viewStore.send(.updateDestination(.balanceBreakdown)) viewStore.send(.updateDestination(.balanceBreakdown))
} label: { } label: {
Text(L10n.balance(viewStore.shieldedBalance.data.total.decimalString())) Text(L10n.balance(viewStore.shieldedBalance.data.total.decimalString(), TargetConstants.tokenName))
.font(.system(size: 32)) .font(.system(size: 32))
.fontWeight(.bold) .fontWeight(.bold)
.accessDebugMenuWithHiddenGesture {
viewStore.send(.debugMenuStartup)
}
} }
if viewStore.walletConfig.isEnabled(.showFiatConversion) { if viewStore.walletConfig.isEnabled(.showFiatConversion) {
@ -115,6 +112,9 @@ extension HomeView {
} }
Text(viewStore.synchronizerStatusSnapshot.message) Text(viewStore.synchronizerStatusSnapshot.message)
.accessDebugMenuWithHiddenGesture {
viewStore.send(.debugMenuStartup)
}
} }
.foregroundColor(Asset.Colors.Mfp.primary.color) .foregroundColor(Asset.Colors.Mfp.primary.color)
} }

View File

@ -10,7 +10,7 @@ struct CreateTransaction: View {
return WithViewStore(store) { viewStore in return WithViewStore(store) { viewStore in
VStack { VStack {
VStack(spacing: 0) { VStack(spacing: 0) {
Text(L10n.Balance.available(viewStore.shieldedBalance.data.total.decimalString())) Text(L10n.Balance.available(viewStore.shieldedBalance.data.total.decimalString(), TargetConstants.tokenName))
.font(.system(size: 32)) .font(.system(size: 32))
.fontWeight(.bold) .fontWeight(.bold)
Text(L10n.Send.fundsInfo) Text(L10n.Send.fundsInfo)

View File

@ -16,7 +16,7 @@ struct TransactionSendingView: View {
ZStack { ZStack {
VStack(alignment: .center, spacing: 40) { VStack(alignment: .center, spacing: 40) {
Spacer() Spacer()
Text(L10n.Send.sendingTo(viewStore.amount.decimalString())) Text(L10n.Send.sendingTo(viewStore.amount.decimalString(), TargetConstants.tokenName))
.foregroundColor(Asset.Colors.Mfp.fontDark.color) .foregroundColor(Asset.Colors.Mfp.fontDark.color)
Text(viewStore.address) Text(viewStore.address)

View File

@ -23,23 +23,23 @@ struct TransactionDetailView: View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
switch transaction.status { switch transaction.status {
case .paid: case .paid:
Text(L10n.Transaction.youSent(transaction.zecAmount.decimalString())) Text(L10n.Transaction.youSent(transaction.zecAmount.decimalString(), TargetConstants.tokenName))
.padding() .padding()
address(mark: .inactive, viewStore: viewStore) address(mark: .inactive, viewStore: viewStore)
memo(transaction, viewStore, mark: .highlight) memo(transaction, viewStore, mark: .highlight)
case .pending: case .pending:
Text(L10n.Transaction.youAreSending(transaction.zecAmount.decimalString())) Text(L10n.Transaction.youAreSending(transaction.zecAmount.decimalString(), TargetConstants.tokenName))
.padding() .padding()
address(mark: .inactive, viewStore: viewStore) address(mark: .inactive, viewStore: viewStore)
memo(transaction, viewStore, mark: .highlight) memo(transaction, viewStore, mark: .highlight)
case .received: case .received:
Text(L10n.Transaction.youReceived(transaction.zecAmount.decimalString())) Text(L10n.Transaction.youReceived(transaction.zecAmount.decimalString(), TargetConstants.tokenName))
.padding() .padding()
address(mark: .inactive, viewStore: viewStore) address(mark: .inactive, viewStore: viewStore)
memo(transaction, viewStore, mark: .highlight) memo(transaction, viewStore, mark: .highlight)
case .failed: case .failed:
Text(L10n.Transaction.youDidNotSent(transaction.zecAmount.decimalString())) Text(L10n.Transaction.youDidNotSent(transaction.zecAmount.decimalString(), TargetConstants.tokenName))
.padding() .padding()
address(mark: .inactive, viewStore: viewStore) address(mark: .inactive, viewStore: viewStore)
memo(transaction, viewStore, mark: .highlight) memo(transaction, viewStore, mark: .highlight)

View File

@ -33,7 +33,7 @@ struct TransactionRowView: View {
Text(transaction.unarySymbol) Text(transaction.unarySymbol)
.font(.system(size: 16)) .font(.system(size: 16))
.foregroundColor(Asset.Colors.Mfp.fontDark.color) .foregroundColor(Asset.Colors.Mfp.fontDark.color)
+ Text(L10n.balance(transaction.zecAmount.decimalString())) + Text(L10n.balance(transaction.zecAmount.decimalString(), TargetConstants.tokenName))
.font(.system(size: 16)) .font(.system(size: 16))
.foregroundColor(Asset.Colors.Mfp.fontDark.color) .foregroundColor(Asset.Colors.Mfp.fontDark.color)
} }

View File

@ -10,9 +10,9 @@ import Foundation
// swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length // swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length
// swiftlint:disable nesting type_body_length type_name vertical_whitespace_opening_braces // swiftlint:disable nesting type_body_length type_name vertical_whitespace_opening_braces
internal enum L10n { internal enum L10n {
/// %@ ZEC /// %@ %@
internal static func balance(_ p1: Any) -> String { internal static func balance(_ p1: Any, _ p2: Any) -> String {
return L10n.tr("Localizable", "balance", String(describing: p1), fallback: "%@ ZEC") return L10n.tr("Localizable", "balance", String(describing: p1), String(describing: p2), fallback: "%@ %@")
} }
/// QR Code for %@ /// QR Code for %@
internal static func qrCodeFor(_ p1: Any) -> String { internal static func qrCodeFor(_ p1: Any) -> String {
@ -35,22 +35,24 @@ internal enum L10n {
} }
} }
internal enum Balance { internal enum Balance {
/// %@ ZEC Available /// %@ %@ Available
internal static func available(_ p1: Any) -> String { internal static func available(_ p1: Any, _ p2: Any) -> String {
return L10n.tr("Localizable", "balance.available", String(describing: p1), fallback: "%@ ZEC Available") return L10n.tr("Localizable", "balance.available", String(describing: p1), String(describing: p2), fallback: "%@ %@ Available")
} }
} }
internal enum BalanceBreakdown { internal enum BalanceBreakdown {
/// Auto Shielding Threshold: %@ ZEC /// Auto Shielding Threshold: %@ %@
internal static func autoShieldingThreshold(_ p1: Any) -> String { internal static func autoShieldingThreshold(_ p1: Any, _ p2: Any) -> String {
return L10n.tr("Localizable", "balanceBreakdown.autoShieldingThreshold", String(describing: p1), fallback: "Auto Shielding Threshold: %@ ZEC") return L10n.tr("Localizable", "balanceBreakdown.autoShieldingThreshold", String(describing: p1), String(describing: p2), fallback: "Auto Shielding Threshold: %@ %@")
} }
/// Block: %@ /// Block: %@
internal static func blockId(_ p1: Any) -> String { internal static func blockId(_ p1: Any) -> String {
return L10n.tr("Localizable", "balanceBreakdown.blockId", String(describing: p1), fallback: "Block: %@") return L10n.tr("Localizable", "balanceBreakdown.blockId", String(describing: p1), fallback: "Block: %@")
} }
/// SHIELDED ZEC (SPENDABLE) /// SHIELDED %@ (SPENDABLE)
internal static let shieldedZec = L10n.tr("Localizable", "balanceBreakdown.shieldedZec", fallback: "SHIELDED ZEC (SPENDABLE)") internal static func shieldedZec(_ p1: Any) -> String {
return L10n.tr("Localizable", "balanceBreakdown.shieldedZec", String(describing: p1), fallback: "SHIELDED %@ (SPENDABLE)")
}
/// TOTAL BALANCE /// TOTAL BALANCE
internal static let totalBalance = L10n.tr("Localizable", "balanceBreakdown.totalBalance", fallback: "TOTAL BALANCE") internal static let totalBalance = L10n.tr("Localizable", "balanceBreakdown.totalBalance", fallback: "TOTAL BALANCE")
/// TRANSPARENT BALANCE /// TRANSPARENT BALANCE
@ -86,8 +88,10 @@ internal enum L10n {
internal enum TransactionAmount { internal enum TransactionAmount {
/// Amount: /// Amount:
internal static let amount = L10n.tr("Localizable", "field.transactionAmount.amount", fallback: "Amount:") internal static let amount = L10n.tr("Localizable", "field.transactionAmount.amount", fallback: "Amount:")
/// ZEC Amount /// %@ Amount
internal static let zecAmount = L10n.tr("Localizable", "field.transactionAmount.zecAmount", fallback: "ZEC Amount") internal static func zecAmount(_ p1: Any) -> String {
return L10n.tr("Localizable", "field.transactionAmount.zecAmount", String(describing: p1), fallback: "%@ Amount")
}
} }
} }
internal enum General { internal enum General {
@ -121,10 +125,14 @@ internal enum L10n {
internal static let yes = L10n.tr("Localizable", "general.yes", fallback: "Yes") internal static let yes = L10n.tr("Localizable", "general.yes", fallback: "Yes")
} }
internal enum Home { internal enum Home {
/// Receive ZEC /// Receive %@
internal static let receiveZec = L10n.tr("Localizable", "home.receiveZec", fallback: "Receive ZEC") internal static func receiveZec(_ p1: Any) -> String {
/// Send ZEC return L10n.tr("Localizable", "home.receiveZec", String(describing: p1), fallback: "Receive %@")
internal static let sendZec = L10n.tr("Localizable", "home.sendZec", fallback: "Send ZEC") }
/// Send %@
internal static func sendZec(_ p1: Any) -> String {
return L10n.tr("Localizable", "home.sendZec", String(describing: p1), fallback: "Send %@")
}
/// Secant Wallet /// Secant Wallet
internal static let title = L10n.tr("Localizable", "home.title", fallback: "Secant Wallet") internal static let title = L10n.tr("Localizable", "home.title", fallback: "Secant Wallet")
/// See transaction history /// See transaction history
@ -426,9 +434,9 @@ internal enum L10n {
} }
/// Write a private message here /// Write a private message here
internal static let memoPlaceholder = L10n.tr("Localizable", "send.memoPlaceholder", fallback: "Write a private message here") internal static let memoPlaceholder = L10n.tr("Localizable", "send.memoPlaceholder", fallback: "Write a private message here")
/// Sending %@ ZEC to /// Sending %@ %@ to
internal static func sendingTo(_ p1: Any) -> String { internal static func sendingTo(_ p1: Any, _ p2: Any) -> String {
return L10n.tr("Localizable", "send.sendingTo", String(describing: p1), fallback: "Sending %@ ZEC to") return L10n.tr("Localizable", "send.sendingTo", String(describing: p1), String(describing: p2), fallback: "Sending %@ %@ to")
} }
/// Sending transaction succeeded /// Sending transaction succeeded
internal static let succeeded = L10n.tr("Localizable", "send.succeeded", fallback: "Sending transaction succeeded") internal static let succeeded = L10n.tr("Localizable", "send.succeeded", fallback: "Sending transaction succeeded")
@ -560,21 +568,21 @@ internal enum L10n {
internal static let unconfirmed = L10n.tr("Localizable", "transaction.unconfirmed", fallback: "unconfirmed") internal static let unconfirmed = L10n.tr("Localizable", "transaction.unconfirmed", fallback: "unconfirmed")
/// With memo: /// With memo:
internal static let withMemo = L10n.tr("Localizable", "transaction.withMemo", fallback: "With memo:") internal static let withMemo = L10n.tr("Localizable", "transaction.withMemo", fallback: "With memo:")
/// You are sending %@ ZEC /// You are sending %@ %@
internal static func youAreSending(_ p1: Any) -> String { internal static func youAreSending(_ p1: Any, _ p2: Any) -> String {
return L10n.tr("Localizable", "transaction.youAreSending", String(describing: p1), fallback: "You are sending %@ ZEC") return L10n.tr("Localizable", "transaction.youAreSending", String(describing: p1), String(describing: p2), fallback: "You are sending %@ %@")
} }
/// You DID NOT send %@ ZEC /// You DID NOT send %@ %@
internal static func youDidNotSent(_ p1: Any) -> String { internal static func youDidNotSent(_ p1: Any, _ p2: Any) -> String {
return L10n.tr("Localizable", "transaction.youDidNotSent", String(describing: p1), fallback: "You DID NOT send %@ ZEC") return L10n.tr("Localizable", "transaction.youDidNotSent", String(describing: p1), String(describing: p2), fallback: "You DID NOT send %@ %@")
} }
/// You received %@ ZEC /// You received %@ %@
internal static func youReceived(_ p1: Any) -> String { internal static func youReceived(_ p1: Any, _ p2: Any) -> String {
return L10n.tr("Localizable", "transaction.youReceived", String(describing: p1), fallback: "You received %@ ZEC") return L10n.tr("Localizable", "transaction.youReceived", String(describing: p1), String(describing: p2), fallback: "You received %@ %@")
} }
/// You sent %@ ZEC /// You sent %@ %@
internal static func youSent(_ p1: Any) -> String { internal static func youSent(_ p1: Any, _ p2: Any) -> String {
return L10n.tr("Localizable", "transaction.youSent", String(describing: p1), fallback: "You sent %@ ZEC") return L10n.tr("Localizable", "transaction.youSent", String(describing: p1), String(describing: p2), fallback: "You sent %@ %@")
} }
} }
internal enum TransactionDetail { internal enum TransactionDetail {

View File

@ -62,8 +62,8 @@
"importWallet.alert.failed.message" = "Error: %@"; "importWallet.alert.failed.message" = "Error: %@";
// MARK: - Home Screen // MARK: - Home Screen
"home.sendZec" = "Send ZEC"; "home.sendZec" = "Send %@";
"home.receiveZec" = "Receive ZEC"; "home.receiveZec" = "Receive %@";
"home.transactionHistory" = "See transaction history"; "home.transactionHistory" = "See transaction history";
"home.title" = "Secant Wallet"; "home.title" = "Secant Wallet";
@ -81,10 +81,10 @@
// MARK: - Balance Breakdown // MARK: - Balance Breakdown
"balanceBreakdown.blockId" = "Block: %@"; "balanceBreakdown.blockId" = "Block: %@";
"balanceBreakdown.shieldedZec" = "SHIELDED ZEC (SPENDABLE)"; "balanceBreakdown.shieldedZec" = "SHIELDED %@ (SPENDABLE)";
"balanceBreakdown.transparentBalance" = "TRANSPARENT BALANCE"; "balanceBreakdown.transparentBalance" = "TRANSPARENT BALANCE";
"balanceBreakdown.totalBalance" = "TOTAL BALANCE"; "balanceBreakdown.totalBalance" = "TOTAL BALANCE";
"balanceBreakdown.autoShieldingThreshold" = "Auto Shielding Threshold: %@ ZEC"; "balanceBreakdown.autoShieldingThreshold" = "Auto Shielding Threshold: %@ %@";
// MARK: - Scan // MARK: - Scan
"scan.info" = "We will validate any Zcash URI and take you to the appropriate action."; "scan.info" = "We will validate any Zcash URI and take you to the appropriate action.";
@ -98,7 +98,7 @@
"send.memoPlaceholder" = "Write a private message here"; "send.memoPlaceholder" = "Write a private message here";
"send.failed" = "Sending transaction failed"; "send.failed" = "Sending transaction failed";
"send.succeeded" = "Sending transaction succeeded"; "send.succeeded" = "Sending transaction succeeded";
"send.sendingTo" = "Sending %@ ZEC to"; "send.sendingTo" = "Sending %@ %@ to";
"send.amount" = "amount: %@"; "send.amount" = "amount: %@";
"send.address" = " address: %@"; "send.address" = " address: %@";
"send.memo" = " memo: %@"; "send.memo" = " memo: %@";
@ -131,10 +131,10 @@
"transaction.sending" = "Sending"; "transaction.sending" = "Sending";
"transaction.received" = "Received"; "transaction.received" = "Received";
"transaction.failed" = "Failed"; "transaction.failed" = "Failed";
"transaction.youSent" = "You sent %@ ZEC"; "transaction.youSent" = "You sent %@ %@";
"transaction.youAreSending" = "You are sending %@ ZEC"; "transaction.youAreSending" = "You are sending %@ %@";
"transaction.youReceived" = "You received %@ ZEC"; "transaction.youReceived" = "You received %@ %@";
"transaction.youDidNotSent" = "You DID NOT send %@ ZEC"; "transaction.youDidNotSent" = "You DID NOT send %@ %@";
"transaction.pending" = "PENDING"; "transaction.pending" = "PENDING";
"transaction.confirmed" = "Confirmed"; "transaction.confirmed" = "Confirmed";
"transaction.confirmedTimes" = "%@ times"; "transaction.confirmedTimes" = "%@ times";
@ -165,8 +165,8 @@
"general.cancel" = "Cancel"; "general.cancel" = "Cancel";
"general.success" = "Success"; "general.success" = "Success";
"general.unknown" = "Unknown"; "general.unknown" = "Unknown";
"balance" = "%@ ZEC"; "balance" = "%@ %@";
"balance.available" = "%@ ZEC Available"; "balance.available" = "%@ %@ Available";
"qrCodeFor" = "QR Code for %@"; "qrCodeFor" = "QR Code for %@";
"general.dateNotAvailable" = "date not available"; "general.dateNotAvailable" = "date not available";
@ -244,5 +244,5 @@
"field.transactionAddress.validZcashAddress" = "Valid Zcash Address"; "field.transactionAddress.validZcashAddress" = "Valid Zcash Address";
"field.transactionAddress.to" = "To:"; "field.transactionAddress.to" = "To:";
"field.transactionAmount.zecAmount" = "ZEC Amount"; "field.transactionAmount.zecAmount" = "%@ Amount";
"field.transactionAmount.amount" = "Amount:"; "field.transactionAmount.amount" = "Amount:";

View File

@ -60,6 +60,16 @@ enum TargetConstants {
return ZcashNetworkBuilder.network(for: .testnet) return ZcashNetworkBuilder.network(for: .testnet)
#else #else
fatalError("SECANT_MAINNET or SECANT_TESTNET flags not defined on Swift Compiler custom flags of your build target.") fatalError("SECANT_MAINNET or SECANT_TESTNET flags not defined on Swift Compiler custom flags of your build target.")
#endif
}
static var tokenName: String {
#if SECANT_MAINNET
return "ZEC"
#elseif SECANT_TESTNET
return "TAZ"
#else
fatalError("SECANT_MAINNET or SECANT_TESTNET flags not defined on Swift Compiler custom flags of your build target.")
#endif #endif
} }
} }

View File

@ -14,7 +14,7 @@ struct TransactionAmountTextField: View {
var body: some View { var body: some View {
VStack { VStack {
SingleLineTextField( SingleLineTextField(
placeholderText: L10n.Field.TransactionAmount.zecAmount, placeholderText: L10n.Field.TransactionAmount.zecAmount(TargetConstants.tokenName),
title: L10n.Field.TransactionAmount.amount, title: L10n.Field.TransactionAmount.amount,
store: store.scope( store: store.scope(
state: \.textFieldState, state: \.textFieldState,