chore: Ktlint

Signed-off-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
KaiserBh 2023-12-20 22:49:19 +11:00
parent 178b00280b
commit 2f2eed0235
No known key found for this signature in database
GPG Key ID: 14D73B142042BBA9
4 changed files with 8 additions and 10 deletions

View File

@ -9,6 +9,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import cafe.adriel.voyager.core.model.StateScreenModel
import cafe.adriel.voyager.core.model.rememberScreenModel
@ -21,13 +22,12 @@ import kotlinx.collections.immutable.minus
import kotlinx.collections.immutable.plus
import kotlinx.collections.immutable.toPersistentSet
import kotlinx.coroutines.flow.update
import tachiyomi.domain.sync.SyncPreferences
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import androidx.compose.runtime.getValue
import tachiyomi.domain.sync.SyncPreferences
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -110,7 +110,6 @@ private class SyncOptionsScreenModel : StateScreenModel<SyncOptionsScreenModel.S
syncPreferences.syncFlags().set(flagsInt)
}
@Immutable
data class State(
val flags: PersistentSet<Int> = SyncChoices.keys.toPersistentSet(),
@ -122,4 +121,3 @@ private val SyncChoices = mapOf(
SyncPreferences.Flags.SYNC_ON_CHAPTER_OPEN to MR.strings.sync_on_chapter_open,
SyncPreferences.Flags.SYNC_ON_APP_START to MR.strings.sync_on_app_start,
)

View File

@ -176,7 +176,6 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
if (syncPreferences.syncService().get() != 0 && syncFlags and SyncPreferences.Flags.SYNC_ON_APP_START == SyncPreferences.Flags.SYNC_ON_APP_START) {
SyncDataJob.startNow(this@App)
}
}
override fun onStop(owner: LifecycleOwner) {

View File

@ -100,7 +100,7 @@ class ReaderViewModel @JvmOverloads constructor(
private val upsertHistory: UpsertHistory = Injekt.get(),
private val updateChapter: UpdateChapter = Injekt.get(),
private val setMangaViewerFlags: SetMangaViewerFlags = Injekt.get(),
private val syncPreferences: SyncPreferences = Injekt.get()
private val syncPreferences: SyncPreferences = Injekt.get(),
) : ViewModel() {
private val mutableState = MutableStateFlow(State())
@ -534,7 +534,8 @@ class ReaderViewModel @JvmOverloads constructor(
// Check if syncing is enabled for chapter read:
if (syncPreferences.syncService().get() != 0 &&
syncFlags and SyncPreferences.Flags.SYNC_ON_CHAPTER_READ == SyncPreferences.Flags.SYNC_ON_CHAPTER_READ) {
syncFlags and SyncPreferences.Flags.SYNC_ON_CHAPTER_READ == SyncPreferences.Flags.SYNC_ON_CHAPTER_READ
) {
SyncDataJob.startNow(Injekt.get<Application>())
}
}
@ -549,7 +550,8 @@ class ReaderViewModel @JvmOverloads constructor(
// Check if syncing is enabled for chapter open:
if (syncPreferences.syncService().get() != 0 &&
syncFlags and SyncPreferences.Flags.SYNC_ON_CHAPTER_OPEN == SyncPreferences.Flags.SYNC_ON_CHAPTER_OPEN) {
syncFlags and SyncPreferences.Flags.SYNC_ON_CHAPTER_OPEN == SyncPreferences.Flags.SYNC_ON_CHAPTER_OPEN
) {
SyncDataJob.startNow(Injekt.get<Application>())
}
}

View File

@ -17,7 +17,6 @@ class SyncPreferences(
fun values() = listOf(NONE, SYNC_ON_CHAPTER_READ, SYNC_ON_CHAPTER_OPEN, SYNC_ON_APP_START)
}
fun syncHost() = preferenceStore.getString("sync_host", "https://sync.tachiyomi.org")
fun syncAPIKey() = preferenceStore.getString("sync_api_key", "")
fun lastSyncTimestamp() = preferenceStore.getLong(Preference.appStateKey("last_sync_timestamp"), 0L)
@ -35,5 +34,5 @@ class SyncPreferences(
"",
)
fun syncFlags() = preferenceStore.getInt("sync_flags", Flags.Defaults)
fun syncFlags() = preferenceStore.getInt("sync_flags", Flags.Defaults)
}