From 508573a1c19c3b83eafbccd4f65e9fb14fe44714 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Mon, 31 Jul 2023 15:22:07 +0200 Subject: [PATCH] refactor: cleanup CommentsSheet --- .../libretube/ui/models/CommentsViewModel.kt | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/models/CommentsViewModel.kt b/app/src/main/java/com/github/libretube/ui/models/CommentsViewModel.kt index d92e673a0..8db9afdca 100644 --- a/app/src/main/java/com/github/libretube/ui/models/CommentsViewModel.kt +++ b/app/src/main/java/com/github/libretube/ui/models/CommentsViewModel.kt @@ -12,13 +12,16 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch class CommentsViewModel : ViewModel() { - private var isLoading = false - val commentsPage = MutableLiveData() - val commentSheetExpand = MutableLiveData() + var videoId: String? = null + private var nextPage: String? = null + private var isLoading = false + var maxHeight = 0 var currentCommentsPosition = 0 + var commentsSheetDismiss: (() -> Unit)? = null + var handleLink: ((url: String) -> Unit)? = null fun setCommentSheetExpand(value: Boolean?) { if (commentSheetExpand.value != value) { @@ -26,13 +29,6 @@ class CommentsViewModel : ViewModel() { } } - private var nextPage: String? = null - - var videoId: String? = null - var maxHeight: Int = 0 - var commentsSheetDismiss: (() -> Unit)? = null - var handleLink: ((url: String) -> Unit)? = null - fun fetchComments() { videoId ?: return viewModelScope.launch(Dispatchers.IO) {