Skip to content

Commit

Permalink
improve startup by a little
Browse files Browse the repository at this point in the history
  • Loading branch information
Iamlooker committed Jan 1, 2025
1 parent f4a3bb0 commit 4cf193a
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions app/src/main/kotlin/com/looker/droidify/MainApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,21 @@ class MainApplication : Application(), ImageLoaderFactory, Configuration.Provide
}

private fun listenApplications() {
registerReceiver(
InstalledAppReceiver(packageManager),
IntentFilter().apply {
addAction(Intent.ACTION_PACKAGE_ADDED)
addAction(Intent.ACTION_PACKAGE_REMOVED)
addDataScheme("package")
}
)
val installedItems =
packageManager.getInstalledPackagesCompat()
?.map { it.toInstalledItem() }
?: return
Database.InstalledAdapter.putAll(installedItems)
appScope.launch(Dispatchers.Default) {
registerReceiver(
InstalledAppReceiver(packageManager),
IntentFilter().apply {
addAction(Intent.ACTION_PACKAGE_ADDED)
addAction(Intent.ACTION_PACKAGE_REMOVED)
addDataScheme("package")
}
)
val installedItems =
packageManager.getInstalledPackagesCompat()
?.map { it.toInstalledItem() }
?: return@launch
Database.InstalledAdapter.putAll(installedItems)
}
}

private fun checkLanguage() {
Expand Down

0 comments on commit 4cf193a

Please sign in to comment.