Created
September 15, 2021 21:20
-
-
Save yveskalume/cfee71c0706f3eaca7b0e638eeea7463 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