mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-04 18:15:01 +02:00
Remove dead code
This commit is contained in:
parent
a461ed43de
commit
fca0fd7bbb
1 changed files with 0 additions and 41 deletions
|
@ -1,41 +0,0 @@
|
|||
//
|
||||
// ActivePlaybackSession.swift
|
||||
// App
|
||||
//
|
||||
// Created by Ron Heft on 8/16/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import RealmSwift
|
||||
|
||||
class ActivePlaybackSession {
|
||||
|
||||
static let shared = ActivePlaybackSession()
|
||||
|
||||
private let queue = DispatchQueue(label: "ABSActivePlaybackSession")
|
||||
private var _session: PlaybackSession?
|
||||
|
||||
private init() {
|
||||
// Singleton
|
||||
}
|
||||
|
||||
func startSession(_ session: ThreadSafeReference<PlaybackSession>) {
|
||||
queue.sync {
|
||||
_session = try? Realm().resolve(session)
|
||||
}
|
||||
}
|
||||
|
||||
// This is a funky method, but it ensures the accessing thread gets a live reference to session properly resolved
|
||||
func get() -> PlaybackSession? {
|
||||
var activeSession: ThreadSafeReference<PlaybackSession>?
|
||||
queue.sync {
|
||||
let realm = try! Realm()
|
||||
guard let session = _session else { return }
|
||||
r
|
||||
activeSession = ThreadSafeReference(to: session)
|
||||
}
|
||||
guard let activeSession = activeSession else { return nil }
|
||||
return try? Realm().resolve(activeSession)
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue