Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
This commit is contained in:
Marino Faggiana 2022-10-01 11:43:30 +02:00
Родитель bfd5ea3b97
Коммит e8cef65022
14 изменённых файлов: 55 добавлений и 63 удалений

Просмотреть файл

@ -81,7 +81,7 @@ class fileProviderData: NSObject {
let levelLog = CCUtility.getLogLevel() let levelLog = CCUtility.getLogLevel()
NKCommon.shared.levelLog = levelLog NKCommon.shared.levelLog = levelLog
let version = NSString(format: NCBrandOptions.shared.textCopyrightNextcloudiOS as NSString, NCUtility.shared.getVersionApp()) as String let version = NSString(format: NCBrandOptions.shared.textCopyrightNextcloudiOS as NSString, NCUtility.shared.getVersionApp()) as String
NKCommon.shared.writeLog("Start File Provider session with level \(levelLog) " + version + " (File Provider Extension)") NKCommon.shared.writeLog("[INFO] Start File Provider session with level \(levelLog) " + version + " (File Provider Extension)")
} }
// NO DOMAIN -> Set default account // NO DOMAIN -> Set default account

Просмотреть файл

@ -121,9 +121,9 @@ class NCShareExtension: UIViewController {
NKCommon.shared.pathLog = pathDirectoryGroup NKCommon.shared.pathLog = pathDirectoryGroup
} }
if isSimulatorOrTestFlight { if isSimulatorOrTestFlight {
NKCommon.shared.writeLog("Start Share session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)") NKCommon.shared.writeLog("[INFO] Start Share session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)")
} else { } else {
NKCommon.shared.writeLog("Start Share session with level \(levelLog) " + versionNextcloudiOS) NKCommon.shared.writeLog("[INFO] Start Share session with level \(levelLog) " + versionNextcloudiOS)
} }
// Colors // Colors

Просмотреть файл

@ -133,9 +133,9 @@ func getDashboardDataEntry(intent: Applications, isPreview: Bool, displaySize: C
NKCommon.shared.pathLog = pathDirectoryGroup NKCommon.shared.pathLog = pathDirectoryGroup
} }
if isSimulatorOrTestFlight { if isSimulatorOrTestFlight {
NKCommon.shared.writeLog("Start \(NCBrandOptions.shared.brand) dashboard widget session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)") NKCommon.shared.writeLog("[INFO] Start \(NCBrandOptions.shared.brand) dashboard widget session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)")
} else { } else {
NKCommon.shared.writeLog("Start \(NCBrandOptions.shared.brand) dashboard widget session with level \(levelLog) " + versionNextcloudiOS) NKCommon.shared.writeLog("[INFO] Start \(NCBrandOptions.shared.brand) dashboard widget session with level \(levelLog) " + versionNextcloudiOS)
} }
let (tableDashboard, tableButton) = NCManageDatabase.shared.getDashboardWidget(account: account.account, id: id) let (tableDashboard, tableButton) = NCManageDatabase.shared.getDashboardWidget(account: account.account, id: id)

Просмотреть файл

@ -194,9 +194,9 @@ func getFilesDataEntry(isPreview: Bool, displaySize: CGSize, completion: @escapi
NKCommon.shared.pathLog = pathDirectoryGroup NKCommon.shared.pathLog = pathDirectoryGroup
} }
if isSimulatorOrTestFlight { if isSimulatorOrTestFlight {
NKCommon.shared.writeLog("Start \(NCBrandOptions.shared.brand) widget session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)") NKCommon.shared.writeLog("[INFO] Start \(NCBrandOptions.shared.brand) widget session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight)")
} else { } else {
NKCommon.shared.writeLog("Start \(NCBrandOptions.shared.brand) widget session with level \(levelLog) " + versionNextcloudiOS) NKCommon.shared.writeLog("[INFO] Start \(NCBrandOptions.shared.brand) widget session with level \(levelLog) " + versionNextcloudiOS)
} }
let options = NKRequestOptions(timeout: 15) let options = NKRequestOptions(timeout: 15)

Просмотреть файл

