[iOS][Wallet][CodeHealth] fix some wallet warnings (#35433)
fix some wallet warnings
This commit is contained in:
@@ -113,10 +113,10 @@ struct LineChartView<DataType: DataPoint, FillStyle: View>: View {
|
||||
}
|
||||
}
|
||||
|
||||
private struct DragContext<DataType: DataPoint> {
|
||||
private struct DragContext<DragContextDataType: DataPoint> {
|
||||
var location: CGPoint
|
||||
var size: CGSize
|
||||
var dataPoint: DataType?
|
||||
var dataPoint: DragContextDataType?
|
||||
}
|
||||
|
||||
@State private var dragContext: DragContext<DataType>?
|
||||
|
||||
@@ -204,19 +204,16 @@ struct FiltersDisplaySettingsView: View {
|
||||
}
|
||||
.padding(.horizontal)
|
||||
}
|
||||
.onChange(
|
||||
of: groupBy,
|
||||
perform: { newValue in
|
||||
if isNFTFilters {
|
||||
if newValue == .accounts {
|
||||
isHidingUnownedNFTs = true
|
||||
isHidingUnownedNFTsDisabled = true
|
||||
} else {
|
||||
isHidingUnownedNFTsDisabled = false
|
||||
}
|
||||
.onChange(of: groupBy) { _, newValue in
|
||||
if isNFTFilters {
|
||||
if newValue == .accounts {
|
||||
isHidingUnownedNFTs = true
|
||||
isHidingUnownedNFTsDisabled = true
|
||||
} else {
|
||||
isHidingUnownedNFTsDisabled = false
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
.background(Color(uiColor: WalletV2Design.containerBackground))
|
||||
.safeAreaInset(
|
||||
edge: .bottom,
|
||||
|
||||
@@ -211,23 +211,17 @@ struct NFTDetailView: View {
|
||||
}
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color(UIColor.braveGroupedBackground))
|
||||
.onChange(
|
||||
of: nftDetailStore.nftMetadata,
|
||||
perform: { newValue in
|
||||
if let newMetadata = newValue {
|
||||
onNFTMetadataRefreshed?(newMetadata)
|
||||
}
|
||||
.onChange(of: nftDetailStore.nftMetadata) { _, newValue in
|
||||
if let newMetadata = newValue {
|
||||
onNFTMetadataRefreshed?(newMetadata)
|
||||
}
|
||||
)
|
||||
.onChange(
|
||||
of: keyringStore.isWalletLocked,
|
||||
perform: { isLocked in
|
||||
guard isLocked else { return }
|
||||
if isPresentingRemoveAlert {
|
||||
isPresentingRemoveAlert = false
|
||||
}
|
||||
}
|
||||
.onChange(of: keyringStore.isWalletLocked) { _, isLocked in
|
||||
guard isLocked else { return }
|
||||
if isPresentingRemoveAlert {
|
||||
isPresentingRemoveAlert = false
|
||||
}
|
||||
)
|
||||
}
|
||||
.background(Color(UIColor.braveGroupedBackground).ignoresSafeArea())
|
||||
.navigationBarTitle(nftDetailStore.nft.nftDetailTitle)
|
||||
.toolbar {
|
||||
|
||||
@@ -219,8 +219,12 @@ struct CreateWalletView: View {
|
||||
EmptyView()
|
||||
}
|
||||
)
|
||||
.onChange(of: password, perform: handleInputChange)
|
||||
.onChange(of: repeatedPassword, perform: handleInputChange)
|
||||
.onChange(of: password) { _, newValue in
|
||||
handleInputChange(newValue)
|
||||
}
|
||||
.onChange(of: repeatedPassword) { _, newValue in
|
||||
handleInputChange(newValue)
|
||||
}
|
||||
.navigationBarBackButtonHidden(isShowingCreatingWallet)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.overlay {
|
||||
|
||||
@@ -156,14 +156,11 @@ struct VerifyRecoveryPhraseView: View {
|
||||
)
|
||||
)
|
||||
.transparentNavigationBar(backButtonDisplayMode: .generic)
|
||||
.onChange(
|
||||
of: input,
|
||||
perform: { newValue in
|
||||
if newValue.isEmpty {
|
||||
isShowingError = false
|
||||
}
|
||||
.onChange(of: input) { _, newValue in
|
||||
if newValue.isEmpty {
|
||||
isShowingError = false
|
||||
}
|
||||
)
|
||||
}
|
||||
.onAppear {
|
||||
isFieldFocused = true
|
||||
}
|
||||
|
||||
@@ -292,14 +292,11 @@ struct AddCustomAssetView: View {
|
||||
}
|
||||
.scrollContentBackground(.hidden)
|
||||
.background(Color(UIColor.braveGroupedBackground))
|
||||
.onChange(
|
||||
of: selectedTokenType,
|
||||
perform: { _ in
|
||||
guard tokenNeedsTokenId == nil else { return }
|
||||
resignFirstResponder()
|
||||
clearInput()
|
||||
}
|
||||
)
|
||||
.onChange(of: selectedTokenType) { _, _ in
|
||||
guard tokenNeedsTokenId == nil else { return }
|
||||
resignFirstResponder()
|
||||
clearInput()
|
||||
}
|
||||
.navigationTitle(Strings.Wallet.customTokenTitle)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
|
||||
@@ -461,7 +461,7 @@ public class SendTokenStore: ObservableObject, WalletObserverStore {
|
||||
fromAccount: selectedAccount,
|
||||
recipient: sendAddress
|
||||
)
|
||||
case .ada:
|
||||
case .ada, .dot:
|
||||
break
|
||||
@unknown default:
|
||||
break
|
||||
|
||||
+7
-10
@@ -101,17 +101,14 @@ struct TransactionConfirmationView: View {
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.foregroundColor(Color(.braveLabel))
|
||||
.background(Color(.braveGroupedBackground).edgesIgnoringSafeArea(.all))
|
||||
.onChange(
|
||||
of: confirmationStore.activeTransactionId,
|
||||
perform: { newValue in
|
||||
// we are looking for `activeTransactionId` value
|
||||
// when the value is an empty string meaning there is no active transaction
|
||||
// aka there is no remaining pending transations
|
||||
if newValue == "" {
|
||||
onDismiss()
|
||||
}
|
||||
.onChange(of: confirmationStore.activeTransactionId) { _, newValue in
|
||||
// we are looking for `activeTransactionId` value
|
||||
// when the value is an empty string meaning there is no active transaction
|
||||
// aka there is no remaining pending transations
|
||||
if newValue == "" {
|
||||
onDismiss()
|
||||
}
|
||||
)
|
||||
}
|
||||
.onAppear {
|
||||
Task {
|
||||
await confirmationStore.prepare()
|
||||
|
||||
@@ -1603,6 +1603,8 @@ extension BraveWallet.TransactionInfo {
|
||||
break
|
||||
case .ethFilForwarderTransfer:
|
||||
break
|
||||
case .cardanoSendLovelace, .cardanoSendToken:
|
||||
break
|
||||
@unknown default:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -34,7 +34,9 @@ extension BraveWallet.TransactionInfo {
|
||||
.solanaSplTokenTransferWithAssociatedTokenAccountCreation,
|
||||
.solanaDappSignAndSendTransaction,
|
||||
.solanaDappSignTransaction,
|
||||
.ethFilForwarderTransfer:
|
||||
.ethFilForwarderTransfer,
|
||||
.cardanoSendLovelace,
|
||||
.cardanoSendToken:
|
||||
return true
|
||||
case .other:
|
||||
// Filecoin or Bitcoin send
|
||||
@@ -174,8 +176,8 @@ extension BraveWallet.AccountInfo {
|
||||
return Strings.Wallet.btcAccountDescription
|
||||
case .zec:
|
||||
return Strings.Wallet.zecAccountDescription
|
||||
case .ada:
|
||||
return ""
|
||||
case .ada, .dot:
|
||||
fallthrough
|
||||
@unknown default:
|
||||
return ""
|
||||
}
|
||||
@@ -270,6 +272,8 @@ extension BraveWallet.CoinType {
|
||||
return [.zCashMainnet, .zCashTestnet]
|
||||
case .ada:
|
||||
return [.cardanoMainnet, .cardanoTestnet]
|
||||
case .dot:
|
||||
return [.polkadotMainnet, .polkadotTestnet]
|
||||
@unknown default:
|
||||
return [.default]
|
||||
}
|
||||
@@ -308,7 +312,7 @@ extension BraveWallet.CoinType {
|
||||
return Strings.Wallet.coinTypeBitcoinDescription
|
||||
case .zec:
|
||||
return Strings.Wallet.coinTypeZCashDescription
|
||||
case .ada:
|
||||
case .ada, .dot:
|
||||
fallthrough
|
||||
@unknown default:
|
||||
return Strings.Wallet.coinTypeUnknown
|
||||
@@ -327,7 +331,7 @@ extension BraveWallet.CoinType {
|
||||
return "bitcoin-asset-icon"
|
||||
case .zec:
|
||||
return "zcash-asset-icon"
|
||||
case .ada:
|
||||
case .ada, .dot:
|
||||
fallthrough
|
||||
@unknown default:
|
||||
return ""
|
||||
@@ -347,7 +351,7 @@ extension BraveWallet.CoinType {
|
||||
return 4
|
||||
case .zec:
|
||||
return 5
|
||||
case .ada:
|
||||
case .ada, .dot:
|
||||
fallthrough
|
||||
@unknown default:
|
||||
return 10
|
||||
@@ -590,6 +594,8 @@ extension BraveWallet.KeyringId {
|
||||
return chainId == BraveWallet.ZCashMainnet ? .zCashMainnet : .zCashTestnet
|
||||
case .ada:
|
||||
return chainId == BraveWallet.CardanoMainnet ? .cardanoMainnet : .cardanoTestnet
|
||||
case .dot:
|
||||
return chainId == BraveWallet.PolkadotMainnet ? .polkadotMainnet : .polkadotTestnet
|
||||
@unknown default:
|
||||
return .default
|
||||
}
|
||||
@@ -743,6 +749,8 @@ extension BraveWallet.TransactionType {
|
||||
return Strings.Wallet.txFunctionTypeOther
|
||||
case .solanaDappSignTransaction:
|
||||
return Strings.Wallet.txFunctionTypeSignDappTransaction
|
||||
case .cardanoSendLovelace, .cardanoSendToken: // not used in tx details
|
||||
fallthrough
|
||||
@unknown default:
|
||||
return Strings.Wallet.txFunctionTypeOther
|
||||
}
|
||||
@@ -764,6 +772,8 @@ extension BraveWallet.ZCashAddressError {
|
||||
return Strings.Wallet.sendErrorZecAddressOrchardPartMissing
|
||||
case .invalidAddressNetworkMismatch:
|
||||
return Strings.Wallet.sendErrorZecAddressNetworkMissmatch
|
||||
case .notZCashAccount, .invalidSenderType:
|
||||
fallthrough
|
||||
@unknown default:
|
||||
return Strings.Wallet.unknownError
|
||||
}
|
||||
|
||||
@@ -124,10 +124,8 @@ extension BraveWalletJsonRpcService {
|
||||
completion(nil)
|
||||
}
|
||||
}
|
||||
case .btc:
|
||||
completion(nil)
|
||||
case .zec:
|
||||
completion(nil)
|
||||
case .btc, .zec, .ada, .dot:
|
||||
fallthrough
|
||||
@unknown default:
|
||||
completion(nil)
|
||||
}
|
||||
@@ -247,12 +245,8 @@ extension BraveWalletJsonRpcService {
|
||||
completion(nil)
|
||||
}
|
||||
}
|
||||
case .btc:
|
||||
// Bitcoin balance should be fetched using `BraveWallet.BitcoinWalletService`
|
||||
completion(nil)
|
||||
case .zec:
|
||||
// Zcash balance should be fetched using `BraveWallet.ZCashWalletService`
|
||||
completion(nil)
|
||||
case .btc, .zec, .ada, .dot:
|
||||
fallthrough
|
||||
@unknown default:
|
||||
completion(nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user