mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-29 11:41:01 +00:00
Fix build
This commit is contained in:
parent
a8fb18559d
commit
b1f81dbe2f
3 changed files with 34 additions and 32 deletions
|
@ -25,7 +25,8 @@ let package = Package(
|
|||
.product(name: "Models", package: "Models"),
|
||||
.product(name: "Env", package: "Env"),
|
||||
.product(name: "Shimmer", package: "SwiftUI-Shimmer"),
|
||||
.product(name: "NukeUI", package: "Nuke")
|
||||
.product(name: "NukeUI", package: "Nuke"),
|
||||
.product(name: "Nuke", package: "Nuke")
|
||||
]),
|
||||
]
|
||||
)
|
||||
|
|
32
Packages/DesignSystem/Sources/DesignSystem/AccountExt.swift
Normal file
32
Packages/DesignSystem/Sources/DesignSystem/AccountExt.swift
Normal file
|
@ -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 a new issue