Move sync strings to SY files
This commit is contained in:
parent
e866e60b19
commit
739f7bc848
@ -129,7 +129,7 @@ private fun LibraryRegularToolbar(
|
|||||||
onClick = onClickOpenRandomManga,
|
onClick = onClickOpenRandomManga,
|
||||||
),
|
),
|
||||||
AppBar.OverflowAction(
|
AppBar.OverflowAction(
|
||||||
title = stringResource(MR.strings.sync_library),
|
title = stringResource(SYMR.strings.sync_library),
|
||||||
onClick = onClickSyncNow,
|
onClick = onClickSyncNow,
|
||||||
),
|
),
|
||||||
).builder().apply {
|
).builder().apply {
|
||||||
|
@ -349,15 +349,15 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
private fun getSyncPreferences(syncPreferences: SyncPreferences, syncService: Int): List<Preference> {
|
private fun getSyncPreferences(syncPreferences: SyncPreferences, syncService: Int): List<Preference> {
|
||||||
return listOf(
|
return listOf(
|
||||||
Preference.PreferenceGroup(
|
Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_sync_service_category),
|
title = stringResource(SYMR.strings.pref_sync_service_category),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
pref = syncPreferences.syncService(),
|
pref = syncPreferences.syncService(),
|
||||||
title = stringResource(MR.strings.pref_sync_service),
|
title = stringResource(SYMR.strings.pref_sync_service),
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
SyncManager.SyncService.NONE.value to stringResource(MR.strings.off),
|
SyncManager.SyncService.NONE.value to stringResource(MR.strings.off),
|
||||||
SyncManager.SyncService.SYNCYOMI.value to stringResource(MR.strings.syncyomi),
|
SyncManager.SyncService.SYNCYOMI.value to stringResource(SYMR.strings.syncyomi),
|
||||||
SyncManager.SyncService.GOOGLE_DRIVE.value to stringResource(MR.strings.google_drive),
|
SyncManager.SyncService.GOOGLE_DRIVE.value to stringResource(SYMR.strings.google_drive),
|
||||||
),
|
),
|
||||||
onValueChanged = { true },
|
onValueChanged = { true },
|
||||||
),
|
),
|
||||||
@ -402,7 +402,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
val googleDriveSync = Injekt.get<GoogleDriveService>()
|
val googleDriveSync = Injekt.get<GoogleDriveService>()
|
||||||
return listOf(
|
return listOf(
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.pref_google_drive_sign_in),
|
title = stringResource(SYMR.strings.pref_google_drive_sign_in),
|
||||||
onClick = {
|
onClick = {
|
||||||
val intent = googleDriveSync.getSignInIntent()
|
val intent = googleDriveSync.getSignInIntent()
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
@ -427,19 +427,19 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
val result = googleDriveSync.deleteSyncDataFromGoogleDrive()
|
val result = googleDriveSync.deleteSyncDataFromGoogleDrive()
|
||||||
when (result) {
|
when (result) {
|
||||||
GoogleDriveSyncService.DeleteSyncDataStatus.NOT_INITIALIZED -> context.toast(
|
GoogleDriveSyncService.DeleteSyncDataStatus.NOT_INITIALIZED -> context.toast(
|
||||||
MR.strings.google_drive_not_signed_in,
|
SYMR.strings.google_drive_not_signed_in,
|
||||||
duration = 5000,
|
duration = 5000,
|
||||||
)
|
)
|
||||||
GoogleDriveSyncService.DeleteSyncDataStatus.NO_FILES -> context.toast(
|
GoogleDriveSyncService.DeleteSyncDataStatus.NO_FILES -> context.toast(
|
||||||
MR.strings.google_drive_sync_data_not_found,
|
SYMR.strings.google_drive_sync_data_not_found,
|
||||||
duration = 5000,
|
duration = 5000,
|
||||||
)
|
)
|
||||||
GoogleDriveSyncService.DeleteSyncDataStatus.SUCCESS -> context.toast(
|
GoogleDriveSyncService.DeleteSyncDataStatus.SUCCESS -> context.toast(
|
||||||
MR.strings.google_drive_sync_data_purged,
|
SYMR.strings.google_drive_sync_data_purged,
|
||||||
duration = 5000,
|
duration = 5000,
|
||||||
)
|
)
|
||||||
GoogleDriveSyncService.DeleteSyncDataStatus.ERROR -> context.toast(
|
GoogleDriveSyncService.DeleteSyncDataStatus.ERROR -> context.toast(
|
||||||
MR.strings.google_drive_sync_data_purge_error,
|
SYMR.strings.google_drive_sync_data_purge_error,
|
||||||
duration = 10000,
|
duration = 10000,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -450,7 +450,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Preference.PreferenceItem.TextPreference(
|
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 },
|
onClick = { showPurgeDialog = true },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -462,8 +462,8 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
) {
|
) {
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
title = { Text(text = stringResource(MR.strings.pref_purge_confirmation_title)) },
|
title = { Text(text = stringResource(SYMR.strings.pref_purge_confirmation_title)) },
|
||||||
text = { Text(text = stringResource(MR.strings.pref_purge_confirmation_message)) },
|
text = { Text(text = stringResource(SYMR.strings.pref_purge_confirmation_message)) },
|
||||||
dismissButton = {
|
dismissButton = {
|
||||||
TextButton(onClick = onDismissRequest) {
|
TextButton(onClick = onDismissRequest) {
|
||||||
Text(text = stringResource(MR.strings.action_cancel))
|
Text(text = stringResource(MR.strings.action_cancel))
|
||||||
@ -482,8 +482,8 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
return listOf(
|
return listOf(
|
||||||
Preference.PreferenceItem.EditTextPreference(
|
Preference.PreferenceItem.EditTextPreference(
|
||||||
title = stringResource(MR.strings.pref_sync_host),
|
title = stringResource(SYMR.strings.pref_sync_host),
|
||||||
subtitle = stringResource(MR.strings.pref_sync_host_summ),
|
subtitle = stringResource(SYMR.strings.pref_sync_host_summ),
|
||||||
pref = syncPreferences.clientHost(),
|
pref = syncPreferences.clientHost(),
|
||||||
onValueChanged = { newValue ->
|
onValueChanged = { newValue ->
|
||||||
scope.launch {
|
scope.launch {
|
||||||
@ -496,8 +496,8 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.EditTextPreference(
|
Preference.PreferenceItem.EditTextPreference(
|
||||||
title = stringResource(MR.strings.pref_sync_api_key),
|
title = stringResource(SYMR.strings.pref_sync_api_key),
|
||||||
subtitle = stringResource(MR.strings.pref_sync_api_key_summ),
|
subtitle = stringResource(SYMR.strings.pref_sync_api_key_summ),
|
||||||
pref = syncPreferences.clientAPIKey(),
|
pref = syncPreferences.clientAPIKey(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -507,12 +507,12 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
private fun getSyncNowPref(): Preference.PreferenceGroup {
|
private fun getSyncNowPref(): Preference.PreferenceGroup {
|
||||||
val navigator = LocalNavigator.currentOrThrow
|
val navigator = LocalNavigator.currentOrThrow
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_sync_now_group_title),
|
title = stringResource(SYMR.strings.pref_sync_now_group_title),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
getSyncOptionsPref(),
|
getSyncOptionsPref(),
|
||||||
Preference.PreferenceItem.TextPreference(
|
Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.pref_sync_now),
|
title = stringResource(SYMR.strings.pref_sync_now),
|
||||||
subtitle = stringResource(MR.strings.pref_sync_now_subtitle),
|
subtitle = stringResource(SYMR.strings.pref_sync_now_subtitle),
|
||||||
onClick = {
|
onClick = {
|
||||||
navigator.push(SyncSettingsSelector())
|
navigator.push(SyncSettingsSelector())
|
||||||
},
|
},
|
||||||
@ -525,8 +525,8 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
private fun getSyncOptionsPref(): Preference.PreferenceItem.TextPreference {
|
private fun getSyncOptionsPref(): Preference.PreferenceItem.TextPreference {
|
||||||
val navigator = LocalNavigator.currentOrThrow
|
val navigator = LocalNavigator.currentOrThrow
|
||||||
return Preference.PreferenceItem.TextPreference(
|
return Preference.PreferenceItem.TextPreference(
|
||||||
title = stringResource(MR.strings.pref_sync_options),
|
title = stringResource(SYMR.strings.pref_sync_options),
|
||||||
subtitle = stringResource(MR.strings.pref_sync_options_summ),
|
subtitle = stringResource(SYMR.strings.pref_sync_options_summ),
|
||||||
onClick = { navigator.push(SyncTriggerOptionsScreen()) },
|
onClick = { navigator.push(SyncTriggerOptionsScreen()) },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -538,16 +538,16 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
val lastSync by syncPreferences.lastSyncTimestamp().collectAsState()
|
val lastSync by syncPreferences.lastSyncTimestamp().collectAsState()
|
||||||
|
|
||||||
return Preference.PreferenceGroup(
|
return Preference.PreferenceGroup(
|
||||||
title = stringResource(MR.strings.pref_sync_automatic_category),
|
title = stringResource(SYMR.strings.pref_sync_automatic_category),
|
||||||
preferenceItems = persistentListOf(
|
preferenceItems = persistentListOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
pref = syncIntervalPref,
|
pref = syncIntervalPref,
|
||||||
title = stringResource(MR.strings.pref_sync_interval),
|
title = stringResource(SYMR.strings.pref_sync_interval),
|
||||||
entries = persistentMapOf(
|
entries = persistentMapOf(
|
||||||
0 to stringResource(MR.strings.off),
|
0 to stringResource(MR.strings.off),
|
||||||
30 to stringResource(MR.strings.update_30min),
|
30 to stringResource(SYMR.strings.update_30min),
|
||||||
60 to stringResource(MR.strings.update_1hour),
|
60 to stringResource(SYMR.strings.update_1hour),
|
||||||
180 to stringResource(MR.strings.update_3hour),
|
180 to stringResource(SYMR.strings.update_3hour),
|
||||||
360 to stringResource(MR.strings.update_6hour),
|
360 to stringResource(MR.strings.update_6hour),
|
||||||
720 to stringResource(MR.strings.update_12hour),
|
720 to stringResource(MR.strings.update_12hour),
|
||||||
1440 to stringResource(MR.strings.update_24hour),
|
1440 to stringResource(MR.strings.update_24hour),
|
||||||
@ -560,7 +560,7 @@ object SettingsDataScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.InfoPreference(
|
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.collections.immutable.ImmutableList
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
|
import tachiyomi.i18n.sy.SYMR
|
||||||
import tachiyomi.presentation.core.components.LabeledCheckbox
|
import tachiyomi.presentation.core.components.LabeledCheckbox
|
||||||
import tachiyomi.presentation.core.components.LazyColumnWithAction
|
import tachiyomi.presentation.core.components.LazyColumnWithAction
|
||||||
import tachiyomi.presentation.core.components.SectionCard
|
import tachiyomi.presentation.core.components.SectionCard
|
||||||
@ -39,7 +40,7 @@ class SyncSettingsSelector : Screen() {
|
|||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
AppBar(
|
AppBar(
|
||||||
title = stringResource(MR.strings.pref_choose_what_to_sync),
|
title = stringResource(SYMR.strings.pref_choose_what_to_sync),
|
||||||
navigateUp = navigator::pop,
|
navigateUp = navigator::pop,
|
||||||
scrollBehavior = it,
|
scrollBehavior = it,
|
||||||
)
|
)
|
||||||
@ -47,14 +48,14 @@ class SyncSettingsSelector : Screen() {
|
|||||||
) { contentPadding ->
|
) { contentPadding ->
|
||||||
LazyColumnWithAction(
|
LazyColumnWithAction(
|
||||||
contentPadding = contentPadding,
|
contentPadding = contentPadding,
|
||||||
actionLabel = stringResource(MR.strings.label_sync),
|
actionLabel = stringResource(SYMR.strings.label_sync),
|
||||||
actionEnabled = state.options.anyEnabled(),
|
actionEnabled = state.options.anyEnabled(),
|
||||||
onClickAction = {
|
onClickAction = {
|
||||||
if (!SyncDataJob.isRunning(context)) {
|
if (!SyncDataJob.isRunning(context)) {
|
||||||
model.syncNow(context)
|
model.syncNow(context)
|
||||||
navigator.pop()
|
navigator.pop()
|
||||||
} else {
|
} 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.collections.immutable.ImmutableList
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
|
import tachiyomi.i18n.sy.SYMR
|
||||||
import tachiyomi.presentation.core.components.LabeledCheckbox
|
import tachiyomi.presentation.core.components.LabeledCheckbox
|
||||||
import tachiyomi.presentation.core.components.LazyColumnWithAction
|
import tachiyomi.presentation.core.components.LazyColumnWithAction
|
||||||
import tachiyomi.presentation.core.components.SectionCard
|
import tachiyomi.presentation.core.components.SectionCard
|
||||||
@ -34,7 +35,7 @@ class SyncTriggerOptionsScreen : Screen() {
|
|||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
AppBar(
|
AppBar(
|
||||||
title = stringResource(MR.strings.pref_sync_options),
|
title = stringResource(SYMR.strings.pref_sync_options),
|
||||||
navigateUp = navigator::pop,
|
navigateUp = navigator::pop,
|
||||||
scrollBehavior = it,
|
scrollBehavior = it,
|
||||||
)
|
)
|
||||||
@ -49,7 +50,7 @@ class SyncTriggerOptionsScreen : Screen() {
|
|||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
SectionCard(MR.strings.label_triggers) {
|
SectionCard(SYMR.strings.label_triggers) {
|
||||||
Options(SyncTriggerOptions.mainOptions, state, model)
|
Options(SyncTriggerOptions.mainOptions, state, model)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package eu.kanade.tachiyomi.data.sync.models
|
|||||||
|
|
||||||
import dev.icerock.moko.resources.StringResource
|
import dev.icerock.moko.resources.StringResource
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.sy.SYMR
|
||||||
|
|
||||||
data class SyncTriggerOptions(
|
data class SyncTriggerOptions(
|
||||||
val syncOnChapterRead: Boolean = false,
|
val syncOnChapterRead: Boolean = false,
|
||||||
@ -25,22 +25,22 @@ data class SyncTriggerOptions(
|
|||||||
companion object {
|
companion object {
|
||||||
val mainOptions = persistentListOf(
|
val mainOptions = persistentListOf(
|
||||||
Entry(
|
Entry(
|
||||||
label = MR.strings.sync_on_chapter_read,
|
label = SYMR.strings.sync_on_chapter_read,
|
||||||
getter = SyncTriggerOptions::syncOnChapterRead,
|
getter = SyncTriggerOptions::syncOnChapterRead,
|
||||||
setter = { options, enabled -> options.copy(syncOnChapterRead = enabled) },
|
setter = { options, enabled -> options.copy(syncOnChapterRead = enabled) },
|
||||||
),
|
),
|
||||||
Entry(
|
Entry(
|
||||||
label = MR.strings.sync_on_chapter_open,
|
label = SYMR.strings.sync_on_chapter_open,
|
||||||
getter = SyncTriggerOptions::syncOnChapterOpen,
|
getter = SyncTriggerOptions::syncOnChapterOpen,
|
||||||
setter = { options, enabled -> options.copy(syncOnChapterOpen = enabled) },
|
setter = { options, enabled -> options.copy(syncOnChapterOpen = enabled) },
|
||||||
),
|
),
|
||||||
Entry(
|
Entry(
|
||||||
label = MR.strings.sync_on_app_start,
|
label = SYMR.strings.sync_on_app_start,
|
||||||
getter = SyncTriggerOptions::syncOnAppStart,
|
getter = SyncTriggerOptions::syncOnAppStart,
|
||||||
setter = { options, enabled -> options.copy(syncOnAppStart = enabled) },
|
setter = { options, enabled -> options.copy(syncOnAppStart = enabled) },
|
||||||
),
|
),
|
||||||
Entry(
|
Entry(
|
||||||
label = MR.strings.sync_on_app_resume,
|
label = SYMR.strings.sync_on_app_resume,
|
||||||
getter = SyncTriggerOptions::syncOnAppResume,
|
getter = SyncTriggerOptions::syncOnAppResume,
|
||||||
setter = { options, enabled -> options.copy(syncOnAppResume = enabled) },
|
setter = { options, enabled -> options.copy(syncOnAppResume = enabled) },
|
||||||
),
|
),
|
||||||
|
@ -27,6 +27,7 @@ import tachiyomi.core.common.i18n.stringResource
|
|||||||
import tachiyomi.core.common.util.lang.withIOContext
|
import tachiyomi.core.common.util.lang.withIOContext
|
||||||
import tachiyomi.core.common.util.system.logcat
|
import tachiyomi.core.common.util.system.logcat
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.MR
|
||||||
|
import tachiyomi.i18n.sy.SYMR
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
@ -68,7 +69,7 @@ class GoogleDriveSyncService(context: Context, json: Json, syncPreferences: Sync
|
|||||||
try {
|
try {
|
||||||
googleDriveService.refreshToken()
|
googleDriveService.refreshToken()
|
||||||
val drive = googleDriveService.driveService
|
val drive = googleDriveService.driveService
|
||||||
?: throw Exception(context.stringResource(MR.strings.google_drive_not_signed_in))
|
?: throw Exception(context.stringResource(SYMR.strings.google_drive_not_signed_in))
|
||||||
|
|
||||||
var backoff = 1000L
|
var backoff = 1000L
|
||||||
var retries = 0 // Retry counter
|
var retries = 0 // Retry counter
|
||||||
@ -112,11 +113,11 @@ class GoogleDriveSyncService(context: Context, json: Json, syncPreferences: Sync
|
|||||||
|
|
||||||
if (retries >= maxRetries) {
|
if (retries >= maxRetries) {
|
||||||
logcat(LogPriority.ERROR) { "Max retries reached, exiting sync process" }
|
logcat(LogPriority.ERROR) { "Max retries reached, exiting sync process" }
|
||||||
throw Exception(context.stringResource(MR.strings.error_before_sync_gdrive) + ": Max retries reached.")
|
throw Exception(context.stringResource(SYMR.strings.error_before_sync_gdrive) + ": Max retries reached.")
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logcat(LogPriority.ERROR, throwable = e) { "Error in GoogleDrive beforeSync" }
|
logcat(LogPriority.ERROR, throwable = e) { "Error in GoogleDrive beforeSync" }
|
||||||
throw Exception(context.stringResource(MR.strings.error_before_sync_gdrive) + ": ${e.message}", e)
|
throw Exception(context.stringResource(SYMR.strings.error_before_sync_gdrive) + ": ${e.message}", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +126,7 @@ class GoogleDriveSyncService(context: Context, json: Json, syncPreferences: Sync
|
|||||||
|
|
||||||
if (drive == null) {
|
if (drive == null) {
|
||||||
logcat(LogPriority.DEBUG) { "Google Drive service not initialized" }
|
logcat(LogPriority.DEBUG) { "Google Drive service not initialized" }
|
||||||
throw Exception(context.stringResource(MR.strings.google_drive_not_signed_in))
|
throw Exception(context.stringResource(SYMR.strings.google_drive_not_signed_in))
|
||||||
}
|
}
|
||||||
|
|
||||||
val fileList = getAppDataFileList(drive)
|
val fileList = getAppDataFileList(drive)
|
||||||
@ -166,7 +167,7 @@ class GoogleDriveSyncService(context: Context, json: Json, syncPreferences: Sync
|
|||||||
override suspend fun pushSyncData(syncData: SyncData) {
|
override suspend fun pushSyncData(syncData: SyncData) {
|
||||||
val jsonData = json.encodeToString(syncData)
|
val jsonData = json.encodeToString(syncData)
|
||||||
val drive = googleDriveService.driveService
|
val drive = googleDriveService.driveService
|
||||||
?: throw Exception(context.stringResource(MR.strings.google_drive_not_signed_in))
|
?: throw Exception(context.stringResource(SYMR.strings.google_drive_not_signed_in))
|
||||||
|
|
||||||
val fileList = getAppDataFileList(drive)
|
val fileList = getAppDataFileList(drive)
|
||||||
val byteArrayOutputStream = ByteArrayOutputStream()
|
val byteArrayOutputStream = ByteArrayOutputStream()
|
||||||
@ -205,7 +206,7 @@ class GoogleDriveSyncService(context: Context, json: Json, syncPreferences: Sync
|
|||||||
deleteLockFile(drive)
|
deleteLockFile(drive)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logcat(LogPriority.ERROR, throwable = e) { "Failed to push or update sync data" }
|
logcat(LogPriority.ERROR, throwable = e) { "Failed to push or update sync data" }
|
||||||
throw Exception(context.stringResource(MR.strings.error_uploading_sync_data) + ": ${e.message}", e)
|
throw Exception(context.stringResource(SYMR.strings.error_uploading_sync_data) + ": ${e.message}", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +283,7 @@ class GoogleDriveSyncService(context: Context, json: Json, syncPreferences: Sync
|
|||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logcat(LogPriority.ERROR, throwable = e) { "Error deleting lock file" }
|
logcat(LogPriority.ERROR, throwable = e) { "Error deleting lock file" }
|
||||||
throw Exception(context.stringResource(MR.strings.error_deleting_google_drive_lock_file), e)
|
throw Exception(context.stringResource(SYMR.strings.error_deleting_google_drive_lock_file), e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,7 +408,7 @@ class GoogleDriveService(private val context: Context) {
|
|||||||
.build()
|
.build()
|
||||||
|
|
||||||
if (refreshToken == "") {
|
if (refreshToken == "") {
|
||||||
throw Exception(context.stringResource(MR.strings.google_drive_not_signed_in))
|
throw Exception(context.stringResource(SYMR.strings.google_drive_not_signed_in))
|
||||||
}
|
}
|
||||||
|
|
||||||
credential.refreshToken = refreshToken
|
credential.refreshToken = refreshToken
|
||||||
|
@ -167,7 +167,7 @@ object LibraryTab : Tab {
|
|||||||
if (!SyncDataJob.isRunning(context)) {
|
if (!SyncDataJob.isRunning(context)) {
|
||||||
SyncDataJob.startNow(context)
|
SyncDataJob.startNow(context)
|
||||||
} else {
|
} else {
|
||||||
context.toast(MR.strings.sync_in_progress)
|
context.toast(SYMR.strings.sync_in_progress)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// SY -->
|
// SY -->
|
||||||
|
@ -6,7 +6,7 @@ import androidx.lifecycle.lifecycleScope
|
|||||||
import eu.kanade.tachiyomi.data.sync.service.GoogleDriveService
|
import eu.kanade.tachiyomi.data.sync.service.GoogleDriveService
|
||||||
import tachiyomi.core.common.i18n.stringResource
|
import tachiyomi.core.common.i18n.stringResource
|
||||||
import tachiyomi.core.common.util.lang.launchIO
|
import tachiyomi.core.common.util.lang.launchIO
|
||||||
import tachiyomi.i18n.MR
|
import tachiyomi.i18n.sy.SYMR
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ class GoogleDriveLoginActivity : BaseOAuthLoginActivity() {
|
|||||||
onSuccess = {
|
onSuccess = {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
this@GoogleDriveLoginActivity,
|
this@GoogleDriveLoginActivity,
|
||||||
stringResource(MR.strings.google_drive_login_success),
|
stringResource(SYMR.strings.google_drive_login_success),
|
||||||
Toast.LENGTH_LONG,
|
Toast.LENGTH_LONG,
|
||||||
).show()
|
).show()
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ class GoogleDriveLoginActivity : BaseOAuthLoginActivity() {
|
|||||||
onFailure = { error ->
|
onFailure = { error ->
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
this@GoogleDriveLoginActivity,
|
this@GoogleDriveLoginActivity,
|
||||||
stringResource(MR.strings.google_drive_login_failed, error),
|
stringResource(SYMR.strings.google_drive_login_failed, error),
|
||||||
Toast.LENGTH_LONG,
|
Toast.LENGTH_LONG,
|
||||||
).show()
|
).show()
|
||||||
returnToSettings()
|
returnToSettings()
|
||||||
@ -42,7 +42,7 @@ class GoogleDriveLoginActivity : BaseOAuthLoginActivity() {
|
|||||||
} else if (error != null) {
|
} else if (error != null) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
this@GoogleDriveLoginActivity,
|
this@GoogleDriveLoginActivity,
|
||||||
stringResource(MR.strings.google_drive_login_failed, error),
|
stringResource(SYMR.strings.google_drive_login_failed, error),
|
||||||
Toast.LENGTH_LONG,
|
Toast.LENGTH_LONG,
|
||||||
).show()
|
).show()
|
||||||
|
|
||||||
|
@ -187,6 +187,9 @@
|
|||||||
<string name="pref_mark_read_dupe_chapters_summary">Mark duplicate chapters as read after reading</string>
|
<string name="pref_mark_read_dupe_chapters_summary">Mark duplicate chapters as read after reading</string>
|
||||||
<string name="pref_library_mark_duplicate_chapters">Mark new duplicate chapters as read</string>
|
<string name="pref_library_mark_duplicate_chapters">Mark new duplicate chapters as read</string>
|
||||||
<string name="pref_library_mark_duplicate_chapters_summary">Automatically mark new chapters as read if it has been read before</string>
|
<string name="pref_library_mark_duplicate_chapters_summary">Automatically mark new chapters as read if it has been read before</string>
|
||||||
|
<string name="update_30min">Every 30 minutes</string>
|
||||||
|
<string name="update_1hour">Every hour</string>
|
||||||
|
<string name="update_3hour">Every 3 hours</string>
|
||||||
|
|
||||||
<!-- Browse settings -->
|
<!-- Browse settings -->
|
||||||
<string name="pref_hide_feed">Hide Feed tab</string>
|
<string name="pref_hide_feed">Hide Feed tab</string>
|
||||||
@ -200,8 +203,60 @@
|
|||||||
<string name="pref_local_source_hidden_folders_summery">Allow local source to read hidden folders</string>
|
<string name="pref_local_source_hidden_folders_summery">Allow local source to read hidden folders</string>
|
||||||
|
|
||||||
<!-- Backup settings -->
|
<!-- Backup settings -->
|
||||||
|
<string name="pref_backup_and_sync_summary">Manual & automatic backups and sync</string>
|
||||||
<string name="custom_entry_info">Custom entry info</string>
|
<string name="custom_entry_info">Custom entry info</string>
|
||||||
<string name="all_read_entries">All read entries</string>
|
<string name="all_read_entries">All read entries</string>
|
||||||
|
<string name="label_backup">Backup</string>
|
||||||
|
<string name="label_sync">Sync</string>
|
||||||
|
<string name="label_triggers">Triggers</string>
|
||||||
|
|
||||||
|
<!-- Sync settings -->
|
||||||
|
<string name="sync_error">Syncing library failed</string>
|
||||||
|
<string name="sync_complete">Syncing library complete</string>
|
||||||
|
<string name="sync_in_progress">Sync is already in progress</string>
|
||||||
|
<string name="pref_sync_host">Host</string>
|
||||||
|
<string name="pref_sync_host_summ">Enter the host address for synchronizing your library</string>
|
||||||
|
<string name="pref_sync_api_key">API key</string>
|
||||||
|
<string name="pref_sync_api_key_summ">Enter the API key to synchronize your library</string>
|
||||||
|
<string name="pref_sync_now_group_title">Sync Actions</string>
|
||||||
|
<string name="pref_sync_now">Sync now</string>
|
||||||
|
<string name="pref_sync_confirmation_title">Sync confirmation</string>
|
||||||
|
<string name="pref_sync_now_subtitle">Initiate immediate synchronization of your data</string>
|
||||||
|
<string name="pref_sync_confirmation_message">Syncing will overwrite your local library with the remote library. Are you sure you want to continue?</string>
|
||||||
|
<string name="pref_sync_service">Service</string>
|
||||||
|
<string name="pref_sync_service_summ">Select the service to sync your library with</string>
|
||||||
|
<string name="pref_sync_service_category">Sync</string>
|
||||||
|
<string name="pref_sync_automatic_category">Automatic Synchronization</string>
|
||||||
|
<string name="pref_sync_interval">Synchronization frequency</string>
|
||||||
|
<string name="pref_choose_what_to_sync">Choose what to sync</string>
|
||||||
|
<string name="success_reset_sync_timestamp">Last sync timestamp reset</string>
|
||||||
|
<string name="syncyomi">SyncYomi</string>
|
||||||
|
<string name="sync_completed_message">Done in %1$s</string>
|
||||||
|
<string name="last_synchronization">Last Synchronization: %1$s</string>
|
||||||
|
<string name="google_drive">Google Drive</string>
|
||||||
|
<string name="pref_google_drive_sign_in">Sign in</string>
|
||||||
|
<string name="google_drive_sign_in_success">Signed in successfully</string>
|
||||||
|
<string name="google_drive_sign_in_failed">Sign in failed</string>
|
||||||
|
<string name="authentication">Authentication</string>
|
||||||
|
<string name="pref_google_drive_purge_sync_data">Clear Sync Data from Google Drive</string>
|
||||||
|
<string name="google_drive_sync_data_purged">Sync data purged from Google Drive</string>
|
||||||
|
<string name="google_drive_sync_data_not_found">No sync data found in Google Drive</string>
|
||||||
|
<string name="google_drive_sync_data_purge_error">Error purging sync data from Google Drive, Try to sign in again.</string>
|
||||||
|
<string name="google_drive_login_success">Logged in to Google Drive</string>
|
||||||
|
<string name="google_drive_login_failed">Failed to log in to Google Drive: %s</string>
|
||||||
|
<string name="google_drive_not_signed_in">Not signed in to Google Drive</string>
|
||||||
|
<string name="error_uploading_sync_data">Error uploading sync data to Google Drive</string>
|
||||||
|
<string name="error_deleting_google_drive_lock_file">Error Deleting Google Drive Lock File</string>
|
||||||
|
<string name="error_before_sync_gdrive">Error before sync: %s</string>
|
||||||
|
<string name="pref_purge_confirmation_title">Purge confirmation</string>
|
||||||
|
<string name="pref_purge_confirmation_message">Purging sync data will delete all your sync data from Google Drive. Are you sure you want to continue?</string>
|
||||||
|
<string name="pref_sync_options">Create sync triggers</string>
|
||||||
|
<string name="pref_sync_options_summ">Can be used to set sync triggers</string>
|
||||||
|
<string name="sync_on_chapter_read">Sync on Chapter Read</string>
|
||||||
|
<string name="sync_on_chapter_open">Sync on Chapter Open</string>
|
||||||
|
<string name="sync_on_app_start">Sync on App Start</string>
|
||||||
|
<string name="sync_on_app_resume">Sync on App Resume</string>
|
||||||
|
<string name="sync_library">Sync library</string>
|
||||||
|
|
||||||
<!-- Security settings -->
|
<!-- Security settings -->
|
||||||
<string name="biometric_lock_times">Biometric lock times</string>
|
<string name="biometric_lock_times">Biometric lock times</string>
|
||||||
|
@ -29,10 +29,8 @@
|
|||||||
<string name="label_upcoming">Upcoming</string>
|
<string name="label_upcoming">Upcoming</string>
|
||||||
<string name="label_recent_manga">History</string>
|
<string name="label_recent_manga">History</string>
|
||||||
<string name="label_sources">Sources</string>
|
<string name="label_sources">Sources</string>
|
||||||
|
<string name="label_backup">Backup and restore</string>
|
||||||
<string name="label_data_storage">Data and storage</string>
|
<string name="label_data_storage">Data and storage</string>
|
||||||
<string name="label_backup">Backup</string>
|
|
||||||
<string name="label_sync">Sync</string>
|
|
||||||
<string name="label_triggers">Triggers</string>
|
|
||||||
<string name="label_stats">Statistics</string>
|
<string name="label_stats">Statistics</string>
|
||||||
<string name="label_migration">Migrate</string>
|
<string name="label_migration">Migrate</string>
|
||||||
<string name="label_extensions">Extensions</string>
|
<string name="label_extensions">Extensions</string>
|
||||||
@ -213,7 +211,6 @@
|
|||||||
<string name="pref_tracking_summary">One-way progress sync, enhanced sync</string>
|
<string name="pref_tracking_summary">One-way progress sync, enhanced sync</string>
|
||||||
<string name="pref_browse_summary">Sources, extensions, global search</string>
|
<string name="pref_browse_summary">Sources, extensions, global search</string>
|
||||||
<string name="pref_backup_summary">Manual & automatic backups, storage space</string>
|
<string name="pref_backup_summary">Manual & automatic backups, storage space</string>
|
||||||
<string name="pref_backup_and_sync_summary">Manual & automatic backups and sync</string>
|
|
||||||
<string name="pref_security_summary">App lock, secure screen</string>
|
<string name="pref_security_summary">App lock, secure screen</string>
|
||||||
<string name="pref_advanced_summary">Dump crash logs, battery optimizations</string>
|
<string name="pref_advanced_summary">Dump crash logs, battery optimizations</string>
|
||||||
|
|
||||||
@ -268,9 +265,6 @@
|
|||||||
<string name="pref_category_library_update">Global update</string>
|
<string name="pref_category_library_update">Global update</string>
|
||||||
<string name="pref_library_update_interval">Automatic updates</string>
|
<string name="pref_library_update_interval">Automatic updates</string>
|
||||||
<string name="update_never">Off</string>
|
<string name="update_never">Off</string>
|
||||||
<string name="update_30min">Every 30 minutes</string>
|
|
||||||
<string name="update_1hour">Every hour</string>
|
|
||||||
<string name="update_3hour">Every 3 hours</string>
|
|
||||||
<string name="update_6hour">Every 6 hours</string>
|
<string name="update_6hour">Every 6 hours</string>
|
||||||
<string name="update_12hour">Every 12 hours</string>
|
<string name="update_12hour">Every 12 hours</string>
|
||||||
<string name="update_24hour">Daily</string>
|
<string name="update_24hour">Daily</string>
|
||||||
@ -551,52 +545,6 @@
|
|||||||
<!-- Sync section -->
|
<!-- Sync section -->
|
||||||
<string name="syncing_library">Syncing library</string>
|
<string name="syncing_library">Syncing library</string>
|
||||||
<string name="library_sync_complete">Library sync complete</string>
|
<string name="library_sync_complete">Library sync complete</string>
|
||||||
<string name="sync_error">Syncing library failed</string>
|
|
||||||
<string name="sync_complete">Syncing library complete</string>
|
|
||||||
<string name="sync_in_progress">Sync is already in progress</string>
|
|
||||||
<string name="pref_sync_host">Host</string>
|
|
||||||
<string name="pref_sync_host_summ">Enter the host address for synchronizing your library</string>
|
|
||||||
<string name="pref_sync_api_key">API key</string>
|
|
||||||
<string name="pref_sync_api_key_summ">Enter the API key to synchronize your library</string>
|
|
||||||
<string name="pref_sync_now_group_title">Sync Actions</string>
|
|
||||||
<string name="pref_sync_now">Sync now</string>
|
|
||||||
<string name="pref_sync_confirmation_title">Sync confirmation</string>
|
|
||||||
<string name="pref_sync_now_subtitle">Initiate immediate synchronization of your data</string>
|
|
||||||
<string name="pref_sync_confirmation_message">Syncing will overwrite your local library with the remote library. Are you sure you want to continue?</string>
|
|
||||||
<string name="pref_sync_service">Service</string>
|
|
||||||
<string name="pref_sync_service_summ">Select the service to sync your library with</string>
|
|
||||||
<string name="pref_sync_service_category">Sync</string>
|
|
||||||
<string name="pref_sync_automatic_category">Automatic Synchronization</string>
|
|
||||||
<string name="pref_sync_interval">Synchronization frequency</string>
|
|
||||||
<string name="pref_choose_what_to_sync">Choose what to sync</string>
|
|
||||||
<string name="success_reset_sync_timestamp">Last sync timestamp reset</string>
|
|
||||||
<string name="syncyomi">SyncYomi</string>
|
|
||||||
<string name="sync_completed_message">Done in %1$s</string>
|
|
||||||
<string name="last_synchronization">Last Synchronization: %1$s</string>
|
|
||||||
<string name="google_drive">Google Drive</string>
|
|
||||||
<string name="pref_google_drive_sign_in">Sign in</string>
|
|
||||||
<string name="google_drive_sign_in_success">Signed in successfully</string>
|
|
||||||
<string name="google_drive_sign_in_failed">Sign in failed</string>
|
|
||||||
<string name="authentication">Authentication</string>
|
|
||||||
<string name="pref_google_drive_purge_sync_data">Clear Sync Data from Google Drive</string>
|
|
||||||
<string name="google_drive_sync_data_purged">Sync data purged from Google Drive</string>
|
|
||||||
<string name="google_drive_sync_data_not_found">No sync data found in Google Drive</string>
|
|
||||||
<string name="google_drive_sync_data_purge_error">Error purging sync data from Google Drive, Try to sign in again.</string>
|
|
||||||
<string name="google_drive_login_success">Logged in to Google Drive</string>
|
|
||||||
<string name="google_drive_login_failed">Failed to log in to Google Drive: %s</string>
|
|
||||||
<string name="google_drive_not_signed_in">Not signed in to Google Drive</string>
|
|
||||||
<string name="error_uploading_sync_data">Error uploading sync data to Google Drive</string>
|
|
||||||
<string name="error_deleting_google_drive_lock_file">Error Deleting Google Drive Lock File</string>
|
|
||||||
<string name="error_before_sync_gdrive">Error before sync: %s</string>
|
|
||||||
<string name="pref_purge_confirmation_title">Purge confirmation</string>
|
|
||||||
<string name="pref_purge_confirmation_message">Purging sync data will delete all your sync data from Google Drive. Are you sure you want to continue?</string>
|
|
||||||
<string name="pref_sync_options">Create sync triggers</string>
|
|
||||||
<string name="pref_sync_options_summ">Can be used to set sync triggers</string>
|
|
||||||
<string name="sync_on_chapter_read">Sync on Chapter Read</string>
|
|
||||||
<string name="sync_on_chapter_open">Sync on Chapter Open</string>
|
|
||||||
<string name="sync_on_app_start">Sync on App Start</string>
|
|
||||||
<string name="sync_on_app_resume">Sync on App Resume</string>
|
|
||||||
<string name="sync_library">Sync library</string>
|
|
||||||
|
|
||||||
<!-- Advanced section -->
|
<!-- Advanced section -->
|
||||||
<string name="label_network">Networking</string>
|
<string name="label_network">Networking</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user