diff --git a/changelog.d/7285.misc b/changelog.d/7285.misc new file mode 100644 index 0000000000..ce94383146 --- /dev/null +++ b/changelog.d/7285.misc @@ -0,0 +1 @@ +Refactor TimelineFragment, split it into MessageComposerFragment and VoiceRecorderFragment. 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 00f2c56c37..21a87f092f 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.existingViewModel +import com.airbnb.mvrx.activityViewModel 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 existingViewModel() - private val messageComposerViewModel: MessageComposerViewModel by existingViewModel() + private val timelineViewModel: TimelineViewModel by activityViewModel() + private val messageComposerViewModel: MessageComposerViewModel by activityViewModel() 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 c45410a5cc..ef253f87a6 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.existingViewModel +import com.airbnb.mvrx.activityViewModel 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 existingViewModel() - private val messageComposerViewModel: MessageComposerViewModel by existingViewModel() + private val timelineViewModel: TimelineViewModel by activityViewModel() + private val messageComposerViewModel: MessageComposerViewModel by activityViewModel() private val permissionVoiceMessageLauncher = registerForPermissionsResult { allGranted, deniedPermanently -> if (allGranted) {