Add debug preference to rebuild icon pack cache
This commit is contained in:
@@ -56,6 +56,12 @@ fun DebugSettingsScreen() {
|
||||
).show()
|
||||
}
|
||||
})
|
||||
Preference(
|
||||
title = stringResource(R.string.preference_debug_reinstall_iconpacks),
|
||||
summary = stringResource(R.string.preference_debug_reinstall_iconpacks_summary),
|
||||
onClick = {
|
||||
viewModel.reinstallIconPacks()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package de.mm20.launcher2.ui.settings.debug
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import de.mm20.launcher2.data.customattrs.CustomAttributesRepository
|
||||
import de.mm20.launcher2.icons.IconService
|
||||
import de.mm20.launcher2.searchable.SearchableRepository
|
||||
import org.koin.core.component.KoinComponent
|
||||
import org.koin.core.component.inject
|
||||
@@ -10,9 +11,14 @@ class DebugSettingsScreenVM: ViewModel(), KoinComponent {
|
||||
|
||||
private val searchableRepository: SearchableRepository by inject()
|
||||
private val customAttributesRepository: CustomAttributesRepository by inject()
|
||||
private val iconService: IconService by inject()
|
||||
suspend fun cleanUpDatabase(): Int {
|
||||
var removed = searchableRepository.cleanupDatabase()
|
||||
removed += customAttributesRepository.cleanupDatabase()
|
||||
return removed
|
||||
}
|
||||
|
||||
fun reinstallIconPacks() {
|
||||
iconService.reinstallAllIconPacks()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user