Browse Source

Livephoto Server NC 28 (#2683)

LivePhoto detect
---------

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 1 năm trước cách đây
mục cha
commit
1b9713452e

+ 1 - 1
Brand/Database.swift

@@ -26,4 +26,4 @@ import Foundation
 // Database Realm
 //
 let databaseName                    = "nextcloud.realm"
-let databaseSchemaVersion: UInt64   = 324
+let databaseSchemaVersion: UInt64   = 330

+ 1 - 1
Share/NCShareExtension+DataSource.swift

@@ -94,7 +94,7 @@ extension NCShareExtension: UICollectionViewDataSource {
         cell.selectMode(false)
 
         // Live Photo
-        if metadata.livePhoto {
+        if metadata.isLivePhoto {
             cell.imageStatus.image = NCImageCache.images.livePhoto
         }
 

+ 0 - 1
Share/NCShareExtension+Files.swift

@@ -45,7 +45,6 @@ extension NCShareExtension {
             ascending: layoutForView?.ascending,
             directoryOnTop: layoutForView?.directoryOnTop,
             favoriteOnTop: true,
-            filterLivePhoto: true,
             groupByField: groupByField)
 
         if withLoadFolder {

+ 10 - 10
Widget/Widget.swift

@@ -47,7 +47,7 @@ struct DashboardWidget: Widget {
         .supportedFamilies([.systemLarge])
         .configurationDisplayName("Dashboard")
         .description(NSLocalizedString("_description_dashboardwidget_", comment: ""))
-//        .contentMarginsDisabled()
+        .contentMarginsDisabled()
     }
 }
 
@@ -61,7 +61,7 @@ struct FilesWidget: Widget {
         .supportedFamilies([.systemLarge])
         .configurationDisplayName("Files")
         .description(NSLocalizedString("_description_fileswidget_", comment: ""))
-//        .contentMarginsDisabled()
+        .contentMarginsDisabled()
     }
 }
 
@@ -75,7 +75,7 @@ struct ToolbarWidget: Widget {
         .supportedFamilies([.systemMedium])
         .configurationDisplayName("Toolbar")
         .description(NSLocalizedString("_description_toolbarwidget_", comment: ""))
-//        .contentMarginsDisabled()
+        .contentMarginsDisabled()
     }
 }
 
@@ -90,7 +90,7 @@ struct LockscreenWidget: Widget {
             .supportedFamilies([.accessoryRectangular, .accessoryCircular])
             .configurationDisplayName(NSLocalizedString("_title_lockscreenwidget_", comment: ""))
             .description(NSLocalizedString("_description_lockscreenwidget_", comment: ""))
-//            .contentMarginsDisabled()
+            .contentMarginsDisabled()
         } else {
             return EmptyWidgetConfiguration()
         }
@@ -99,12 +99,12 @@ struct LockscreenWidget: Widget {
 
 extension View {
     func widgetBackground(_ backgroundView: some View) -> some View {
-//        if #available(iOSApplicationExtension 17.0, *) {
-//            return containerBackground(for: .widget) {
-//                backgroundView
-//            }
-//        } else {
+        if #available(iOSApplicationExtension 17.0, *) {
+            return containerBackground(for: .widget) {
+                backgroundView
+            }
+        } else {
             return background(backgroundView)
-//        }
+        }
     }
 }

+ 3 - 0
iOSClient/AppDelegate.swift

@@ -285,6 +285,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
         NCNetworking.shared.cancelDownloadTasks()
         presentPasscode { }
 
+        //TODO: TESTTTT
+        //NCNetworking.shared.convertLivePhoto()
+
         NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterApplicationDidEnterBackground)
     }
 

+ 5 - 16
iOSClient/Data/NCDataSource.swift

