mirror of
https://github.com/mihonapp/mihon.git
synced 2025-10-28 21:07:57 +01:00
feat: added triggers for syncing.
Experimental for now, but works fine so far, I don't know about google api limit but I think it's pretty generous. Signed-off-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
@@ -6,6 +6,18 @@ import tachiyomi.core.preference.PreferenceStore
|
||||
class SyncPreferences(
|
||||
private val preferenceStore: PreferenceStore,
|
||||
) {
|
||||
object Flags {
|
||||
const val NONE = 0x0
|
||||
const val SYNC_ON_CHAPTER_READ = 0x1
|
||||
const val SYNC_ON_CHAPTER_OPEN = 0x2
|
||||
const val SYNC_ON_APP_START = 0x4
|
||||
|
||||
const val Defaults = NONE
|
||||
|
||||
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)
|
||||
@@ -22,4 +34,6 @@ class SyncPreferences(
|
||||
Preference.appStateKey("google_drive_refresh_token"),
|
||||
"",
|
||||
)
|
||||
|
||||
fun syncFlags() = preferenceStore.getInt("sync_flags", Flags.Defaults)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user