Fix build
This commit is contained in:
parent
a8fb18559d
commit
b1f81dbe2f
|
@ -25,7 +25,8 @@ let package = Package(
|
||||||
.product(name: "Models", package: "Models"),
|
.product(name: "Models", package: "Models"),
|
||||||
.product(name: "Env", package: "Env"),
|
.product(name: "Env", package: "Env"),
|
||||||
.product(name: "Shimmer", package: "SwiftUI-Shimmer"),
|
.product(name: "Shimmer", package: "SwiftUI-Shimmer"),
|
||||||
.product(name: "NukeUI", package: "Nuke")
|
.product(name: "NukeUI", package: "Nuke"),
|
||||||
|
.product(name: "Nuke", package: "Nuke")
|
||||||
]),
|
]),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
import Foundation
|
||||||
|
import SwiftUI
|
||||||
|
import Nuke
|
||||||
|
import NukeUI
|
||||||
|
import Models
|
||||||
|
|
||||||
|
@MainActor
|
||||||
|
extension Account {
|
||||||
|
public var displayNameWithEmojis: some View {
|
||||||
|
let splittedDisplayName = displayName.split(separator: ":")
|
||||||
|
return HStack(spacing: 0) {
|
||||||
|
ForEach(splittedDisplayName, id: \.self) { part in
|
||||||
|
if let emoji = emojis.first(where: { $0.shortcode == part }) {
|
||||||
|
LazyImage(url: emoji.url) { state in
|
||||||
|
if let image = state.image {
|
||||||
|
image
|
||||||
|
.resizingMode(.aspectFit)
|
||||||
|
} else if state.isLoading {
|
||||||
|
ProgressView()
|
||||||
|
} else {
|
||||||
|
ProgressView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.processors([ImageProcessors.Resize(size: .init(width: 20, height: 20))])
|
||||||
|
.frame(width: 20, height: 20)
|
||||||
|
} else {
|
||||||
|
Text(part)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,31 +0,0 @@
|
||||||
import Foundation
|
|
||||||
import SwiftUI
|
|
||||||
import Nuke
|
|
||||||
import NukeUI
|
|
||||||
|
|
||||||
@MainActor
|
|
||||||
extension Account {
|
|
||||||
public var displayNameWithEmojis: some View {
|
|
||||||
let splittedDisplayName = displayName.split(separator: ":")
|
|
||||||
return HStack(spacing: 0) {
|
|
||||||
ForEach(splittedDisplayName, id: \.self) { part in
|
|
||||||
if let emoji = emojis.first(where: { $0.shortcode == part }) {
|
|
||||||
LazyImage(url: emoji.url) { state in
|
|
||||||
if let image = state.image {
|
|
||||||
image
|
|
||||||
.resizingMode(.aspectFit)
|
|
||||||
} else if state.isLoading {
|
|
||||||
ProgressView()
|
|
||||||
} else {
|
|
||||||
ProgressView()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.processors([ImageProcessors.Resize(size: .init(width: 20, height: 20))])
|
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
} else {
|
|
||||||
Text(part)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue