Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
af00a96
doc
marinofaggiana Oct 9, 2025
b8da2d0
cod
marinofaggiana Oct 10, 2025
7a6545b
cod
marinofaggiana Oct 10, 2025
8d76c33
fix
marinofaggiana Oct 10, 2025
a52fdf9
code
marinofaggiana Oct 10, 2025
8a3b323
cod
marinofaggiana Oct 10, 2025
0192cbe
cod
marinofaggiana Oct 10, 2025
6f2fbb2
lint
marinofaggiana Oct 10, 2025
1e91b55
code
marinofaggiana Oct 10, 2025
33c5279
clean
marinofaggiana Oct 10, 2025
a22cbc2
cleaning
marinofaggiana Oct 10, 2025
012d60e
fix
marinofaggiana Oct 10, 2025
ff9e652
Merge branch 'master' into NCMetadataStore
marinofaggiana Oct 10, 2025
7af80b1
cod
marinofaggiana Oct 10, 2025
69f8515
fix forced
marinofaggiana Oct 10, 2025
5761299
cod
marinofaggiana Oct 10, 2025
2e8eaab
networkingStatusDownloadCancel
marinofaggiana Oct 10, 2025
bfb1747
cleaning
marinofaggiana Oct 10, 2025
b4beb71
fix live photos
marinofaggiana Oct 10, 2025
ceeb2b9
fix
marinofaggiana Oct 10, 2025
73b1d53
cod
marinofaggiana Oct 10, 2025
418f18c
code
marinofaggiana Oct 10, 2025
8064b4f
cleaning
marinofaggiana Oct 10, 2025
88d6aee
cod
marinofaggiana Oct 10, 2025
e7451b8
rename
marinofaggiana Oct 11, 2025
ed0119a
cleaning
marinofaggiana Oct 11, 2025
126ac5d
Update NCMetadataStore.swift
marinofaggiana Oct 11, 2025
481fb05
cleaning
marinofaggiana Oct 11, 2025
9004c39
Update NCMetadataStore.swift
marinofaggiana Oct 11, 2025
639e051
Update NCMetadataStore.swift
marinofaggiana Oct 11, 2025
fe68b50
Update NCUtilityFileSystem.swift
marinofaggiana Oct 11, 2025
d0ce8b8
Diagnostic
marinofaggiana Oct 11, 2025
80963d1
Update NCManageDatabase+Metadata.swift
marinofaggiana Oct 11, 2025
51bb5cd
cod
marinofaggiana Oct 11, 2025
5f4d80d
Update NCNetworking+Upload.swift
marinofaggiana Oct 11, 2025
f3c4f0b
cleaning
marinofaggiana Oct 11, 2025
3327375
cod
marinofaggiana Oct 11, 2025
a0b26b1
cod
marinofaggiana Oct 11, 2025
5fd8918
cod
marinofaggiana Oct 11, 2025
6a29664
Update NCNetworkingProcess.swift
marinofaggiana Oct 12, 2025
04be7f0
cleaning
marinofaggiana Oct 12, 2025
9e45073
fix
marinofaggiana Oct 12, 2025
6ac0295
cod
marinofaggiana Oct 12, 2025
d066367
Update NCNetworking+Upload.swift
marinofaggiana Oct 12, 2025
f0b9ef9
Update NCNetworking+Upload.swift
marinofaggiana Oct 12, 2025
d4d1094
cleaning
marinofaggiana Oct 12, 2025
2d22bd0
Update NCNetworking+WebDAV.swift
marinofaggiana Oct 12, 2025
8cd12f6
delete files live
marinofaggiana Oct 12, 2025
d63a3f5
cod
marinofaggiana Oct 13, 2025
e39d470
normalized
marinofaggiana Oct 13, 2025
9d63e87
normalized
marinofaggiana Oct 13, 2025
ce08a09
normalized
marinofaggiana Oct 13, 2025
f846352
remove progress in metadata
marinofaggiana Oct 13, 2025
6fd2e4c
cleaning
marinofaggiana Oct 13, 2025
a63a8b1
cleaning
marinofaggiana Oct 13, 2025
5399116
cleaning
marinofaggiana Oct 13, 2025
c76c7d1
swiftUI transfers
marinofaggiana Oct 13, 2025
44b0d0d
cleaning
marinofaggiana Oct 13, 2025
907fb5f
cleaning
marinofaggiana Oct 13, 2025
f18adbd
clean
marinofaggiana Oct 13, 2025
48360eb
cleaning
marinofaggiana Oct 13, 2025
5b9ceb4
cod
marinofaggiana Oct 13, 2025
7701cf0
cod
marinofaggiana Oct 14, 2025
8227c0e
cod
marinofaggiana Oct 14, 2025
f2b11c2
cod
marinofaggiana Oct 14, 2025
f9edbc5
cleaning
marinofaggiana Oct 14, 2025
9f8660a
cod
marinofaggiana Oct 14, 2025
9e6d22f
code
marinofaggiana Oct 15, 2025
605ff3b
code
marinofaggiana Oct 15, 2025
92f1de6
code
marinofaggiana Oct 15, 2025
8d1d28f
cod
marinofaggiana Oct 15, 2025
3713844
Update NCTransfersView.swift
marinofaggiana Oct 15, 2025
8d908cd
cleaning
marinofaggiana Oct 15, 2025
99efe24
code
marinofaggiana Oct 15, 2025
fe3e59f
Update NCMainNavigationController.swift
marinofaggiana Oct 15, 2025
c21cf4c
remove old NCTrasfers
marinofaggiana Oct 15, 2025
e2bcf2e
Update Main.storyboard
marinofaggiana Oct 15, 2025
436e54a
gui
marinofaggiana Oct 15, 2025
a2a5a05
Update NCTransfersView.swift
marinofaggiana Oct 15, 2025
c4e7362
Update NCTransfersView.swift
marinofaggiana Oct 15, 2025
08b19bb
Update NCTransfersView.swift
marinofaggiana Oct 15, 2025
e35ee0d
gui
marinofaggiana Oct 15, 2025
6013287
cod
marinofaggiana Oct 15, 2025
7d8d7c1
code
marinofaggiana Oct 15, 2025
dbf96c4
code
marinofaggiana Oct 15, 2025
9cbfdfb
Update NCTransfersModel.swift
marinofaggiana Oct 15, 2025
91d9535
cod
marinofaggiana Oct 15, 2025
fe840e1
Update NCTransfersView.swift
marinofaggiana Oct 15, 2025
bca8b89
code
marinofaggiana Oct 16, 2025
f8603ac
code
marinofaggiana Oct 16, 2025
a493fc8
cod
marinofaggiana Oct 16, 2025
5382d76
cod
marinofaggiana Oct 16, 2025
2fc5569
fix
marinofaggiana Oct 16, 2025
5d10a4b
fix
marinofaggiana Oct 16, 2025
8f4e86d
claning
marinofaggiana Oct 16, 2025
13021bf
code
marinofaggiana Oct 16, 2025
f65dcc7
cod
marinofaggiana Oct 16, 2025
99819d4
cod
marinofaggiana Oct 16, 2025
fe473b2
cleaning
marinofaggiana Oct 16, 2025
15c4028
cod
marinofaggiana Oct 16, 2025
2075dd0
cod
marinofaggiana Oct 16, 2025
79ec415
TRANSFER
marinofaggiana Oct 16, 2025
dd7aec8
cod
marinofaggiana Oct 16, 2025
fda924a
Update SceneDelegate.swift
marinofaggiana Oct 16, 2025
98f368a
cod
marinofaggiana Oct 16, 2025
ad73dbc
code
marinofaggiana Oct 16, 2025
10094c1
Update NCService.swift
marinofaggiana Oct 16, 2025
e10900a
Update SceneDelegate.swift
marinofaggiana Oct 16, 2025
a20d02e
cod
marinofaggiana Oct 16, 2025
50fe6b5
cleaning
marinofaggiana Oct 16, 2025
6b2826b
cod
marinofaggiana Oct 17, 2025
31e3074
cod
marinofaggiana Oct 17, 2025
c7ef5b9
Update TranfersSuccess.swift
marinofaggiana Oct 17, 2025
97c3dfc
cod
marinofaggiana Oct 17, 2025
4e2653b
Update NCNetworkingProcess.swift
marinofaggiana Oct 17, 2025
de1d4f3
Update NCNetworkingProcess.swift
marinofaggiana Oct 17, 2025
9dc4b4d
cod
marinofaggiana Oct 17, 2025
492577e
cod
marinofaggiana Oct 17, 2025
fee8680
cod
marinofaggiana Oct 17, 2025
19058d7
Update NCNetworkingProcess.swift
marinofaggiana Oct 17, 2025
4abbfce
cod
marinofaggiana Oct 17, 2025
1888c6e
rename
marinofaggiana Oct 17, 2025
5c1c8c1
cod
marinofaggiana Oct 17, 2025
7eae42d
cod
marinofaggiana Oct 17, 2025
f8287f3
cleaning
marinofaggiana Oct 17, 2025
9e55945
Update NCManageDatabase+Metadata.swift
marinofaggiana Oct 17, 2025
90c9d5d
improvements
marinofaggiana Oct 17, 2025
df99dc8
Update NCNetworking+LivePhoto.swift
marinofaggiana Oct 17, 2025
120dfd1
Update NCMetadataTranfersSuccess.swift
marinofaggiana Oct 17, 2025
fdbe492
counter
marinofaggiana Oct 18, 2025
1642985
Update NCNetworkingProcess.swift
marinofaggiana Oct 18, 2025
4e66ff2
Update NCNetworkingProcess.swift
marinofaggiana Oct 18, 2025
a6e8cc8
cleaning
marinofaggiana Oct 18, 2025
6e91419
cleaning
marinofaggiana Oct 18, 2025
d4c0954
improved
marinofaggiana Oct 18, 2025
cbd3f2c
code
marinofaggiana Oct 19, 2025
05340b4
cod
marinofaggiana Oct 19, 2025
f1b5b3c
Update NCTransfersView.swift
marinofaggiana Oct 19, 2025
c15632b
cod
marinofaggiana Oct 19, 2025
b36b4a8
cod
marinofaggiana Oct 19, 2025
401d292
code
marinofaggiana Oct 19, 2025
0340f74
Update NCNetworkingProcess.swift
marinofaggiana Oct 19, 2025
c7e9469
cod
marinofaggiana Oct 19, 2025
fa0520c
Update NCNetworking+WebDAV.swift
marinofaggiana Oct 19, 2025
93ba3c6
Update NCNetworking+WebDAV.swift
marinofaggiana Oct 19, 2025
4815cc5
code
marinofaggiana Oct 20, 2025
99889df
code
marinofaggiana Oct 20, 2025
908b227
cleaning old code
marinofaggiana Oct 20, 2025
dfbc2ac
code
marinofaggiana Oct 20, 2025
eccd980
cod
marinofaggiana Oct 20, 2025
2468ae7
cod
marinofaggiana Oct 20, 2025
dd1b33e
cod
marinofaggiana Oct 20, 2025
eb09909
cleaning
marinofaggiana Oct 20, 2025
7c767c6
outlineView.tintColor = .clear
marinofaggiana Oct 20, 2025
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
3 changes: 1 addition & 2 deletions Brand/Database.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ import Foundation
//
let databaseName = "nextcloud.realm"
let tableAccountBackup = "tableAccountBackup.json"
let fileMetadataStore = "metadata.json"
let databaseSchemaVersion: UInt64 = 403
let databaseSchemaVersion: UInt64 = 404
2 changes: 1 addition & 1 deletion Brand/NCBrand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ final class NCBrandOptions: @unchecked Sendable {
let httpMaximumConnectionsPerHostInUpload: Int = 8

// Max request/download/upload process
let numMaximumProcess: Int = 50
let numMaximumProcess: Int = 20

// Number of failed attempts after reset app
let resetAppPasscodeAttempts: Int = 10
Expand Down
1 change: 0 additions & 1 deletion File Provider Extension/FileProviderData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ class FileProviderData: NSObject {
metadata.sessionSelector = ""
metadata.sessionDate = nil
metadata.sessionTaskIdentifier = 0
metadata.progress = 0
metadata.status = NCGlobal.shared.metadataStatusNormal

await self.database.addMetadataAsync(metadata)
Expand Down
80 changes: 36 additions & 44 deletions Nextcloud.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

17 changes: 1 addition & 16 deletions Share/NCShareExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -411,22 +411,7 @@ extension NCShareExtension {
if metadata.isDirectoryE2EE {
error = await NCNetworkingE2EEUpload().upload(metadata: metadata, session: session, controller: self)
} else if metadata.chunk > 0 {
var numChunks = 0
var counterUpload: Int = 0
hud.pieProgress(text: NSLocalizedString("_wait_file_preparation_", comment: ""))

let results = await NCNetworking.shared.uploadChunkFile(metadata: metadata) { num in
numChunks = num
} counterChunk: { counter in
self.hud.progress(num: Float(counter), total: Float(numChunks))
} startFilesChunk: { _ in
self.hud.setText(NSLocalizedString("_keep_active_for_upload_", comment: ""))
} requestHandler: { _ in
self.hud.progress(num: Float(counterUpload), total: Float(numChunks))
counterUpload += 1
} assembling: {
self.hud.setText(NSLocalizedString("_wait_", comment: ""))
}
let results = await NCNetworking.shared.uploadChunk(metadata: metadata, hud: hud)
error = results.error
} else {
let fileNameLocalPath = utilityFileSystem.getDirectoryProviderStorageOcId(metadata.ocId,
Expand Down
26 changes: 4 additions & 22 deletions iOSClient/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -315,30 +315,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD

func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) {
nkLog(debug: "Handle events For background URLSession: \(identifier)")
backgroundSessionCompletionHandler = completionHandler

// Starts a temporary background task to ensure that a potential flush
// of the MetadataStore JSON can complete even if the app is resumed
// briefly for background URLSession events.
//
// The flush runs only if the cache exceeds ~1 MB (~2000 item), preventing oversized
// in-memory data from persisting too long. The task is safely ended
// either in its expiration handler or after the operation completes.
bgTask = UIApplication.shared.beginBackgroundTask(withName: "MetadataStore.flush") {
UIApplication.shared.endBackgroundTask(self.bgTask)
self.bgTask = .invalid
if NCManageDatabase.shared.openRealmBackground() {
WidgetCenter.shared.reloadAllTimelines()
}

Task.detached(priority: .background) {
let cacheIsHuge = await NCMetadataStore.shared.cacheIsHuge(thresholdBytes: 1 * 1024 * 1024)
let count = await NCMetadataStore.shared.cacheCount()
if cacheIsHuge {
nkLog(tag: NCGlobal.shared.logTagTransferStore, emoji: .start, message: "Forced Sync Realm triggered — \(count) items (~1 MB threshold reached)")
await NCMetadataStore.shared.forcedSyncRealm()
} else {
nkLog(tag: NCGlobal.shared.logTagTransferStore, emoji: .info, message: "No forced Sync Realm required — \(count) items in cache")
}
}
backgroundSessionCompletionHandler = completionHandler
}

// MARK: - Push Notifications
Expand Down Expand Up @@ -397,7 +379,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
Task {
await NCNetworking.shared.transferDispatcher.notifyAllDelegatesAsync { delegate in
try? await Task.sleep(nanoseconds: 500_000_000)
delegate.transferRequestData(serverUrl: nil)
delegate.transferReloadData(serverUrl: nil, requestData: true, status: nil)
}
}
} else if let navigationController = UIStoryboard(name: "NCNotification", bundle: nil).instantiateInitialViewController() as? UINavigationController,
Expand Down
10 changes: 10 additions & 0 deletions iOSClient/Data/NCManageDatabase+AutoUpload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ extension NCManageDatabase {
}
}

func addAutoUploadTransferAsync(_ items: [tableAutoUploadTransfer]) async {
guard !items.isEmpty else {
return
}

await performRealmWriteAsync { realm in
realm.add(items, update: .all)
}
}

func deleteAutoUploadTransferAsync(account: String,
autoUploadServerUrlBase: String) async {
await performRealmWriteAsync { realm in
Expand Down
55 changes: 28 additions & 27 deletions iOSClient/Data/NCManageDatabase+LivePhoto.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,37 @@ extension NCManageDatabase {

// MARK: - Realm Write

func setLivePhotoImage(account: String, serverUrlFileName: String, fileId: String) async {
let serverUrlFileNameNoExt = (serverUrlFileName as NSString).deletingPathExtension
let primaryKey = account + serverUrlFileNameNoExt

await performRealmWriteAsync { realm in
if let result = realm.object(ofType: tableLivePhoto.self, forPrimaryKey: primaryKey) {
result.serverUrlFileNameImage = serverUrlFileName
result.fileIdImage = fileId
} else {
let addObject = tableLivePhoto(account: account, serverUrlFileNameNoExt: serverUrlFileNameNoExt)
addObject.serverUrlFileNameImage = serverUrlFileName
addObject.fileIdImage = fileId
realm.add(addObject, update: .all)
}
func setLivePhotoVideo(metadatas: [tableMetadata]) async {
guard !metadatas.isEmpty else {
return
}
}

func setLivePhotoVideo(account: String, serverUrlFileName: String, fileId: String) async {
let serverUrlFileNameNoExt = (serverUrlFileName as NSString).deletingPathExtension
let primaryKey = account + serverUrlFileNameNoExt

await performRealmWriteAsync { realm in
if let result = realm.object(ofType: tableLivePhoto.self, forPrimaryKey: primaryKey) {
result.serverUrlFileNameVideo = serverUrlFileName
result.fileIdVideo = fileId
} else {
let addObject = tableLivePhoto(account: account, serverUrlFileNameNoExt: serverUrlFileNameNoExt)
addObject.serverUrlFileNameVideo = serverUrlFileName
addObject.fileIdVideo = fileId
realm.add(addObject, update: .all)
for metadata in metadatas {
let serverUrlFileNameNoExt = (metadata.serverUrlFileName as NSString).deletingPathExtension
let primaryKey = metadata.account + serverUrlFileNameNoExt
if let result = realm.object(ofType: tableLivePhoto.self, forPrimaryKey: primaryKey) {
if metadata.isVideo {
// Update existing (only the provided fields)
result.serverUrlFileNameVideo = metadata.serverUrlFileName
result.fileIdVideo = metadata.fileId
} else if metadata.isImage {
result.serverUrlFileNameImage = metadata.serverUrlFileName
result.fileIdImage = metadata.fileId
}
} else {
// Insert new — ensure the initializer sets the same PK used above
let addObject = tableLivePhoto(account: metadata.account, serverUrlFileNameNoExt: serverUrlFileNameNoExt)
if metadata.isVideo {
addObject.serverUrlFileNameVideo = metadata.serverUrlFileName
addObject.fileIdVideo = metadata.fileId
realm.add(addObject, update: .modified)
} else if metadata.isImage {
addObject.serverUrlFileNameImage = metadata.serverUrlFileName
addObject.fileIdImage = metadata.fileId
realm.add(addObject, update: .modified)
}
}
}
}
}
Expand Down
37 changes: 1 addition & 36 deletions iOSClient/Data/NCManageDatabase+Metadata+Session.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ extension NCManageDatabase {
selector: String? = nil,
status: Int? = nil,
etag: String? = nil,
errorCode: Int? = nil,
progress: Double? = nil) async -> tableMetadata? {
errorCode: Int? = nil) async -> tableMetadata? {
var query: NSPredicate = NSPredicate()
if let ocId {
query = NSPredicate(format: "ocId == %@", ocId)
Expand Down Expand Up @@ -96,10 +95,6 @@ extension NCManageDatabase {
if let errorCode {
metadata.errorCode = errorCode
}

if let progress {
metadata.progress = progress
}
}

return await performRealmReadAsync { realm in
Expand All @@ -110,34 +105,6 @@ extension NCManageDatabase {
}
}

func setMetadataProgress(fileName: String,
serverUrl: String,
taskIdentifier: Int,
progress: Double) async {
await performRealmWriteAsync { realm in
guard let metadata = realm.objects(tableMetadata.self)
.filter("fileName == %@ AND serverUrl == %@ and sessionTaskIdentifier == %d", fileName, serverUrl, taskIdentifier)
.first else {
return
}
metadata.progress = progress
print(progress)
}
}

func setMetadataProgress(ocId: String,
progress: Double) async {
await performRealmWriteAsync { realm in
guard let metadata = realm.objects(tableMetadata.self)
.filter("ocId == %@", ocId)
.first else {
return
}
metadata.progress = progress
print(progress)
}
}

/// Asynchronously sets a metadata record into "wait download" state.
/// - Parameters:
/// - ocId: The object ID of the metadata.
Expand All @@ -164,7 +131,6 @@ extension NCManageDatabase {
metadata.sessionSelector = selector
metadata.status = NCGlobal.shared.metadataStatusWaitDownload
metadata.sessionDate = Date()
metadata.progress = 0
}

return await performRealmReadAsync { realm in
Expand Down Expand Up @@ -194,7 +160,6 @@ extension NCManageDatabase {
metadata.sessionSelector = ""
metadata.sessionDate = nil
metadata.status = NCGlobal.shared.metadataStatusNormal
metadata.progress = 0
return metadata
}

Expand Down
Loading
Loading