mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user