[TMP] Get widgets / stickers working again

Change-Id: If24a0b93dc1d689ee68315ba068f0711c43979df
This commit is contained in:
SpiritCroc 2023-01-27 10:12:18 +01:00
parent e02a3adcdf
commit c47b9ee64d
2 changed files with 12 additions and 1 deletions

View File

@ -291,6 +291,17 @@ abstract class VectorBaseFragment<VB : ViewBinding> : Fragment(), MavericksView
}
}
// SC-TODO: this is the pre-v1.5.18 implementation of observeViewEvents, to fix custom widgets. Revert me once upstream implements a fix.
protected fun <T : VectorViewEvents> VectorViewModel<*, *, T>.oldObserveViewEvents(observer: (T) -> Unit) {
val tag = this@VectorBaseFragment::class.simpleName.toString()
viewEvents
.stream(tag)
.onEach {
observer(it)
}
.launchIn(viewLifecycleOwner.lifecycleScope)
}
/* ==========================================================================================
* Views
* ========================================================================================== */

View File

@ -92,7 +92,7 @@ class WidgetFragment :
if (fragmentArgs.kind.isAdmin()) {
viewModel.getPostAPIMediator().setWebView(views.widgetWebView)
}
viewModel.observeViewEvents {
viewModel.oldObserveViewEvents {
Timber.v("Observed view events: $it")
when (it) {
is WidgetViewEvents.DisplayTerms -> displayTerms(it)