From bca5421dbc436b346e77b63a6605c73e3d06f873 Mon Sep 17 00:00:00 2001 From: benonymity Date: Tue, 24 Jan 2023 17:35:12 -0500 Subject: [PATCH] update: higher sync interval on low power mode --- ios/App/Shared/player/PlayerProgress.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ios/App/Shared/player/PlayerProgress.swift b/ios/App/Shared/player/PlayerProgress.swift index 52c54d74..9aa15739 100644 --- a/ios/App/Shared/player/PlayerProgress.swift +++ b/ios/App/Shared/player/PlayerProgress.swift @@ -12,7 +12,7 @@ import RealmSwift class 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") @@ -117,6 +117,11 @@ class PlayerProgress { } 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 guard var session = session.thaw() else { return }