diff --git a/app/src/main/java/app/revanced/manager/ui/screen/settings/DownloadsSettingsScreen.kt b/app/src/main/java/app/revanced/manager/ui/screen/settings/DownloadsSettingsScreen.kt
index 96247a0316..b764bb781c 100644
--- a/app/src/main/java/app/revanced/manager/ui/screen/settings/DownloadsSettingsScreen.kt
+++ b/app/src/main/java/app/revanced/manager/ui/screen/settings/DownloadsSettingsScreen.kt
@@ -2,7 +2,9 @@ package app.revanced.manager.ui.screen.settings
import androidx.annotation.StringRes
import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
@@ -10,10 +12,13 @@ import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material3.AlertDialog
+import androidx.compose.material3.Card
+import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.OutlinedCard
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
@@ -31,6 +36,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
+import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
@@ -59,6 +65,7 @@ fun DownloadsSettingsScreen(
val downloadedApps by viewModel.downloadedApps.collectAsStateWithLifecycle(emptyList())
val pluginStates by viewModel.downloaderPluginStates.collectAsStateWithLifecycle()
val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState())
+ val context = LocalContext.current
Scaffold(
topBar = {
@@ -129,15 +136,18 @@ fun DownloadsSettingsScreen(
.digest(androidSignature.toByteArray())
hash.toHexString(format = HexFormat.UpperCase)
}
+ val appName = packageInfo.applicationInfo?.loadLabel(context.packageManager)
+ ?.toString()
+ ?: packageName
when (state) {
is DownloaderPluginState.Loaded -> TrustDialog(
title = R.string.downloader_plugin_revoke_trust_dialog_title,
body = stringResource(
- R.string.downloader_plugin_trust_dialog_body,
- packageName,
- signature
+ R.string.downloader_plugin_revoke_trust_dialog_body,
),
+ pluginName = appName,
+ signature = signature,
onDismiss = ::dismiss,
onConfirm = {
viewModel.revokePluginTrust(packageName)
@@ -152,19 +162,20 @@ fun DownloadsSettingsScreen(
onDismiss = ::dismiss
)
- is DownloaderPluginState.Untrusted -> TrustDialog(
- title = R.string.downloader_plugin_trust_dialog_title,
- body = stringResource(
- R.string.downloader_plugin_trust_dialog_body,
- packageName,
- signature
- ),
- onDismiss = ::dismiss,
- onConfirm = {
- viewModel.trustPlugin(packageName)
- dismiss()
- }
- )
+ is DownloaderPluginState.Untrusted ->
+ TrustDialog(
+ title = R.string.downloader_plugin_trust_dialog_title,
+ body = stringResource(
+ R.string.downloader_plugin_trust_dialog_body
+ ),
+ pluginName = appName,
+ signature = signature,
+ onDismiss = ::dismiss,
+ onConfirm = {
+ viewModel.trustPlugin(packageName)
+ dismiss()
+ }
+ )
}
}
@@ -233,6 +244,8 @@ fun DownloadsSettingsScreen(
private fun TrustDialog(
@StringRes title: Int,
body: String,
+ pluginName: String,
+ signature: String,
onDismiss: () -> Unit,
onConfirm: () -> Unit
) {
@@ -249,6 +262,39 @@ private fun TrustDialog(
}
},
title = { Text(stringResource(title)) },
- text = { Text(body) }
+ text = {
+ Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
+ Text(body)
+ Card(
+ colors = CardDefaults.outlinedCardColors(
+ containerColor = MaterialTheme.colorScheme.surfaceContainer
+ )
+ ) {
+ Column(
+ Modifier.padding(12.dp),
+ verticalArrangement = Arrangement.spacedBy(12.dp)
+ ) {
+ Text(
+ stringResource(
+ R.string.downloader_plugin_trust_dialog_plugin,
+ pluginName
+ ),
+ )
+ OutlinedCard(
+ colors = CardDefaults.outlinedCardColors(
+ containerColor = MaterialTheme.colorScheme.surfaceContainerHigh
+ )
+ ) {
+ Text(
+ stringResource(
+ R.string.downloader_plugin_trust_dialog_signature,
+ signature.chunked(2).joinToString(" ")
+ ), modifier = Modifier.padding(12.dp)
+ )
+ }
+ }
+ }
+ }
+ }
)
}
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index fab90c15c5..01a2f50876 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -137,7 +137,10 @@
Untrusted
Trust plugin?
Revoke trust?
- Package name: %1$s\nSignature (SHA-256): %2$s
+ By continuing you\'ve agreed to running external plugins.\n\nDo not allow any suspicious plugin(s) to be installed as they can run arbitrary code.
+ By revoking trust, this plugin will be disabled and prevented from running.
+ Signature:\n\n%s
+ Plugin:\n%s
No downloaded apps found
Search apps…