Skip to content

Commit

Permalink
Change description for receive
Browse files Browse the repository at this point in the history
- change icon for "Contact Us"
  • Loading branch information
ant013 committed Sep 12, 2023
1 parent c843dca commit 678ca65
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 43 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,12 @@ class ManageWalletsService {
private func fetchTokens() -> [Token] {
do {
if filter.trimmingCharacters(in: .whitespaces).isEmpty {
let queries = [
TokenQuery(blockchainType: .bitcoin, tokenType: .derived(derivation: .bip84)),
TokenQuery(blockchainType: .ethereum, tokenType: .native),
TokenQuery(blockchainType: .binanceSmartChain, tokenType: .native),
]

let tokens = try marketKit.tokens(queries: queries)
let list = BlockchainType.supported.map { $0.defaultTokenQuery }
let tokens = try marketKit.tokens(queries: list)
let featuredTokens = tokens.filter { account.type.supports(token: $0) }
let enabledTokens = wallets.map { $0.token }

return Array(Set(featuredTokens + enabledTokens))
return (enabledTokens + featuredTokens).removeDuplicates()
} else if let ethAddress = try? EvmKit.Address(hex: filter) {
let address = ethAddress.hex
let tokens = try marketKit.tokens(reference: address)
Expand Down Expand Up @@ -136,22 +131,10 @@ class ManageWalletsService {
return lhsStartsWithName
}
}

let lhsMarketCapRank = lhsToken.coin.marketCapRank ?? Int.max
let rhsMarketCapRank = rhsToken.coin.marketCapRank ?? Int.max

if lhsMarketCapRank != rhsMarketCapRank {
return lhsMarketCapRank < rhsMarketCapRank
if lhsToken.blockchainType.order != rhsToken.blockchainType.order {
return lhsToken.blockchainType.order < rhsToken.blockchainType.order
}

let lhsName = lhsToken.coin.name.lowercased()
let rhsName = rhsToken.coin.name.lowercased()

if lhsName != rhsName {
return lhsName < rhsName
}

return lhsToken.blockchainType.order < rhsToken.blockchainType.order
return lhsToken.badge ?? "" < rhsToken.badge ?? ""
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ extension AboutViewController: SectionsDataSource {
rows: [
row(
id: "email",
image: "at_24",
image: "mail_24",
title: "settings.about_app.contact".localized,
isFirst: true,
isLast: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ extension ReceiveService {
}
extension ReceiveService {

func isEnabled(coin: Coin) -> Bool {
walletManager.activeWallets.contains { $0.coin == coin }
}

var predefinedCoins: [FullCoin] {
// get all restored coins
let activeWallets = walletManager.activeWallets
Expand All @@ -173,9 +177,18 @@ extension ReceiveService {
// filter not supported by current account
let predefined = fullCoins?.filter { fullCoin in
fullCoin.tokens.contains { account.type.supports(token: $0) }
} ?? []
}.sorted { lhsCoin, rhsCoin in
let lhsEnabled = isEnabled(coin: lhsCoin.coin)
let rhsEnabled = isEnabled(coin: rhsCoin.coin)

if lhsEnabled != rhsEnabled {
return lhsEnabled
}

return lhsCoin.coin.marketCapRank ?? Int.max < rhsCoin.coin.marketCapRank ?? Int.max
}

return predefined
return predefined ?? []
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ class ReceiveSelectCoinService {
private func sync() {
let filter = provider.filter

coins = provider.fetch().sorted { lhsFullCoin, rhsFullCoin in
if !filter.isEmpty {
let coins = provider.fetch()
if !filter.isEmpty {
self.coins = coins.sorted { lhsFullCoin, rhsFullCoin in
let filter = filter.lowercased()

let lhsExactCode = lhsFullCoin.coin.code.lowercased() == filter
Expand All @@ -26,16 +27,7 @@ class ReceiveSelectCoinService {
if lhsExactCode != rhsExactCode {
return lhsExactCode
}
}

let lhsMarketCapRank = lhsFullCoin.coin.marketCapRank ?? Int.max
let rhsMarketCapRank = rhsFullCoin.coin.marketCapRank ?? Int.max

if lhsMarketCapRank != rhsMarketCapRank {
return lhsMarketCapRank < rhsMarketCapRank
}

if !filter.isEmpty {
let lhsStartsWithCode = lhsFullCoin.coin.code.lowercased().starts(with: filter)
let rhsStartsWithCode = rhsFullCoin.coin.code.lowercased().starts(with: filter)

Expand All @@ -49,16 +41,16 @@ class ReceiveSelectCoinService {
if lhsStartsWithName != rhsStartsWithName {
return lhsStartsWithName
}
}

return lhsFullCoin.coin.name.lowercased() < rhsFullCoin.coin.name.lowercased()
return lhsFullCoin.coin.name.lowercased() < rhsFullCoin.coin.name.lowercased()
}
} else {
self.coins = coins
}
}

}

extension ReceiveSelectCoinService {

func set(filter: String) {
provider.filter = filter

Expand All @@ -70,5 +62,4 @@ extension ReceiveSelectCoinService {
coin.coin.uid == uid
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ Go to Settings - > %@ and allow access to the camera.";
"receive_network_select.description" = "Choose a network and get an address to receive.";

"receive_address_format_select.title" = "Address Format";
"receive_address_format_select.description" = "Choose a network and get an address to receive.";
"receive_address_format_select.description" = "Select an address format to receive your address.";
"receive_address_format_select.bitcoin.bottom_description" = "The Native SegWit format is preferred in Bitcoin for improved throughput and security. All address formats (Taproot, SegWit, Legacy) can be used interchangeably to receive BTC regardless of the sender's address format, enabling seamless transactions across different coin types.";
"receive_address_format_select.bitcoin_cash.bottom_description" = "The Cash Address format is preferred for receiving Bitcoin Cash (BCH) due to its improved user experience and compatibility. However, both address formats can be used interchangeably to receive BCH, regardless of the sender's address format.";

Expand Down

0 comments on commit 678ca65

Please sign in to comment.