Skip to content

Commit

Permalink
Fix installed apps not registering
Browse files Browse the repository at this point in the history
  • Loading branch information
Iamlooker committed Oct 16, 2023
1 parent ebb7b4d commit 1db8659
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions app/src/main/kotlin/com/looker/droidify/MainApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,12 @@ class MainApplication : Application(), ImageLoaderFactory, Configuration.Provide
addAction(Intent.ACTION_PACKAGE_REMOVED)
addDataScheme("package")
})
appScope.launch {
val installedItems =
packageManager.getInstalledPackagesCompat()
?.map { it.toInstalledItem() }
?: run {
cancel()
return@launch
}
Database.InstalledAdapter.putAll(installedItems)
}
val installedItems =
packageManager.getInstalledPackagesCompat()
?.map { it.toInstalledItem() }
?: return
Database.InstalledAdapter.putAll(installedItems)

}

private fun checkLanguage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ object Database {

fun put(installedItem: InstalledItem) = put(installedItem, true)

suspend fun putAll(installedItems: List<InstalledItem>) = withContext(Dispatchers.IO) {
fun putAll(installedItems: List<InstalledItem>) {
db.transaction {
db.delete(Schema.Installed.name, null, null)
installedItems.forEach { put(it, false) }
Expand Down

0 comments on commit 1db8659

Please sign in to comment.