mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-08-04 18:15:01 +02:00
fix: iOS 16 realm crash
This commit is contained in:
parent
fdc829d06c
commit
7ccd8db085
2 changed files with 3 additions and 3 deletions
|
@ -36,7 +36,7 @@ public class AbsAudioPlayer: CAPPlugin {
|
|||
func restorePlaybackSession() async {
|
||||
do {
|
||||
// Fetch the most recent active session
|
||||
let activeSession = try await Realm().objects(PlaybackSession.self).where({
|
||||
let activeSession = try Realm(queue: nil).objects(PlaybackSession.self).where({
|
||||
$0.isActiveSession == true && $0.serverConnectionConfigId == Store.serverConfig?.id
|
||||
}).last?.freeze()
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ class PlayerProgress {
|
|||
|
||||
private func updateAllServerSessionFromLocalSession() async throws {
|
||||
try await withThrowingTaskGroup(of: Void.self) { [self] group in
|
||||
for session in try await Realm().objects(PlaybackSession.self).where({ $0.serverConnectionConfigId == Store.serverConfig?.id }) {
|
||||
for session in try Realm(queue: nil).objects(PlaybackSession.self).where({ $0.serverConnectionConfigId == Store.serverConfig?.id }) {
|
||||
let session = session.freeze()
|
||||
group.addTask {
|
||||
try await self.updateServerSessionFromLocalSession(session)
|
||||
|
@ -164,7 +164,7 @@ class PlayerProgress {
|
|||
|
||||
private func updateLocalSessionFromServerMediaProgress() async throws {
|
||||
logger.log("updateLocalSessionFromServerMediaProgress: Checking if local media progress was updated on server")
|
||||
guard let session = try await Realm().objects(PlaybackSession.self).last(where: {
|
||||
guard let session = try Realm(queue: nil).objects(PlaybackSession.self).last(where: {
|
||||
$0.isActiveSession == true && $0.serverConnectionConfigId == Store.serverConfig?.id
|
||||
})?.freeze() else {
|
||||
logger.log("updateLocalSessionFromServerMediaProgress: Failed to get session")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue