Skip to content

Commit 4838581

Browse files
Merge branch 'master' into LucidBanner
Signed-off-by: Marino Faggiana <marino.faggiana@nextcloud.com>
2 parents 9cd427f + 0565a24 commit 4838581

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+475
-372
lines changed

Nextcloud.xcodeproj/project.pbxproj

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@
304304
F7327E322B73A86700A462C7 /* NCNetworking+WebDAV.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7327E2F2B73A86700A462C7 /* NCNetworking+WebDAV.swift */; };
305305
F7327E352B73AEDE00A462C7 /* NCNetworking+LivePhoto.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7327E342B73AEDE00A462C7 /* NCNetworking+LivePhoto.swift */; };
306306
F7327E3B2B73B8D600A462C7 /* Array+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7AC1CAF28AB94490032D99F /* Array+Extension.swift */; };
307-
F7327E3D2B73B92800A462C7 /* NCNetworking+Synchronization.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7327E3C2B73B92800A462C7 /* NCNetworking+Synchronization.swift */; };
308307
F732D23327CF8AED000B0F1B /* NCPlayerToolBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = F732D23227CF8AED000B0F1B /* NCPlayerToolBar.xib */; };
309308
F733598125C1C188002ABA72 /* NCAskAuthorization.swift in Sources */ = {isa = PBXBuildFile; fileRef = F733598025C1C188002ABA72 /* NCAskAuthorization.swift */; };
310309
F7346E1628B0EF5C006CE2D2 /* Widget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7346E1528B0EF5C006CE2D2 /* Widget.swift */; };
@@ -397,7 +396,6 @@
397396
F752BA052E58C05200616A26 /* Maintenance.swift in Sources */ = {isa = PBXBuildFile; fileRef = F752BA042E58C05200616A26 /* Maintenance.swift */; };
398397
F75379222AE2ADA100C0250E /* JGProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = F75379212AE2ADA100C0250E /* JGProgressHUD */; };
399398
F753BA93281FD8020015BFB6 /* EasyTipView in Frameworks */ = {isa = PBXBuildFile; productRef = F753BA92281FD8020015BFB6 /* EasyTipView */; };
400-
F753DBDF2E5D99C300A1AF91 /* NCFiles+SyncMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = F753DBDE2E5D99B700A1AF91 /* NCFiles+SyncMetadata.swift */; };
401399
F755BD9B20594AC7008C5FBB /* NCService.swift in Sources */ = {isa = PBXBuildFile; fileRef = F755BD9A20594AC7008C5FBB /* NCService.swift */; };
402400
F755CB402B8CB13C00CE27E9 /* NCMediaLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = F755CB3F2B8CB13C00CE27E9 /* NCMediaLayout.swift */; };
403401
F757CC8229E7F88B00F31428 /* NCManageDatabase+Groupfolders.swift in Sources */ = {isa = PBXBuildFile; fileRef = F757CC8129E7F88B00F31428 /* NCManageDatabase+Groupfolders.swift */; };
@@ -755,6 +753,7 @@
755753
F7CBC1242BAC8B0000EC1D55 /* NCSectionFirstHeaderEmptyData.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7CBC1212BAC8B0000EC1D55 /* NCSectionFirstHeaderEmptyData.xib */; };
756754
F7CBC1252BAC8B0000EC1D55 /* NCSectionFirstHeaderEmptyData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CBC1222BAC8B0000EC1D55 /* NCSectionFirstHeaderEmptyData.swift */; };
757755
F7CBC1262BAC8B0000EC1D55 /* NCSectionFirstHeaderEmptyData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CBC1222BAC8B0000EC1D55 /* NCSectionFirstHeaderEmptyData.swift */; };
756+
F7CCAB512ECF316700F8E68B /* NCCollectionViewCommon+SyncMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CCAB502ECF315F00F8E68B /* NCCollectionViewCommon+SyncMetadata.swift */; };
758757
F7CEE6002BA9A5C9003EFD89 /* NCTrashGridCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7CEE5FE2BA9A5C9003EFD89 /* NCTrashGridCell.xib */; };
759758
F7CEE6012BA9A5C9003EFD89 /* NCTrashGridCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CEE5FF2BA9A5C9003EFD89 /* NCTrashGridCell.swift */; };
760759
F7CF06802E0FF3990063AD04 /* NCAppStateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CF067A2E0FF38F0063AD04 /* NCAppStateManager.swift */; };
@@ -1343,7 +1342,6 @@
13431342
F7327E1F2B73A42F00A462C7 /* NCNetworking+Download.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCNetworking+Download.swift"; sourceTree = "<group>"; };
13441343
F7327E2F2B73A86700A462C7 /* NCNetworking+WebDAV.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCNetworking+WebDAV.swift"; sourceTree = "<group>"; };
13451344
F7327E342B73AEDE00A462C7 /* NCNetworking+LivePhoto.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCNetworking+LivePhoto.swift"; sourceTree = "<group>"; };
1346-
F7327E3C2B73B92800A462C7 /* NCNetworking+Synchronization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCNetworking+Synchronization.swift"; sourceTree = "<group>"; };
13471345
F732D23227CF8AED000B0F1B /* NCPlayerToolBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCPlayerToolBar.xib; sourceTree = "<group>"; };
13481346
F733598025C1C188002ABA72 /* NCAskAuthorization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAskAuthorization.swift; sourceTree = "<group>"; };
13491347
F7346E1028B0EF5B006CE2D2 /* Widget.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Widget.appex; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -1386,7 +1384,6 @@
13861384
F753701822723D620041C76C /* gl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = gl; path = gl.lproj/Localizable.strings; sourceTree = "<group>"; };
13871385
F753701922723E0D0041C76C /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = ca.lproj/Localizable.strings; sourceTree = "<group>"; };
13881386
F753701A22723EC80041C76C /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = "<group>"; };
1389-
F753DBDE2E5D99B700A1AF91 /* NCFiles+SyncMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCFiles+SyncMetadata.swift"; sourceTree = "<group>"; };
13901387
F755BD9A20594AC7008C5FBB /* NCService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCService.swift; sourceTree = "<group>"; };
13911388
F755CB3F2B8CB13C00CE27E9 /* NCMediaLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCMediaLayout.swift; sourceTree = "<group>"; };
13921389
F757CC8129E7F88B00F31428 /* NCManageDatabase+Groupfolders.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NCManageDatabase+Groupfolders.swift"; sourceTree = "<group>"; };
@@ -1685,6 +1682,7 @@
16851682
F7CBC1212BAC8B0000EC1D55 /* NCSectionFirstHeaderEmptyData.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCSectionFirstHeaderEmptyData.xib; sourceTree = "<group>"; };
16861683
F7CBC1222BAC8B0000EC1D55 /* NCSectionFirstHeaderEmptyData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCSectionFirstHeaderEmptyData.swift; sourceTree = "<group>"; };
16871684
F7CC04E61F5AD50D00378CEF /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
1685+
F7CCAB502ECF315F00F8E68B /* NCCollectionViewCommon+SyncMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCCollectionViewCommon+SyncMetadata.swift"; sourceTree = "<group>"; };
16881686
F7CE8AFA1DC1F8D8009CAE48 /* Nextcloud.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Nextcloud.app; sourceTree = BUILT_PRODUCTS_DIR; };
16891687
F7CE8AFB1DC1F8D8009CAE48 /* Share.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Share.appex; sourceTree = BUILT_PRODUCTS_DIR; };
16901688
F7CEE5FE2BA9A5C9003EFD89 /* NCTrashGridCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCTrashGridCell.xib; sourceTree = "<group>"; };
@@ -2384,7 +2382,6 @@
23842382
F7327E342B73AEDE00A462C7 /* NCNetworking+LivePhoto.swift */,
23852383
F7F3E58A2D3BB65000A32B14 /* NCNetworking+Recommendations.swift */,
23862384
F7411C532D7B26C600F57358 /* NCNetworking+ServerError.swift */,
2387-
F7327E3C2B73B92800A462C7 /* NCNetworking+Synchronization.swift */,
23882385
F74230F22C79B57200CA1ACA /* NCNetworking+Task.swift */,
23892386
F785129A2D79899E0087DDD0 /* NCNetworking+TermsOfService.swift */,
23902387
F71916102E2901E800E13E96 /* NCNetworking+Upload.swift */,
@@ -2455,6 +2452,7 @@
24552452
F7D890742BD25C570050B8A6 /* NCCollectionViewCommon+DragDrop.swift */,
24562453
F799DF872C4B83CC003410B5 /* NCCollectionViewCommon+EasyTipView.swift */,
24572454
F799DF8A2C4B84EB003410B5 /* NCCollectionViewCommon+EndToEndInitialize.swift */,
2455+
F7CCAB502ECF315F00F8E68B /* NCCollectionViewCommon+SyncMetadata.swift */,
24582456
F778231D2C42C07C001BB94F /* NCCollectionViewCommon+MediaLayout.swift */,
24592457
F36E64F62B9245210085ABB5 /* NCCollectionViewCommon+SelectTabBarDelegate.swift */,
24602458
F7D4BF002CA1831600A5E746 /* NCCollectionViewCommonPinchGesture.swift */,
@@ -2644,7 +2642,6 @@
26442642
children = (
26452643
F7725A5F251F33BB00D125E0 /* NCFiles.storyboard */,
26462644
F7725A5E251F33BB00D125E0 /* NCFiles.swift */,
2647-
F753DBDE2E5D99B700A1AF91 /* NCFiles+SyncMetadata.swift */,
26482645
F73EFF9A2DB11EB900FD434C /* NCFiles+UIScrollViewDelegate.swift */,
26492646
F722133A2D40EF8C002F7438 /* NCFilesNavigationController.swift */,
26502647
);
@@ -4470,7 +4467,6 @@
44704467
F7D60CAF2C941ACB008FBFDD /* NCMediaPinchGesture.swift in Sources */,
44714468
F71916142E2901FB00E13E96 /* NCNetworking+Upload.swift in Sources */,
44724469
F704B5E92430C0B800632F5F /* NCCreateFormUploadConflictCell.swift in Sources */,
4473-
F7327E3D2B73B92800A462C7 /* NCNetworking+Synchronization.swift in Sources */,
44744470
F72D404923D2082500A97FD0 /* NCViewerNextcloudText.swift in Sources */,
44754471
AFCE353927E5DE0500FEA6C2 /* Shareable.swift in Sources */,
44764472
F77BB746289984CA0090FC19 /* UIViewController+Extension.swift in Sources */,
@@ -4480,7 +4476,6 @@
44804476
F785EE9D246196DF00B3F945 /* NCNetworkingE2EE.swift in Sources */,
44814477
F724377B2C10B83E00C7C68D /* NCSharePermissions.swift in Sources */,
44824478
F794E13D2BBBFF2E003693D7 /* NCMainTabBarController.swift in Sources */,
4483-
F753DBDF2E5D99C300A1AF91 /* NCFiles+SyncMetadata.swift in Sources */,
44844479
F7CBC1252BAC8B0000EC1D55 /* NCSectionFirstHeaderEmptyData.swift in Sources */,
44854480
F7D4BF3D2CA2E8D800A5E746 /* TOPasscodeKeypadView.m in Sources */,
44864481
F7D4BF3E2CA2E8D800A5E746 /* TOPasscodeSettingsKeypadView.m in Sources */,
@@ -4668,6 +4663,7 @@
46684663
F7D68FCC28CB9051009139F3 /* NCManageDatabase+DashboardWidget.swift in Sources */,
46694664
F76882292C0DD1E7001CF441 /* NCManageE2EEModel.swift in Sources */,
46704665
F799DF8B2C4B84EB003410B5 /* NCCollectionViewCommon+EndToEndInitialize.swift in Sources */,
4666+
F7CCAB512ECF316700F8E68B /* NCCollectionViewCommon+SyncMetadata.swift in Sources */,
46714667
AA8E041D2D300FDE00E7E89C /* NCShareNetworkingDelegate.swift in Sources */,
46724668
F78E2D6529AF02DB0024D4F3 /* Database.swift in Sources */,
46734669
F70CEF5623E9C7E50007035B /* UIColor+Extension.swift in Sources */,
@@ -5709,7 +5705,7 @@
57095705
CLANG_WARN_UNREACHABLE_CODE = YES;
57105706
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
57115707
COPY_PHASE_STRIP = NO;
5712-
CURRENT_PROJECT_VERSION = 1;
5708+
CURRENT_PROJECT_VERSION = 4;
57135709
DEBUG_INFORMATION_FORMAT = dwarf;
57145710
DEVELOPMENT_TEAM = NKUJUXUJ3B;
57155711
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -5775,7 +5771,7 @@
57755771
CLANG_WARN_UNREACHABLE_CODE = YES;
57765772
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
57775773
COPY_PHASE_STRIP = NO;
5778-
CURRENT_PROJECT_VERSION = 1;
5774+
CURRENT_PROJECT_VERSION = 4;
57795775
DEVELOPMENT_TEAM = NKUJUXUJ3B;
57805776
ENABLE_STRICT_OBJC_MSGSEND = YES;
57815777
ENABLE_TESTABILITY = YES;

iOSClient/Data/NCManageDatabase+LivePhoto.swift

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,28 @@ extension NCManageDatabase {
3030

3131
// MARK: - Realm Write
3232

33-
func setLivePhotoVideo(metadatas: [tableMetadata]) async {
34-
guard !metadatas.isEmpty else {
35-
return
36-
}
37-
33+
func setLivePhotoVideo(account: String, serverUrlFileName: String, fileId: String, classFile: String) async {
3834
await core.performRealmWriteAsync { realm in
39-
for metadata in metadatas {
40-
let serverUrlFileNameNoExt = (metadata.serverUrlFileName as NSString).deletingPathExtension
41-
let primaryKey = metadata.account + serverUrlFileNameNoExt
42-
if let result = realm.object(ofType: tableLivePhoto.self, forPrimaryKey: primaryKey) {
43-
if metadata.isVideo {
44-
// Update existing (only the provided fields)
45-
result.serverUrlFileNameVideo = metadata.serverUrlFileName
46-
result.fileIdVideo = metadata.fileId
47-
} else if metadata.isImage {
48-
result.serverUrlFileNameImage = metadata.serverUrlFileName
49-
result.fileIdImage = metadata.fileId
50-
}
51-
} else {
52-
// Insert new — ensure the initializer sets the same PK used above
53-
let addObject = tableLivePhoto(account: metadata.account, serverUrlFileNameNoExt: serverUrlFileNameNoExt)
54-
if metadata.isVideo {
55-
addObject.serverUrlFileNameVideo = metadata.serverUrlFileName
56-
addObject.fileIdVideo = metadata.fileId
57-
realm.add(addObject, update: .modified)
58-
} else if metadata.isImage {
59-
addObject.serverUrlFileNameImage = metadata.serverUrlFileName
60-
addObject.fileIdImage = metadata.fileId
61-
realm.add(addObject, update: .modified)
62-
}
63-
}
35+
let serverUrlFileNameNoExt = (serverUrlFileName as NSString).deletingPathExtension
36+
let primaryKey = account + serverUrlFileNameNoExt
37+
38+
let livePhoto: tableLivePhoto
39+
if let existing = realm.object(ofType: tableLivePhoto.self, forPrimaryKey: primaryKey) {
40+
livePhoto = existing
41+
} else {
42+
// Create and add a new entry with the proper primary key
43+
let newObject = tableLivePhoto(account: account, serverUrlFileNameNoExt: serverUrlFileNameNoExt)
44+
realm.add(newObject, update: .modified)
45+
livePhoto = newObject
46+
}
47+
48+
// Update only the relevant fields based on metadata content type
49+
if classFile == NKTypeClassFile.video.rawValue {
50+
livePhoto.serverUrlFileNameVideo = serverUrlFileName
51+
livePhoto.fileIdVideo = fileId
52+
} else if classFile == NKTypeClassFile.image.rawValue {
53+
livePhoto.serverUrlFileNameImage = serverUrlFileName
54+
livePhoto.fileIdImage = fileId
6455
}
6556
}
6657
}
@@ -112,4 +103,18 @@ extension NCManageDatabase {
112103
}
113104
}
114105
// swiftlint:enable empty_string
106+
107+
/// Returns true if at least one valid Live Photo record exists for the given account.
108+
func hasLivePhotos() async -> Bool {
109+
await core.performRealmReadAsync { realm in
110+
let results = realm.objects(tableLivePhoto.self)
111+
.where {
112+
$0.serverUrlFileNameImage != "" &&
113+
$0.serverUrlFileNameVideo != "" &&
114+
$0.fileIdImage != "" &&
115+
$0.fileIdVideo != ""
116+
}
117+
return !results.isEmpty
118+
} ?? false
119+
}
115120
}

iOSClient/Data/NCManageDatabase+Metadata.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@ extension tableMetadata {
312312
!livePhotoFile.isEmpty
313313
}
314314

315+
var isLivePhotoVideo: Bool {
316+
!livePhotoFile.isEmpty && classFile == NKTypeClassFile.video.rawValue
317+
}
318+
319+
var isLivePhotoImage: Bool {
320+
!livePhotoFile.isEmpty && classFile == NKTypeClassFile.image.rawValue
321+
}
322+
315323
var isNotFlaggedAsLivePhotoByServer: Bool {
316324
!isFlaggedAsLivePhotoByServer
317325
}
@@ -1273,4 +1281,12 @@ extension NCManageDatabase {
12731281
.count
12741282
} ?? 0
12751283
}
1284+
1285+
func metadataExistsAsync(predicate: NSPredicate) async -> Bool {
1286+
await core.performRealmReadAsync { realm in
1287+
realm.objects(tableMetadata.self)
1288+
.filter(predicate)
1289+
.first != nil
1290+
} ?? false
1291+
}
12761292
}

