Skip to content

Commit

Permalink
Merge pull request #492 from Outblock/feature/custom-token-all
Browse files Browse the repository at this point in the history
feat: filter custom token by network and type of evm
  • Loading branch information
zhouxl authored Nov 6, 2024
2 parents 600d514 + 58515b4 commit f2c58b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions FRW/Modules/Wallet/CustomToken/CustomTokenManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CustomTokenManager: ObservableObject {
let belong = EVMAccountManager.shared.selectedAccount != nil ? CustomToken.Belong.evm : .flow

let result = list.filter { token in
token.belongAddress == address && token.network == currentNetwork && token.belong == belong && token.userId == userId
token.network == currentNetwork && token.belong == belong
}
return result
}
Expand Down Expand Up @@ -66,7 +66,7 @@ class CustomTokenManager: ObservableObject {
func isExist(token: CustomToken) -> Bool {
queue.sync {
let result = allTokens.filter { model in
token.belongAddress == model.belongAddress && token.network == model.network && token.belong == model.belong && token.userId == model.userId && model.address == token.address
token.network == model.network && model.address == token.address && token.belong == model.belong
}
return result.count > 0
}
Expand Down Expand Up @@ -97,7 +97,7 @@ class CustomTokenManager: ObservableObject {
func delete(token: CustomToken) {
queue.sync {
allTokens.removeAll { model in
token.belongAddress == model.belongAddress && token.network == model.network && token.belong == model.belong && token.userId == model.userId && model.address == token.address
token.network == model.network && token.belong == model.belong && model.address == token.address
}
LocalUserDefaults.shared.customToken = allTokens
}
Expand All @@ -108,7 +108,7 @@ class CustomTokenManager: ObservableObject {
private func update(token: CustomToken) {
queue.sync {
let index = allTokens.firstIndex { model in
token.belongAddress == model.belongAddress && token.network == model.network && token.belong == model.belong && token.userId == model.userId && model.address == token.address
token.belong == model.belong && model.address == token.address && token.network == model.network
}
guard let index else {
return
Expand Down

0 comments on commit f2c58b7

Please sign in to comment.