Move sync strings to SY files

This commit is contained in:
Jobobby04
2024-04-13 15:50:23 -04:00
parent e866e60b19
commit 739f7bc848
10 changed files with 110 additions and 104 deletions
@@ -129,7 +129,7 @@ private fun LibraryRegularToolbar(
onClick = onClickOpenRandomManga,
),
AppBar.OverflowAction(
title = stringResource(MR.strings.sync_library),
title = stringResource(SYMR.strings.sync_library),
onClick = onClickSyncNow,
),
).builder().apply {
@@ -349,15 +349,15 @@ object SettingsDataScreen : SearchableSettings {
private fun getSyncPreferences(syncPreferences: SyncPreferences, syncService: Int): List<Preference> {
return listOf(
Preference.PreferenceGroup(
title = stringResource(MR.strings.pref_sync_service_category),
title = stringResource(SYMR.strings.pref_sync_service_category),
preferenceItems = persistentListOf(
Preference.PreferenceItem.ListPreference(
pref = syncPreferences.syncService(),
title = stringResource(MR.strings.pref_sync_service),
title = stringResource(SYMR.strings.pref_sync_service),
entries = persistentMapOf(
SyncManager.SyncService.NONE.value to stringResource(MR.strings.off),
SyncManager.SyncService.SYNCYOMI.value to stringResource(MR.strings.syncyomi),
SyncManager.SyncService.GOOGLE_DRIVE.value to stringResource(MR.strings.google_drive),
SyncManager.SyncService.SYNCYOMI.value to stringResource(SYMR.strings.syncyomi),
SyncManager.SyncService.GOOGLE_DRIVE.value to stringResource(SYMR.strings.google_drive),
),
onValueChanged = { true },
),
@@ -402,7 +402,7 @@ object SettingsDataScreen : SearchableSettings {
val googleDriveSync = Injekt.get<GoogleDriveService>()
return listOf(
Preference.PreferenceItem.TextPreference(
title = stringResource(MR.strings.pref_google_drive_sign_in),
title = stringResource(SYMR.strings.pref_google_drive_sign_in),
onClick = {
val intent = googleDriveSync.getSignInIntent()
context.startActivity(intent)
@@ -427,19 +427,19 @@ object SettingsDataScreen : SearchableSettings {
val result = googleDriveSync.deleteSyncDataFromGoogleDrive()
when (result) {
GoogleDriveSyncService.DeleteSyncDataStatus.NOT_INITIALIZED -> context.toast(
MR.strings.google_drive_not_signed_in,
SYMR.strings.google_drive_not_signed_in,
duration = 5000,
)
GoogleDriveSyncService.DeleteSyncDataStatus.NO_FILES -> context.toast(
MR.strings.google_drive_sync_data_not_found,
SYMR.strings.google_drive_sync_data_not_found,
duration = 5000,
)
GoogleDriveSyncService.DeleteSyncDataStatus.SUCCESS -> context.toast(
MR.strings.google_drive_sync_data_purged,
SYMR.strings.google_drive_sync_data_purged,
duration = 5000,
)
GoogleDriveSyncService.DeleteSyncDataStatus.ERROR -> context.toast(
MR.strings.google_drive_sync_data_purge_error,
SYMR.strings.google_drive_sync_data_purge_error,
duration = 10000,
)
}
@@ -450,7 +450,7 @@ object SettingsDataScreen : SearchableSettings {
}
return Preference.PreferenceItem.TextPreference(
title = stringResource(MR.strings.pref_google_drive_purge_sync_data),
title = stringResource(SYMR.strings.pref_google_drive_purge_sync_data),
onClick = { showPurgeDialog = true },
)
}
@@ -462,8 +462,8 @@ object SettingsDataScreen : SearchableSettings {
) {
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(MR.strings.pref_purge_confirmation_title)) },
text = { Text(text = stringResource(MR.strings.pref_purge_confirmation_message)) },
title = { Text(text = stringResource(SYMR.strings.pref_purge_confirmation_title)) },
text = { Text(text = stringResource(SYMR.strings.pref_purge_confirmation_message)) },
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(MR.strings.action_cancel))
@@ -482,8 +482,8 @@ object SettingsDataScreen : SearchableSettings {
val scope = rememberCoroutineScope()
return listOf(
Preference.PreferenceItem.EditTextPreference(
title = stringResource(MR.strings.pref_sync_host),
subtitle = stringResource(MR.strings.pref_sync_host_summ),
title = stringResource(SYMR.strings.pref_sync_host),
subtitle = stringResource(SYMR.strings.pref_sync_host_summ),
pref = syncPreferences.clientHost(),
onValueChanged = { newValue ->
scope.launch {
@@ -496,8 +496,8 @@ object SettingsDataScreen : SearchableSettings {
},
),
Preference.PreferenceItem.EditTextPreference(
title = stringResource(MR.strings.pref_sync_api_key),
subtitle = stringResource(MR.strings.pref_sync_api_key_summ),
title = stringResource(SYMR.strings.pref_sync_api_key),
subtitle = stringResource(SYMR.strings.pref_sync_api_key_summ),
pref = syncPreferences.clientAPIKey(),
),
)
@@ -507,12 +507,12 @@ object SettingsDataScreen : SearchableSettings {
private fun getSyncNowPref(): Preference.PreferenceGroup {
val navigator = LocalNavigator.currentOrThrow
return Preference.PreferenceGroup(
title = stringResource(MR.strings.pref_sync_now_group_title),
title = stringResource(SYMR.strings.pref_sync_now_group_title),
preferenceItems = persistentListOf(
getSyncOptionsPref(),
Preference.PreferenceItem.TextPreference(
title = stringResource(MR.strings.pref_sync_now),
subtitle = stringResource(MR.strings.pref_sync_now_subtitle),
title = stringResource(SYMR.strings.pref_sync_now),
subtitle = stringResource(SYMR.strings.pref_sync_now_subtitle),
onClick = {
navigator.push(SyncSettingsSelector())
},
@@ -525,8 +525,8 @@ object SettingsDataScreen : SearchableSettings {
private fun getSyncOptionsPref(): Preference.PreferenceItem.TextPreference {
val navigator = LocalNavigator.currentOrThrow
return Preference.PreferenceItem.TextPreference(
title = stringResource(MR.strings.pref_sync_options),
subtitle = stringResource(MR.strings.pref_sync_options_summ),
title = stringResource(SYMR.strings.pref_sync_options),
subtitle = stringResource(SYMR.strings.pref_sync_options_summ),
onClick = { navigator.push(SyncTriggerOptionsScreen()) },
)
}
@@ -538,16 +538,16 @@ object SettingsDataScreen : SearchableSettings {
val lastSync by syncPreferences.lastSyncTimestamp().collectAsState()
return Preference.PreferenceGroup(
title = stringResource(MR.strings.pref_sync_automatic_category),
title = stringResource(SYMR.strings.pref_sync_automatic_category),
preferenceItems = persistentListOf(
Preference.PreferenceItem.ListPreference(
pref = syncIntervalPref,
title = stringResource(MR.strings.pref_sync_interval),
title = stringResource(SYMR.strings.pref_sync_interval),
entries = persistentMapOf(
0 to stringResource(MR.strings.off),
30 to stringResource(MR.strings.update_30min),
60 to stringResource(MR.strings.update_1hour),
180 to stringResource(MR.strings.update_3hour),
30 to stringResource(SYMR.strings.update_30min),
60 to stringResource(SYMR.strings.update_1hour),
180 to stringResource(SYMR.strings.update_3hour),
360 to stringResource(MR.strings.update_6hour),
720 to stringResource(MR.strings.update_12hour),
1440 to stringResource(MR.strings.update_24hour),
@@ -560,7 +560,7 @@ object SettingsDataScreen : SearchableSettings {
},
),
Preference.PreferenceItem.InfoPreference(
stringResource(MR.strings.last_synchronization, relativeTimeSpanString(lastSync)),
stringResource(SYMR.strings.last_synchronization, relativeTimeSpanString(lastSync)),
),
),
)
@@ -20,6 +20,7 @@ import eu.kanade.tachiyomi.util.system.toast
import kotlinx.collections.immutable.ImmutableList
import kotlinx.coroutines.flow.update
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.components.LazyColumnWithAction
import tachiyomi.presentation.core.components.SectionCard
@@ -39,7 +40,7 @@ class SyncSettingsSelector : Screen() {
Scaffold(
topBar = {
AppBar(
title = stringResource(MR.strings.pref_choose_what_to_sync),
title = stringResource(SYMR.strings.pref_choose_what_to_sync),
navigateUp = navigator::pop,
scrollBehavior = it,
)
@@ -47,14 +48,14 @@ class SyncSettingsSelector : Screen() {
) { contentPadding ->
LazyColumnWithAction(
contentPadding = contentPadding,
actionLabel = stringResource(MR.strings.label_sync),
actionLabel = stringResource(SYMR.strings.label_sync),
actionEnabled = state.options.anyEnabled(),
onClickAction = {
if (!SyncDataJob.isRunning(context)) {
model.syncNow(context)
navigator.pop()
} else {
context.toast(MR.strings.sync_in_progress)
context.toast(SYMR.strings.sync_in_progress)
}
},
) {
@@ -15,6 +15,7 @@ import eu.kanade.tachiyomi.data.sync.models.SyncTriggerOptions
import kotlinx.collections.immutable.ImmutableList
import kotlinx.coroutines.flow.update
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.components.LazyColumnWithAction
import tachiyomi.presentation.core.components.SectionCard
@@ -34,7 +35,7 @@ class SyncTriggerOptionsScreen : Screen() {
Scaffold(
topBar = {
AppBar(
title = stringResource(MR.strings.pref_sync_options),
title = stringResource(SYMR.strings.pref_sync_options),
navigateUp = navigator::pop,
scrollBehavior = it,
)
@@ -49,7 +50,7 @@ class SyncTriggerOptionsScreen : Screen() {
},
) {
item {
SectionCard(MR.strings.label_triggers) {
SectionCard(SYMR.strings.label_triggers) {
Options(SyncTriggerOptions.mainOptions, state, model)
}
}