Allow plugins to override their own name using meta data (instead of the app name)

This commit is contained in:
MM20 2023-12-10 18:54:15 +01:00
parent 63e2d5cdac
commit fced1bc14e
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
2 changed files with 6 additions and 4 deletions

View File

@ -2,7 +2,6 @@ import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.util.Log
import de.mm20.launcher2.crashreporter.CrashReporter
import de.mm20.launcher2.plugin.Plugin
import de.mm20.launcher2.plugin.PluginType
@ -40,7 +39,8 @@ class PluginScanner(
} ?: continue
plugins.add(
Plugin(
label = cr.loadLabel(context.packageManager).toString(),
label = providerInfo.metaData?.getString("de.mm20.launcher2.plugin.label")
?: cr.loadLabel(context.packageManager).toString(),
description = providerInfo.metaData?.getString("de.mm20.launcher2.plugin.description"),
packageName = providerInfo.packageName,
className = providerInfo.name,

View File

@ -214,7 +214,8 @@ internal class PluginServiceImpl(
val signature = getSignature(packageName)
PluginPackage(
packageName = packageName,
label = appInfo.loadLabel(context.packageManager).toString(),
label = appInfo.metaData?.getString("de.mm20.launcher2.plugin.label")
?: appInfo.loadLabel(context.packageManager).toString(),
description = appInfo.metaData?.getString("de.mm20.launcher2.plugin.description"),
author = appInfo.metaData?.getString("de.mm20.launcher2.plugin.author"),
plugins = plugins,
@ -248,7 +249,8 @@ internal class PluginServiceImpl(
.map {
PluginPackage(
packageName = packageName,
label = appInfo.loadLabel(context.packageManager).toString(),
label = appInfo.metaData?.getString("de.mm20.launcher2.plugin.label")
?: appInfo.loadLabel(context.packageManager).toString(),
description = appInfo.metaData?.getString("de.mm20.launcher2.plugin.description"),
author = appInfo.metaData?.getString("de.mm20.launcher2.plugin.author"),
plugins = it,