Hook up the emoji picker to the custom status row. (#5902)

* Refactor EmojiPickerScreen to take a continuation instead of a timeline/itemID.

* Hook up the emoji picker to the custom status row.
This commit is contained in:
Doug
2026-07-22 13:35:37 +01:00
committed by GitHub
parent a6466e80e0
commit 32a54c5b71
19 changed files with 223 additions and 92 deletions
@@ -103,7 +103,7 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo
state.bindings.isPresentingStatusPicker = false
state.bindings.isShowingCustomStatusField = true
case .userStatus(.pickCustomEmoji):
break // Hook-up the emoji picker here.
pickCustomEmoji()
case .userStatus(.set(let status)):
Task { await setUserStatus(status) }
case .userStatus(.cancel):
@@ -144,6 +144,19 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo
// MARK: - Private
private var pickCustomEmojiCancellable: AnyCancellable?
private func pickCustomEmoji() {
let (stream, continuation) = AsyncStream<String>.makeStream()
actionsSubject.send(.userStatusEmojiPicker(continuation))
pickCustomEmojiCancellable = Task { [weak self] in
for await emoji in stream {
self?.state.bindings.customStatusEmoji = Character(emoji)
}
}
.asCancellable()
}
func setUserStatus(_ status: UserStatus.Raw?) async {
// Loading state tbc
state.bindings.isPresentingStatusPicker = false