remove non existing apps from cache
This commit is contained in:
parent
9a46ceec58
commit
69ee50167b
|
@ -98,6 +98,12 @@ class AllAppsFragment(context: Context, attributeSet: AttributeSet) : MyFragment
|
|||
val launchers = allApps.distinctBy { it.packageName } as ArrayList<AppLauncher>
|
||||
context.launchersDB.insertAll(launchers)
|
||||
gotLaunchers(launchers)
|
||||
|
||||
cachedLaunchers.map { it.packageName }.forEach { packageName ->
|
||||
if (!launchers.map { it.packageName }.contains(packageName)) {
|
||||
context.launchersDB.deleteApp(packageName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,4 +13,7 @@ interface AppLaunchersDao {
|
|||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insertAll(appLaunchers: List<AppLauncher>)
|
||||
|
||||
@Query("DELETE FROM apps WHERE package_name = :packageName")
|
||||
fun deleteApp(packageName: String)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue