Skip to content

Commit

Permalink
Add sort criteria on sample app when fetch files list (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
HectorNarvaez committed Jul 6, 2023
1 parent 40b643f commit 572c17f
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ class FileViewerViewModel @Inject constructor(

val cancellable = omhStorageClient.listFiles(parentId)
.addOnSuccess { data ->
val files: List<OmhFile> = data.files
val files: List<OmhFile> = data
.files
.sortedWith(
compareBy<OmhFile> { !it.isFolder() }
.thenBy { it.mimeType }
.thenBy { it.name }
)

setState(FileViewerViewState.Content(files))
}
.addOnFailure { e ->
Expand Down

0 comments on commit 572c17f

Please sign in to comment.