mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-12-18 13:16:49 +00:00
6219f4c446
Co-authored-by: Yusuke Arakawa <nekolaboratory@users.noreply.github.com>
26 lines
613 B
Swift
26 lines
613 B
Swift
import Foundation
|
|
import Models
|
|
import NukeUI
|
|
import SwiftUI
|
|
|
|
public extension Account {
|
|
private struct Part: Identifiable {
|
|
let id = UUID().uuidString
|
|
let value: Substring
|
|
}
|
|
|
|
var safeDisplayName: String {
|
|
if displayName.isEmpty || displayName == "" {
|
|
return "@\(username)"
|
|
}
|
|
return displayName
|
|
}
|
|
|
|
var displayNameWithoutEmojis: String {
|
|
var name = safeDisplayName
|
|
for emoji in emojis {
|
|
name = name.replacingOccurrences(of: ":\(emoji.shortcode):", with: "")
|
|
}
|
|
return name.split(separator: " ", omittingEmptySubsequences: true).joined(separator: " ")
|
|
}
|
|
}
|