diff --git a/Mastodon/Diffiable/Item/ComposeStatusItem.swift b/Mastodon/Diffiable/Item/ComposeStatusItem.swift index 96ea8b05f..7c916b166 100644 --- a/Mastodon/Diffiable/Item/ComposeStatusItem.swift +++ b/Mastodon/Diffiable/Item/ComposeStatusItem.swift @@ -25,6 +25,7 @@ extension ComposeStatusItem { let avatarURL = CurrentValueSubject(nil) let displayName = CurrentValueSubject(nil) + let emojiDict = CurrentValueSubject([:]) let username = CurrentValueSubject(nil) let composeContent = CurrentValueSubject(nil) @@ -34,6 +35,7 @@ extension ComposeStatusItem { static func == (lhs: ComposeStatusAttribute, rhs: ComposeStatusAttribute) -> Bool { return lhs.avatarURL.value == rhs.avatarURL.value && lhs.displayName.value == rhs.displayName.value && + lhs.emojiDict.value == rhs.emojiDict.value && lhs.username.value == rhs.username.value && lhs.composeContent.value == rhs.composeContent.value && lhs.isContentWarningComposing.value == rhs.isContentWarningComposing.value && diff --git a/Mastodon/Diffiable/Section/ComposeStatusSection.swift b/Mastodon/Diffiable/Section/ComposeStatusSection.swift index b82116ad4..3419cc113 100644 --- a/Mastodon/Diffiable/Section/ComposeStatusSection.swift +++ b/Mastodon/Diffiable/Section/ComposeStatusSection.swift @@ -43,13 +43,14 @@ extension ComposeStatusSection { } .store(in: &cell.disposeBag) // set display name and username - Publishers.CombineLatest( - attribute.displayName.eraseToAnyPublisher(), + Publishers.CombineLatest3( + attribute.displayName, + attribute.emojiDict, attribute.username.eraseToAnyPublisher() ) .receive(on: DispatchQueue.main) - .sink { displayName, username in - cell.statusView.nameLabel.text = displayName + .sink { displayName, emojiDict, username in + cell.statusView.nameLabel.configure(content: displayName ?? " ", emojiDict: emojiDict) cell.statusView.usernameLabel.text = username.flatMap { "@" + $0 } ?? " " } .store(in: &cell.disposeBag) diff --git a/Mastodon/Scene/Compose/ComposeViewModel.swift b/Mastodon/Scene/Compose/ComposeViewModel.swift index af8c8e2ac..68880e819 100644 --- a/Mastodon/Scene/Compose/ComposeViewModel.swift +++ b/Mastodon/Scene/Compose/ComposeViewModel.swift @@ -181,6 +181,7 @@ final class ComposeViewModel: NSObject { } return displayName }() + self.composeStatusAttribute.emojiDict.value = mastodonUser?.emojiDict ?? [:] self.composeStatusAttribute.username.value = username } .store(in: &disposeBag)