Skip to content

Commit

Permalink
chore: refactor StorageUtils (#593)
Browse files Browse the repository at this point in the history
  • Loading branch information
refactor-droidyy authored and adityastic committed Dec 30, 2019
1 parent 4032041 commit 5ef947e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +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() })
files.sortWith(Comparator<File> { a, b -> (b.lastModified() - a.lastModified()).toInt() })
for (i in files.indices) {
if (getFileExtension(files[i].name) == badgeExt) {
val json = files[i].readText()
Expand All @@ -60,7 +60,7 @@ class StorageUtils(val context: Context) {
}
}
}
return list.asReversed()
return list
}

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

0 comments on commit 5ef947e

Please sign in to comment.