Skip to content

Commit

Permalink
do not render svgs
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-dydx committed Jun 6, 2024
1 parent 88f979e commit 72da950
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,21 @@ private extension dydxTransferSearchItemViewModel {
}
self.isSelected = selected
if let iconUrl = option.iconUrl, let url = URL(string: iconUrl) {
self.icon = PlatformIconViewModel(
type: .url(url: url, placeholderContent: {
Text(option.localizedString?.prefix(1) ?? "")
.frame(width: 32, height: 32)
.themeColor(foreground: .textTertiary)
.themeColor(background: .layer5)
.borderAndClip(style: .circle, borderColor: .layer7, lineWidth: 1)
.wrappedInAnyView()
}),
size: CGSize(width: 32, height: 32))
let type: PlatformIconViewModel.IconType
let placeholderText = Text(option.localizedString?.prefix(1) ?? "")
.frame(width: 32, height: 32)
.themeColor(foreground: .textTertiary)
.themeColor(background: .layer5)
.borderAndClip(style: .circle, borderColor: .layer7, lineWidth: 1)
.wrappedInAnyView()
// SwiftUI does not process svgs well
if url.absoluteString.ends(with: ".svg") {
self.icon = placeholderText.wrappedViewModel
} else {
self.icon = PlatformIconViewModel(
type: .url(url: url, placeholderContent: { placeholderText }),
size: CGSize(width: 32, height: 32))
}
}
self.onTapAction = onTapAction
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Utilities

public class dydxTransferSearchItemViewModel: PlatformViewModel {
@Published public var onTapAction: (() -> Void)?
@Published public var icon: PlatformIconViewModel?
@Published public var icon: PlatformViewModel?
@Published public var text: String?
@Published public var tokenText: TokenTextViewModel?
@Published public var isSelected: Bool = false
Expand Down

0 comments on commit 72da950

Please sign in to comment.