Merge pull request #4387 from AlphaWallet/temporary-switch-token-icon-loading-url-format-to-use-lowercase-instead-eip55

Temporary switch token icons URL to a different source towards using lowercase instead of EIP55 (easier for people to upload images with correct filenames)
pull/4390/head
Crypto Pank 3 years ago committed by GitHub
commit 2e5fb319cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      AlphaWallet/UI/TokenObject+UI.swift

@ -113,7 +113,7 @@ extension TokenObject {
}
extension Activity.AssignedToken {
func icon(withSize size: GoogleContentSize) -> Subscribable<TokenImage> {
let name = symbol.nilIfEmpty ?? name
let nftBalance = nftBalanceValue.first
@ -288,8 +288,17 @@ class GithubAssetsURLResolver {
static let file = "logo.png"
enum Source: String {
case alphaWallet = "https://raw.githubusercontent.com/alphawallet/iconassets/master/"
case alphaWallet = "https://raw.githubusercontent.com/AlphaWallet/iconassets/lowercased/"
case thirdParty = "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/"
func url(forContract contract: AlphaWallet.Address) -> String {
switch self {
case .alphaWallet:
return rawValue + contract.eip55String.lowercased() + "/" + GithubAssetsURLResolver.file
case .thirdParty:
return rawValue + contract.eip55String + "/" + GithubAssetsURLResolver.file
}
}
}
enum AnyError: Error {
@ -297,8 +306,7 @@ class GithubAssetsURLResolver {
}
func resolve(for githubAssetsSource: GithubAssetsURLResolver.Source, contractAddress: AlphaWallet.Address) -> Promise<URLRequest> {
let value = githubAssetsSource.rawValue + contractAddress.eip55String + "/" + GithubAssetsURLResolver.file
let value = githubAssetsSource.url(forContract: contractAddress)
guard let url = URL(string: value) else {
verboseLog("Loading token icon URL: \(value) error")
return .init(error: AnyError.case1)

Loading…
Cancel
Save