Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Brand/Database.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ import Foundation
//
let databaseName = "nextcloud.realm"
let tableAccountBackup = "tableAccountBackup.json"
let databaseSchemaVersion: UInt64 = 413
let databaseSchemaVersion: UInt64 = 414
8 changes: 4 additions & 4 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
2C33C48223E2C475005F963B /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C33C48123E2C475005F963B /* NotificationService.swift */; };
2C33C48623E2C475005F963B /* Notification Service Extension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 2C33C47F23E2C475005F963B /* Notification Service Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
370D26AF248A3D7A00121797 /* NCCellMain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 370D26AE248A3D7A00121797 /* NCCellMain.swift */; };
A1B2C3D430B0000100ABCDEF /* NCMediaViewerLoadingPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D330B0000100ABCDEF /* NCMediaViewerLoadingPolicy.swift */; };
A5A87F9E4B0E4441A6A4BC20 /* NCContextMenuProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB7697C94BA14450A0867940 /* NCContextMenuProfile.swift */; };
AA3C85E82D36B08C00F74F12 /* UITestBackend.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3C85E72D36B08C00F74F12 /* UITestBackend.swift */; };
AA3C85EB2D36BBFB00F74F12 /* OCSResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA3C85EA2D36BBF400F74F12 /* OCSResponse.swift */; };
Expand Down Expand Up @@ -850,7 +851,6 @@
F7CDB5C32FA33CA300F72306 /* NCMediaViewerPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CDB5B92FA33CA300F72306 /* NCMediaViewerPageView.swift */; };
F7CDB5C42FA33CA300F72306 /* NCImageViewerContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CDB5B62FA33CA300F72306 /* NCImageViewerContentView.swift */; };
F7CDB5C52FA33CA300F72306 /* NCMediaViewerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CDB5B82FA33CA300F72306 /* NCMediaViewerModel.swift */; };
A1B2C3D430B0000100ABCDEF /* NCMediaViewerLoadingPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D330B0000100ABCDEF /* NCMediaViewerLoadingPolicy.swift */; };
F7CDB5C62FA33CA300F72306 /* NCMediaViewerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CDB5BB2FA33CA300F72306 /* NCMediaViewerView.swift */; };
F7CDB5CC2FA33CA300F72306 /* NCNextcloudMediaViewerLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CDB5BD2FA33CA300F72306 /* NCNextcloudMediaViewerLoader.swift */; };
F7CDB5D32FA3448B00F72306 /* NCAudioViewerContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CDB5D22FA3448A00F72306 /* NCAudioViewerContentView.swift */; };
Expand Down Expand Up @@ -1217,6 +1217,7 @@
2C33C48A23E2CC26005F963B /* Notification_Service_Extension-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Notification_Service_Extension-Bridging-Header.h"; sourceTree = "<group>"; };
370D26AE248A3D7A00121797 /* NCCellMain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCellMain.swift; sourceTree = "<group>"; };
8932E90EC4278026D86CCCC9 /* NCContextMenuComment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCContextMenuComment.swift; sourceTree = "<group>"; };
A1B2C3D330B0000100ABCDEF /* NCMediaViewerLoadingPolicy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMediaViewerLoadingPolicy.swift; sourceTree = "<group>"; };
AA3C85E72D36B08C00F74F12 /* UITestBackend.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITestBackend.swift; sourceTree = "<group>"; };
AA3C85EA2D36BBF400F74F12 /* OCSResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OCSResponse.swift; sourceTree = "<group>"; };
AA3C85ED2D36BCCB00F74F12 /* SharesResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharesResponse.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1873,7 +1874,6 @@
F7CCAB502ECF315F00F8E68B /* NCCollectionViewCommon+SyncMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCCollectionViewCommon+SyncMetadata.swift"; sourceTree = "<group>"; };
F7CDB5B62FA33CA300F72306 /* NCImageViewerContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCImageViewerContentView.swift; sourceTree = "<group>"; };
F7CDB5B82FA33CA300F72306 /* NCMediaViewerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMediaViewerModel.swift; sourceTree = "<group>"; };
A1B2C3D330B0000100ABCDEF /* NCMediaViewerLoadingPolicy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMediaViewerLoadingPolicy.swift; sourceTree = "<group>"; };
F7CDB5B92FA33CA300F72306 /* NCMediaViewerPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMediaViewerPageView.swift; sourceTree = "<group>"; };
F7CDB5BB2FA33CA300F72306 /* NCMediaViewerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMediaViewerView.swift; sourceTree = "<group>"; };
F7CDB5BD2FA33CA300F72306 /* NCNextcloudMediaViewerLoader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCNextcloudMediaViewerLoader.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6347,7 +6347,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
Expand Down Expand Up @@ -6415,7 +6415,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = NKUJUXUJ3B;
Expand Down
8 changes: 7 additions & 1 deletion iOSClient/Data/NCManageDatabase+MediaMetadataBackfill.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import NextcloudKit
class tableMediaMetadataBackfill: Object {
@Persisted(primaryKey: true) var account = ""
@Persisted var offset = 0
@Persisted var cursorDate: Date?
@Persisted var lastRunDate: Date?
@Persisted var lastCompletedCycleDate: Date?

Expand All @@ -36,15 +37,18 @@ extension NCManageDatabase {
// MARK: - Realm write

func updateMediaMetadataBackfillAsync(account: String,
offset: Int) async {
offset: Int,
cursorDate: Date) async {
await core.performRealmWriteAsync { realm in
if let backfill = realm.object(ofType: tableMediaMetadataBackfill.self,
forPrimaryKey: account) {
backfill.offset = offset
backfill.cursorDate = cursorDate
backfill.lastRunDate = Date()
} else {
let backfill = tableMediaMetadataBackfill(account: account)
backfill.offset = offset
backfill.cursorDate = cursorDate
backfill.lastRunDate = Date()
realm.add(backfill)
}
Expand All @@ -55,11 +59,13 @@ extension NCManageDatabase {
await core.performRealmWriteAsync { realm in
if let backfill = realm.object(ofType: tableMediaMetadataBackfill.self, forPrimaryKey: account) {
backfill.offset = 0
backfill.cursorDate = nil
backfill.lastRunDate = Date()
backfill.lastCompletedCycleDate = Date()
} else {
let backfill = tableMediaMetadataBackfill(account: account)
backfill.offset = 0
backfill.cursorDate = nil
backfill.lastRunDate = Date()
backfill.lastCompletedCycleDate = Date()
realm.add(backfill)
Expand Down
24 changes: 14 additions & 10 deletions iOSClient/Media/NCMediaDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ extension NCMedia {

var firstDateNew = Date.distantFuture
var lastDateNew = Date.distantPast
var firstDate: Date?
var lastDate: Date?
var firstVisibleCellDate: Date?
var lastVisibleCellDate: Date?
var visibleCells: [NCMediaCell] = []

await MainActor.run {
Expand Down Expand Up @@ -270,8 +270,8 @@ extension NCMedia {
return date1 > date2
}

firstDate = visibleCells.first?.date
lastDate = visibleCells.last?.date
firstVisibleCellDate = visibleCells.first?.date
lastVisibleCellDate = visibleCells.last?.date

if !visibleCells.isEmpty, !distant {
let firstCellDate = visibleCells.first?.date
Expand Down Expand Up @@ -324,17 +324,20 @@ extension NCMedia {
guard !Task.isCancelled,
self.isViewActived,
self.session.account == account,
let firstDate,
let lastDate else {
let firstVisibleCellDate,
let lastVisibleCellDate else {
return
}

// VERIFY MEDIA
//
await self.verifyNetworkMedia(firstDate: firstDate,
lastDate: lastDate,
// Nextcloud cannot range-filter displayname, so same-date results are bounded by this cap.
let verificationLimit = 1000
await self.verifyNetworkMedia(firstDate: firstVisibleCellDate,
lastDate: lastVisibleCellDate,
mediaPath: tblAccount.mediaPath,
account: account) {
account: account,
limit: verificationLimit) {
Task { [weak self] in
guard let self else {
return
Expand Down Expand Up @@ -409,6 +412,7 @@ extension NCMedia {
lastDate: Date,
mediaPath: String,
account: String,
limit: Int,
update: @escaping () -> Void,
finish: @escaping () -> Void) async {
await NCMediaNetwork().searchMediaPage(
Expand All @@ -417,7 +421,7 @@ extension NCMedia {
lastDate: lastDate,
account: account,
paginate: true,
limit: 1000000) { task in
limit: limit) { task in
Task {
let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(
account: account,
Expand Down
Loading
Loading