@@ -40,13 +40,12 @@ class NCDataSource: NSObject {
     private var sort: String = ""
     private var directoryOnTop: Bool = true
     private var favoriteOnTop: Bool = true
-    private var filterLivePhoto: Bool = true
 
     override init() {
         super.init()
     }
 
-    init(metadatas: [tableMetadata], account: String, directory: tableDirectory? = nil, sort: String? = "none", ascending: Bool? = false, directoryOnTop: Bool? = true, favoriteOnTop: Bool? = true, filterLivePhoto: Bool? = true, groupByField: String = "name", providers: [NKSearchProvider]? = nil, searchResults: [NKSearchResult]? = nil) {
+    init(metadatas: [tableMetadata], account: String, directory: tableDirectory? = nil, sort: String? = "none", ascending: Bool? = false, directoryOnTop: Bool? = true, favoriteOnTop: Bool? = true, groupByField: String = "name", providers: [NKSearchProvider]? = nil, searchResults: [NKSearchResult]? = nil) {
         super.init()
 
         self.metadatas = metadatas.filter({
@@ -57,7 +56,6 @@ class NCDataSource: NSObject {
         self.ascending = ascending ?? false
         self.directoryOnTop = directoryOnTop ?? true
         self.favoriteOnTop = favoriteOnTop ?? true
-        self.filterLivePhoto = filterLivePhoto ?? true
         self.groupByField = groupByField
         // unified search
         self.providers = providers
@@ -110,10 +108,7 @@ class NCDataSource: NSObject {
         // get all Section
         for metadata in self.metadatas {
             // skipped livePhoto VIDEO part
-            if filterLivePhoto && metadata.livePhoto && metadata.classFile == NKCommon.TypeClassFile.video.rawValue {
-                if let metadataImage = self.metadatas.filter({ $0.fileNoExtension == metadata.fileNoExtension && $0.classFile == NKCommon.TypeClassFile.image.rawValue }).first {
-                    NCLivePhoto().setLivePhoto(metadata1: metadataImage, metadata2: metadata)
-                }
+            if metadata.isLivePhoto && metadata.classFile == NKCommon.TypeClassFile.video.rawValue {
                 continue
             }
             let section = NSLocalizedString(self.getSectionValue(metadata: metadata), comment: "")
@@ -179,8 +174,7 @@ class NCDataSource: NSObject {
                                                       sort: self.sort,
                                                       ascending: self.ascending,
                                                       directoryOnTop: self.directoryOnTop,
-                                                      favoriteOnTop: self.favoriteOnTop,
-                                                      filterLivePhoto: self.filterLivePhoto)
+                                                      favoriteOnTop: self.favoriteOnTop)
         metadatasForSection.append(metadataForSection)
     }
 
@@ -347,7 +341,6 @@ class NCMetadataForSection: NSObject {
     private var ascending: Bool
     private var directoryOnTop: Bool
     private var favoriteOnTop: Bool
-    private var filterLivePhoto: Bool
 
     private var metadatasSorted: [tableMetadata] = []
     private var metadatasFavoriteDirectory: [tableMetadata] = []
@@ -359,7 +352,7 @@ class NCMetadataForSection: NSObject {
     public var numFile: Int = 0
     public var totalSize: Int64 = 0
 
-    init(sectionValue: String, metadatas: [tableMetadata], lastSearchResult: NKSearchResult?, sort: String, ascending: Bool, directoryOnTop: Bool, favoriteOnTop: Bool, filterLivePhoto: Bool) {
+    init(sectionValue: String, metadatas: [tableMetadata], lastSearchResult: NKSearchResult?, sort: String, ascending: Bool, directoryOnTop: Bool, favoriteOnTop: Bool) {
 
         self.sectionValue = sectionValue
         self.metadatas = metadatas
@@ -368,7 +361,6 @@ class NCMetadataForSection: NSObject {
         self.ascending = ascending
         self.directoryOnTop = directoryOnTop
         self.favoriteOnTop = favoriteOnTop
-        self.filterLivePhoto = filterLivePhoto
 
         super.init()
 
@@ -432,10 +424,7 @@ class NCMetadataForSection: NSObject {
             }
 
             // skipped livePhoto
-            if filterLivePhoto && metadata.livePhoto && metadata.classFile == NKCommon.TypeClassFile.video.rawValue {
-                if let metadataImage = self.metadatas.filter({ $0.fileNoExtension == metadata.fileNoExtension && $0.classFile == NKCommon.TypeClassFile.image.rawValue }).first {
-                    NCLivePhoto().setLivePhoto(metadata1: metadataImage, metadata2: metadata)
-                }
+            if metadata.isLivePhoto && metadata.classFile == NKCommon.TypeClassFile.video.rawValue {
                 continue
             }
 

+ 47 - 105
iOSClient/Data/NCManageDatabase+Metadata.swift

@@ -61,8 +61,8 @@ class tableMetadata: Object, NCUserBaseUrl {
     @objc dynamic var iconName = ""
     @objc dynamic var iconUrl = ""
     @objc dynamic var isExtractFile: Bool = false
-    @objc dynamic var livePhoto: Bool = false
     @objc dynamic var livePhotoFile = ""
+    @objc dynamic var livePhotoServer: Bool = false
     @objc dynamic var mountType = ""
     @objc dynamic var name = ""                                             // for unifiedSearch is the provider.id
     @objc dynamic var note = ""
@@ -249,6 +249,10 @@ extension tableMetadata {
         NCUtilityFileSystem().isDirectoryE2EETop(account: account, serverUrl: serverUrl)
     }
 
+    var isLivePhoto: Bool {
+        !livePhotoFile.isEmpty
+    }
+
     /// Returns false if the user is lokced out of the file. I.e. The file is locked but by somone else
     func canUnlock(as user: String) -> Bool {
         return !lock || (lockOwner == user && lockOwnerType == 0)
@@ -342,9 +346,7 @@ extension NCManageDatabase {
         metadata.height = file.height
         metadata.width = file.width
         metadata.livePhotoFile = file.livePhotoFile
-        if !metadata.livePhotoFile.isEmpty {
-            metadata.livePhoto = true
-        }
+        metadata.livePhotoServer = file.livePhotoServer
 
         // E2EE find the fileName for fileNameView
         if isDirectoryE2EE || file.e2eEncrypted {
@@ -393,30 +395,10 @@ extension NCManageDatabase {
             counter += 1
         }
 
-        //
-        // Detect Live photo
-        //
-        var metadataOutput: [tableMetadata] = []
-        metadatas = metadatas.sorted(by: {$0.fileNameView < $1.fileNameView})
-
-        for index in metadatas.indices {
-            let metadata = metadatas[index]
-            if index < metadatas.count - 1,
-                metadata.fileNoExtension == metadatas[index + 1].fileNoExtension,
-                ((metadata.classFile == NKCommon.TypeClassFile.image.rawValue && metadatas[index + 1].classFile == NKCommon.TypeClassFile.video.rawValue) || (metadata.classFile == NKCommon.TypeClassFile.video.rawValue && metadatas[index + 1].classFile == NKCommon.TypeClassFile.image.rawValue)) {
-                metadata.livePhoto = true
-                metadatas[index + 1].livePhoto = true
-                let metadata1 = metadata
-                let metadata2 = metadatas[index + 1]
-                NCLivePhoto().setLivePhoto(metadata1: metadata1, metadata2: metadata2)
-            }
-            metadataOutput.append(metadata)
-        }
-
-        completion(metadataFolder, metadataFolders, metadataOutput)
+        completion(metadataFolder, metadataFolders, metadatas)
     }
 
-    func createMetadata(account: String, user: String, userId: String, fileName: String, fileNameView: String, ocId: String, serverUrl: String, urlBase: String, url: String, contentType: String, isLivePhoto: Bool = false, isUrl: Bool = false, name: String = NCGlobal.shared.appName, subline: String? = nil, iconName: String? = nil, iconUrl: String? = nil) -> tableMetadata {
+    func createMetadata(account: String, user: String, userId: String, fileName: String, fileNameView: String, ocId: String, serverUrl: String, urlBase: String, url: String, contentType: String, isUrl: Bool = false, name: String = NCGlobal.shared.appName, subline: String? = nil, iconName: String? = nil, iconUrl: String? = nil) -> tableMetadata {
 
         let metadata = tableMetadata()
         if isUrl {
@@ -451,7 +433,6 @@ extension NCManageDatabase {
         metadata.etag = ocId
         metadata.fileName = fileName
         metadata.fileNameView = fileName
-        metadata.livePhoto = isLivePhoto
         metadata.name = name
         metadata.ocId = ocId
         metadata.permissions = "RGDNVW"
@@ -546,7 +527,7 @@ extension NCManageDatabase {
     }
 
     @discardableResult
-    func updateMetadatas(_ metadatas: [tableMetadata], metadatasResult: [tableMetadata], addCompareLivePhoto: Bool = true, addExistsInLocal: Bool = false, addCompareEtagLocal: Bool = false) -> (metadatasUpdate: [tableMetadata], metadatasLocalUpdate: [tableMetadata], metadatasDelete: [tableMetadata]) {
+    func updateMetadatas(_ metadatas: [tableMetadata], metadatasResult: [tableMetadata], addExistsInLocal: Bool = false, addCompareEtagLocal: Bool = false) -> (metadatasUpdate: [tableMetadata], metadatasLocalUpdate: [tableMetadata], metadatasDelete: [tableMetadata]) {
 
         var ocIdsUdate: [String] = []
         var ocIdsLocalUdate: [String] = []
@@ -590,7 +571,7 @@ extension NCManageDatabase {
                              result.tags != metadata.tags) {
                             ocIdsUdate.append(metadata.ocId)
                             realm.add(tableMetadata.init(value: metadata), update: .all)
-                        } else if result.status == NCGlobal.shared.metadataStatusNormal && addCompareLivePhoto && result.livePhoto != metadata.livePhoto {
+                        } else if result.status == NCGlobal.shared.metadataStatusNormal {
                             ocIdsUdate.append(metadata.ocId)
                             realm.add(tableMetadata.init(value: metadata), update: .all)
                         }
@@ -734,6 +715,19 @@ extension NCManageDatabase {
         }
     }
 
+    func setMetadataLivePhotoServer(account: String, ocId: String) {
+
+        do {
+            let realm = try Realm()
+            try realm.write {
+                let result = realm.objects(tableMetadata.self).filter("account == %@ AND ocId == %@", account, ocId).first
+                result?.livePhotoServer = true
+            }
+        } catch let error {
+            NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)")
+        }
+    }
+
     func updateMetadatasFavorite(account: String, metadatas: [tableMetadata]) {
 
         do {
@@ -820,6 +814,18 @@ extension NCManageDatabase {
         return []
     }
 
+    func getResultsMetadatas(predicate: NSPredicate) -> Results<tableMetadata>? {
+
+        do {
+            let realm = try Realm()
+            return realm.objects(tableMetadata.self).filter(predicate)
+        } catch let error as NSError {
+            NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)")
+        }
+
+        return nil
+    }
+
     func getAdvancedMetadatas(predicate: NSPredicate, page: Int = 0, limit: Int = 0, sorted: String, ascending: Bool) -> [tableMetadata] {
 
         var metadatas: [tableMetadata] = []
@@ -992,7 +998,6 @@ extension NCManageDatabase {
 
         do {
             let realm = try Realm()
-            realm.refresh()
             let results = realm.objects(tableMetadata.self).filter("account == %@ AND assetLocalIdentifier != '' AND deleteAssetLocalIdentifier == true", account)
             for result in results {
                 assetLocalIdentifiers.append(result.assetLocalIdentifier)
@@ -1008,7 +1013,6 @@ extension NCManageDatabase {
 
         do {
             let realm = try Realm()
-            realm.refresh()
             try realm.write {
                 let results = realm.objects(tableMetadata.self).filter("account == %@ AND assetLocalIdentifier IN %@", account, assetLocalIdentifiers)
                 for result in results {
@@ -1021,95 +1025,33 @@ extension NCManageDatabase {
         }
     }
 
-    func isMetadataLivePhoto(metadata: tableMetadata) -> tableMetadata? {
-
-        guard metadata.livePhoto, NCKeychain().livePhoto, metadata.livePhotoFile.isEmpty else { return nil }
-
-        return getMetadataLivePhoto(metadata: metadata)
-    }
-
     func getMetadataLivePhoto(metadata: tableMetadata) -> tableMetadata? {
 
-        guard metadata.livePhoto, NCKeychain().livePhoto else { return nil }
-        var classFile = metadata.classFile
-        var fileName = (metadata.fileNameView as NSString).deletingPathExtension
-
-        if !metadata.livePhotoFile.isEmpty {
-
-            do {
-                let realm = try Realm()
-                realm.refresh()
-                guard let result = realm.objects(tableMetadata.self).filter(NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView == %@", metadata.account, metadata.serverUrl, metadata.livePhotoFile)).first else { return nil }
-                return tableMetadata.init(value: result)
-            } catch let error as NSError {
-                NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)")
-            }
-
-        } else {
+        guard metadata.isLivePhoto else { return nil }
 
-            if classFile == NKCommon.TypeClassFile.image.rawValue {
-                classFile = NKCommon.TypeClassFile.video.rawValue
-                fileName = fileName + ".mov"
-            } else {
-                classFile = NKCommon.TypeClassFile.image.rawValue
-                fileName = fileName + ".jpg"
-            }
-
-            do {
-                let realm = try Realm()
-                realm.refresh()
-                guard let result = realm.objects(tableMetadata.self).filter(NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView CONTAINS[cd] %@ AND ocId != %@ AND classFile == %@", metadata.account, metadata.serverUrl, fileName, metadata.ocId, classFile)).first else { return nil }
-                return tableMetadata.init(value: result)
-            } catch let error as NSError {
-                NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)")
-            }
+        do {
+            let realm = try Realm()
+            guard let result = realm.objects(tableMetadata.self).filter(NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileName == %@", metadata.account, metadata.serverUrl, metadata.livePhotoFile)).first else { return nil }
+            return tableMetadata.init(value: result)
+        } catch let error as NSError {
+            NextcloudKit.shared.nkCommonInstance.writeLog("Could not access database: \(error)")
         }
 
         return nil
     }
 
-    func getMetadatasMedia(predicate: NSPredicate, livePhoto: Bool) -> [tableMetadata] {
-
-        var metadatas: [tableMetadata] = []
+    func getMetadatasMedia(predicate: NSPredicate) -> [tableMetadata] {
 
         do {
             let realm = try Realm()
-            realm.refresh()
-            try realm.write {
-                let sortProperties = [SortDescriptor(keyPath: "serverUrl", ascending: false), SortDescriptor(keyPath: "fileNameView", ascending: false)]
-                let results = realm.objects(tableMetadata.self).filter(predicate).sorted(by: sortProperties)
-                if livePhoto {
-                    for index in results.indices {
-                        let metadata = results[index]
-                        if index < results.count - 1, metadata.fileNoExtension == results[index + 1].fileNoExtension {
-                            if !metadata.livePhoto {
-                                metadata.livePhoto = true
-                            }
-                            if !results[index + 1].livePhoto {
-                                results[index + 1].livePhoto = true
-                            }
-                            let metadata1 = tableMetadata(value: results[index + 1])
-                            let metadata2 = tableMetadata(value: results[index])
-                            NCLivePhoto().setLivePhoto(metadata1: metadata1, metadata2: metadata2)
-                        }
-                        if metadata.livePhoto {
-                            if metadata.classFile == NKCommon.TypeClassFile.image.rawValue {
-                                metadatas.append(tableMetadata.init(value: metadata))
-                            }
-                            continue
-                        } else {
-                            metadatas.append(tableMetadata.init(value: metadata))
-                        }
-                    }
-                } else {
-                    metadatas = Array(results.map { tableMetadata.init(value: $0) })
-                }
-            }
+            let sortProperties = [SortDescriptor(keyPath: "serverUrl", ascending: false), SortDescriptor(keyPath: "fileName", ascending: false)]
+            let results = realm.objects(tableMetadata.self).filter(predicate).sorted(by: sortProperties)
+            return Array(results.map { tableMetadata.init(value: $0) })
         } catch let error {
             NextcloudKit.shared.nkCommonInstance.writeLog("Could not write to database: \(error)")
         }
 
-        return metadatas
+        return []
     }
 
     func isMetadataShareOrMounted(metadata: tableMetadata, metadataFolder: tableMetadata?) -> Bool {

+ 1 - 1
iOSClient/Data/NCManageDatabase+Video.swift

@@ -48,7 +48,7 @@ extension NCManageDatabase {
 
     func addVideo(metadata: tableMetadata, position: Float? = nil, width: Int? = nil, height: Int? = nil, length: Int? = nil, currentAudioTrackIndex: Int? = nil, currentVideoSubTitleIndex: Int? = nil) {
 
-        if metadata.livePhoto { return }
+        if metadata.isLivePhoto { return }
 
         do {
             let realm = try Realm()

+ 7 - 3
iOSClient/Data/NCManageDatabase.swift

@@ -110,8 +110,6 @@ class NCManageDatabase: NSObject {
                             migration.deleteData(forType: tableActivityLatestId.className())
                             migration.deleteData(forType: tableActivityPreview.className())
                             migration.deleteData(forType: tableActivitySubjectRich.className())
-                            migration.deleteData(forType: tableDirectory.className())
-                            migration.deleteData(forType: tableMetadata.className())
                         }
 
                         if oldSchemaVersion < 292 {
@@ -120,12 +118,18 @@ class NCManageDatabase: NSObject {
 
                         if oldSchemaVersion < 319 {
                             migration.deleteData(forType: tableChunk.className())
-                            migration.deleteData(forType: tableMetadata.className())
                             migration.deleteData(forType: tableDirectory.className())
                             migration.deleteData(forType: tableE2eEncryptionLock.className())
                             migration.deleteData(forType: tableGPS.className())
                         }
 
+                        if oldSchemaVersion < 330 {
+                            migration.deleteData(forType: tableMetadata.className())
+                            migration.enumerateObjects(ofType: tableDirectory.className()) { _, newObject in
+                                newObject?["etag"] = ""
+                            }
+                        }
+
                     }, shouldCompactOnLaunch: { totalBytes, usedBytes in
 
                         // totalBytes refers to the size of the file on disk in bytes (data + free space)

+ 0 - 1
iOSClient/Favorites/NCFavorite.swift

@@ -65,7 +65,6 @@ class NCFavorite: NCCollectionViewCommon {
                                        ascending: self.layoutForView?.ascending,
                                        directoryOnTop: self.layoutForView?.directoryOnTop,
                                        favoriteOnTop: true,
-                                       filterLivePhoto: true,
                                        groupByField: self.groupByField,
                                        providers: self.providers,
                                        searchResults: self.searchResults)

+ 0 - 1
iOSClient/Files/NCFiles.swift

@@ -123,7 +123,6 @@ class NCFiles: NCCollectionViewCommon {
             ascending: self.layoutForView?.ascending,
             directoryOnTop: self.layoutForView?.directoryOnTop,
             favoriteOnTop: true,
-            filterLivePhoto: true,
             groupByField: self.groupByField,
             providers: self.providers,
             searchResults: self.searchResults)

+ 0 - 1
iOSClient/Groupfolders/NCGroupfolders.swift

@@ -66,7 +66,6 @@ class NCGroupfolders: NCCollectionViewCommon {
             ascending: self.layoutForView?.ascending,
             directoryOnTop: self.layoutForView?.directoryOnTop,
             favoriteOnTop: true,
-            filterLivePhoto: true,
             groupByField: self.groupByField,
             providers: self.providers,
             searchResults: self.searchResults)

+ 1 - 3
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -935,7 +935,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
                     ascending: self.layoutForView?.ascending,
                     directoryOnTop: self.layoutForView?.directoryOnTop,
                     favoriteOnTop: true,
-                    filterLivePhoto: true,
                     providers: self.providers,
                     searchResults: self.searchResults)
             } update: { _, _, searchResult, metadatas in
@@ -960,7 +959,6 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
                     ascending: self.layoutForView?.ascending,
                     directoryOnTop: self.layoutForView?.directoryOnTop,
                     favoriteOnTop: true,
-                    filterLivePhoto: true,
                     groupByField: self.groupByField,
                     providers: self.providers,
                     searchResults: self.searchResults)
@@ -1449,7 +1447,7 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
         }
 
         // Live Photo
-        if metadata.livePhoto {
+        if metadata.isLivePhoto {
             cell.fileStatusImage?.image = NCImageCache.images.livePhoto
             a11yValues.append(NSLocalizedString("_upload_mov_livephoto_", comment: ""))
         }

+ 4 - 1
iOSClient/Main/Create cloud/NCUploadAssets.swift

@@ -257,8 +257,11 @@ struct UploadAssetsView: View {
             let isRecordInSessions = NCManageDatabase.shared.getAdvancedMetadatas(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileName == %@ AND session != ''", uploadAssets.userBaseUrl.account, serverUrl, fileName), sorted: "fileName", ascending: false)
             if !isRecordInSessions.isEmpty { continue }
 
-            let metadata = NCManageDatabase.shared.createMetadata(account: uploadAssets.userBaseUrl.account, user: uploadAssets.userBaseUrl.user, userId: uploadAssets.userBaseUrl.userId, fileName: fileName, fileNameView: fileName, ocId: NSUUID().uuidString, serverUrl: serverUrl, urlBase: uploadAssets.userBaseUrl.urlBase, url: "", contentType: "", isLivePhoto: livePhoto)
+            let metadata = NCManageDatabase.shared.createMetadata(account: uploadAssets.userBaseUrl.account, user: uploadAssets.userBaseUrl.user, userId: uploadAssets.userBaseUrl.userId, fileName: fileName, fileNameView: fileName, ocId: NSUUID().uuidString, serverUrl: serverUrl, urlBase: uploadAssets.userBaseUrl.urlBase, url: "", contentType: "")
 
+            if livePhoto {
+                metadata.livePhotoFile = (metadata.fileName as NSString).deletingPathExtension + ".mov"
+            }
             metadata.assetLocalIdentifier = asset.localIdentifier
             metadata.session = NCNetworking.shared.sessionIdentifierBackground
             metadata.sessionSelector = NCGlobal.shared.selectorUploadFile

+ 4 - 4
iOSClient/Media/NCMedia.swift

@@ -405,7 +405,7 @@ extension NCMedia: UICollectionViewDataSource {
 
             if metadata.isAudioOrVideo {
                 cell.imageStatus.image = cacheImages.cellPlayImage
-            } else if metadata.livePhoto && NCImageCache.shared.isLivePhotoEnable {
+            } else if metadata.isLivePhoto {
                 cell.imageStatus.image = cacheImages.cellLivePhotoImage
             } else {
                 cell.imageStatus.image = nil
@@ -447,7 +447,7 @@ extension NCMedia {
     func getPredicate(_ predicatedefault: Bool = false) -> NSPredicate {
 
         let startServerUrl = NCUtilityFileSystem().getHomeServer(urlBase: appDelegate.urlBase, userId: appDelegate.userId) + mediaPath
-        let showAll = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND (classFile == %@ OR classFile == %@) AND NOT (session CONTAINS[c] 'upload')", appDelegate.account, startServerUrl, NKCommon.TypeClassFile.image.rawValue, NKCommon.TypeClassFile.video.rawValue)
+        let showAll = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND (classFile == %@ OR classFile == %@) AND NOT (session CONTAINS[c] 'upload') AND NOT(livePhotoFile != '' AND classFile == %@)", appDelegate.account, startServerUrl, NKCommon.TypeClassFile.image.rawValue, NKCommon.TypeClassFile.video.rawValue, NKCommon.TypeClassFile.video.rawValue)
 
         if predicatedefault { return showAll }
         if showOnlyImages {
@@ -533,7 +533,7 @@ extension NCMedia {
                         let predicateDate = NSPredicate(format: "date > %@ AND date < %@", greaterDate as NSDate, lessDate as NSDate)
                         let predicateResult = NSCompoundPredicate(andPredicateWithSubpredicates: [predicateDate, self.getPredicate(true)])
                         let metadatasResult = NCManageDatabase.shared.getMetadatas(predicate: predicateResult)
-                        let metadatasChanged = NCManageDatabase.shared.updateMetadatas(metadatas, metadatasResult: metadatasResult, addCompareLivePhoto: false)
+                        let metadatasChanged = NCManageDatabase.shared.updateMetadatas(metadatas, metadatasResult: metadatasResult)
                         if metadatasChanged.metadatasUpdate.isEmpty {
                             self.researchOldMedia(value: value, limit: limit, withElseReloadDataSource: true)
                         } else {
@@ -614,7 +614,7 @@ extension NCMedia {
                         let predicate = NSPredicate(format: "date > %@ AND date < %@", greaterDate as NSDate, lessDate as NSDate)
                         let predicateResult = NSCompoundPredicate(andPredicateWithSubpredicates: [predicate, self.getPredicate(true)])
                         let metadatasResult = NCManageDatabase.shared.getMetadatas(predicate: predicateResult)
-                        let updateMetadatas = NCManageDatabase.shared.updateMetadatas(metadatas, metadatasResult: metadatasResult, addCompareLivePhoto: false)
+                        let updateMetadatas = NCManageDatabase.shared.updateMetadatas(metadatas, metadatasResult: metadatasResult)
                         if !updateMetadatas.metadatasUpdate.isEmpty || !updateMetadatas.metadatasDelete.isEmpty {
                             self.reloadDataSourceWithCompletion { _ in }
                         }

+ 2 - 8
iOSClient/NCImageCache.swift

@@ -48,10 +48,6 @@ import NextcloudKit
     }()
     private var ocIdEtag: [String: String] = [:]
     private var metadatas: [tableMetadata]?
-    private var livePhoto: Bool = false
-    var isLivePhotoEnable: Bool {
-        return livePhoto
-    }
 
     override private init() {}
 
@@ -147,11 +143,9 @@ import NextcloudKit
         guard let account = NCManageDatabase.shared.getAccount(predicate: NSPredicate(format: "account == %@", account)) else { return [] }
         let startServerUrl = NCUtilityFileSystem().getHomeServer(urlBase: account.urlBase, userId: account.userId) + account.mediaPath
 
-        let predicateDefault = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND (classFile == %@ OR classFile == %@) AND NOT (session CONTAINS[c] 'upload')", account.account, startServerUrl, NKCommon.TypeClassFile.image.rawValue, NKCommon.TypeClassFile.video.rawValue)
-
-        livePhoto = NCKeychain().livePhoto
+        let predicateDefault = NSPredicate(format: "account == %@ AND serverUrl BEGINSWITH %@ AND (classFile == %@ OR classFile == %@) AND NOT (session CONTAINS[c] 'upload') AND NOT(livePhotoFile != '' AND classFile == %@)", account.account, startServerUrl, NKCommon.TypeClassFile.image.rawValue, NKCommon.TypeClassFile.video.rawValue, NKCommon.TypeClassFile.video.rawValue)
 
-        var metadatas = NCManageDatabase.shared.getMetadatasMedia(predicate: predicate ?? predicateDefault, livePhoto: livePhoto)
+        var metadatas = NCManageDatabase.shared.getMetadatasMedia(predicate: predicate ?? predicateDefault)
 
         switch NCKeychain().mediaSortDate {
         case "date":

+ 6 - 3
iOSClient/Networking/NCAutoUpload.swift

@@ -103,7 +103,7 @@ class NCAutoUpload: NSObject {
 
             for asset in assets {
 
-                var livePhoto = false
+                var isLivePhoto = false
                 var session: String = ""
                 let dateFormatter = DateFormatter()
                 let assetDate = asset.creationDate ?? Date()
@@ -118,7 +118,7 @@ class NCAutoUpload: NSObject {
                 let fileName = CCUtility.createFileName(asset.originalFilename as String, fileDate: assetDate, fileType: assetMediaType, keyFileName: NCGlobal.shared.keyFileNameAutoUploadMask, keyFileNameType: NCGlobal.shared.keyFileNameAutoUploadType, keyFileNameOriginal: NCGlobal.shared.keyFileNameOriginalAutoUpload, forcedNewFileName: false)!
 
                 if asset.mediaSubtypes.contains(.photoLive), NCKeychain().livePhoto {
-                    livePhoto = true
+                    isLivePhoto = true
                 }
 
                 if selector == NCGlobal.shared.selectorUploadAutoUploadAll {
@@ -160,7 +160,10 @@ class NCAutoUpload: NSObject {
                         NCManageDatabase.shared.addPhotoLibrary([asset], account: account.account)
                     }
                 } else {
-                    let metadata = NCManageDatabase.shared.createMetadata(account: account.account, user: account.user, userId: account.userId, fileName: fileName, fileNameView: fileName, ocId: NSUUID().uuidString, serverUrl: serverUrl, urlBase: account.urlBase, url: "", contentType: "", isLivePhoto: livePhoto)
+                    let metadata = NCManageDatabase.shared.createMetadata(account: account.account, user: account.user, userId: account.userId, fileName: fileName, fileNameView: fileName, ocId: NSUUID().uuidString, serverUrl: serverUrl, urlBase: account.urlBase, url: "", contentType: "")
+                    if isLivePhoto {
+                        metadata.livePhotoFile = (metadata.fileName as NSString).deletingPathExtension + ".mov"
+                    }
                     metadata.assetLocalIdentifier = asset.localIdentifier
                     metadata.session = session
                     metadata.sessionSelector = selector

+ 49 - 7
iOSClient/Networking/NCNetworking.swift

@@ -691,7 +691,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
                 utilityFileSystem.removeFile(atPath: utilityFileSystem.getDirectoryProviderStorageOcId(ocIdTemp))
             }
 
-            NCLivePhoto().setLivephotoUpload(metadata: metadata)
+            uploadLivePhoto(metadata: metadata)
 
             NextcloudKit.shared.nkCommonInstance.writeLog("[SUCCESS] Upload complete " + serverUrl + "/" + fileName + ", result: success(\(size) bytes)")
             NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": error])
@@ -790,6 +790,48 @@ class NCNetworking: NSObject, NKCommonDelegate {
         })
     }
 
+    // MARK: - Live Photo
+
+    func uploadLivePhoto(metadata: tableMetadata) {
+
+        guard NCGlobal.shared.capabilityServerVersionMajor >= NCGlobal.shared.nextcloudVersion28,
+              metadata.isLivePhoto,
+              let metadata1 = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND urlBase == %@ AND path == %@ AND fileName == %@ AND status == %d", metadata.account, metadata.urlBase, metadata.path, metadata.livePhotoFile, NCGlobal.shared.metadataStatusNormal)) else {
+            return
+        }
+
+        let serverUrlfileNamePath = metadata.urlBase + metadata.path + metadata.livePhotoFile
+        let serverUrlfileNamePath1 = metadata1.urlBase + metadata1.path + metadata1.livePhotoFile
+
+        Task {
+            let results = await NextcloudKit.shared.setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath, livePhotoFile: metadata1.livePhotoFile)
+            print("Send LivePhoto metadata error \(results.error.errorCode)")
+
+            let results1 = await NextcloudKit.shared.setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath1, livePhotoFile: metadata.livePhotoFile)
+            print("Send LivePhoto metadata1 error \(results1.error.errorCode)")
+        }
+    }
+
+    func convertLivePhoto() {
+
+        guard NCGlobal.shared.capabilityServerVersionMajor >= NCGlobal.shared.nextcloudVersion28 else { return }
+
+        if let results = NCManageDatabase.shared.getResultsMetadatas(predicate: NSPredicate(format: "livePhotoServer == false AND livePhotoFile != ''")) {
+            var index: Int = 0
+            for result in results {
+                index += 1
+                let serverUrlfileNamePath = result.urlBase + result.path + result.fileName
+                NextcloudKit.shared.setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath, livePhotoFile: result.livePhotoFile) { _, error in
+                    if error == .success {
+                        NCManageDatabase.shared.setMetadataLivePhotoServer(account: result.account, ocId: result.ocId)
+                    }
+                }
+                if index >= 20 { break }
+            }
+        }
+
+    }
+
     // MARK: - Cancel (Download Upload)
 
     // sessionIdentifierDownload: String = "com.nextcloud.nextcloudkit.session.download"
@@ -1400,7 +1442,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
 
         if metadata.isDirectoryE2EE {
 #if !EXTENSION
-            if let metadataLive = NCManageDatabase.shared.isMetadataLivePhoto(metadata: metadata) {
+            if let metadataLive = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) {
                 let error = await NCNetworkingE2EEDelete().delete(metadata: metadataLive)
                 if error == .success {
                     return await NCNetworkingE2EEDelete().delete(metadata: metadata)
@@ -1414,7 +1456,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
             return NKError()
 #endif
         } else {
-            if let metadataLive = NCManageDatabase.shared.isMetadataLivePhoto(metadata: metadata) {
+            if let metadataLive = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) {
                 let error = await deleteMetadataPlain(metadataLive)
                 if error == .success {
                     return await deleteMetadataPlain(metadata)
@@ -1472,7 +1514,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
 
     func favoriteMetadata(_ metadata: tableMetadata, completion: @escaping (_ error: NKError) -> Void) {
 
-        if let metadataLive = NCManageDatabase.shared.isMetadataLivePhoto(metadata: metadata) {
+        if let metadataLive = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) {
             favoriteMetadataPlain(metadataLive) { error in
                 if error == .success {
                     self.favoriteMetadataPlain(metadata, completion: completion)
@@ -1526,7 +1568,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
 
     func renameMetadata(_ metadata: tableMetadata, fileNameNew: String, indexPath: IndexPath, viewController: UIViewController?, completion: @escaping (_ error: NKError) -> Void) {
 
-        let metadataLive = NCManageDatabase.shared.isMetadataLivePhoto(metadata: metadata)
+        let metadataLive = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata)
         let fileNameNew = fileNameNew.trimmingCharacters(in: .whitespacesAndNewlines)
         let fileNameNewLive = (fileNameNew as NSString).deletingPathExtension + ".mov"
 
@@ -1633,7 +1675,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
 
     func moveMetadata(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool) async -> NKError {
 
-        if let metadataLive = NCManageDatabase.shared.isMetadataLivePhoto(metadata: metadata) {
+        if let metadataLive = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) {
             let error = await moveMetadataPlain(metadataLive, serverUrlTo: serverUrlTo, overwrite: overwrite)
             if error == .success {
                 return await moveMetadataPlain(metadata, serverUrlTo: serverUrlTo, overwrite: overwrite)
@@ -1669,7 +1711,7 @@ class NCNetworking: NSObject, NKCommonDelegate {
 
     func copyMetadata(_ metadata: tableMetadata, serverUrlTo: String, overwrite: Bool) async -> NKError {
 
-        if let metadataLive = NCManageDatabase.shared.isMetadataLivePhoto(metadata: metadata) {
+        if let metadataLive = NCManageDatabase.shared.getMetadataLivePhoto(metadata: metadata) {
             let error = await copyMetadataPlain(metadataLive, serverUrlTo: serverUrlTo, overwrite: overwrite)
             if error == .success {
                 return await copyMetadataPlain(metadata, serverUrlTo: serverUrlTo, overwrite: overwrite)

+ 0 - 1
iOSClient/Offline/NCOffline.swift

@@ -76,7 +76,6 @@ class NCOffline: NCCollectionViewCommon {
             ascending: self.layoutForView?.ascending,
             directoryOnTop: self.layoutForView?.directoryOnTop,
             favoriteOnTop: true,
-            filterLivePhoto: true,
             groupByField: self.groupByField,
             providers: self.providers,
             searchResults: self.searchResults)

+ 1 - 2
iOSClient/Select/NCSelect.swift

@@ -415,7 +415,7 @@ extension NCSelect: UICollectionViewDataSource {
         cell.selectMode(false)
 
         // Live Photo
-        if metadata.livePhoto {
+        if metadata.isLivePhoto {
             cell.imageStatus.image = NCImageCache.images.livePhoto
         }
 
@@ -545,7 +545,6 @@ extension NCSelect {
                                        ascending: true,
                                        directoryOnTop: true,
                                        favoriteOnTop: true,
-                                       filterLivePhoto: true,
                                        groupByField: "none")
 
         if withLoadFolder {

+ 0 - 1
iOSClient/Shares/NCShares.swift

@@ -60,7 +60,6 @@ class NCShares: NCCollectionViewCommon {
                                            ascending: layoutForView?.ascending,
                                            directoryOnTop: layoutForView?.directoryOnTop,
                                            favoriteOnTop: true,
-                                           filterLivePhoto: true,
                                            groupByField: groupByField,
                                            providers: providers,
                                            searchResults: searchResults)

+ 3 - 3
iOSClient/Utility/NCCameraRoll.swift

@@ -75,7 +75,7 @@ class NCCameraRoll: NSObject {
                 self.utilityFileSystem.moveFile(atPath: fileNamePath, toPath: toPath)
                 let fetchAssets = PHAsset.fetchAssets(withLocalIdentifiers: [metadataSource.assetLocalIdentifier], options: nil)
                 // swiftlint:disable empty_count
-                if metadata.livePhoto, fetchAssets.count > 0 {
+                if metadata.isLivePhoto, fetchAssets.count > 0 {
                     self.createMetadataLivePhoto(metadata: metadata, asset: fetchAssets.firstObject) { metadata in
                         if let metadata = metadata, let metadata = NCManageDatabase.shared.addMetadata(metadata) {
                             metadatas.append(metadata)
@@ -282,9 +282,9 @@ class NCCameraRoll: NSObject {
                                                                                serverUrl: metadata.serverUrl,
                                                                                urlBase: metadata.urlBase,
                                                                                url: "",
-                                                                               contentType: "",
-                                                                               isLivePhoto: true)
+                                                                               contentType: "")
 
+                metadataLivePhoto.livePhotoFile = metadata.fileName
                 metadataLivePhoto.classFile = NKCommon.TypeClassFile.video.rawValue
                 metadataLivePhoto.isExtractFile = true
                 metadataLivePhoto.session = metadata.session

+ 0 - 55
iOSClient/Utility/NCLivePhoto.swift

@@ -14,9 +14,6 @@ import NextcloudKit
 
 class NCLivePhoto {
 
-    var livePhotoFile = ""
-    var livePhotoFile2 = ""
-
     // MARK: PUBLIC
     typealias LivePhotoResources = (pairedImage: URL, pairedVideo: URL)
     /// Returns the paired image and video for the given PHLivePhoto
@@ -467,55 +464,3 @@ fileprivate extension AVAsset {
         }
     }
 }
-
-extension NCLivePhoto {
-
-    func setLivephotoUpload(metadata: tableMetadata) {
-
-        guard NCGlobal.shared.capabilityServerVersionMajor >= NCGlobal.shared.nextcloudVersion28 else { return }
-
-        livePhotoFile = metadata.livePhotoFile
-        livePhotoFile2 = metadata.fileName
-
-        if livePhotoFile.isEmpty {
-            if metadata.classFile == NKCommon.TypeClassFile.image.rawValue {
-                livePhotoFile = (metadata.fileName as NSString).deletingPathExtension + ".mov"
-            } else if metadata.classFile == NKCommon.TypeClassFile.video.rawValue {
-                livePhotoFile = (metadata.fileName as NSString).deletingPathExtension + ".jpg"
-            }
-        }
-
-        guard metadata.livePhoto,
-              !livePhotoFile.isEmpty,
-              let metadata2 = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND urlBase == %@ AND path == %@ AND fileName == %@ AND status == %d", metadata.account, metadata.urlBase, metadata.path, livePhotoFile, NCGlobal.shared.metadataStatusNormal)) else { return }
-
-        let serverUrlfileNamePath1 = metadata.urlBase + metadata.path + metadata.fileName
-        let serverUrlfileNamePath2 = metadata2.urlBase + metadata2.path + livePhotoFile
-
-        Task {
-            if metadata.livePhotoFile.isEmpty {
-                _ = await NextcloudKit.shared.setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath1, livePhotoFile: livePhotoFile)
-            }
-            if metadata2.livePhotoFile.isEmpty {
-                _ = await NextcloudKit.shared.setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath2, livePhotoFile: livePhotoFile2)
-            }
-        }
-    }
-
-    func setLivePhoto(metadata1: tableMetadata, metadata2: tableMetadata) {
-
-        guard NCGlobal.shared.capabilityServerVersionMajor >= NCGlobal.shared.nextcloudVersion28,
-              (!metadata1.livePhotoFile.isEmpty && !metadata2.livePhotoFile.isEmpty) else { return }
-
-        Task {
-            if metadata1.livePhotoFile.isEmpty {
-                let serverUrlfileNamePath = metadata1.urlBase + metadata1.path + metadata1.fileName
-                _ = await NextcloudKit.shared.setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath, livePhotoFile: metadata2.fileName)
-            }
-            if metadata2.livePhotoFile.isEmpty {
-                let serverUrlfileNamePath = metadata2.urlBase + metadata2.path + metadata2.fileName
-                _ = await NextcloudKit.shared.setLivephoto(serverUrlfileNamePath: serverUrlfileNamePath, livePhotoFile: metadata1.fileName)
-            }
-        }
-    }
-}

+ 1 - 1
iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift

@@ -279,7 +279,7 @@ class NCViewerMedia: UIViewController {
         guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(metadata.ocId) else { return }
         self.metadata = metadata
 
-        if metadata.livePhoto {
+        if metadata.isLivePhoto {
             let fileNameMOV = (metadata.fileNameView as NSString).deletingPathExtension + ".mov"
             if let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", metadata.account, metadata.serverUrl, fileNameMOV)), !utilityFileSystem.fileProviderStorageExists(metadata) {
                 NCNetworking.shared.download(metadata: metadata, selector: "") { _, _ in }

+ 1 - 1
iOSClient/Viewer/NCViewerMedia/NCViewerMediaDetailView.swift

@@ -204,7 +204,7 @@ class NCViewerMediaDetailView: UIView {
             locationLabel.text = exif.location
         }
 
-        if metadata.livePhoto {
+        if metadata.isLivePhoto {
             livePhotoImageView.isHidden = false
         }
 

+ 1 - 1
iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.swift

@@ -676,7 +676,7 @@ extension NCViewerMediaPage: UIGestureRecognizerDelegate {
     // MARK: - Live Photo
     @objc func didLongpressGestureEvent(gestureRecognizer: UITapGestureRecognizer) {
 
-        if !currentViewController.metadata.livePhoto || currentViewController.detailView.isShown { return }
+        if !currentViewController.metadata.isLivePhoto || currentViewController.detailView.isShown { return }
 
         if gestureRecognizer.state == .began {
             let fileName = (currentViewController.metadata.fileNameView as NSString).deletingPathExtension + ".mov"

+ 2 - 2
iOSClient/Viewer/NCViewerQuickLook/NCViewerQuickLook.swift

@@ -71,7 +71,7 @@ private var hasChangesQuickLook: Bool = false
         super.viewDidLoad()
         guard isEditingEnabled else { return }
 
-        if metadata?.livePhoto == true {
+        if metadata?.isLivePhoto == true {
             let error = NKError(errorCode: NCGlobal.shared.errorCharactersForbidden, errorDescription: "_message_disable_overwrite_livephoto_")
             NCContentPresenter().showInfo(error: error)
         }
@@ -126,7 +126,7 @@ private var hasChangesQuickLook: Bool = false
 
         let alertController = UIAlertController(title: NSLocalizedString("_save_", comment: ""), message: nil, preferredStyle: .alert)
         var message: String?
-        if metadata.livePhoto {
+        if metadata.isLivePhoto {
             message = NSLocalizedString("_message_disable_overwrite_livephoto_", comment: "")
         } else if metadata.lock {
             message = NSLocalizedString("_file_locked_no_override_", comment: "")