Make file plugin config parameter non-optional, remove unused field

This commit is contained in:
MM20 2023-12-15 13:54:57 +01:00
parent c3acebe072
commit f327906a3e
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
2 changed files with 1 additions and 7 deletions

View File

@ -4,10 +4,6 @@ import android.os.Bundle
import de.mm20.launcher2.plugin.config.StorageStrategy import de.mm20.launcher2.plugin.config.StorageStrategy
data class SearchPluginConfig( data class SearchPluginConfig(
/**
* Icon resource to indicate that a result is from this provider
*/
val providerIconRes: Int? = null,
/** /**
* Strategy to store items from this provider in the launcher database * Strategy to store items from this provider in the launcher database
* @see [StorageStrategy] * @see [StorageStrategy]
@ -16,7 +12,6 @@ data class SearchPluginConfig(
) { ) {
fun toBundle(): Bundle { fun toBundle(): Bundle {
return Bundle().apply { return Bundle().apply {
putInt("providerIconRes", providerIconRes ?: 0)
putString("storageStrategy", storageStrategy.name) putString("storageStrategy", storageStrategy.name)
} }
} }
@ -24,7 +19,6 @@ data class SearchPluginConfig(
companion object { companion object {
operator fun invoke(bundle: Bundle): SearchPluginConfig? { operator fun invoke(bundle: Bundle): SearchPluginConfig? {
return SearchPluginConfig( return SearchPluginConfig(
providerIconRes = bundle.getInt("providerIconRes", 0).takeIf { it != 0 },
storageStrategy = StorageStrategy.valueOfOrElse( storageStrategy = StorageStrategy.valueOfOrElse(
bundle.getString( bundle.getString(
"storageStrategy", "storageStrategy",

View File

@ -7,7 +7,7 @@ import de.mm20.launcher2.plugin.contracts.FilePluginContract
import de.mm20.launcher2.sdk.base.SearchPluginProvider import de.mm20.launcher2.sdk.base.SearchPluginProvider
abstract class FileProvider( abstract class FileProvider(
config: SearchPluginConfig = SearchPluginConfig(), config: SearchPluginConfig,
) : SearchPluginProvider<File>(config) { ) : SearchPluginProvider<File>(config) {
abstract override suspend fun search(query: String): List<File> abstract override suspend fun search(query: String): List<File>