Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Nextcloud.xcodeproj/project.pbxproj20
-rw-r--r--iOSClient/Brand/Nextcloud-Bridging-Header.h (renamed from iOSClient/Nextcloud-Bridging-Header.h)0
-rw-r--r--iOSClient/Data/NCDataSource.swift2
-rw-r--r--iOSClient/Main/Collection Common/NCCollectionViewCommon.swift19
-rw-r--r--iOSClient/Networking/NCNetworking.swift59
-rw-r--r--iOSClient/Networking/NCNetworkingCheckRemoteUser.swift8
-rw-r--r--iOSClient/Networking/NCOperationQueue.swift2
-rw-r--r--iOSClient/Supporting Files/en.lproj/Localizable.strings2
-rw-r--r--iOSClient/Transfers/NCTransfers.swift29
9 files changed, 82 insertions, 59 deletions
diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj
index c0b162e9e..aec8b56f6 100644
--- a/Nextcloud.xcodeproj/project.pbxproj
+++ b/Nextcloud.xcodeproj/project.pbxproj
@@ -604,6 +604,7 @@
F70D87CE25EE6E58008CBBBD /* NCRenameFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCRenameFile.swift; sourceTree = "<group>"; };
F70D8D8024A4A9BF000A5756 /* NCNetworkingProcessUpload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCNetworkingProcessUpload.swift; sourceTree = "<group>"; };
F70F2BA4225F2D8900EBB73E /* ZIPFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ZIPFoundation.framework; path = Carthage/Build/iOS/ZIPFoundation.framework; sourceTree = "<group>"; };
+ F70F96AF2874394B006C8379 /* Nextcloud-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Nextcloud-Bridging-Header.h"; sourceTree = "<group>"; };
F710C5EF2471A6D1009AD8B7 /* Sentry.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sentry.framework; path = Carthage/Build/iOS/Sentry.framework; sourceTree = "<group>"; };
F710D1F42405770F00A6033D /* NCViewerPDF.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCViewerPDF.swift; sourceTree = "<group>"; };
F710D2012405826100A6033D /* NCViewer+Menu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NCViewer+Menu.swift"; sourceTree = "<group>"; };
@@ -900,7 +901,6 @@
F7CE8AFA1DC1F8D8009CAE48 /* Nextcloud.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Nextcloud.app; sourceTree = BUILT_PRODUCTS_DIR; };
F7CE8AFB1DC1F8D8009CAE48 /* Share.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Share.appex; sourceTree = BUILT_PRODUCTS_DIR; };
F7D0F33D264144FC0097D4A3 /* Background.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Background.xcassets; sourceTree = "<group>"; };
- F7D154271E2392A300202FD9 /* Nextcloud-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Nextcloud-Bridging-Header.h"; sourceTree = "<group>"; };
F7D1611F23CF19E30039EBBF /* NCViewerRichWorkspace.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCViewerRichWorkspace.storyboard; sourceTree = "<group>"; };
F7D2C772246470CA008513AE /* XLForm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XLForm.framework; path = Carthage/Build/iOS/XLForm.framework; sourceTree = "<group>"; };
F7D532461F5D4123006568B1 /* is */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = is; path = is.lproj/Localizable.strings; sourceTree = "<group>"; };
@@ -1598,6 +1598,7 @@
F7D0F33D264144FC0097D4A3 /* Background.xcassets */,
F7B8B82F25681C3400967775 /* GoogleService-Info.plist */,
F7362A1E220C853A005101B5 /* LaunchScreen.storyboard */,
+ F70F96AF2874394B006C8379 /* Nextcloud-Bridging-Header.h */,
F73CB5771ED46807005F2A5A /* NCBridgeSwift.h */,
F76B3CCD1EAE01BD00921AC9 /* NCBrand.swift */,
);
@@ -1804,7 +1805,6 @@
children = (
F7F4F0FB27ECDBDA008676F9 /* Font */,
F72B60941A24F04E004EF66F /* Localizations */,
- F7D154271E2392A300202FD9 /* Nextcloud-Bridging-Header.h */,
);
name = "Supporting Files";
path = iOSClient;
@@ -2822,7 +2822,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "it.twsweb.Nextcloud.Notification-Service-Extension";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_NOTIFICATION_SERVICE";
- SWIFT_OBJC_BRIDGING_HEADER = "Notification Service Extension/Notification_Service_Extension-Bridging-Header.h";
+ SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/Notification Service Extension/Notification_Service_Extension-Bridging-Header.h";
};
name = Debug;
};
@@ -2840,7 +2840,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "it.twsweb.Nextcloud.Notification-Service-Extension";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_NOTIFICATION_SERVICE";
- SWIFT_OBJC_BRIDGING_HEADER = "Notification Service Extension/Notification_Service_Extension-Bridging-Header.h";
+ SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/Notification Service Extension/Notification_Service_Extension-Bridging-Header.h";
};
name = Release;
};
@@ -2886,7 +2886,7 @@
PRODUCT_BUNDLE_IDENTIFIER = it.twsweb.Nextcloud.Share;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_SHARE";
- SWIFT_OBJC_BRIDGING_HEADER = "Share/Share-Bridging-Header.h";
+ SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/Share/Share-Bridging-Header.h";
};
name = Debug;
};
@@ -2904,7 +2904,7 @@
PRODUCT_BUNDLE_IDENTIFIER = it.twsweb.Nextcloud.Share;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_SHARE";
- SWIFT_OBJC_BRIDGING_HEADER = "Share/Share-Bridging-Header.h";
+ SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/Share/Share-Bridging-Header.h";
};
name = Release;
};
@@ -2922,7 +2922,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "it.twsweb.Nextcloud.File-Provider-Extension";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_FILE_PROVIDER_EXTENSION";
- SWIFT_OBJC_BRIDGING_HEADER = "File Provider Extension/FileProviderExtension-Bridging-Header.h";
+ SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/File Provider Extension/FileProviderExtension-Bridging-Header.h";
};
name = Debug;
};
@@ -2940,7 +2940,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "it.twsweb.Nextcloud.File-Provider-Extension";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) EXTENSION EXTENSION_FILE_PROVIDER_EXTENSION";
- SWIFT_OBJC_BRIDGING_HEADER = "File Provider Extension/FileProviderExtension-Bridging-Header.h";
+ SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/File Provider Extension/FileProviderExtension-Bridging-Header.h";
};
name = Release;
};
@@ -2953,7 +2953,6 @@
INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/iOSClient.plist";
PRODUCT_BUNDLE_IDENTIFIER = "it.twsweb.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_OBJC_BRIDGING_HEADER = "iOSClient/Nextcloud-Bridging-Header.h";
};
name = Debug;
};
@@ -2966,7 +2965,6 @@
INFOPLIST_FILE = "$(SRCROOT)/iOSClient/Brand/iOSClient.plist";
PRODUCT_BUNDLE_IDENTIFIER = "it.twsweb.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_OBJC_BRIDGING_HEADER = "iOSClient/Nextcloud-Bridging-Header.h";
};
name = Release;
};
@@ -3026,6 +3024,7 @@
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) NC";
+ SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/iOSClient/Brand/Nextcloud-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -3087,6 +3086,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG NC";
SWIFT_COMPILATION_MODE = wholemodule;
+ SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/iOSClient/Brand/Nextcloud-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
diff --git a/iOSClient/Nextcloud-Bridging-Header.h b/iOSClient/Brand/Nextcloud-Bridging-Header.h
index b758fed19..b758fed19 100644
--- a/iOSClient/Nextcloud-Bridging-Header.h
+++ b/iOSClient/Brand/Nextcloud-Bridging-Header.h
diff --git a/iOSClient/Data/NCDataSource.swift b/iOSClient/Data/NCDataSource.swift
index 2ada7f31c..d75d1ec8a 100644
--- a/iOSClient/Data/NCDataSource.swift
+++ b/iOSClient/Data/NCDataSource.swift
@@ -497,6 +497,8 @@ class NCMetadataForSection: NSObject {
if localFile?.offline ?? false {
metadataOffLine.append(metadata.ocId)
}
+ } else {
+ NCManageDatabase.shared.deleteLocalFile(predicate: NSPredicate(format: "ocId == %@", metadata.ocId))
}
// Organized the metadata
diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
index f68eab544..f125a5bc1 100644
--- a/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
+++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
@@ -1102,7 +1102,11 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
metadataForSection.unifiedSearchInProgress = true
self.collectionView?.reloadData()
- NCNetworking.shared.unifiedSearchFilesProvider(urlBase: appDelegate, id: searchResult.id, term: term, limit: 5, cursor: cursor) { searchResult, metadatas, errorCode, ErrorDescription in
+ NCNetworking.shared.unifiedSearchFilesProvider(urlBase: appDelegate, id: searchResult.id, term: term, limit: 5, cursor: cursor) { searchResult, metadatas, errorCode, errorDescription in
+
+ if errorCode != 0 {
+ NCContentPresenter.shared.messageNotification("_error_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode)
+ }
metadataForSection.unifiedSearchInProgress = false
guard let searchResult = searchResult, let metadatas = metadatas else { return }
@@ -1424,8 +1428,19 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
// Thumbnail
if !metadata.directory {
if metadata.name == NCGlobal.shared.appName {
- if FileManager().fileExists(atPath: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)) {
+
+ let imagePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
+ let iconImagePath = CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)!
+
+ if FileManager().fileExists(atPath: iconImagePath) {
(cell as! NCCellProtocol).filePreviewImageView?.image = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag))
+ } else if metadata.status > NCGlobal.shared.metadataStatusNormal && FileManager().fileExists(atPath: imagePath) {
+ if let image = UIImage(contentsOfFile: imagePath), let image = image.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon), isAspectRation: true), let data = image.jpegData(compressionQuality: 0.5) {
+ do {
+ try data.write(to: URL.init(fileURLWithPath: iconImagePath), options: .atomic)
+ (cell as! NCCellProtocol).filePreviewImageView?.image = image
+ } catch { }
+ }
} else {
NCOperationQueue.shared.downloadThumbnail(metadata: metadata, placeholder: true, cell: cell, view: collectionView)
}
diff --git a/iOSClient/Networking/NCNetworking.swift b/iOSClient/Networking/NCNetworking.swift
index 62b2cf0ab..94341fbd8 100644
--- a/iOSClient/Networking/NCNetworking.swift
+++ b/iOSClient/Networking/NCNetworking.swift
@@ -605,7 +605,7 @@ import Queuer
let metadata = tableMetadata.init(value: metadata)
- NCUtilityFileSystem.shared.moveFileInBackground(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId), toPath: CCUtility.getDirectoryProviderStorageOcId(ocId))
+ NCUtilityFileSystem.shared.deleteFile(filePath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId))
metadata.uploadDate = date ?? NSDate()
metadata.etag = etag ?? ""
@@ -625,21 +625,17 @@ import Queuer
metadata.deleteAssetLocalIdentifier = true
}
- // Remove file
- CCUtility.removeFile(atPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId))
-
NCManageDatabase.shared.addMetadata(metadata)
NCManageDatabase.shared.deleteMetadata(predicate: NSPredicate(format: "ocId == %@", ocIdTemp))
-#if !EXTENSION
+ #if !EXTENSION
self.getOcIdInBackgroundSession { listOcId in
if listOcId.count == 0 && self.uploadRequest.count == 0 {
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.networkingProcessUpload?.startProcess()
}
}
- CCUtility.setExif(metadata) { _, _, _, _, _ in }
-#endif
+ #endif
NCCommunicationCommon.shared.writeLog("Upload complete " + serverUrl + "/" + fileName + ", result: success(\(size) bytes)")
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "ocIdTemp": ocIdTemp, "errorCode": errorCode, "errorDescription": ""])
@@ -652,9 +648,9 @@ import Queuer
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadCancelFile, userInfo: ["ocId": metadata.ocId, "serverUrl": metadata.serverUrl, "account": metadata.account])
} else if errorCode == 401 || errorCode == 403 {
-#if !EXTENSION
+ #if !EXTENSION
NCNetworkingCheckRemoteUser.shared.checkRemoteUser(account: metadata.account, errorCode: errorCode, errorDescription: errorDescription)
-#endif
+ #endif
NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId, session: nil, sessionError: errorDescription, sessionTaskIdentifier: 0, status: NCGlobal.shared.metadataStatusUploadError)
} else {
if size == 0 {
@@ -666,9 +662,9 @@ import Queuer
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterUploadedFile, userInfo: ["ocId": metadata.ocId, "ocIdTemp": ocIdTemp, "errorCode": errorCode, "errorDescription": ""])
}
-#if !EXTENSION
+ #if !EXTENSION
DispatchQueue.main.async { (UIApplication.shared.delegate as! AppDelegate).listProgress[metadata.ocId] = nil }
-#endif
+ #endif
// Delete
self.uploadMetadataInBackground[fileName + serverUrl] = nil
}
@@ -962,9 +958,12 @@ import Queuer
let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ && fileId == %@", urlBase.userAccount, String(fileId))) {
metadatas.append(metadata)
} else if let filePath = entry.filePath {
- self.loadMetadata(urlBase: urlBase, filePath: filePath, dispatchGroup: dispatchGroup) { metadata in
+ let semaphore = Semaphore()
+ self.loadMetadata(urlBase: urlBase, filePath: filePath, dispatchGroup: dispatchGroup) { account, metadata, errorCode, errorDescription in
metadatas.append(metadata)
+ semaphore.continue()
}
+ semaphore.wait()
} else { print(#function, "[ERROR]: File search entry has no path: \(entry)") }
})
break
@@ -981,9 +980,12 @@ import Queuer
filename)) {
metadatas.append(metadata)
} else {
- self.loadMetadata(urlBase: urlBase, filePath: dir + filename, dispatchGroup: dispatchGroup) { metadata in
+ let semaphore = Semaphore()
+ self.loadMetadata(urlBase: urlBase, filePath: dir + filename, dispatchGroup: dispatchGroup) { account, metadata, errorCode, errorDescription in
metadatas.append(metadata)
+ semaphore.continue()
}
+ semaphore.wait()
}
})
default:
@@ -1014,12 +1016,15 @@ import Queuer
switch id {
case "files":
searchResult.entries.forEach({ entry in
- if let fileId = entry.fileId, let newMetadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ && fileId == %@", urlBase.userAccount, String(fileId))) {
- metadatas.append(newMetadata)
+ if let fileId = entry.fileId, let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ && fileId == %@", urlBase.userAccount, String(fileId))) {
+ metadatas.append(metadata)
} else if let filePath = entry.filePath {
- self.loadMetadata(urlBase: urlBase, filePath: filePath, dispatchGroup: nil) { newMetadata in
- metadatas.append(newMetadata)
+ let semaphore = Semaphore()
+ self.loadMetadata(urlBase: urlBase, filePath: filePath, dispatchGroup: nil) { account, metadata, errorCode, errorDescription in
+ metadatas.append(metadata)
+ semaphore.continue()
}
+ semaphore.wait()
} else { print(#function, "[ERROR]: File search entry has no path: \(entry)") }
})
break
@@ -1029,12 +1034,15 @@ import Queuer
searchResult.entries.forEach({ entry in
let url = URLComponents(string: entry.resourceURL)
guard let dir = url?.queryItems?["dir"]?.value, let filename = url?.queryItems?["scrollto"]?.value else { return }
- if let newMetadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ && path == %@ && fileName == %@", urlBase.userAccount, "/remote.php/dav/files/" + urlBase.user + dir, filename)) {
- metadatas.append(newMetadata)
+ if let metadata = NCManageDatabase.shared.getMetadata(predicate: NSPredicate(format: "account == %@ && path == %@ && fileName == %@", urlBase.userAccount, "/remote.php/dav/files/" + urlBase.user + dir, filename)) {
+ metadatas.append(metadata)
} else {
- self.loadMetadata(urlBase: urlBase, filePath: dir + filename, dispatchGroup: nil) { newMetadata in
- metadatas.append(newMetadata)
+ let semaphore = Semaphore()
+ self.loadMetadata(urlBase: urlBase, filePath: dir + filename, dispatchGroup: nil) { account, metadata, errorCode, errorDescription in
+ metadatas.append(metadata)
+ semaphore.continue()
}
+ semaphore.wait()
}
})
default:
@@ -1058,16 +1066,15 @@ import Queuer
requestsUnifiedSearch.removeAll()
}
- private func loadMetadata(urlBase: NCUserBaseUrl, filePath: String, dispatchGroup: DispatchGroup? = nil, completion: @escaping (tableMetadata) -> Void) {
+ private func loadMetadata(urlBase: NCUserBaseUrl, filePath: String, dispatchGroup: DispatchGroup? = nil, completion: @escaping (String, tableMetadata, Int, String) -> Void) {
let urlPath = urlBase.urlBase + "/remote.php/dav/files/" + urlBase.user + filePath
dispatchGroup?.enter()
self.readFile(serverUrlFileName: urlPath) { account, metadata, errorCode, errorDescription in
defer { dispatchGroup?.leave() }
guard let metadata = metadata else { return }
- DispatchQueue.main.async {
- NCManageDatabase.shared.addMetadata(metadata)
- completion(metadata)
- }
+ let returnMetadata = tableMetadata.init(value: metadata)
+ NCManageDatabase.shared.addMetadata(metadata)
+ completion(account, returnMetadata, errorCode, errorDescription)
}
}
diff --git a/iOSClient/Networking/NCNetworkingCheckRemoteUser.swift b/iOSClient/Networking/NCNetworkingCheckRemoteUser.swift
index 37dd9711d..0acf5dd40 100644
--- a/iOSClient/Networking/NCNetworkingCheckRemoteUser.swift
+++ b/iOSClient/Networking/NCNetworkingCheckRemoteUser.swift
@@ -29,7 +29,6 @@ import NCCommunication
return instance
}()
- let appDelegate = UIApplication.shared.delegate as! AppDelegate
var checkRemoteUserInProgress = false
@objc func checkRemoteUser(account: String, errorCode: Int, errorDescription: String) {
@@ -58,19 +57,20 @@ import NCCommunication
NCCommunication.shared.getRemoteWipeStatus(serverUrl: tableAccount.urlBase, token: token) { account, wipe, errorCode, _ in
+ let appDelegate = UIApplication.shared.delegate as! AppDelegate
if wipe {
- self.appDelegate.deleteAccount(account, wipe: true)
+ appDelegate.deleteAccount(account, wipe: true)
NCContentPresenter.shared.messageNotification(tableAccount.user, description: "_wipe_account_", delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorInternalError, priority: .max)
NCCommunication.shared.setRemoteWipeCompletition(serverUrl: tableAccount.urlBase, token: token) { _, _, _ in print("wipe") }
} else {
- if UIApplication.shared.applicationState == .active && NCCommunication.shared.isNetworkReachable() && !CCUtility.getPassword(account).isEmpty && !self.appDelegate.deletePasswordSession {
+ if UIApplication.shared.applicationState == .active && NCCommunication.shared.isNetworkReachable() && !CCUtility.getPassword(account).isEmpty && !appDelegate.deletePasswordSession {
let description = String.localizedStringWithFormat(NSLocalizedString("_error_check_remote_user_", comment: ""), tableAccount.user, tableAccount.urlBase)
NCContentPresenter.shared.messageNotification("_error_", description: description, delay: NCGlobal.shared.dismissAfterSecondLong, type: NCContentPresenter.messageType.error, errorCode: errorCode, priority: .max)
CCUtility.setPassword(account, password: nil)
- self.appDelegate.deletePasswordSession = true
+ appDelegate.deletePasswordSession = true
}
}
diff --git a/iOSClient/Networking/NCOperationQueue.swift b/iOSClient/Networking/NCOperationQueue.swift
index 9626f0942..e9348d05d 100644
--- a/iOSClient/Networking/NCOperationQueue.swift
+++ b/iOSClient/Networking/NCOperationQueue.swift
@@ -555,7 +555,7 @@ class NCOperationDataSource: ConcurrentOperation {
}
func reloadDataThenPerform(_ closure: @escaping (() -> Void)) {
- DispatchQueue.main.async {
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
CATransaction.begin()
CATransaction.setCompletionBlock(closure)
self.collectionViewCommon.collectionView.reloadData()
diff --git a/iOSClient/Supporting Files/en.lproj/Localizable.strings b/iOSClient/Supporting Files/en.lproj/Localizable.strings
index 1caef05ea..baaa7892f 100644
--- a/iOSClient/Supporting Files/en.lproj/Localizable.strings
+++ b/iOSClient/Supporting Files/en.lproj/Localizable.strings
@@ -872,6 +872,8 @@
"_in_" = "in";
"_enter_passphrase_" = "Enter passphrase (12 words)";
"_show_more_results_" = "Show more results";
+"_waiting_for_" = "Waiting for:";
+"_reachable_wifi_" = "network reachable via WiFi or cable";
// Video
"_select_trace_" = "Select the trace";
diff --git a/iOSClient/Transfers/NCTransfers.swift b/iOSClient/Transfers/NCTransfers.swift
index 545d98af2..08f831b30 100644
--- a/iOSClient/Transfers/NCTransfers.swift
+++ b/iOSClient/Transfers/NCTransfers.swift
@@ -167,7 +167,7 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate {
cell.fileUser = metadata.ownerId
cell.indexPath = indexPath
- cell.imageItem.image = NCBrandColor.cacheImages.file
+ cell.imageItem.image = nil
cell.imageItem.backgroundColor = nil
cell.labelTitle.text = metadata.fileNameView
@@ -182,28 +182,21 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate {
cell.progressView.progress = 0.0
- /*
let imagePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
- let iconImagePath = CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.fileNameView)!
+ let iconImagePath = CCUtility.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)!
if FileManager().fileExists(atPath: iconImagePath) {
cell.imageItem.image = UIImage(contentsOfFile:iconImagePath)
} else if FileManager().fileExists(atPath: imagePath) {
- if let image = UIImage(contentsOfFile: imagePath) {
- let image = image.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon), isAspectRation: true)
- if let data = image?.jpegData(compressionQuality: 0.5) {
- do {
- try data.write(to: URL.init(fileURLWithPath: iconImagePath), options: .atomic)
- cell.imageItem.image = image
- } catch {
- }
- }
+ if let image = UIImage(contentsOfFile: imagePath), let image = image.resizeImage(size: CGSize(width: NCGlobal.shared.sizeIcon, height: NCGlobal.shared.sizeIcon), isAspectRation: true), let data = image.jpegData(compressionQuality: 0.5) {
+ do {
+ try data.write(to: URL.init(fileURLWithPath: iconImagePath), options: .atomic)
+ cell.imageItem.image = image
+ } catch { }
}
- }
- if cell.imageItem.image == nil {
+ } else {
cell.imageItem.image = NCBrandColor.cacheImages.file
}
- */
cell.labelInfo.text = CCUtility.dateDiff(metadata.date as Date) + " ยท " + CCUtility.transformedSize(metadata.size)
@@ -258,8 +251,12 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate {
break
}
if self.appDelegate.account != metadata.account {
- cell.labelInfo.text = NSLocalizedString("_user_", comment: "") + ": \(metadata.userId) " + NSLocalizedString("_in_", comment: "") + " \(metadata.urlBase)"
+ cell.labelInfo.text = NSLocalizedString("_waiting_for_", comment: "") + " " + NSLocalizedString("_user_", comment: "") + ": \(metadata.userId) " + NSLocalizedString("_in_", comment: "") + " \(metadata.urlBase)"
+ }
+ if metadata.session == NCNetworking.shared.sessionIdentifierBackgroundWWan && NCNetworking.shared.networkReachability != NCCommunicationCommon.typeReachability.reachableEthernetOrWiFi {
+ cell.labelInfo.text = NSLocalizedString("_waiting_for_", comment: "") + " " + NSLocalizedString("_reachable_wifi_", comment: "")
}
+
cell.accessibilityLabel = metadata.fileNameView + ", " + (cell.labelInfo.text ?? "")
// Remove last separator