feat: hide unfinished pages in release mode

This commit is contained in:
Ax333l 2023-10-14 18:48:07 +02:00
parent 8f5449527d
commit f5b3b29d6d
No known key found for this signature in database
GPG Key ID: D2B4D85271127D23
3 changed files with 12 additions and 8 deletions

View File

@ -22,10 +22,12 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import app.revanced.manager.R
import app.revanced.manager.ui.component.TextInputDialog
import app.revanced.manager.util.isDebuggable
@Composable
fun BaseBundleDialog(
@ -159,20 +161,18 @@ fun BaseBundleDialog(
)
}
val patchesClickable = LocalContext.current.isDebuggable && patchCount > 0
BundleListItem(
headlineText = stringResource(R.string.patches),
supportingText = if (patchCount == 0) stringResource(R.string.no_patches)
else stringResource(R.string.patches_available, patchCount),
modifier = Modifier.clickable(enabled = patchCount > 0) {
onPatchesClick()
}
modifier = Modifier.clickable(enabled = patchesClickable, onClick = onPatchesClick)
) {
if (patchCount > 0) {
if (patchesClickable)
Icon(
Icons.Outlined.ArrowRight,
stringResource(R.string.patches)
)
}
}
version?.let {

View File

@ -24,6 +24,7 @@ import app.revanced.manager.BuildConfig
import app.revanced.manager.R
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.openUrl
import com.google.accompanist.drawablepainter.rememberDrawablePainter
import dev.olshevski.navigation.reimagined.NavController
@ -57,15 +58,15 @@ fun AboutSettingsScreen(
}),
)
val listItems = listOf(
val listItems = listOfNotNull(
Triple(stringResource(R.string.submit_feedback), stringResource(R.string.submit_feedback_description),
third = {
context.openUrl("https://github.com/ReVanced/revanced-manager/issues/new/choose")
}),
Triple(stringResource(R.string.contributors), stringResource(R.string.contributors_description),
third = onContributorsClick),
third = onContributorsClick).takeIf { context.isDebuggable },
Triple(stringResource(R.string.developer_options), stringResource(R.string.developer_options_description),
third = { /*TODO*/ }),
third = { /*TODO*/ }).takeIf { context.isDebuggable },
Triple(stringResource(R.string.opensource_licenses), stringResource(R.string.opensource_licenses_description),
third = onLicensesClick)
)

View File

@ -2,6 +2,7 @@ package app.revanced.manager.util
import android.content.Context
import android.content.Intent
import android.content.pm.ApplicationInfo
import android.util.Log
import android.widget.Toast
import androidx.annotation.StringRes
@ -22,6 +23,8 @@ import java.util.Locale
typealias PatchesSelection = Map<Int, Set<String>>
typealias Options = Map<Int, Map<String, Map<String, Any?>>>
val Context.isDebuggable get() = 0 != applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE
fun Context.openUrl(url: String) {
startActivity(Intent(Intent.ACTION_VIEW, url.toUri()).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK