Last active
July 19, 2019 06:18
-
-
Save keiji/524976ee2075ad69f5c7de9c4dc55a19 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
val myFlow = flow { | |
emit(fileListRepository.getFileList(path, limit, offsetValue, refresh)) | |
}.retry(RETRY_LIMIT) { throwable -> | |
throwable is IOException | |
}.catch { throwable -> | |
errorMessage.postValue(throwable.message) | |
isLoading.postValue(null) | |
}.onEach() { | |
hasNext = it.hasNext | |
pathListSnapshot.addAll(it.fileList) | |
pathList.postValue(pathListSnapshot) | |
errorMessage.postValue(null) | |
isLoading.postValue(null) | |
} | |
isLoading.postValue(myFlow) | |
myFlow.launchIn(coroutineScope) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment