fix: visibility missing bind back to source issue

This commit is contained in:
CMK 2022-11-14 18:41:54 +08:00
parent 81bc8eb662
commit 7e7f41112e
1 changed files with 12 additions and 0 deletions

View File

@ -334,9 +334,21 @@ extension ComposeContentViewController {
viewModel.$isPollActive.assign(to: &composeContentToolbarViewModel.$isPollActive)
viewModel.$isEmojiActive.assign(to: &composeContentToolbarViewModel.$isEmojiActive)
viewModel.$isContentWarningActive.assign(to: &composeContentToolbarViewModel.$isContentWarningActive)
viewModel.$visibility.assign(to: &composeContentToolbarViewModel.$visibility)
viewModel.$maxTextInputLimit.assign(to: &composeContentToolbarViewModel.$maxTextInputLimit)
viewModel.$contentWeightedLength.assign(to: &composeContentToolbarViewModel.$contentWeightedLength)
viewModel.$contentWarningWeightedLength.assign(to: &composeContentToolbarViewModel.$contentWarningWeightedLength)
// bind back to source due to visibility not update via delegate
composeContentToolbarViewModel.$visibility
.dropFirst()
.sink { [weak self] visibility in
guard let self = self else { return }
if self.viewModel.visibility != visibility {
self.viewModel.visibility = visibility
}
}
.store(in: &disposeBag)
}
private func updateAutoCompleteViewControllerLayout() {