@ -100,9 +100,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
NKCommon.shared.levelLog = levelLog NKCommon.shared.levelLog = levelLog
NKCommon.shared.copyLogToDocumentDirectory = true NKCommon.shared.copyLogToDocumentDirectory = true
if isSimulatorOrTestFlight { if isSimulatorOrTestFlight {
NKCommon.shared.writeLog("Start session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight) in \(UIApplication.shared.applicationState)") NKCommon.shared.writeLog("[INFO] Start session with level \(levelLog) " + versionNextcloudiOS + " (Simulator / TestFlight) in \(UIApplication.shared.applicationState)")
} else { } else {
NKCommon.shared.writeLog("Start session with level \(levelLog) " + versionNextcloudiOS + " in \(UIApplication.shared.applicationState)") NKCommon.shared.writeLog("[INFO] Start session with level \(levelLog) " + versionNextcloudiOS + " in \(UIApplication.shared.applicationState)")
} }
} }
@ -110,7 +110,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
if let account = NCManageDatabase.shared.getActiveAccount() { if let account = NCManageDatabase.shared.getActiveAccount() {
NKCommon.shared.writeLog("Account active \(account.account)") NKCommon.shared.writeLog("Account active \(account.account)")
if CCUtility.getPassword(account.account).isEmpty { if CCUtility.getPassword(account.account).isEmpty {
NKCommon.shared.writeLog("PASSWORD NOT FOUND for \(account.account)") NKCommon.shared.writeLog("[ERROR] PASSWORD NOT FOUND for \(account.account)")
} }
} }
@ -152,9 +152,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
// Start process Upload, Initialize // Start process Upload, Initialize
if UIApplication.shared.applicationState == .background { if UIApplication.shared.applicationState == .background {
NKCommon.shared.writeLog("Process in background, denied process upload and Inizialize main") NKCommon.shared.writeLog("[INFO] Process in background, denied process upload and Inizialize main")
} else { } else {
NKCommon.shared.writeLog("Starting process upload and Inizialize main") NKCommon.shared.writeLog("[INFO] Starting process upload and Inizialize main")
networkingProcessUpload = NCNetworkingProcessUpload() networkingProcessUpload = NCNetworkingProcessUpload()
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize, userInfo:["atStart":1]) NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize, userInfo:["atStart":1])
} }
@ -239,16 +239,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize) NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterInitialize)
} }
NKCommon.shared.writeLog("Application will enter in foreground") NKCommon.shared.writeLog("[INFO] Application will enter in foreground")
// START TIMER UPLOAD PROCESS
if NCUtility.shared.isSimulator() {
networkingProcessUpload?.startTimer()
}
// Initialize Auto upload // Initialize Auto upload
NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in
NKCommon.shared.writeLog("Initialize Auto upload with \(items) uploads") NKCommon.shared.writeLog("[INFO] Initialize Auto upload with \(items) uploads")
} }
// Required unsubscribing / subscribing // Required unsubscribing / subscribing
@ -300,11 +295,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
if account == "" { return } if account == "" { return }
// STOP TIMER UPLOAD PROCESS
if NCUtility.shared.isSimulator() {
networkingProcessUpload?.stopTimer()
}
scheduleAppRefresh() scheduleAppRefresh()
scheduleAppProcessing() scheduleAppProcessing()
@ -326,14 +316,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
@objc private func initialize() { @objc private func initialize() {
guard !account.isEmpty else { return } guard !account.isEmpty else { return }
NKCommon.shared.writeLog("initialize Main") NKCommon.shared.writeLog("[INFO] initialize Main")
// Registeration push notification // Registeration push notification
NCPushNotification.shared().pushNotification() NCPushNotification.shared().pushNotification()
// Start Auto Upload // Start Auto Upload
NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in
NKCommon.shared.writeLog("Initialize Auto upload with \(items) uploads") NKCommon.shared.writeLog("[INFO] Initialize Auto upload with \(items) uploads")
} }
// Start services // Start services
@ -364,9 +354,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
request.earliestBeginDate = Date(timeIntervalSinceNow: 6 * 60) // Refresh after 6 minutes. request.earliestBeginDate = Date(timeIntervalSinceNow: 6 * 60) // Refresh after 6 minutes.
do { do {
try BGTaskScheduler.shared.submit(request) try BGTaskScheduler.shared.submit(request)
NKCommon.shared.writeLog("Refresh task success submit request 6 minutes \(request)") NKCommon.shared.writeLog("[SUCCESS] Refresh task success submit request 6 minutes \(request)")
} catch { } catch {
NKCommon.shared.writeLog("Refresh task failed to submit request: \(error)") NKCommon.shared.writeLog("[ERROR] Refresh task failed to submit request: \(error)")
} }
} }
@ -381,9 +371,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
request.requiresExternalPower = false request.requiresExternalPower = false
do { do {
try BGTaskScheduler.shared.submit(request) try BGTaskScheduler.shared.submit(request)
NKCommon.shared.writeLog("Background Processing task success submit request 5 minutes \(request)") NKCommon.shared.writeLog("[SUCCESS] Background Processing task success submit request 5 minutes \(request)")
} catch { } catch {
NKCommon.shared.writeLog("Background Processing task failed to submit request: \(error)") NKCommon.shared.writeLog("[ERROR] Background Processing task failed to submit request: \(error)")
} }
} }
@ -395,10 +385,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
return return
} }
NKCommon.shared.writeLog("Start handler refresh task [Auto upload]") NKCommon.shared.writeLog("[INFO] Start handler refresh task [Auto upload]")
NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in
NKCommon.shared.writeLog("Completition handler refresh task [Auto upload] with \(items) uploads") NKCommon.shared.writeLog("[INFO] Completition handler refresh task [Auto upload] with \(items) uploads")
task.setTaskCompleted(success: true) task.setTaskCompleted(success: true)
} }
} }
@ -411,10 +401,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
return return
} }
NKCommon.shared.writeLog("Start handler processing task [Auto upload]") NKCommon.shared.writeLog("[INFO] Start handler processing task [Auto upload]")
NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in
NKCommon.shared.writeLog("Completition handler procesing task [Auto upload] with \(items) uploads") NKCommon.shared.writeLog("[INFO] Completition handler procesing task [Auto upload] with \(items) uploads")
task.setTaskCompleted(success: true) task.setTaskCompleted(success: true)
} }
} }
@ -423,7 +413,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) { func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) {
NKCommon.shared.writeLog("Start handle Events For Background URLSession: \(identifier)") NKCommon.shared.writeLog("[INFO] Start handle Events For Background URLSession: \(identifier)")
backgroundSessionCompletionHandler = completionHandler backgroundSessionCompletionHandler = completionHandler
} }
@ -678,7 +668,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
let popup = NCPopupViewController(contentController: vcAccountRequest, popupWidth: 300, popupHeight: height+20) let popup = NCPopupViewController(contentController: vcAccountRequest, popupWidth: 300, popupHeight: height+20)
popup.backgroundAlpha = 0.8 popup.backgroundAlpha = 0.8
UIApplication.shared.keyWindow?.rootViewController?.present(popup, animated: true) window?.rootViewController?.present(popup, animated: true)
vcAccountRequest.startTimer() vcAccountRequest.startTimer()
} }

Просмотреть файл

@ -548,7 +548,7 @@ extension NCMedia {
self.researchOldMedia(value: value, limit: limit, withElseReloadDataSource: false) self.researchOldMedia(value: value, limit: limit, withElseReloadDataSource: false)
} }
} else if error != .success { } else if error != .success {
NKCommon.shared.writeLog("Media search old media error code \(error.errorCode) " + error.errorDescription) NKCommon.shared.writeLog("[INFO] Media search old media error code \(error.errorCode) " + error.errorDescription)
} }
} }
} }
@ -624,7 +624,7 @@ extension NCMedia {
} else if error == .success && files.count == 0 && self.metadatas.count == 0 { } else if error == .success && files.count == 0 && self.metadatas.count == 0 {
self.searchOldMedia() self.searchOldMedia()
} else if error != .success { } else if error != .success {
NKCommon.shared.writeLog("Media search new media error code \(error.errorCode) " + error.errorDescription) NKCommon.shared.writeLog("[ERROR] Media search new media error code \(error.errorCode) " + error.errorDescription)
} }
} }
} }

Просмотреть файл

@ -86,11 +86,11 @@ class NCAutoUpload: NSObject {
self.getCameraRollAssets(viewController: viewController, account: account, selector: selector, alignPhotoLibrary: false) { assets in self.getCameraRollAssets(viewController: viewController, account: account, selector: selector, alignPhotoLibrary: false) { assets in
guard let assets = assets, !assets.isEmpty else { guard let assets = assets, !assets.isEmpty else {
NKCommon.shared.writeLog("Automatic upload, no new assets found [" + log + "]") NKCommon.shared.writeLog("[INFO] Automatic upload, no new assets found [" + log + "]")
completion(0) completion(0)
return return
} }
NKCommon.shared.writeLog("Automatic upload, new \(assets.count) assets found [" + log + "]") NKCommon.shared.writeLog("[INFO] Automatic upload, new \(assets.count) assets found [" + log + "]")
// Create the folder for auto upload & if request the subfolders // Create the folder for auto upload & if request the subfolders
if !NCNetworking.shared.createFolder(assets: assets, selector: selector, useSubFolder: account.autoUploadCreateSubfolder, account: account.account, urlBase: account.urlBase) { if !NCNetworking.shared.createFolder(assets: assets, selector: selector, useSubFolder: account.autoUploadCreateSubfolder, account: account.account, urlBase: account.urlBase) {
#if !EXTENSION #if !EXTENSION
@ -164,7 +164,7 @@ class NCAutoUpload: NSObject {
metadata.classFile = NKCommon.typeClassFile.image.rawValue metadata.classFile = NKCommon.typeClassFile.image.rawValue
} }
if selector == NCGlobal.shared.selectorUploadAutoUpload { if selector == NCGlobal.shared.selectorUploadAutoUpload {
NKCommon.shared.writeLog("Automatic upload added \(metadata.fileNameView) with Identifier \(metadata.assetLocalIdentifier)") NKCommon.shared.writeLog("[INFO] Automatic upload added \(metadata.fileNameView) with Identifier \(metadata.assetLocalIdentifier)")
NCManageDatabase.shared.addPhotoLibrary([asset], account: account.account) NCManageDatabase.shared.addPhotoLibrary([asset], account: account.account)
} }
metadatas.append(metadata) metadatas.append(metadata)
@ -172,15 +172,17 @@ class NCAutoUpload: NSObject {
} }
self.endForAssetToUpload = true self.endForAssetToUpload = true
// AUTO UPLOAD ALL
#if !EXTENSION
if selector == NCGlobal.shared.selectorUploadAutoUploadAll { if selector == NCGlobal.shared.selectorUploadAutoUploadAll {
NKCommon.shared.writeLog("[INFO] Start Upload All")
#if !EXTENSION
(UIApplication.shared.delegate as! AppDelegate).networkingProcessUpload?.createProcessUploads(metadatas: metadatas) (UIApplication.shared.delegate as! AppDelegate).networkingProcessUpload?.createProcessUploads(metadatas: metadatas)
completion(metadatas.count) completion(metadatas.count)
#endif
} else if selector == NCGlobal.shared.selectorUploadAutoUpload {
NKCommon.shared.writeLog("[INFO] Start Upload")
self.createProcessUploads(metadatas: metadatas, completion: completion)
} }
#endif
// AUTO UPLOAD
self.createProcessUploads(metadatas: metadatas, completion: completion)
} }
} }
} }
@ -256,7 +258,7 @@ class NCAutoUpload: NSObject {
guard let assets = assets else { return } guard let assets = assets else { return }
NCManageDatabase.shared.addPhotoLibrary(assets, account: activeAccount.account) NCManageDatabase.shared.addPhotoLibrary(assets, account: activeAccount.account)
NKCommon.shared.writeLog("Align Photo Library \(assets.count)") NKCommon.shared.writeLog("[INFO] Align Photo Library \(assets.count)")
} }
} }

