mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-01-18 16:53:56 +00:00
feat: Rename strings
This commit is contained in:
@@ -34,7 +34,7 @@ sealed class PatchBundleSource(initialName: String, val uid: Int, directory: Fil
|
||||
|
||||
private val _nameFlow = MutableStateFlow(initialName)
|
||||
val nameFlow =
|
||||
_nameFlow.map { it.ifEmpty { app.getString(if (isDefault) R.string.bundle_name_default else R.string.bundle_name_fallback) } }
|
||||
_nameFlow.map { it.ifEmpty { app.getString(if (isDefault) R.string.patches_name_default else R.string.patches_name_fallback) } }
|
||||
|
||||
suspend fun getName() = nameFlow.first()
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ sealed class RemotePatchBundle(name: String, id: Int, directory: File, val endpo
|
||||
suspend fun setAutoUpdate(value: Boolean) = configRepository.setAutoUpdate(uid, value)
|
||||
|
||||
companion object {
|
||||
const val updateFailMsg = "Failed to update patch bundle(s)"
|
||||
const val updateFailMsg = "Failed to update patches"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ class PatchBundleRepository(
|
||||
getBundlesByType<RemotePatchBundle>().forEach { it.downloadLatest() }
|
||||
|
||||
suspend fun updateCheck() =
|
||||
uiSafe(app, R.string.source_download_fail, "Failed to update bundles") {
|
||||
uiSafe(app, R.string.patches_download_fail, "Failed to update bundles") {
|
||||
coroutineScope {
|
||||
if (!networkInfo.isSafe()) {
|
||||
Log.d(tag, "Skipping update check because the network is down or metered.")
|
||||
|
||||
@@ -30,7 +30,7 @@ fun ExceptionViewerDialog(text: String, onDismiss: () -> Unit) {
|
||||
Scaffold(
|
||||
topBar = {
|
||||
BundleTopBar(
|
||||
title = stringResource(R.string.bundle_error),
|
||||
title = stringResource(R.string.patches_error),
|
||||
onBackClick = onDismiss,
|
||||
backIcon = {
|
||||
Icon(
|
||||
|
||||
@@ -92,8 +92,8 @@ fun BaseBundleDialog(
|
||||
|
||||
if (remoteUrl != null) {
|
||||
BundleListItem(
|
||||
headlineText = stringResource(R.string.bundle_auto_update),
|
||||
supportingText = stringResource(R.string.bundle_auto_update_description),
|
||||
headlineText = stringResource(R.string.auto_update),
|
||||
supportingText = stringResource(R.string.auto_update_description),
|
||||
trailingContent = {
|
||||
HapticSwitch(
|
||||
checked = autoUpdate,
|
||||
@@ -113,7 +113,7 @@ fun BaseBundleDialog(
|
||||
if (showUrlInputDialog) {
|
||||
TextInputDialog(
|
||||
initial = url,
|
||||
title = stringResource(R.string.bundle_input_source_url),
|
||||
title = stringResource(R.string.patches_url),
|
||||
onDismissRequest = { showUrlInputDialog = false },
|
||||
onConfirm = {
|
||||
showUrlInputDialog = false
|
||||
@@ -134,7 +134,7 @@ fun BaseBundleDialog(
|
||||
showUrlInputDialog = true
|
||||
}
|
||||
),
|
||||
headlineText = stringResource(R.string.bundle_input_source_url),
|
||||
headlineText = stringResource(R.string.patches_url),
|
||||
supportingText = url.ifEmpty {
|
||||
stringResource(R.string.field_not_set)
|
||||
}
|
||||
@@ -143,8 +143,8 @@ fun BaseBundleDialog(
|
||||
|
||||
val patchesClickable = patchCount > 0
|
||||
BundleListItem(
|
||||
headlineText = stringResource(R.string.bundle_view_patches),
|
||||
supportingText = stringResource(R.string.bundle_view_all_patches, patchCount),
|
||||
headlineText = stringResource(R.string.patches),
|
||||
supportingText = stringResource(R.string.view_patches),
|
||||
modifier = Modifier.clickable(
|
||||
enabled = patchesClickable,
|
||||
onClick = onPatchesClick
|
||||
|
||||
@@ -119,8 +119,8 @@ fun BundleInformationDialog(
|
||||
)
|
||||
|
||||
BundleListItem(
|
||||
headlineText = stringResource(R.string.bundle_error),
|
||||
supportingText = stringResource(R.string.bundle_error_description),
|
||||
headlineText = stringResource(R.string.patches_error),
|
||||
supportingText = stringResource(R.string.patches_error_description),
|
||||
trailingContent = {
|
||||
Icon(
|
||||
Icons.AutoMirrored.Outlined.ArrowRight,
|
||||
@@ -133,8 +133,8 @@ fun BundleInformationDialog(
|
||||
|
||||
if (state is PatchBundleSource.State.Missing && !isLocal) {
|
||||
BundleListItem(
|
||||
headlineText = stringResource(R.string.bundle_error),
|
||||
supportingText = stringResource(R.string.bundle_not_downloaded),
|
||||
headlineText = stringResource(R.string.patches_error),
|
||||
supportingText = stringResource(R.string.patches_not_downloaded),
|
||||
modifier = Modifier.clickable(onClick = onUpdate)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ fun BundleItem(
|
||||
onDelete()
|
||||
viewBundleDialogPage = false
|
||||
},
|
||||
title = stringResource(R.string.bundle_delete_single_dialog_title),
|
||||
description = stringResource(R.string.bundle_delete_single_dialog_description, name),
|
||||
title = stringResource(R.string.delete),
|
||||
description = stringResource(R.string.patches_delete_single_dialog_description, name),
|
||||
icon = Icons.Outlined.Delete
|
||||
)
|
||||
}
|
||||
@@ -100,8 +100,8 @@ fun BundleItem(
|
||||
Row {
|
||||
val icon = remember(state) {
|
||||
when (state) {
|
||||
is PatchBundleSource.State.Failed -> Icons.Outlined.ErrorOutline to R.string.bundle_error
|
||||
is PatchBundleSource.State.Missing -> Icons.Outlined.Warning to R.string.bundle_missing
|
||||
is PatchBundleSource.State.Failed -> Icons.Outlined.ErrorOutline to R.string.patches_error
|
||||
is PatchBundleSource.State.Missing -> Icons.Outlined.Warning to R.string.patches_missing
|
||||
is PatchBundleSource.State.Loaded -> null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ fun BundlePatchesDialog(
|
||||
Scaffold(
|
||||
topBar = {
|
||||
BundleTopBar(
|
||||
title = stringResource(R.string.bundle_patches),
|
||||
title = stringResource(R.string.patches),
|
||||
onBackClick = onDismissRequest,
|
||||
backIcon = {
|
||||
Icon(
|
||||
@@ -133,10 +133,10 @@ fun PatchItem(
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
PatchInfoChip(
|
||||
text = "$PACKAGE_ICON ${stringResource(R.string.bundle_view_patches_any_package)}"
|
||||
text = "$PACKAGE_ICON ${stringResource(R.string.patches_view_any_package)}"
|
||||
)
|
||||
PatchInfoChip(
|
||||
text = "$VERSION_ICON ${stringResource(R.string.bundle_view_patches_any_version)}"
|
||||
text = "$VERSION_ICON ${stringResource(R.string.patches_view_any_version)}"
|
||||
)
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -13,14 +13,14 @@ import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import app.revanced.manager.R
|
||||
import app.revanced.manager.domain.bundles.PatchBundleSource
|
||||
import app.revanced.manager.domain.bundles.PatchBundleSource.Extensions.nameState
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
@@ -50,7 +50,7 @@ fun BundleSelector(bundles: List<PatchBundleSource>, onFinish: (PatchBundleSourc
|
||||
.fillMaxWidth()
|
||||
) {
|
||||
Text(
|
||||
text = "Select bundle",
|
||||
text = stringResource(R.string.select),
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
)
|
||||
|
||||
@@ -77,7 +77,7 @@ fun ImportPatchBundleDialog(
|
||||
AlertDialogExtended(
|
||||
onDismissRequest = onDismiss,
|
||||
title = {
|
||||
Text(stringResource(if (currentStep == 0) R.string.select else R.string.add_patch_bundle))
|
||||
Text(stringResource(if (currentStep == 0) R.string.select else R.string.add_patches))
|
||||
},
|
||||
text = {
|
||||
steps[currentStep]()
|
||||
@@ -126,7 +126,7 @@ fun SelectBundleTypeStep(
|
||||
) {
|
||||
Text(
|
||||
modifier = Modifier.padding(horizontal = 24.dp),
|
||||
text = stringResource(R.string.select_bundle_type_dialog_description)
|
||||
text = stringResource(R.string.select_patches_type_dialog_description)
|
||||
)
|
||||
Column {
|
||||
ListItem(
|
||||
@@ -136,7 +136,7 @@ fun SelectBundleTypeStep(
|
||||
),
|
||||
headlineContent = { Text(stringResource(R.string.enter_url)) },
|
||||
overlineContent = { Text(stringResource(R.string.recommended)) },
|
||||
supportingContent = { Text(stringResource(R.string.remote_bundle_description)) },
|
||||
supportingContent = { Text(stringResource(R.string.remote_patches_description)) },
|
||||
leadingContent = {
|
||||
HapticRadioButton(
|
||||
selected = bundleType == BundleType.Remote,
|
||||
@@ -152,7 +152,7 @@ fun SelectBundleTypeStep(
|
||||
onClick = { onBundleTypeSelected(BundleType.Local) }
|
||||
),
|
||||
headlineContent = { Text(stringResource(R.string.select_from_storage)) },
|
||||
supportingContent = { Text(stringResource(R.string.local_bundle_description)) },
|
||||
supportingContent = { Text(stringResource(R.string.local_patches_description)) },
|
||||
overlineContent = { },
|
||||
leadingContent = {
|
||||
HapticRadioButton(
|
||||
@@ -185,7 +185,7 @@ fun ImportBundleStep(
|
||||
) {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
Text(stringResource(R.string.patch_bundle_field))
|
||||
Text(stringResource(R.string.patches))
|
||||
},
|
||||
supportingContent = { Text(stringResource(if (patchBundle != null) R.string.file_field_set else R.string.file_field_not_set)) },
|
||||
trailingContent = {
|
||||
@@ -206,7 +206,7 @@ fun ImportBundleStep(
|
||||
OutlinedTextField(
|
||||
value = remoteUrl,
|
||||
onValueChange = onRemoteUrlChange,
|
||||
label = { Text(stringResource(R.string.bundle_url)) }
|
||||
label = { Text(stringResource(R.string.patches_url)) }
|
||||
)
|
||||
}
|
||||
Column(
|
||||
|
||||
@@ -79,7 +79,7 @@ enum class DashboardPage(
|
||||
val icon: ImageVector
|
||||
) {
|
||||
DASHBOARD(R.string.tab_apps, Icons.Outlined.Apps),
|
||||
BUNDLES(R.string.tab_bundles, Icons.Outlined.Source),
|
||||
BUNDLES(R.string.tab_patches, Icons.Outlined.Source),
|
||||
}
|
||||
|
||||
@SuppressLint("BatteryLife")
|
||||
@@ -93,7 +93,7 @@ fun DashboardScreen(
|
||||
onDownloaderPluginClick: () -> Unit,
|
||||
onAppClick: (String) -> Unit
|
||||
) {
|
||||
val bundlesSelectable by remember { derivedStateOf { vm.selectedSources.size > 0 } }
|
||||
val bundlesSelectable by remember { derivedStateOf { vm.selectedSources.isNotEmpty() } }
|
||||
val availablePatches by vm.availablePatches.collectAsStateWithLifecycle(0)
|
||||
val showNewDownloaderPluginsNotification by vm.newDownloaderPluginsAvailable.collectAsStateWithLifecycle(
|
||||
false
|
||||
@@ -164,8 +164,8 @@ fun DashboardScreen(
|
||||
vm.selectedSources.forEach { if (!it.isDefault) vm.delete(it) }
|
||||
vm.cancelSourceSelection()
|
||||
},
|
||||
title = stringResource(R.string.bundle_delete_multiple_dialog_title),
|
||||
description = stringResource(R.string.bundle_delete_multiple_dialog_description),
|
||||
title = stringResource(R.string.delete),
|
||||
description = stringResource(R.string.patches_delete_multiple_dialog_description),
|
||||
icon = Icons.Outlined.Delete
|
||||
)
|
||||
}
|
||||
@@ -174,7 +174,7 @@ fun DashboardScreen(
|
||||
topBar = {
|
||||
if (bundlesSelectable) {
|
||||
BundleTopBar(
|
||||
title = stringResource(R.string.bundles_selected, vm.selectedSources.size),
|
||||
title = stringResource(R.string.patches_selected, vm.selectedSources.size),
|
||||
onBackClick = vm::cancelSourceSelection,
|
||||
backIcon = {
|
||||
Icon(
|
||||
@@ -239,7 +239,7 @@ fun DashboardScreen(
|
||||
when (pagerState.currentPage) {
|
||||
DashboardPage.DASHBOARD.ordinal -> {
|
||||
if (availablePatches < 1) {
|
||||
androidContext.toast(androidContext.getString(R.string.patches_unavailable))
|
||||
androidContext.toast(androidContext.getString(R.string.no_patch_found))
|
||||
composableScope.launch {
|
||||
pagerState.animateScrollToPage(
|
||||
DashboardPage.BUNDLES.ordinal
|
||||
|
||||
@@ -48,13 +48,13 @@ fun DeveloperSettingsScreen(
|
||||
description = R.string.developer_options_description,
|
||||
)
|
||||
|
||||
GroupHeader(stringResource(R.string.patch_bundles_section))
|
||||
GroupHeader(stringResource(R.string.patches))
|
||||
SettingsListItem(
|
||||
headlineContent = stringResource(R.string.patch_bundles_force_download),
|
||||
headlineContent = stringResource(R.string.patches_force_download),
|
||||
modifier = Modifier.clickable(onClick = vm::redownloadBundles)
|
||||
)
|
||||
SettingsListItem(
|
||||
headlineContent = stringResource(R.string.patch_bundles_reset),
|
||||
headlineContent = stringResource(R.string.patches_reset),
|
||||
modifier = Modifier.clickable(onClick = vm::redownloadBundles)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -240,8 +240,8 @@ fun ImportExportSettingsScreen(
|
||||
}
|
||||
}
|
||||
},
|
||||
headline = R.string.patch_selection_reset_bundle,
|
||||
description = R.string.patch_selection_reset_bundle_description
|
||||
headline = R.string.patch_selection_reset_patches,
|
||||
description = R.string.patch_selection_reset_patches_description
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -296,8 +296,8 @@ fun ImportExportSettingsScreen(
|
||||
}
|
||||
}
|
||||
},
|
||||
headline = R.string.patch_options_reset_bundle,
|
||||
description = R.string.patch_options_reset_bundle_description,
|
||||
headline = R.string.patch_options_reset,
|
||||
description = R.string.patch_options_reset_all,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,13 +135,13 @@ class DashboardViewModel(
|
||||
|
||||
uiSafe(
|
||||
app,
|
||||
R.string.source_download_fail,
|
||||
R.string.patches_download_fail,
|
||||
RemotePatchBundle.updateFailMsg
|
||||
) {
|
||||
if (bundle.update())
|
||||
app.toast(app.getString(R.string.bundle_update_success, bundle.getName()))
|
||||
app.toast(app.getString(R.string.patches_update_success, bundle.getName()))
|
||||
else
|
||||
app.toast(app.getString(R.string.bundle_update_unavailable, bundle.getName()))
|
||||
app.toast(app.getString(R.string.patches_update_unavailable, bundle.getName()))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ class DeveloperOptionsViewModel(
|
||||
private val patchBundleRepository: PatchBundleRepository
|
||||
) : ViewModel() {
|
||||
fun redownloadBundles() = viewModelScope.launch {
|
||||
uiSafe(app, R.string.source_download_fail, RemotePatchBundle.updateFailMsg) {
|
||||
uiSafe(app, R.string.patches_download_fail, RemotePatchBundle.updateFailMsg) {
|
||||
patchBundleRepository.redownloadRemoteBundles()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ sealed class ResetDialogState(
|
||||
)
|
||||
|
||||
class PatchSelectionBundle(dialogOptionName: String, onConfirm: () -> Unit) : ResetDialogState(
|
||||
titleResId = R.string.patch_selection_reset_bundle,
|
||||
descriptionResId = R.string.patch_selection_reset_bundle_dialog_description,
|
||||
titleResId = R.string.patch_selection_reset_patches,
|
||||
descriptionResId = R.string.patch_selection_reset_patches_dialog_description,
|
||||
onConfirm = onConfirm,
|
||||
dialogOptionName = dialogOptionName
|
||||
)
|
||||
@@ -81,8 +81,8 @@ sealed class ResetDialogState(
|
||||
)
|
||||
|
||||
class PatchOptionBundle(dialogOptionName: String, onConfirm: () -> Unit) : ResetDialogState(
|
||||
titleResId = R.string.patch_options_reset_bundle,
|
||||
descriptionResId = R.string.patch_options_reset_bundle_dialog_description,
|
||||
titleResId = R.string.patch_options_reset,
|
||||
descriptionResId = R.string.patch_options_reset_dialog_description,
|
||||
onConfirm = onConfirm,
|
||||
dialogOptionName = dialogOptionName
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user