diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/AllAppsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/AllAppsFragment.kt index f7324cc..4f47cdf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/AllAppsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/fragments/AllAppsFragment.kt @@ -98,6 +98,12 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment val launchers = allApps.distinctBy { it.packageName } as ArrayList context.launchersDB.insertAll(launchers) gotLaunchers(launchers) + + cachedLaunchers.map { it.packageName }.forEach { packageName -> + if (!launchers.map { it.packageName }.contains(packageName)) { + context.launchersDB.deleteApp(packageName) + } + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/launcher/interfaces/AppLaunchersDao.kt b/app/src/main/kotlin/com/simplemobiletools/launcher/interfaces/AppLaunchersDao.kt index 32f602b..d2b7b6c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/launcher/interfaces/AppLaunchersDao.kt +++ b/app/src/main/kotlin/com/simplemobiletools/launcher/interfaces/AppLaunchersDao.kt @@ -13,4 +13,7 @@ interface AppLaunchersDao { @Insert(onConflict = OnConflictStrategy.REPLACE) fun insertAll(appLaunchers: List) + + @Query("DELETE FROM apps WHERE package_name = :packageName") + fun deleteApp(packageName: String) }