From ad5146e2ee8506c5b90bd506f53361447c6f4a75 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sun, 12 Nov 2023 13:36:23 -0600 Subject: [PATCH] Update:iOS remove unused logic of opening last active session on app launch --- components/app/AudioPlayerContainer.vue | 2 +- ios/App/App/plugins/AbsAudioPlayer.swift | 21 ++------------------- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/components/app/AudioPlayerContainer.vue b/components/app/AudioPlayerContainer.vue index f3c13535..c2f36aa1 100644 --- a/components/app/AudioPlayerContainer.vue +++ b/components/app/AudioPlayerContainer.vue @@ -273,7 +273,7 @@ export default { this.notifyOnReady() }, notifyOnReady() { - // TODO: iOS opens last active playback session on app launch. Should be consistent with Android + // TODO: was used on iOS to open last played media. May be removed if (!this.isIos) return // If settings aren't loaded yet, native player will receive incorrect settings diff --git a/ios/App/App/plugins/AbsAudioPlayer.swift b/ios/App/App/plugins/AbsAudioPlayer.swift index bec79abe..5ebe376c 100644 --- a/ios/App/App/plugins/AbsAudioPlayer.swift +++ b/ios/App/App/plugins/AbsAudioPlayer.swift @@ -31,25 +31,8 @@ public class AbsAudioPlayer: CAPPlugin { } @objc func onReady(_ call: CAPPluginCall) { - Task { await self.restorePlaybackSession() } - } - - func restorePlaybackSession() async { - do { - // Fetch the most recent active session - let activeSession = try Realm(queue: nil).objects(PlaybackSession.self).where({ - $0.isActiveSession == true && $0.serverConnectionConfigId == Store.serverConfig?.id - }).last?.freeze() - - if let activeSession = activeSession { - PlayerHandler.stopPlayback(currentSessionId: activeSession.id) - await PlayerProgress.shared.syncFromServer() - try self.startPlaybackSession(activeSession, playWhenReady: false, playbackRate: PlayerSettings.main().playbackRate) - } - } catch { - logger.error("Failed to restore playback session") - debugPrint(error) - } + // TODO: Was used to notify when Abs UI was ready so that last played media could be opened - this was buggy and removed + call.resolve() } @objc func startPlaybackSession(_ session: PlaybackSession, playWhenReady: Bool, playbackRate: Float) throws {