From e08028378b53a68c3c5fcc62e91998c9025f5808 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 7 Oct 2022 11:26:37 +0200 Subject: [PATCH 1/2] Fix broken Breadcrumbs --- .../app/features/home/room/detail/TimelineFragment.kt | 6 +++--- .../home/room/detail/composer/MessageComposerFragment.kt | 6 +++--- .../room/detail/composer/voice/VoiceRecorderFragment.kt | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt index 7ea837c035..b02fed8445 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt @@ -53,8 +53,8 @@ import com.airbnb.epoxy.OnModelBuildFinishedListener import com.airbnb.epoxy.addGlidePreloader import com.airbnb.epoxy.glidePreloader import com.airbnb.mvrx.Fail -import com.airbnb.mvrx.activityViewModel import com.airbnb.mvrx.args +import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.withState import com.google.android.material.dialog.MaterialAlertDialogBuilder import dagger.hilt.android.AndroidEntryPoint @@ -256,8 +256,8 @@ class TimelineFragment : private val timelineArgs: TimelineArgs by args() - private val timelineViewModel: TimelineViewModel by activityViewModel() - private val messageComposerViewModel: MessageComposerViewModel by activityViewModel() + private val timelineViewModel: TimelineViewModel by fragmentViewModel() + private val messageComposerViewModel: MessageComposerViewModel by fragmentViewModel() private val debouncer = Debouncer(createUIHandler()) private lateinit var scrollOnNewMessageCallback: ScrollOnNewMessageCallback diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt index 21a87f092f..e6d5e1e4a2 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt @@ -41,7 +41,7 @@ import androidx.core.view.isInvisible import androidx.core.view.isVisible import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope -import com.airbnb.mvrx.activityViewModel +import com.airbnb.mvrx.parentFragmentViewModel import com.airbnb.mvrx.withState import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.vanniktech.emoji.EmojiPopup @@ -156,8 +156,8 @@ class MessageComposerFragment : VectorBaseFragment(), A private lateinit var attachmentsHelper: AttachmentsHelper private lateinit var attachmentTypeSelector: AttachmentTypeSelectorView - private val timelineViewModel: TimelineViewModel by activityViewModel() - private val messageComposerViewModel: MessageComposerViewModel by activityViewModel() + private val timelineViewModel: TimelineViewModel by parentFragmentViewModel() + private val messageComposerViewModel: MessageComposerViewModel by parentFragmentViewModel() private lateinit var sharedActionViewModel: MessageSharedActionViewModel override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentComposerBinding { diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/voice/VoiceRecorderFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/voice/VoiceRecorderFragment.kt index ef253f87a6..4a4f025688 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/voice/VoiceRecorderFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/voice/VoiceRecorderFragment.kt @@ -21,7 +21,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.core.view.isVisible -import com.airbnb.mvrx.activityViewModel +import com.airbnb.mvrx.parentFragmentViewModel import com.airbnb.mvrx.withState import dagger.hilt.android.AndroidEntryPoint import im.vector.app.R @@ -46,8 +46,8 @@ class VoiceRecorderFragment : VectorBaseFragment() @Inject lateinit var audioMessagePlaybackTracker: AudioMessagePlaybackTracker @Inject lateinit var clock: Clock - private val timelineViewModel: TimelineViewModel by activityViewModel() - private val messageComposerViewModel: MessageComposerViewModel by activityViewModel() + private val timelineViewModel: TimelineViewModel by parentFragmentViewModel() + private val messageComposerViewModel: MessageComposerViewModel by parentFragmentViewModel() private val permissionVoiceMessageLauncher = registerForPermissionsResult { allGranted, deniedPermanently -> if (allGranted) { From bbc4b35b23de1b141d3bd3c384464d03448d78cd Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 7 Oct 2022 11:27:08 +0200 Subject: [PATCH 2/2] Remove unused val. --- .../im/vector/app/features/home/room/detail/TimelineFragment.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt index b02fed8445..c34d60de71 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt @@ -282,8 +282,6 @@ class TimelineFragment : private lateinit var callActionsHandler: StartCallActionsHandler private val currentCallsViewPresenter = CurrentCallsViewPresenter() - private val isEmojiKeyboardVisible: Boolean - get() = vectorPreferences.showEmojiKeyboard() private val lazyLoadedViews = RoomDetailLazyLoadedViews()