From 6c5525ccd85040bdb57ab29bdf6f6f99512a0161 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Mon, 29 Aug 2022 23:19:03 +0800 Subject: [PATCH] Disable preloading in iOS --- .../Sources/App/Views/Home/HomeFeedViewModel.swift | 4 ++-- .../Sources/Services/AudioSession/AudioSession.swift | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift index cafd507ea..755e3e979 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewModel.swift @@ -55,7 +55,7 @@ import Views items.insert(item, at: 0) } - func loadItems(dataService: DataService, audioSession: AudioSession, isRefresh: Bool) async { + func loadItems(dataService: DataService, audioSession _: AudioSession, isRefresh: Bool) async { let syncStartTime = Date() let thisSearchIdx = searchIdx searchIdx += 1 @@ -123,7 +123,7 @@ import Views cursor = queryResult.cursor if let username = dataService.currentViewer?.username { await dataService.prefetchPages(itemIDs: newItems.map(\.unwrappedID), username: username) - await audioSession.preload(itemIDs: newItems.map(\.unwrappedID)) + // await audioSession.preload(itemIDs: newItems.map(\.unwrappedID)) } } else { updateFetchController(dataService: dataService) diff --git a/apple/OmnivoreKit/Sources/Services/AudioSession/AudioSession.swift b/apple/OmnivoreKit/Sources/Services/AudioSession/AudioSession.swift index 890e7e3f6..abf47ab3d 100644 --- a/apple/OmnivoreKit/Sources/Services/AudioSession/AudioSession.swift +++ b/apple/OmnivoreKit/Sources/Services/AudioSession/AudioSession.swift @@ -227,6 +227,7 @@ public class AudioSession: NSObject, ObservableObject, AVAudioPlayerDelegate { } } catch { print("error playing MP3 file", error) + try? FileManager.default.removeItem(atPath: audioUrl.path) state = .stopped } }