Skip to content

Instantly share code, notes, and snippets.

@kasem-sm
Created September 13, 2021 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasem-sm/da680f28cba046bc845bf0816b8c4a57 to your computer and use it in GitHub Desktop.
Save kasem-sm/da680f28cba046bc845bf0816b8c4a57 to your computer and use it in GitHub Desktop.
result.data?.let { list ->
val totalCount = list.count()
// example there are 2 uploadedPosts
list.forEach { review ->
if (review.status.contains("Live")) {
/** if totalCount (posts) are 2 and both of them are live,
* minus 1 for each live post, so totalCount would be 0
*/
val finalCount = totalCount - 1
isUploadEnabled.value = finalCount < 2
} else {
isUploadEnabled.value = list.count() < 2
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment