Disable preloading in iOS

This commit is contained in:
Jackson Harper 2022-08-29 23:19:03 +08:00
parent b34e062df6
commit 6c5525ccd8
2 changed files with 3 additions and 2 deletions

View file

@ -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)

View file

@ -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
}
}