Using ViewModel to handle clearing of audio controller

This commit is contained in:
Maxime NATUREL 2022-07-29 09:44:23 +02:00
parent 018772ca9a
commit 81cba3d275

View File

@ -965,8 +965,7 @@ class TimelineFragment @Inject constructor(
} }
override fun onDestroyView() { override fun onDestroyView() {
audioMessagePlaybackTracker.makeAllPlaybacksIdle() messageComposerViewModel.handle(MessageComposerAction.EndAllVoiceActions())
audioMessagePlaybackTracker.clear()
lazyLoadedViews.unBind() lazyLoadedViews.unBind()
timelineEventController.callback = null timelineEventController.callback = null
timelineEventController.removeModelBuildListener(modelBuildListener) timelineEventController.removeModelBuildListener(modelBuildListener)
@ -1099,7 +1098,7 @@ class TimelineFragment @Inject constructor(
else -> state.isAllowedToManageWidgets else -> state.isAllowedToManageWidgets
} }
menu.findItem(R.id.video_call).icon?.alpha = if (callButtonsEnabled) 0xFF else 0x40 menu.findItem(R.id.video_call).icon?.alpha = if (callButtonsEnabled) 0xFF else 0x40
menu.findItem(R.id.voice_call).icon?.alpha = if (callButtonsEnabled || state.hasActiveElementCallWidget()) 0xFF else 0x40 menu.findItem(R.id.voice_call).icon?.alpha = if (callButtonsEnabled || state.hasActiveElementCallWidget()) 0xFF else 0x40
val matrixAppsMenuItem = menu.findItem(R.id.open_matrix_apps) val matrixAppsMenuItem = menu.findItem(R.id.open_matrix_apps)
val widgetsCount = state.activeRoomWidgets.invoke()?.size ?: 0 val widgetsCount = state.activeRoomWidgets.invoke()?.size ?: 0