iOSClient/Data/NCMetadataTranfersSuccess.swift

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,27 @@
55
import Foundation
66
import NextcloudKit
77

8+
public protocol NCMetadataTransfersSuccessDelegate: AnyObject {
9+
func metadataTransferWillFlush(hasLivePhotos: Bool)
10+
func metadataTransferDidFlush(hasLivePhotos: Bool)
11+
}
12+
813
actor NCMetadataTranfersSuccess {
914
private var tranfersSuccess: [tableMetadata] = []
1015
private let utility = NCUtility()
16+
private var delegates: [NCMetadataTransfersSuccessDelegate] = []
17+
18+
// Adds a new delegate
19+
func addDelegate(_ delegate: NCMetadataTransfersSuccessDelegate) {
20+
delegates.append(delegate)
21+
}
1122

12-
func append(metadata: tableMetadata, ocId: String, date: Date?, etag: String?) {
23+
// Removes a delegate
24+
func removeDelegate(_ delegate: NCMetadataTransfersSuccessDelegate) {
25+
delegates.removeAll { $0 as AnyObject === delegate as AnyObject }
26+
}
27+
28+
func append(metadata: tableMetadata, ocId: String, date: Date?, etag: String?) async {
1329
metadata.ocId = ocId
1430
metadata.uploadDate = (date as? NSDate) ?? NSDate()
1531
metadata.etag = etag ?? ""
@@ -29,6 +45,16 @@ actor NCMetadataTranfersSuccess {
2945
} else {
3046
tranfersSuccess.append(metadata)
3147
}
48+
49+
// Create Live Photo metadata
50+
let capabilities = await NKCapabilities.shared.getCapabilities(for: metadata.account)
51+
if capabilities.isLivePhotoServerAvailable,
52+
metadata.isLivePhoto {
53+
await NCManageDatabase.shared.setLivePhotoVideo(account: metadata.account,
54+
serverUrlFileName: metadata.serverUrlFileName,
55+
fileId: metadata.fileId,
56+
classFile: metadata.classFile)
57+
}
3258
}
3359

3460
func count() -> Int {
@@ -45,14 +71,17 @@ actor NCMetadataTranfersSuccess {
4571

4672
func flush() async {
4773
let metadatas: [tableMetadata] = tranfersSuccess
74+
let hasLivePhotos = await NCManageDatabase.shared.hasLivePhotos()
4875
tranfersSuccess.removeAll(keepingCapacity: true)
4976

50-
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterMetadataTranfersSuccessFlush)
51-
5277
var metadatasLocalFiles: [tableMetadata] = []
5378
var metadatasLivePhoto: [tableMetadata] = []
5479
var autoUploads: [tableAutoUploadTransfer] = []
5580

81+
for delegate in delegates {
82+
delegate.metadataTransferWillFlush(hasLivePhotos: hasLivePhotos)
83+
}
84+
5685
for metadata in metadatas {
5786
let results = await NCNetworking.shared.helperMetadataSuccess(metadata: metadata)
5887
if let localFile = results.localFile {
@@ -74,11 +103,7 @@ actor NCMetadataTranfersSuccess {
74103
// Auto Upload
75104
await NCManageDatabase.shared.addAutoUploadTransferAsync(autoUploads)
76105

77-
// Create Live Photo metadatas
78-
await NCManageDatabase.shared.setLivePhotoVideo(metadatas: metadatasLivePhoto)
79-
80106
if !NCNetworking.shared.isInBackground() {
81-
82107
// Set livePhoto on Server
83108
let accounts = Set(metadatasLivePhoto.map { $0.account })
84109
for account in accounts {
@@ -93,6 +118,7 @@ actor NCMetadataTranfersSuccess {
93118
for metadata in metadatas {
94119
delegate.transferChange(status: NCGlobal.shared.networkingStatusUploaded,
95120
account: metadata.account,
121+
fileName: metadata.fileName,
96122
serverUrl: metadata.serverUrl,
97123
selector: metadata.sessionSelector,
98124
ocId: metadata.ocId,
@@ -102,6 +128,10 @@ actor NCMetadataTranfersSuccess {
102128
}
103129
}
104130

131+
for delegate in delegates {
132+
delegate.metadataTransferDidFlush(hasLivePhotos: hasLivePhotos)
133+
}
134+
105135
nkLog(tag: NCGlobal.shared.logTagMetadataTransfers, message: "Flush successful (\(metadatas.count))", consoleOnly: true)
106136
}
107137
}

0 commit comments

Comments
 (0)