Просмотреть файл

@ -150,7 +150,7 @@ import Photos
#if !EXTENSION #if !EXTENSION
if let appDelegate = UIApplication.shared.delegate as? AppDelegate, let completionHandler = appDelegate.backgroundSessionCompletionHandler { if let appDelegate = UIApplication.shared.delegate as? AppDelegate, let completionHandler = appDelegate.backgroundSessionCompletionHandler {
NKCommon.shared.writeLog("Called urlSessionDidFinishEvents for Background URLSession") NKCommon.shared.writeLog("[INFO] Called urlSessionDidFinishEvents for Background URLSession")
appDelegate.backgroundSessionCompletionHandler = nil appDelegate.backgroundSessionCompletionHandler = nil
completionHandler() completionHandler()
} }
@ -400,7 +400,7 @@ import Photos
completion: @escaping (_ error: NKError) -> () = { error in }) { completion: @escaping (_ error: NKError) -> () = { error in }) {
let metadata = tableMetadata.init(value: metadata) let metadata = tableMetadata.init(value: metadata)
NKCommon.shared.writeLog("Upload file \(metadata.fileNameView) with Identifier \(metadata.assetLocalIdentifier) with size \(metadata.size) [CHUNCK \(metadata.chunk), E2EE \(metadata.e2eEncrypted)]") NKCommon.shared.writeLog("[INFO] Upload file \(metadata.fileNameView) with Identifier \(metadata.assetLocalIdentifier) with size \(metadata.size) [CHUNCK \(metadata.chunk), E2EE \(metadata.e2eEncrypted)]")
if metadata.e2eEncrypted { if metadata.e2eEncrypted {
#if !EXTENSION_FILE_PROVIDER_EXTENSION && !EXTENSION_WIDGET #if !EXTENSION_FILE_PROVIDER_EXTENSION && !EXTENSION_WIDGET
@ -561,7 +561,7 @@ import Photos
NCUtilityFileSystem.shared.deleteFile(filePath: CCUtility.getDirectoryProviderStorageOcId(ocIdTemp)) NCUtilityFileSystem.shared.deleteFile(filePath: CCUtility.getDirectoryProviderStorageOcId(ocIdTemp))
} }
NKCommon.shared.writeLog("Upload complete " + serverUrl + "/" + fileName + ", result: success(\(size) bytes)") NKCommon.shared.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]) NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": error])
} else { } else {
if error.errorCode == NSURLErrorCancelled || error.errorCode == NCGlobal.shared.errorRequestExplicityCancelled { if error.errorCode == NSURLErrorCancelled || error.errorCode == NCGlobal.shared.errorRequestExplicityCancelled {
@ -573,7 +573,7 @@ import Photos
} else { } else {
if size == 0 { if size == 0 {
errorDescription = "File length 0" errorDescription = "File length 0"
NKCommon.shared.writeLog("Upload error 0 length " + serverUrl + "/" + fileName + ", result: success(\(size) bytes)") NKCommon.shared.writeLog("[ERROR] Upload error 0 length " + serverUrl + "/" + fileName)
} }
NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: errorDescription, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusUploadError) NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: errorDescription, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusUploadError)
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": error]) NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account, "fileName": metadata.fileName, "ocIdTemp": ocIdTemp, "error": error])

Просмотреть файл

@ -64,7 +64,7 @@ class NCNetworkingCheckRemoteUser {
let error = NKError(errorCode: error.errorCode, errorDescription: description) let error = NKError(errorCode: error.errorCode, errorDescription: description)
NCContentPresenter.shared.showError(error: error, priority: .max) NCContentPresenter.shared.showError(error: error, priority: .max)
CCUtility.setPassword(account, password: nil) CCUtility.setPassword(account, password: nil)
NKCommon.shared.writeLog("Password removed.") NKCommon.shared.writeLog("[INFO] Password removed.")
appDelegate.deletePasswordSession = true appDelegate.deletePasswordSession = true
} }
} }

Просмотреть файл

@ -88,7 +88,7 @@ extension NCNetworking {
}, taskHandler: { task in }, taskHandler: { task in
NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, sessionError: "", sessionTaskIdentifier: task.taskIdentifier, status: NCGlobal.shared.metadataStatusUploading) NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, sessionError: "", sessionTaskIdentifier: task.taskIdentifier, status: NCGlobal.shared.metadataStatusUploading)
NKCommon.shared.writeLog("Upload chunk: " + fileName) NKCommon.shared.writeLog("[INFO] Upload chunk: " + fileName)
}, progressHandler: { progress in }, progressHandler: { progress in
@ -155,7 +155,7 @@ extension NCNetworking {
NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: true, options: options) { _, error in NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: serverUrlFileNameSource, serverUrlFileNameDestination: serverUrlFileNameDestination, overwrite: true, options: options) { _, error in
NKCommon.shared.writeLog("Assembling chunk with error code: \(error.errorCode)") NKCommon.shared.writeLog("[ERROR] Assembling chunk with error code: \(error.errorCode)")
guard error == .success else { guard error == .success else {
self.uploadChunkFileError(metadata: metadata, chunkFolderPath: chunkFolderPath, directoryProviderStorageOcId: directoryProviderStorageOcId, error: error) self.uploadChunkFileError(metadata: metadata, chunkFolderPath: chunkFolderPath, directoryProviderStorageOcId: directoryProviderStorageOcId, error: error)
@ -230,7 +230,7 @@ extension NCNetworking {
var errorDescription = error.errorDescription var errorDescription = error.errorDescription
NKCommon.shared.writeLog("Upload chunk error code: \(error.errorCode)") NKCommon.shared.writeLog("[ERROR] Upload chunk error code: \(error.errorCode)")
if error.errorCode == NSURLErrorCancelled || error.errorCode == NCGlobal.shared.errorRequestExplicityCancelled { if error.errorCode == NSURLErrorCancelled || error.errorCode == NCGlobal.shared.errorRequestExplicityCancelled {

Просмотреть файл

@ -76,20 +76,20 @@ class NCNetworkingProcessUpload: NSObject {
let limit = NCGlobal.shared.maxConcurrentOperationUpload - counterUpload let limit = NCGlobal.shared.maxConcurrentOperationUpload - counterUpload
let metadatas = NCManageDatabase.shared.getAdvancedMetadatas(predicate: NSPredicate(format: "sessionSelector == %@ AND status == %d", sessionSelector, NCGlobal.shared.metadataStatusWaitUpload), page: 1, limit: limit, sorted: "date", ascending: true) let metadatas = NCManageDatabase.shared.getAdvancedMetadatas(predicate: NSPredicate(format: "sessionSelector == %@ AND status == %d", sessionSelector, NCGlobal.shared.metadataStatusWaitUpload), page: 1, limit: limit, sorted: "date", ascending: true)
if metadatas.count > 0 { if metadatas.count > 0 {
NKCommon.shared.writeLog("PROCESS-UPLOAD find \(metadatas.count) items") NKCommon.shared.writeLog("[INFO] PROCESS-UPLOAD find \(metadatas.count) items")
} }
for metadata in metadatas { for metadata in metadatas {
// Different account // Different account
if account.account != metadata.account { if account.account != metadata.account {
NKCommon.shared.writeLog("Process auto upload skipped file: \(metadata.serverUrl)/\(metadata.fileNameView) on account: \(metadata.account), because the actual account is \(account.account).") NKCommon.shared.writeLog("[INFO] Process auto upload skipped file: \(metadata.serverUrl)/\(metadata.fileNameView) on account: \(metadata.account), because the actual account is \(account.account).")
continue continue
} }
// Is already in upload background? skipped // Is already in upload background? skipped
if listOcId.contains(metadata.ocId) { if listOcId.contains(metadata.ocId) {
NKCommon.shared.writeLog("Process auto upload skipped file: \(metadata.serverUrl)/\(metadata.fileNameView), because is already in session.") NKCommon.shared.writeLog("[INFO] Process auto upload skipped file: \(metadata.serverUrl)/\(metadata.fileNameView), because is already in session.")
continue continue
} }

Просмотреть файл

@ -112,7 +112,7 @@ class NCService: NSObject {
guard error == .success, account == self.appDelegate.account else { guard error == .success, account == self.appDelegate.account else {
// Ops the server has Unauthorized // Ops the server has Unauthorized
NKCommon.shared.writeLog("The server has response with Unauthorized \(error.errorCode)") NKCommon.shared.writeLog("[ERROR] The server has response with Unauthorized \(error.errorCode)")
DispatchQueue.main.async { DispatchQueue.main.async {
if (UIApplication.shared.applicationState == .active) && if (UIApplication.shared.applicationState == .active) &&

Просмотреть файл

@ -112,7 +112,7 @@
[[NextcloudKit shared] subscribingPushProxyWithProxyServerUrl:proxyServerPath pushToken:self.pushKitToken deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent queue:dispatch_get_main_queue() completion:^(NKError *error) { [[NextcloudKit shared] subscribingPushProxyWithProxyServerUrl:proxyServerPath pushToken:self.pushKitToken deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent queue:dispatch_get_main_queue() completion:^(NKError *error) {
if (error == NKError.success) { if (error == NKError.success) {
[[NKCommon shared] writeLog:@"Subscribed to Push Notification server & proxy successfully"]; [[NKCommon shared] writeLog:@"[INFO] Subscribed to Push Notification server & proxy successfully"];
[CCUtility setPushNotificationToken:account token:self.pushKitToken]; [CCUtility setPushNotificationToken:account token:self.pushKitToken];
[CCUtility setPushNotificationDeviceIdentifier:account deviceIdentifier:deviceIdentifier]; [CCUtility setPushNotificationDeviceIdentifier:account deviceIdentifier:deviceIdentifier];
@ -139,7 +139,7 @@
[[NextcloudKit shared] unsubscribingPushProxyWithProxyServerUrl:proxyServerPath deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent queue:dispatch_get_main_queue() completion:^(NKError *error) { [[NextcloudKit shared] unsubscribingPushProxyWithProxyServerUrl:proxyServerPath deviceIdentifier:deviceIdentifier signature:signature publicKey:publicKey userAgent:userAgent queue:dispatch_get_main_queue() completion:^(NKError *error) {
if (error == NKError.success) { if (error == NKError.success) {
[[NKCommon shared] writeLog:@"Unsubscribed to Push Notification server & proxy successfully."]; [[NKCommon shared] writeLog:@"[INFO] Unsubscribed to Push Notification server & proxy successfully."];
[CCUtility setPushNotificationPublicKey:account data:nil]; [CCUtility setPushNotificationPublicKey:account data:nil];
[CCUtility setPushNotificationSubscribingPublicKey:account publicKey:nil]; [CCUtility setPushNotificationSubscribingPublicKey:account publicKey:nil];

Просмотреть файл

@ -174,9 +174,9 @@
BOOL isSimulatorOrTestFlight = [[NCUtility shared] isSimulatorOrTestFlight]; BOOL isSimulatorOrTestFlight = [[NCUtility shared] isSimulatorOrTestFlight];
NSString *versionNextcloudiOS = [NSString stringWithFormat:[NCBrandOptions shared].textCopyrightNextcloudiOS, [[NCUtility shared] getVersionAppWithBuild:true]]; NSString *versionNextcloudiOS = [NSString stringWithFormat:[NCBrandOptions shared].textCopyrightNextcloudiOS, [[NCUtility shared] getVersionAppWithBuild:true]];
if (isSimulatorOrTestFlight) { if (isSimulatorOrTestFlight) {
[[NKCommon shared] writeLog:[NSString stringWithFormat:@"Clear log with level %lu %@ (Simulator / TestFlight)", (unsigned long)logLevel, versionNextcloudiOS]]; [[NKCommon shared] writeLog:[NSString stringWithFormat:@"[INFO] Clear log with level %lu %@ (Simulator / TestFlight)", (unsigned long)logLevel, versionNextcloudiOS]];
} else { } else {
[[NKCommon shared] writeLog:[NSString stringWithFormat:@"Clear log with level %lu %@", (unsigned long)logLevel, versionNextcloudiOS]]; [[NKCommon shared] writeLog:[NSString stringWithFormat:@"[INFO] Clear log with level %lu %@", (unsigned long)logLevel, versionNextcloudiOS]];
} }
}; };
[section addFormRow:row]; [section addFormRow:row];