Skip to content

Commit

Permalink
fix: reverse listing of saved badges (#570)
Browse files Browse the repository at this point in the history
fix: reverse listing of saved badges
  • Loading branch information
refactor-droidyy authored and iamareebjamal committed Dec 26, 2019
1 parent bea4bee commit c89e3a0
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class StorageUtils(val context: Context) {

externalStorageDir?.let {
val files = File(externalStorageDir).listFiles() ?: return list
files.sortWith(Comparator<File> { a, b -> (a.lastModified() - b.lastModified()).toInt() })
for (i in files.indices) {
if (getFileExtension(files[i].name) == badgeExt) {
val json = files[i].readText()
Expand All @@ -59,7 +60,7 @@ class StorageUtils(val context: Context) {
}
}
}
return list
return list.asReversed()
}

private fun getFileExtension(name: String): String {
Expand Down

0 comments on commit c89e3a0

Please sign in to comment.