fix: broken logo in about page on release builds

This commit is contained in:
Ax333l 2023-10-15 00:22:12 +02:00
parent f5b3b29d6d
commit 4c1ad868a9
No known key found for this signature in database
GPG Key ID: D2B4D85271127D23

View File

@ -1,5 +1,6 @@
package app.revanced.manager.ui.screen.settings package app.revanced.manager.ui.screen.settings
import androidx.appcompat.content.res.AppCompatResources
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.border import androidx.compose.foundation.border
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
@ -13,22 +14,19 @@ import androidx.compose.material.icons.outlined.Language
import androidx.compose.material.icons.outlined.MailOutline import androidx.compose.material.icons.outlined.MailOutline
import androidx.compose.material3.* import androidx.compose.material3.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import app.revanced.manager.BuildConfig import app.revanced.manager.BuildConfig
import app.revanced.manager.R import app.revanced.manager.R
import app.revanced.manager.ui.component.AppTopBar import app.revanced.manager.ui.component.AppTopBar
import app.revanced.manager.ui.destination.SettingsDestination
import app.revanced.manager.util.isDebuggable import app.revanced.manager.util.isDebuggable
import app.revanced.manager.util.openUrl import app.revanced.manager.util.openUrl
import com.google.accompanist.drawablepainter.rememberDrawablePainter import com.google.accompanist.drawablepainter.rememberDrawablePainter
import dev.olshevski.navigation.reimagined.NavController
import dev.olshevski.navigation.reimagined.navigate
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
@ -38,7 +36,10 @@ fun AboutSettingsScreen(
onLicensesClick: () -> Unit, onLicensesClick: () -> Unit,
) { ) {
val context = LocalContext.current val context = LocalContext.current
val icon = painterResource(R.drawable.ic_logo_ring) // painterResource() is broken on release builds for some reason.
val icon = rememberDrawablePainter(drawable = remember {
AppCompatResources.getDrawable(context, R.drawable.ic_logo_ring)
})
val filledButton = listOf( val filledButton = listOf(
Triple(Icons.Outlined.FavoriteBorder, stringResource(R.string.donate)) { Triple(Icons.Outlined.FavoriteBorder, stringResource(R.string.donate)) {
@ -59,16 +60,24 @@ fun AboutSettingsScreen(
) )
val listItems = listOfNotNull( val listItems = listOfNotNull(
Triple(stringResource(R.string.submit_feedback), stringResource(R.string.submit_feedback_description), Triple(stringResource(R.string.submit_feedback),
stringResource(R.string.submit_feedback_description),
third = { third = {
context.openUrl("https://github.com/ReVanced/revanced-manager/issues/new/choose") context.openUrl("https://github.com/ReVanced/revanced-manager/issues/new/choose")
}), }),
Triple(stringResource(R.string.contributors), stringResource(R.string.contributors_description), Triple(
third = onContributorsClick).takeIf { context.isDebuggable }, stringResource(R.string.contributors),
Triple(stringResource(R.string.developer_options), stringResource(R.string.developer_options_description), stringResource(R.string.contributors_description),
third = onContributorsClick
).takeIf { context.isDebuggable },
Triple(stringResource(R.string.developer_options),
stringResource(R.string.developer_options_description),
third = { /*TODO*/ }).takeIf { context.isDebuggable }, third = { /*TODO*/ }).takeIf { context.isDebuggable },
Triple(stringResource(R.string.opensource_licenses), stringResource(R.string.opensource_licenses_description), Triple(
third = onLicensesClick) stringResource(R.string.opensource_licenses),
stringResource(R.string.opensource_licenses_description),
third = onLicensesClick
)
) )
Scaffold( Scaffold(
@ -94,7 +103,10 @@ fun AboutSettingsScreen(
) { ) {
Image(painter = icon, contentDescription = null) Image(painter = icon, contentDescription = null)
Text(stringResource(R.string.app_name), style = MaterialTheme.typography.titleLarge) Text(stringResource(R.string.app_name), style = MaterialTheme.typography.titleLarge)
Text( text = stringResource(R.string.version) + " " + BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")", style = MaterialTheme.typography.bodyMedium) Text(
text = stringResource(R.string.version) + " " + BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")",
style = MaterialTheme.typography.bodyMedium
)
Row( Row(
modifier = Modifier.padding(top = 12.dp) modifier = Modifier.padding(top = 12.dp)
) { ) {
@ -190,7 +202,13 @@ fun AboutSettingsScreen(
.padding(8.dp) .padding(8.dp)
.clickable { onClick() }, .clickable { onClick() },
headlineContent = { Text(title, style = MaterialTheme.typography.titleLarge) }, headlineContent = { Text(title, style = MaterialTheme.typography.titleLarge) },
supportingContent = { Text(description, style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.outline) } supportingContent = {
Text(
description,
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.outline
)
}
) )
} }
} }