mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-26 05:14:09 +02:00
IOS: Support autoRewind and disableAutoRewind setting
This commit is contained in:
@@ -21,10 +21,13 @@ class PlayerTimeUtils {
|
||||
static internal func timeSinceLastPlayed(_ lastPlayedMs: Double?) -> TimeInterval? {
|
||||
guard let lastPlayedMs = lastPlayedMs else { return nil }
|
||||
let lastPlayed = Date(timeIntervalSince1970: lastPlayedMs / 1000)
|
||||
return lastPlayed.timeIntervalSinceNow
|
||||
return Date().timeIntervalSince(lastPlayed)
|
||||
}
|
||||
|
||||
static internal func timeToSeekBackForSinceLastPlayed(_ sinceLastPlayed: TimeInterval?) -> TimeInterval {
|
||||
if isAutoRewindDisabled(){
|
||||
return 0
|
||||
}
|
||||
if let sinceLastPlayed = sinceLastPlayed {
|
||||
if sinceLastPlayed < 6 {
|
||||
return 2
|
||||
@@ -44,4 +47,9 @@ class PlayerTimeUtils {
|
||||
}
|
||||
}
|
||||
|
||||
static internal func isAutoRewindDisabled() -> Bool {
|
||||
let deviceSettings = Database.shared.getDeviceSettings()
|
||||
return deviceSettings.disableAutoRewind
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user