Remove shortcuts from favorites after launch attempt failed

This commit is contained in:
MM20 2022-08-05 13:36:12 +02:00
parent bc86a22086
commit d175edca76
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -9,6 +9,7 @@ import de.mm20.launcher2.favorites.FavoritesRepository
import de.mm20.launcher2.icons.IconRepository
import de.mm20.launcher2.icons.LauncherIcon
import de.mm20.launcher2.ktx.isAtLeastApiLevel
import de.mm20.launcher2.search.data.AppShortcut
import de.mm20.launcher2.search.data.Application
import de.mm20.launcher2.search.data.Searchable
import kotlinx.coroutines.flow.Flow
@ -67,7 +68,7 @@ abstract class SearchableItemVM(
if (searchable.launch(context, bundle)) {
favoritesRepository.incrementLaunchCounter(searchable)
return true
} else if (searchable is Application) {
} else if (searchable is Application || searchable is AppShortcut) {
favoritesRepository.remove(searchable)
}
return false