Merge pull request #2114 from Bnyro/master

fix duplicated comments
This commit is contained in:
Bnyro 2022-11-27 17:39:37 +01:00 committed by GitHub
commit a32e4a8776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,7 @@ import kotlinx.coroutines.withContext
class CommentsSheet( class CommentsSheet(
private val videoId: String, private val videoId: String,
private val comments: MutableList<Comment>, private val comments: List<Comment>,
private var nextPage: String?, private var nextPage: String?,
private val onMoreComments: (comments: List<Comment>, nextPage: String?) -> Unit private val onMoreComments: (comments: List<Comment>, nextPage: String?) -> Unit
) : ExpandedBottomSheet() { ) : ExpandedBottomSheet() {
@ -45,7 +45,7 @@ class CommentsSheet(
} }
} }
commentsAdapter = CommentsAdapter(videoId, comments) { commentsAdapter = CommentsAdapter(videoId, comments.toMutableList()) {
dialog?.dismiss() dialog?.dismiss()
} }
binding.commentsRV.adapter = commentsAdapter binding.commentsRV.adapter = commentsAdapter
@ -60,7 +60,6 @@ class CommentsSheet(
val response = try { val response = try {
RetrofitInstance.api.getComments(videoId) RetrofitInstance.api.getComments(videoId)
} catch (e: Exception) { } catch (e: Exception) {
Log.e(TAG(), e.toString())
return@launchWhenCreated return@launchWhenCreated
} }
binding.progress.visibility = View.GONE binding.progress.visibility = View.GONE