mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-28 05:53:59 +02:00
update: higher sync interval on low power mode
This commit is contained in:
parent
20085c5eed
commit
bca5421dbc
1 changed files with 6 additions and 1 deletions
|
@ -12,7 +12,7 @@ import RealmSwift
|
||||||
class PlayerProgress {
|
class PlayerProgress {
|
||||||
public static let shared = PlayerProgress()
|
public static let shared = PlayerProgress()
|
||||||
|
|
||||||
private static let TIME_BETWEEN_SESSION_SYNC_IN_SECONDS = 10.0
|
private static var TIME_BETWEEN_SESSION_SYNC_IN_SECONDS = 15.0
|
||||||
|
|
||||||
private let logger = AppLogger(category: "PlayerProgress")
|
private let logger = AppLogger(category: "PlayerProgress")
|
||||||
|
|
||||||
|
@ -117,6 +117,11 @@ class PlayerProgress {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func updateServerSessionFromLocalSession(_ session: PlaybackSession, rateLimitSync: Bool = false) async throws {
|
private func updateServerSessionFromLocalSession(_ session: PlaybackSession, rateLimitSync: Bool = false) async throws {
|
||||||
|
if ProcessInfo.processInfo.isLowPowerModeEnabled == true {
|
||||||
|
PlayerProgress.TIME_BETWEEN_SESSION_SYNC_IN_SECONDS = 60.0
|
||||||
|
} else {
|
||||||
|
PlayerProgress.TIME_BETWEEN_SESSION_SYNC_IN_SECONDS = 15.0
|
||||||
|
}
|
||||||
var safeToSync = true
|
var safeToSync = true
|
||||||
|
|
||||||
guard var session = session.thaw() else { return }
|
guard var session = session.thaw() else { return }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue