Fix id of Items, saving
This commit is contained in:
@@ -2,7 +2,7 @@ import Foundation
|
||||
import SwiftUI
|
||||
import Combine
|
||||
|
||||
final class Content: ObservableObject {
|
||||
final class Content: ChangeObservableItem {
|
||||
|
||||
@ObservedObject
|
||||
var storage: Storage
|
||||
@@ -47,6 +47,8 @@ final class Content: ObservableObject {
|
||||
|
||||
var errorCallback: ((StorageError) -> Void)?
|
||||
|
||||
var cancellables: Set<AnyCancellable> = []
|
||||
|
||||
/// A cache of file sizes
|
||||
private var fileSizes: [String: Int] = [:]
|
||||
|
||||
@@ -200,9 +202,9 @@ final class Content: ObservableObject {
|
||||
for file in self.files {
|
||||
guard file.type.isVideo else { continue }
|
||||
guard !file.isExternallyStored else { continue }
|
||||
guard !storage.hasVideoThumbnail(for: file.id) else { continue }
|
||||
if await imageGenerator.createVideoThumbnail(for: file.id) {
|
||||
print("Generated thumbnail for \(file.id)")
|
||||
guard !storage.hasVideoThumbnail(for: file.identifier) else { continue }
|
||||
if await imageGenerator.createVideoThumbnail(for: file.identifier) {
|
||||
print("Generated thumbnail for \(file.identifier)")
|
||||
file.didChange()
|
||||
}
|
||||
}
|
||||
@@ -229,6 +231,10 @@ final class Content: ObservableObject {
|
||||
self.lastSave = .now
|
||||
}
|
||||
|
||||
func needsSaving() {
|
||||
needsSave()
|
||||
}
|
||||
|
||||
// MARK: File sizes
|
||||
|
||||
func size(of file: String) -> Int? {
|
||||
|
Reference in New Issue
Block a user