Skip to content

Commit

Permalink
fix: Crash after loading apps and filtering at the same time (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
klxiaoniu authored Feb 17, 2024
1 parent 805037c commit b7cf802
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ object PackageHelper {
private lateinit var pm: PackageManager

private val packageCache = MutableSharedFlow<Map<String, PackageCache>>(replay = 1)
private val mAppList = MutableSharedFlow<MutableList<String>>(replay = 1)
private val mAppList = MutableSharedFlow<List<String>>(replay = 1)
val appList: SharedFlow<List<String>> = mAppList

private val mRefreshing = MutableSharedFlow<Boolean>(replay = 1)
Expand All @@ -80,7 +80,7 @@ object PackageHelper {
}
}
packageCache.emit(cache)
mAppList.emit(cache.keys.toMutableList())
mAppList.emit(cache.keys.toList())
mRefreshing.emit(false)
}
}
Expand All @@ -93,8 +93,7 @@ object PackageHelper {
PrefManager.SortMethod.BY_UPDATE_TIME -> Comparators.byUpdateTime
}
if (PrefManager.appFilter_reverseOrder) comparator = comparator.reversed()
val list = mAppList.first()
list.sortWith(firstComparator.then(comparator))
val list = mAppList.first().sortedWith(firstComparator.then(comparator))
mAppList.emit(list)
}

Expand Down

0 comments on commit b7cf802

Please sign in to comment.