Last active
May 25, 2021 22:55
-
-
Save yveskalume/5cca284319c698fe86cb67bfaf38a212 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun invalidate(): Unit = withState(postViewModel) { | |
binding.progess.isVisible = it.post is Loading | |
when (it.post) { | |
is Success -> { | |
binding.progess.visibility = View.GONE | |
adapter.submitList(it.post.invoke()) | |
} | |
is Fail -> { | |
Toast.makeText( requireContext(), "An error occured", Toast.LENGTH_SHORT).show() | |
Log.e("message", it.post.error.localizedMessage) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment