refactor: cleanup CommentsSheet

This commit is contained in:
Bnyro 2023-07-31 15:22:07 +02:00
parent c4cc2ca6ac
commit 508573a1c1

View File

@ -12,13 +12,16 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
class CommentsViewModel : ViewModel() { class CommentsViewModel : ViewModel() {
private var isLoading = false
val commentsPage = MutableLiveData<CommentsPage?>() val commentsPage = MutableLiveData<CommentsPage?>()
val commentSheetExpand = MutableLiveData<Boolean?>() val commentSheetExpand = MutableLiveData<Boolean?>()
var videoId: String? = null
private var nextPage: String? = null
private var isLoading = false
var maxHeight = 0
var currentCommentsPosition = 0 var currentCommentsPosition = 0
var commentsSheetDismiss: (() -> Unit)? = null
var handleLink: ((url: String) -> Unit)? = null
fun setCommentSheetExpand(value: Boolean?) { fun setCommentSheetExpand(value: Boolean?) {
if (commentSheetExpand.value != value) { 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() { fun fetchComments() {
videoId ?: return videoId ?: return
viewModelScope.launch(Dispatchers.IO) { viewModelScope.launch(Dispatchers.IO) {