-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix displaying coin alternative icons in Transactions list
- Loading branch information
Showing
16 changed files
with
49 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 2 additions & 29 deletions
31
UnstoppableWallet/UnstoppableWallet/UserInterface/Extensions/UIImageView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,10 @@ | ||
import Alamofire | ||
import Kingfisher | ||
import ComponentKit | ||
import MarketKit | ||
import UIKit | ||
|
||
extension UIImageView { | ||
func setImage(coin: Coin?, placeholder: String? = nil) { | ||
let options: [KingfisherOptionsInfoItem] = [.scaleFactor(UIScreen.main.scale)] | ||
let placeholder = UIImage(named: placeholder ?? "placeholder_circle_32") | ||
|
||
if let alternativeUrlString = coin?.image, let alternativeUrl = URL(string: alternativeUrlString) { | ||
if ImageCache.default.isCached(forKey: alternativeUrlString) { | ||
kf.setImage( | ||
with: alternativeUrl, | ||
placeholder: placeholder, | ||
options: options | ||
) | ||
} else { | ||
kf.setImage( | ||
with: URL(string: coin?.imageUrl ?? ""), | ||
placeholder: placeholder, | ||
options: options + [.alternativeSources([.network(alternativeUrl)])] | ||
) | ||
} | ||
} else { | ||
kf.setImage( | ||
with: URL(string: coin?.imageUrl ?? ""), | ||
placeholder: placeholder, | ||
options: options | ||
) | ||
|
||
return | ||
} | ||
|
||
setImage(url: coin?.imageUrl, alternativeUrl: coin?.image, placeholder: UIImage(named: placeholder ?? "placeholder_circle_32")) | ||
cornerRadius = CGFloat.iconSize32 / 2 | ||
} | ||
} |