зеркало из https://github.com/nextcloud/ios.git
Merge branch 'develop'
This commit is contained in:
Коммит
7b47f476af
|
@ -25,8 +25,7 @@ import Foundation
|
|||
|
||||
@objc protocol CCActionsDeleteDelegate {
|
||||
|
||||
func deleteFileOrFolderSuccess(_ metadataNet: CCMetadataNet)
|
||||
func deleteFileOrFolderFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger)
|
||||
func deleteFileOrFolderSuccessFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger)
|
||||
}
|
||||
|
||||
@objc protocol CCActionsRenameDelegate {
|
||||
|
@ -81,9 +80,7 @@ class CCActions: NSObject {
|
|||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
@objc func deleteFileOrFolder(_ metadata: tableMetadata,delegate: AnyObject, hud: CCHud?, hudTitled: String?) {
|
||||
|
||||
var token: NSString?
|
||||
|
||||
|
||||
guard let serverUrl = NCManageDatabase.sharedInstance.getServerUrl(metadata.directoryID) else {
|
||||
return
|
||||
}
|
||||
|
@ -105,7 +102,7 @@ class CCActions: NSObject {
|
|||
// E2EE LOCK
|
||||
let tableE2eEncryption = NCManageDatabase.sharedInstance.getE2eEncryption(predicate: NSPredicate(format: "account = %@ AND fileNameIdentifier = %@", self.appDelegate.activeAccount, metadata.fileName))
|
||||
if tableE2eEncryption != nil {
|
||||
let error = NCNetworkingSync.sharedManager().lockEnd(toEndFolderEncrypted: self.appDelegate.activeUser, userID: self.appDelegate.activeUserID, password: self.appDelegate.activePassword, url: self.appDelegate.activeUrl, fileID: tableDirectory.fileID, token: &token)
|
||||
let error = NCNetworkingSync.sharedManager().lockEnd(toEndFolderEncrypted: self.appDelegate.activeUser, userID: self.appDelegate.activeUserID, password: self.appDelegate.activePassword, url: self.appDelegate.activeUrl, serverUrl:serverUrl, fileID: tableDirectory.fileID)
|
||||
if error != nil {
|
||||
DispatchQueue.main.async {
|
||||
self.appDelegate.messageNotification("_delete_", description: error!.localizedDescription, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: 0)
|
||||
|
@ -134,71 +131,59 @@ class CCActions: NSObject {
|
|||
}
|
||||
}
|
||||
|
||||
@objc func deleteFileOrFolderSuccess(_ metadataNet: CCMetadataNet) {
|
||||
|
||||
let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "fileID == %@", metadataNet.fileID))
|
||||
|
||||
if let metadata = metadata {
|
||||
self.deleteFile(metadata: metadata, serverUrl: metadataNet.serverUrl)
|
||||
}
|
||||
|
||||
guard let tableDirectory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account = %@ AND serverUrl = %@", self.appDelegate.activeAccount, metadataNet.serverUrl)) else {
|
||||
self.deleteFileOrFolderFailure(metadataNet, message: "Internal error, tableDirectory not found", errorCode: 0)
|
||||
return
|
||||
}
|
||||
|
||||
// E2EE Rebuild and send Metadata
|
||||
if tableDirectory.e2eEncrypted {
|
||||
|
||||
DispatchQueue.global().async {
|
||||
|
||||
var token = tableDirectory.e2eTokenLock as NSString?
|
||||
|
||||
// Send Metadata
|
||||
let errorRebuild = NCNetworkingSync.sharedManager().rebuildAndSendEndToEndMetadata(onServerUrl: metadataNet.serverUrl, account: self.appDelegate.activeAccount, user: self.appDelegate.activeUser, userID: self.appDelegate.activeUserID, password: self.appDelegate.activePassword, url: self.appDelegate.activeUrl, token: &token) as NSError?
|
||||
if (errorRebuild != nil) {
|
||||
DispatchQueue.main.async {
|
||||
self.deleteFileOrFolderFailure(metadataNet, message: errorRebuild!.localizedDescription as NSString, errorCode: errorRebuild!.code)
|
||||
}
|
||||
}
|
||||
|
||||
// Unlock
|
||||
let errorUnlock = NCNetworkingSync.sharedManager().unlockEnd(toEndFolderEncrypted: self.appDelegate.activeUser, userID: self.appDelegate.activeUserID, password: self.appDelegate.activePassword, url: self.appDelegate.activeUrl, fileID: tableDirectory.fileID, token: token! as String) as NSError?
|
||||
if (errorUnlock != nil && errorRebuild == nil) {
|
||||
DispatchQueue.main.async {
|
||||
self.deleteFileOrFolderFailure(metadataNet, message: errorUnlock!.localizedDescription as NSString, errorCode: errorUnlock!.code)
|
||||
}
|
||||
}
|
||||
|
||||
if (errorRebuild == nil && errorUnlock == nil) {
|
||||
DispatchQueue.main.async {
|
||||
metadataNet.delegate?.deleteFileOrFolderSuccess(metadataNet)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
metadataNet.delegate?.deleteFileOrFolderSuccess(metadataNet)
|
||||
}
|
||||
}
|
||||
|
||||
@objc func deleteFileOrFolderFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger) {
|
||||
|
||||
if errorCode == 404 {
|
||||
|
||||
let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "fileID == %@", metadataNet.fileID))
|
||||
|
||||
if metadata != nil {
|
||||
self.deleteFile(metadata: metadata!, serverUrl: metadataNet.serverUrl)
|
||||
}
|
||||
}
|
||||
@objc func deleteFileOrFolderSuccessFailure(_ metadataNet: CCMetadataNet, message: NSString, errorCode: NSInteger) {
|
||||
|
||||
if message.length > 0 {
|
||||
|
||||
appDelegate.messageNotification("_delete_", description: message as String, visible: true, delay:TimeInterval(k_dismissAfterSecond), type:TWMessageBarMessageType.error, errorCode: errorCode)
|
||||
}
|
||||
if (errorCode == 0) {
|
||||
|
||||
metadataNet.delegate?.deleteFileOrFolderFailure(metadataNet, message: message, errorCode: errorCode)
|
||||
let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "fileID == %@", metadataNet.fileID))
|
||||
|
||||
if let metadata = metadata {
|
||||
self.deleteFile(metadata: metadata, serverUrl: metadataNet.serverUrl)
|
||||
}
|
||||
|
||||
guard let tableDirectory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account = %@ AND serverUrl = %@", self.appDelegate.activeAccount, metadataNet.serverUrl)) else {
|
||||
self.deleteFileOrFolderSuccessFailure(metadataNet, message: "Internal error, tableDirectory not found", errorCode: 0)
|
||||
return
|
||||
}
|
||||
|
||||
// E2EE Rebuild and send Metadata
|
||||
if tableDirectory.e2eEncrypted {
|
||||
|
||||
DispatchQueue.global().async {
|
||||
|
||||
// Send Metadata
|
||||
let error = NCNetworkingSync.sharedManager().rebuildAndSendEndToEndMetadata(onServerUrl: metadataNet.serverUrl, account: self.appDelegate.activeAccount, user: self.appDelegate.activeUser, userID: self.appDelegate.activeUserID, password: self.appDelegate.activePassword, url: self.appDelegate.activeUrl) as NSError?
|
||||
|
||||
DispatchQueue.main.async {
|
||||
if (error == nil) {
|
||||
metadataNet.delegate?.deleteFileOrFolderSuccessFailure(metadataNet, message: "", errorCode: 0)
|
||||
} else {
|
||||
self.deleteFileOrFolderSuccessFailure(metadataNet, message: error!.localizedDescription as NSString, errorCode: error!.code)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
metadataNet.delegate?.deleteFileOrFolderSuccessFailure(metadataNet, message: "", errorCode: 0)
|
||||
}
|
||||
} else {
|
||||
|
||||
if errorCode == 404 {
|
||||
|
||||
let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "fileID == %@", metadataNet.fileID))
|
||||
|
||||
if metadata != nil {
|
||||
self.deleteFile(metadata: metadata!, serverUrl: metadataNet.serverUrl)
|
||||
}
|
||||
}
|
||||
|
||||
if message.length > 0 {
|
||||
|
||||
appDelegate.messageNotification("_delete_", description: message as String, visible: true, delay:TimeInterval(k_dismissAfterSecond), type:TWMessageBarMessageType.error, errorCode: errorCode)
|
||||
}
|
||||
|
||||
metadataNet.delegate?.deleteFileOrFolderSuccessFailure(metadataNet, message: message, errorCode: errorCode)
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -476,15 +476,16 @@
|
|||
|
||||
- (BOOL)createFolderSubFolderAutoUploadFolderPhotos:(NSString *)folderPhotos useSubFolder:(BOOL)useSubFolder assets:(PHFetchResult *)assets selector:(NSString *)selector
|
||||
{
|
||||
NSError *error;
|
||||
NSString *fileID;
|
||||
|
||||
error = [[NCNetworkingSync sharedManager] createFolderAutomaticUpload:folderPhotos user:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword];
|
||||
BOOL encrypted = [CCUtility isFolderEncrypted:folderPhotos account:appDelegate.activeAccount];
|
||||
NSError *error = [[NCNetworkingSync sharedManager] createFolder:folderPhotos user:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl encrypted:encrypted fileID:&fileID];
|
||||
|
||||
if (error == nil) {
|
||||
|
||||
tableDirectory *tableDirectory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", appDelegate.activeAccount, folderPhotos]];
|
||||
if (!tableDirectory)
|
||||
(void)[[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:folderPhotos permissions:nil encrypted:false];
|
||||
(void)[[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:folderPhotos fileID:fileID permissions:nil encrypted:encrypted];
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -502,16 +503,18 @@
|
|||
|
||||
for (NSString *dateSubFolder in [CCUtility createNameSubFolder:assets]) {
|
||||
|
||||
error = [[NCNetworkingSync sharedManager] createFolderAutomaticUpload:[NSString stringWithFormat:@"%@/%@", folderPhotos, dateSubFolder] user:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword];
|
||||
NSString *folderPathName = [NSString stringWithFormat:@"%@/%@", folderPhotos, dateSubFolder];
|
||||
|
||||
error = [[NCNetworkingSync sharedManager] createFolder:folderPathName user:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl encrypted:encrypted fileID:&fileID];
|
||||
|
||||
if ( error == nil) {
|
||||
|
||||
(void)[[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:[NSString stringWithFormat:@"%@/%@", folderPhotos, dateSubFolder] permissions:nil encrypted:false];
|
||||
(void)[[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:folderPathName fileID:fileID permissions:nil encrypted:encrypted];
|
||||
|
||||
} else {
|
||||
|
||||
// Activity
|
||||
[[NCManageDatabase sharedInstance] addActivityClient:[NSString stringWithFormat:@"%@/%@", folderPhotos, dateSubFolder] fileID:@"" action:k_activityDebugActionAutoUpload selector:selector note:NSLocalizedString(@"_error_createsubfolders_upload_",nil) type:k_activityTypeFailure verbose:k_activityVerboseDefault activeUrl:appDelegate.activeUrl];
|
||||
[[NCManageDatabase sharedInstance] addActivityClient:folderPathName fileID:@"" action:k_activityDebugActionAutoUpload selector:selector note:NSLocalizedString(@"_error_createsubfolders_upload_",nil) type:k_activityTypeFailure verbose:k_activityVerboseDefault activeUrl:appDelegate.activeUrl];
|
||||
|
||||
if ([selector isEqualToString:selectorUploadAutoUploadAll])
|
||||
[appDelegate messageNotification:@"_error_" description:@"_error_createsubfolders_upload_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
|
||||
|
|
|
@ -76,6 +76,8 @@ class tableCapabilities: Object {
|
|||
|
||||
@objc dynamic var account = ""
|
||||
@objc dynamic var themingBackground = ""
|
||||
@objc dynamic var themingBackgroundDefault: Bool = false
|
||||
@objc dynamic var themingBackgroundPlain: Bool = false
|
||||
@objc dynamic var themingColor = ""
|
||||
@objc dynamic var themingColorElement = ""
|
||||
@objc dynamic var themingColorText = ""
|
||||
|
|
|
@ -57,7 +57,7 @@ class NCManageDatabase: NSObject {
|
|||
let config = Realm.Configuration(
|
||||
|
||||
fileURL: dirGroup?.appendingPathComponent("\(appDatabaseNextcloud)/\(k_databaseDefault)"),
|
||||
schemaVersion: 15,
|
||||
schemaVersion: 16,
|
||||
|
||||
// 10 : Version 2.18.0
|
||||
// 11 : Version 2.18.2
|
||||
|
@ -65,6 +65,7 @@ class NCManageDatabase: NSObject {
|
|||
// 13 : Version 2.19.0.14
|
||||
// 14 : Version 2.19.0.xx
|
||||
// 15 : Version 2.19.2
|
||||
// 16 : Version 2.20.2
|
||||
|
||||
migrationBlock: { migration, oldSchemaVersion in
|
||||
// We haven’t migrated anything yet, so oldSchemaVersion == 0
|
||||
|
@ -85,8 +86,9 @@ class NCManageDatabase: NSObject {
|
|||
@objc func clearTable(_ table : Object.Type, account: String?) {
|
||||
|
||||
let results : Results<Object>
|
||||
let realm = try! Realm()
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
if let account = account {
|
||||
|
@ -147,7 +149,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func addAccount(_ account: String, url: String, user: String, password: String, loginFlow: Bool) {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
let addObject = tableAccount()
|
||||
|
@ -182,7 +184,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func setAccountPassword(_ account: String, password: String) -> tableAccount? {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
guard let result = realm.objects(tableAccount.self).filter("account = %@", account).first else {
|
||||
|
@ -205,7 +207,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func deleteAccount(_ account: String) {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
guard let result = realm.objects(tableAccount.self).filter("account = %@", account).first else {
|
||||
|
@ -249,7 +251,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func getAccount(predicate: NSPredicate) -> tableAccount? {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
if let result = realm.objects(tableAccount.self).filter(predicate).first {
|
||||
return tableAccount.init(value: result)
|
||||
}
|
||||
|
@ -260,7 +262,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func getAccountAutoUploadFileName() -> String {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
guard let result = realm.objects(tableAccount.self).filter("active = true").first else {
|
||||
return ""
|
||||
}
|
||||
|
@ -275,7 +277,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func getAccountAutoUploadDirectory(_ activeUrl : String) -> String {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
guard let result = realm.objects(tableAccount.self).filter("active = true").first else {
|
||||
return ""
|
||||
}
|
||||
|
@ -300,7 +302,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func setAccountActive(_ account: String) -> tableAccount? {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
var activeAccount = tableAccount()
|
||||
|
||||
do {
|
||||
|
@ -332,7 +334,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func setAccountAutoUploadProperty(_ property: String, state: Bool) {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
guard let result = realm.objects(tableAccount.self).filter("active = true").first else {
|
||||
|
@ -357,7 +359,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func setAccountAutoUploadFileName(_ fileName: String?) {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -381,7 +383,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func setAccountAutoUploadDirectory(_ serverUrl: String?, activeUrl: String) {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -409,7 +411,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -449,7 +451,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func getActivity(predicate: NSPredicate) -> [tableActivity] {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
let results = realm.objects(tableActivity.self).filter(predicate).sorted(byKeyPath: "date", ascending: false)
|
||||
|
||||
return Array(results.map { tableActivity.init(value:$0) })
|
||||
|
@ -462,7 +464,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -508,7 +510,7 @@ class NCManageDatabase: NSObject {
|
|||
noteReplacing = note.replacingOccurrences(of: "\(k_domain_session_queue).", with: "")
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
if realm.isInWriteTransaction {
|
||||
|
||||
print("[LOG] Could not write to database, addActivityClient is already in write transaction")
|
||||
|
@ -550,7 +552,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -564,6 +566,8 @@ class NCManageDatabase: NSObject {
|
|||
|
||||
resultCapabilities.account = tableAccount.account
|
||||
resultCapabilities.themingBackground = capabilities.themingBackground
|
||||
resultCapabilities.themingBackgroundDefault = capabilities.themingBackgroundDefault
|
||||
resultCapabilities.themingBackgroundPlain = capabilities.themingBackgroundPlain
|
||||
resultCapabilities.themingColor = capabilities.themingColor
|
||||
resultCapabilities.themingColorElement = capabilities.themingColorElement
|
||||
resultCapabilities.themingColorText = capabilities.themingColorText
|
||||
|
@ -605,7 +609,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
guard let result = realm.objects(tableCapabilities.self).filter("account = %@", tableAccount.account).first else {
|
||||
return 0
|
||||
}
|
||||
|
@ -620,7 +624,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
guard let result = realm.objects(tableCapabilities.self).filter("account = %@", tableAccount.account).first else {
|
||||
return 0
|
||||
}
|
||||
|
@ -635,7 +639,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
guard let capabilities = realm.objects(tableCapabilities.self).filter("account = %@", tableAccount.account).first else {
|
||||
return -1
|
||||
}
|
||||
|
@ -667,7 +671,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func addCertificates(_ certificateLocation: String) {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -685,7 +689,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func getCertificatesLocation(_ localCertificatesFolder: String) -> [String] {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
let results = realm.objects(tableCertificates.self)
|
||||
|
||||
return Array(results.map { "\(localCertificatesFolder)/\($0.certificateLocation)" })
|
||||
|
@ -694,14 +698,14 @@ class NCManageDatabase: NSObject {
|
|||
//MARK: -
|
||||
//MARK: Table Directory
|
||||
|
||||
@objc func addDirectory(serverUrl: String, permissions: String?, encrypted: Bool) -> String {
|
||||
@objc func addDirectory(serverUrl: String, fileID: String?, permissions: String?, encrypted: Bool) -> String {
|
||||
|
||||
guard let tableAccount = self.getAccountActive() else {
|
||||
return ""
|
||||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
var directoryID: String = ""
|
||||
|
||||
do {
|
||||
|
@ -717,7 +721,9 @@ class NCManageDatabase: NSObject {
|
|||
directoryID = NSUUID().uuidString
|
||||
addObject.directoryID = directoryID
|
||||
addObject.e2eEncrypted = encrypted
|
||||
|
||||
if let fileID = fileID {
|
||||
addObject.fileID = fileID
|
||||
}
|
||||
if let permissions = permissions {
|
||||
addObject.permissions = permissions
|
||||
}
|
||||
|
@ -726,11 +732,14 @@ class NCManageDatabase: NSObject {
|
|||
|
||||
} else {
|
||||
|
||||
directoryID = result!.directoryID
|
||||
result!.e2eEncrypted = encrypted
|
||||
if let fileID = fileID {
|
||||
result!.fileID = fileID
|
||||
}
|
||||
if let permissions = permissions {
|
||||
result!.permissions = permissions
|
||||
}
|
||||
directoryID = result!.directoryID
|
||||
result!.e2eEncrypted = encrypted
|
||||
realm.add(result!, update: true)
|
||||
}
|
||||
}
|
||||
|
@ -749,7 +758,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
let results = realm.objects(tableDirectory.self).filter("account = %@ AND serverUrl BEGINSWITH %@", tableAccount.account, serverUrl)
|
||||
|
||||
// Delete table Metadata & LocalFile
|
||||
|
@ -777,7 +786,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -809,7 +818,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -843,7 +852,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
guard let result = realm.objects(tableDirectory.self).filter(predicate).first else {
|
||||
return nil
|
||||
}
|
||||
|
@ -858,6 +867,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
let results = realm.objects(tableDirectory.self).filter(predicate).sorted(byKeyPath: sorted, ascending: ascending)
|
||||
|
||||
if (results.count > 0) {
|
||||
|
@ -880,7 +890,7 @@ class NCManageDatabase: NSObject {
|
|||
let realm = try! Realm()
|
||||
|
||||
guard let result = realm.objects(tableDirectory.self).filter("account = %@ AND serverUrl = %@", tableAccount.account,serverUrl).first else {
|
||||
return self.addDirectory(serverUrl: serverUrl, permissions: nil, encrypted: false)
|
||||
return self.addDirectory(serverUrl: serverUrl, fileID: nil,permissions: nil, encrypted: false)
|
||||
}
|
||||
|
||||
return result.directoryID
|
||||
|
@ -897,7 +907,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
guard let result = realm.objects(tableDirectory.self).filter("account = %@ AND directoryID = %@", tableAccount.account, directoryID).first else {
|
||||
return nil
|
||||
}
|
||||
|
@ -905,19 +915,24 @@ class NCManageDatabase: NSObject {
|
|||
return result.serverUrl
|
||||
}
|
||||
|
||||
@objc func getDirectoryE2ETokenLock(serverUrl: String) -> String? {
|
||||
@objc func getDirectoryE2ETokenLock(serverUrl: String, completion: @escaping (String?) -> Void) {
|
||||
|
||||
guard let tableAccount = self.getAccountActive() else {
|
||||
return nil
|
||||
DispatchQueue.main.async {
|
||||
|
||||
guard let tableAccount = self.getAccountActive() else {
|
||||
completion(nil)
|
||||
return
|
||||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
guard let result = realm.objects(tableDirectory.self).filter("account = %@ AND serverUrl = %@ AND e2eTokenLock != ''", tableAccount.account, serverUrl).first else {
|
||||
completion(nil)
|
||||
return
|
||||
}
|
||||
|
||||
completion(result.e2eTokenLock)
|
||||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
guard let result = realm.objects(tableDirectory.self).filter("account = %@ AND serverUrl = %@ AND e2eTokenLock != ''", tableAccount.account, serverUrl).first else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return result.e2eTokenLock
|
||||
}
|
||||
|
||||
@objc func setDateReadDirectory(directoryID: String) {
|
||||
|
@ -927,7 +942,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
guard let result = realm.objects(tableDirectory.self).filter("account = %@ AND directoryID = %@", tableAccount.account, directoryID).first else {
|
||||
|
@ -951,7 +966,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -974,7 +989,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
var update = false
|
||||
|
||||
do {
|
||||
|
@ -1003,7 +1018,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -1018,32 +1033,34 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
}
|
||||
|
||||
@objc func setDirectoryE2ETokenLock(fileID: String, token: String?) {
|
||||
@objc func setDirectoryE2ETokenLock(serverUrl: String, token: String?) {
|
||||
|
||||
guard let tableAccount = self.getAccountActive() else {
|
||||
return
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
|
||||
guard let tableAccount = self.getAccountActive() else {
|
||||
return
|
||||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
let realm = try! Realm()
|
||||
realm.beginWrite()
|
||||
|
||||
realm.beginWrite()
|
||||
guard let result = realm.objects(tableDirectory.self).filter("account = %@ AND serverUrl = %@", tableAccount.account, serverUrl).first else {
|
||||
realm.cancelWrite()
|
||||
return
|
||||
}
|
||||
|
||||
guard let result = realm.objects(tableDirectory.self).filter("account = %@ AND fileID = %@", tableAccount.account, fileID).first else {
|
||||
realm.cancelWrite()
|
||||
return
|
||||
}
|
||||
|
||||
if (token == nil) {
|
||||
result.e2eTokenLock = ""
|
||||
} else {
|
||||
result.e2eTokenLock = token!
|
||||
}
|
||||
if (token == nil) {
|
||||
result.e2eTokenLock = ""
|
||||
} else {
|
||||
result.e2eTokenLock = token!
|
||||
}
|
||||
|
||||
do {
|
||||
try realm.commitWrite()
|
||||
} catch let error {
|
||||
print("[LOG] Could not write to database: ", error)
|
||||
return
|
||||
do {
|
||||
try realm.commitWrite()
|
||||
} catch let error {
|
||||
print("[LOG] Could not write to database: ", error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1057,7 +1074,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
realm.add(e2e, update: true)
|
||||
|
@ -1077,7 +1094,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -1097,7 +1114,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
guard let result = realm.objects(tableE2eEncryption.self).filter(predicate).sorted(byKeyPath: "metadataKeyIndex", ascending: false).first else {
|
||||
return nil
|
||||
}
|
||||
|
@ -1112,6 +1129,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
let results : Results<tableE2eEncryption>
|
||||
|
||||
results = realm.objects(tableE2eEncryption.self).filter(predicate)
|
||||
|
@ -1130,7 +1148,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
guard let result = realm.objects(tableE2eEncryption.self).filter("account = %@ AND serverUrl = %@ AND fileNameIdentifier = %@", tableAccount.account, serverUrl, fileNameIdentifier).first else {
|
||||
|
@ -1195,7 +1213,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -1208,11 +1226,15 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
}
|
||||
|
||||
@objc func getAllExternalSites(predicate: NSPredicate) -> [tableExternalSites] {
|
||||
@objc func getAllExternalSites() -> [tableExternalSites]? {
|
||||
|
||||
guard let tableAccount = self.getAccountActive() else {
|
||||
return nil
|
||||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
let results = realm.objects(tableExternalSites.self).filter(predicate).sorted(byKeyPath: "idExternalSite", ascending: true)
|
||||
|
||||
let results = realm.objects(tableExternalSites.self).filter("account = %@", tableAccount.account).sorted(byKeyPath: "idExternalSite", ascending: true)
|
||||
|
||||
return Array(results)
|
||||
}
|
||||
|
@ -1256,7 +1278,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func getLocationFromGeoLatitude(_ latitude: String, longitude: String) -> String? {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
guard let result = realm.objects(tableGPS.self).filter("latitude = %@ AND longitude = %@", latitude, longitude).first else {
|
||||
return nil
|
||||
}
|
||||
|
@ -1274,7 +1296,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -1304,7 +1326,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -1324,7 +1346,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -1361,7 +1383,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
guard let result = realm.objects(tableLocalFile.self).filter(predicate).first else {
|
||||
return nil
|
||||
}
|
||||
|
@ -1383,8 +1405,9 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let directoryID = metadata.directoryID
|
||||
let realm = try! Realm()
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
realm.add(metadata, update: true)
|
||||
|
@ -1410,7 +1433,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
for metadata in metadatas {
|
||||
|
@ -1440,7 +1463,7 @@ class NCManageDatabase: NSObject {
|
|||
var directoriesID = [String]()
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
let results = realm.objects(tableMetadata.self).filter(predicate)
|
||||
|
@ -1474,7 +1497,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -1498,7 +1521,7 @@ class NCManageDatabase: NSObject {
|
|||
let directoryID = metadata.directoryID
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
realm.add(metadata, update: true)
|
||||
|
@ -1520,7 +1543,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
guard let result = realm.objects(tableMetadata.self).filter(predicate).first else {
|
||||
|
@ -1566,7 +1589,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
guard let result = realm.objects(tableMetadata.self).filter("account = %@ AND fileID = %@", tableAccount.account, fileID).first else {
|
||||
|
@ -1598,7 +1621,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
guard let result = realm.objects(tableMetadata.self).filter("account = %@ AND directoryID = %@ AND fileName = %@", tableAccount.account, directoryID, fileName).first else {
|
||||
|
@ -1630,7 +1653,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
guard let result = realm.objects(tableMetadata.self).filter("account = %@ AND fileID = %@", tableAccount.account, fileID).first else {
|
||||
|
@ -1662,7 +1685,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
guard let result = realm.objects(tableMetadata.self).filter(predicate).first else {
|
||||
return nil
|
||||
}
|
||||
|
@ -1677,6 +1700,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
let results : Results<tableMetadata>
|
||||
|
||||
if let sorted = sorted {
|
||||
|
@ -1706,7 +1730,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
let results = realm.objects(tableMetadata.self).filter(predicate).sorted(byKeyPath: sorted, ascending: ascending)
|
||||
|
||||
if (results.count > 0 && results.count > index) {
|
||||
|
@ -1723,7 +1747,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
guard let result = realm.objects(tableMetadata.self).filter("account = %@ AND directoryID = %@ AND fileName = %@", tableAccount.account, directoryID, fileName).first else {
|
||||
return nil
|
||||
}
|
||||
|
@ -1782,7 +1806,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
let directories = realm.objects(tableDirectory.self).filter(NSPredicate(format: "account = %@ AND serverUrl BEGINSWITH %@", tableAccount.account, serverUrl)).sorted(byKeyPath: "serverUrl", ascending: true)
|
||||
let directoriesID = Array(directories.map { $0.directoryID })
|
||||
|
||||
|
@ -1801,7 +1825,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
if realm.isInWriteTransaction {
|
||||
|
||||
print("[LOG] Could not write to database, addPhotoLibrary is already in write transaction")
|
||||
|
@ -1854,7 +1878,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
var predicate = NSPredicate()
|
||||
|
||||
if (image && video) {
|
||||
|
@ -1880,7 +1904,7 @@ class NCManageDatabase: NSObject {
|
|||
@objc func getPhotoLibrary(predicate: NSPredicate) -> [tablePhotoLibrary] {
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
let results = realm.objects(tablePhotoLibrary.self).filter(predicate)
|
||||
|
||||
return Array(results.map { tablePhotoLibrary.init(value:$0) })
|
||||
|
@ -1896,7 +1920,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -1931,7 +1955,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
guard let result = realm.objects(tableQueueDownload.self).filter("account = %@", tableAccount.account).first else {
|
||||
|
@ -1969,6 +1993,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
let results : Results<tableQueueDownload>
|
||||
|
||||
if let session = session {
|
||||
|
@ -1991,7 +2016,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
if realm.isInWriteTransaction {
|
||||
|
||||
print("[LOG] Could not write to database, addQueueUpload is already in write transaction")
|
||||
|
@ -2038,7 +2063,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -2077,7 +2102,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
guard let result = realm.objects(tableQueueUpload.self).filter("account = %@ AND selector = %@ AND lock == false", tableAccount.account, selector).sorted(byKeyPath: "date", ascending: true).first else {
|
||||
|
@ -2116,7 +2141,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
guard let result = realm.objects(tableQueueUpload.self).filter("account = %@ AND lock == false", tableAccount.account).sorted(byKeyPath: "date", ascending: true).first else {
|
||||
return nil
|
||||
}
|
||||
|
@ -2142,7 +2167,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
let results = realm.objects(tableQueueUpload.self).filter("account = %@ AND lock = true", tableAccount.account)
|
||||
|
||||
return Array(results.map { tableQueueUpload.init(value:$0) })
|
||||
|
@ -2155,7 +2180,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
let results = realm.objects(tableQueueUpload.self).filter(predicate)
|
||||
|
||||
return Array(results.map { tableQueueUpload.init(value:$0) })
|
||||
|
@ -2168,7 +2193,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
guard let result = realm.objects(tableQueueUpload.self).filter("account = %@ AND assetLocalIdentifier = %@", tableAccount.account, assetLocalIdentifier).first else {
|
||||
|
@ -2193,7 +2218,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -2213,6 +2238,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
let results : Results<tableQueueUpload>
|
||||
|
||||
if let session = session {
|
||||
|
@ -2317,7 +2343,7 @@ class NCManageDatabase: NSObject {
|
|||
var sharesUserAndGroup = sharesUserAndGroup
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
realm.beginWrite()
|
||||
|
||||
let results = realm.objects(tableShare.self).filter("account = %@ AND (shareLink CONTAINS %@ OR shareUserAndGroup CONTAINS %@)", tableAccount.account, share, share)
|
||||
|
@ -2373,7 +2399,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
do {
|
||||
try realm.write {
|
||||
|
||||
|
@ -2510,7 +2536,7 @@ class NCManageDatabase: NSObject {
|
|||
}
|
||||
|
||||
let realm = try! Realm()
|
||||
|
||||
|
||||
let results = realm.objects(tableShare.self).filter("account = %@", tableAccount.account).sorted(byKeyPath: "fileName", ascending: true)
|
||||
|
||||
return Array(results)
|
||||
|
|
|
@ -165,14 +165,12 @@
|
|||
#pragma mark ===== Delete <delegate> =====
|
||||
#pragma--------------------------------------------------------------------------------------------
|
||||
|
||||
- (void)deleteFileOrFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
|
||||
- (void)deleteFileOrFolderSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
|
||||
{
|
||||
NSLog(@"[LOG] DeleteFileOrFolder failure error %d, %@", (int)errorCode, message);
|
||||
}
|
||||
|
||||
- (void)deleteFileOrFolderSuccess:(CCMetadataNet *)metadataNet
|
||||
{
|
||||
[self reloadDatasource];
|
||||
if (errorCode == 0)
|
||||
[self reloadDatasource];
|
||||
else
|
||||
NSLog(@"[LOG] DeleteFileOrFolder failure error %d, %@", (int)errorCode, message);
|
||||
}
|
||||
|
||||
#pragma --------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -59,6 +59,8 @@
|
|||
|
||||
// Theming
|
||||
@property (nonatomic, strong) NSString *themingBackground;
|
||||
@property (nonatomic) BOOL themingBackgroundDefault;
|
||||
@property (nonatomic) BOOL themingBackgroundPlain;
|
||||
@property (nonatomic, strong) NSString *themingColor;
|
||||
@property (nonatomic, strong) NSString *themingColorElement;
|
||||
@property (nonatomic, strong) NSString *themingColorText;
|
||||
|
|
|
@ -1413,6 +1413,16 @@
|
|||
if ([theming valueForKey:@"background"] && ![[theming valueForKey:@"background"] isEqual:[NSNull null]])
|
||||
capabilities.themingBackground = [theming valueForKey:@"background"];
|
||||
|
||||
if ([theming valueForKey:@"background-default"] && ![[theming valueForKey:@"background-default"] isEqual:[NSNull null]]) {
|
||||
NSNumber *result = (NSNumber*)[theming valueForKey:@"background-default"];
|
||||
capabilities.themingBackgroundDefault = result.boolValue;
|
||||
}
|
||||
|
||||
if ([theming valueForKey:@"background-plain"] && ![[theming valueForKey:@"background-plain"] isEqual:[NSNull null]]) {
|
||||
NSNumber *result = (NSNumber*)[theming valueForKey:@"background-plain"];
|
||||
capabilities.themingBackgroundPlain = result.boolValue;
|
||||
}
|
||||
|
||||
if ([theming valueForKey:@"color"] && ![[theming valueForKey:@"color"] isEqual:[NSNull null]])
|
||||
capabilities.themingColor = [theming valueForKey:@"color"];
|
||||
|
||||
|
@ -1893,8 +1903,8 @@
|
|||
if ([data valueForKey:@"address"] && ![[data valueForKey:@"address"] isKindOfClass:[NSNull class]])
|
||||
userProfile.address = [data valueForKey:@"address"];
|
||||
|
||||
if ([data valueForKey:@"displayname"] && ![[data valueForKey:@"displayname"] isKindOfClass:[NSNull class]])
|
||||
userProfile.displayName = [data valueForKey:@"displayname"];
|
||||
if ([data valueForKey:@"display-name"] && ![[data valueForKey:@"display-name"] isKindOfClass:[NSNull class]])
|
||||
userProfile.displayName = [data valueForKey:@"display-name"];
|
||||
|
||||
if ([data valueForKey:@"email"] && ![[data valueForKey:@"email"] isKindOfClass:[NSNull class]])
|
||||
userProfile.email = [data valueForKey:@"email"];
|
||||
|
|
|
@ -269,7 +269,7 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
|
|||
- (void)search:(NSString *)path folder:(NSString *)folder fileName:(NSString *)fileName depth:(NSString *)depth dateLastModified:(NSString *)dateLastModified contentType:(NSString *)contentType user:(NSString *)user userID:(NSString *)userID onCommunication:(OCCommunication *)sharedOCCommunication withUserSessionToken:(NSString *)token success:(void(^)(NSHTTPURLResponse *, id, NSString *token))success failure:(void(^)(NSHTTPURLResponse *, id _Nullable responseObject, NSError *, NSString *token))failure {
|
||||
|
||||
NSString *body;
|
||||
|
||||
|
||||
NSParameterAssert(success);
|
||||
|
||||
_requestMethod = @"SEARCH";
|
||||
|
@ -355,7 +355,8 @@ NSString const *OCWebDAVModificationDateKey = @"modificationdate";
|
|||
NSParameterAssert(success);
|
||||
|
||||
_requestMethod = @"REPORT";
|
||||
|
||||
|
||||
userID = [userID stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]];
|
||||
NSMutableURLRequest *request = [self requestWithMethod:_requestMethod path:[NSString stringWithFormat:@"%@/files/%@%@", path, userID, folder] parameters:nil];
|
||||
|
||||
body = [NSString stringWithFormat: @""
|
||||
|
|
|
@ -321,13 +321,13 @@ extension SwiftWebVC: WKNavigationDelegate {
|
|||
self.delegate?.didFinishLoading(success: true, url: webView.url!)
|
||||
UIApplication.shared.isNetworkActivityIndicatorVisible = false
|
||||
|
||||
webView.evaluateJavaScript("document.title", completionHandler: {(response, error) in
|
||||
webView.evaluateJavaScript("document.title") { (result, error) -> Void in
|
||||
if error == nil {
|
||||
self.navBarTitle.text = response as! String?
|
||||
self.navBarTitle.text = String(describing: result!)
|
||||
self.navBarTitle.sizeToFit()
|
||||
self.updateToolbarItems()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
||||
|
|
|
@ -79,7 +79,7 @@ extension CCLoginWeb: SwiftModalWebVCDelegate {
|
|||
serverUrl = String(serverUrl.dropLast())
|
||||
}
|
||||
|
||||
let username : String = keyValue[1].replacingOccurrences(of: "user:", with: "")
|
||||
let username : String = keyValue[1].replacingOccurrences(of: "user:", with: "").replacingOccurrences(of: "+", with: " ")
|
||||
let password : String = keyValue[2].replacingOccurrences(of: "password:", with: "")
|
||||
|
||||
let account : String = "\(username) \(serverUrl)"
|
||||
|
|
|
@ -872,65 +872,62 @@
|
|||
#pragma mark ===== Delete =====
|
||||
#pragma --------------------------------------------------------------------------------------------
|
||||
|
||||
- (void)deleteFileOrFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
|
||||
- (void)deleteFileOrFolderSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
|
||||
{
|
||||
NSLog(@"[LOG] DeleteFileOrFolder failure error %d, %@", (int)errorCode, message);
|
||||
}
|
||||
|
||||
- (void)deleteFileOrFolderSuccess:(CCMetadataNet *)metadataNet
|
||||
{
|
||||
// reload Main
|
||||
[appDelegate.activeMain reloadDatasource];
|
||||
if (errorCode == 0) {
|
||||
|
||||
// reload Main
|
||||
[appDelegate.activeMain reloadDatasource];
|
||||
|
||||
// If removed document (web) or PDF close
|
||||
if (_webView || _readerPDFViewController)
|
||||
[self removeAllView];
|
||||
// If removed document (web) or PDF close
|
||||
if (_webView || _readerPDFViewController)
|
||||
[self removeAllView];
|
||||
|
||||
// if a message for a directory of these
|
||||
if (![_dataSourceDirectoryID containsObject:metadataNet.directoryID])
|
||||
return;
|
||||
// if a message for a directory of these
|
||||
if (![_dataSourceDirectoryID containsObject:metadataNet.directoryID])
|
||||
return;
|
||||
|
||||
// if we are not in browserPhoto and it's removed photo/video in preview then "< Back"
|
||||
if (!self.photoBrowser && [self.metadataDetail.fileID isEqualToString:metadataNet.fileID]) {
|
||||
// if we are not in browserPhoto and it's removed photo/video in preview then "< Back"
|
||||
if (!self.photoBrowser && [self.metadataDetail.fileID isEqualToString:metadataNet.fileID]) {
|
||||
|
||||
|
||||
NSArray *viewsToRemove = [self.view subviews];
|
||||
for (id element in viewsToRemove) {
|
||||
NSArray *viewsToRemove = [self.view subviews];
|
||||
for (id element in viewsToRemove) {
|
||||
|
||||
if ([element isMemberOfClass:[UIView class]] || [element isMemberOfClass:[UIToolbar class]])
|
||||
[element removeFromSuperview];
|
||||
}
|
||||
if ([element isMemberOfClass:[UIView class]] || [element isMemberOfClass:[UIToolbar class]])
|
||||
[element removeFromSuperview];
|
||||
}
|
||||
|
||||
self.title = @"";
|
||||
self.title = @"";
|
||||
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
// only photoBrowser if exists
|
||||
for (NSUInteger index=0; index < [self.dataSourceImagesVideos count] && _photoBrowser; index++ ) {
|
||||
// only photoBrowser if exists
|
||||
for (NSUInteger index=0; index < [self.dataSourceImagesVideos count] && _photoBrowser; index++ ) {
|
||||
|
||||
tableMetadata *metadata = [self.dataSourceImagesVideos objectAtIndex:index];
|
||||
tableMetadata *metadata = [self.dataSourceImagesVideos objectAtIndex:index];
|
||||
|
||||
// ricerca index
|
||||
if ([metadata.fileID isEqualToString:metadataNet.fileID]) {
|
||||
// ricerca index
|
||||
if ([metadata.fileID isEqualToString:metadataNet.fileID]) {
|
||||
|
||||
[self.dataSourceImagesVideos removeObjectAtIndex:index];
|
||||
[self.dataSourceImagesVideos removeObjectAtIndex:index];
|
||||
[self.photos removeObjectAtIndex:index];
|
||||
[self.photoBrowser reloadData];
|
||||
|
||||
[self.photos removeObjectAtIndex:index];
|
||||
|
||||
[self.photoBrowser reloadData];
|
||||
|
||||
// Title
|
||||
if ([self.dataSourceImagesVideos count] == 0) {
|
||||
// Title
|
||||
if ([self.dataSourceImagesVideos count] == 0) {
|
||||
|
||||
self.title = @"";
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
self.title = @"";
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NSLog(@"[LOG] DeleteFileOrFolder failure error %d, %@", (int)errorCode, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1573,7 +1573,7 @@
|
|||
|
||||
NSString *autoUploadPath = [[NCManageDatabase sharedInstance] getAccountAutoUploadPath:appDelegate.activeUrl];
|
||||
|
||||
// if request create the folder for Photos & the subfolders
|
||||
// if request create the folder for Photos & the subfolders
|
||||
if ([autoUploadPath isEqualToString:serverUrl])
|
||||
if (![[NCAutoUpload sharedInstance] createFolderSubFolderAutoUploadFolderPhotos:autoUploadPath useSubFolder:useSubFolder assets:(PHFetchResult *)assets selector:selectorUploadFile])
|
||||
return;
|
||||
|
@ -1829,7 +1829,7 @@
|
|||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (error) {
|
||||
if (error.code != 404)
|
||||
[appDelegate messageNotification:@"_error_e2ee_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
[appDelegate messageNotification:@"_e2e_error_get_metadata_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
} else {
|
||||
if ([[NCEndToEndMetadata sharedInstance] decoderMetadata:metadata privateKey:[CCUtility getEndToEndPrivateKey:appDelegate.activeAccount] serverUrl:self.serverUrl account:appDelegate.activeAccount url:appDelegate.activeUrl] == false)
|
||||
[appDelegate messageNotification:@"_error_e2ee_" description:@"_e2e_error_decode_metadata_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
|
@ -2034,19 +2034,12 @@
|
|||
#pragma mark ===== Delete File or Folder =====
|
||||
#pragma --------------------------------------------------------------------------------------------
|
||||
|
||||
- (void)deleteFileOrFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
|
||||
- (void)deleteFileOrFolderSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
|
||||
{
|
||||
// Unauthorized
|
||||
if (errorCode == kOCErrorServerUnauthorized)
|
||||
[appDelegate openLoginView:self loginType:loginModifyPasswordUser];
|
||||
|
||||
NSLog(@"[LOG] Delete File failure error %d, %@", (int)errorCode, message);
|
||||
|
||||
[self deleteFileOrFolderSuccess:metadataNet];
|
||||
}
|
||||
|
||||
- (void)deleteFileOrFolderSuccess:(CCMetadataNet *)metadataNet
|
||||
{
|
||||
|
||||
[_queueSelector removeObject:metadataNet.selector];
|
||||
|
||||
if ([_queueSelector count] == 0) {
|
||||
|
@ -2117,7 +2110,7 @@
|
|||
NSString *fileName = [arguments objectAtIndex:1];
|
||||
|
||||
// E2EE
|
||||
if ([CCUtility isFolderEncrypted:self.serverUrl account:appDelegate.activeAccount]) {
|
||||
if (_metadataFolder.e2eEncrypted) {
|
||||
|
||||
// verify if exists the new fileName
|
||||
if ([[NCManageDatabase sharedInstance] getE2eEncryptionWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@ AND fileName = %@", appDelegate.activeAccount, self.serverUrl, fileName]]) {
|
||||
|
@ -2127,9 +2120,7 @@
|
|||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
||||
|
||||
NSString *token;
|
||||
|
||||
NSError *error = [[NCNetworkingSync sharedManager] sendEndToEndMetadataOnServerUrl:self.serverUrl account:appDelegate.activeAccount user:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl fileNameRename:metadata.fileName fileNameNewRename:fileName token:&token];
|
||||
NSError *error = [[NCNetworkingSync sharedManager] sendEndToEndMetadataOnServerUrl:self.serverUrl account:appDelegate.activeAccount user:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl fileNameRename:metadata.fileName fileNameNewRename:fileName];
|
||||
if (error) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[appDelegate messageNotification:@"_error_e2ee_" description:@"_e2e_error_send_metadata_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
|
@ -2139,17 +2130,19 @@
|
|||
}
|
||||
|
||||
// Unlock
|
||||
if (token) {
|
||||
NSError *error = [[NCNetworkingSync sharedManager] unlockEndToEndFolderEncrypted:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl fileID:_metadataFolder.fileID token:token];
|
||||
if (error) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[appDelegate messageNotification:@"_error_e2ee_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
});
|
||||
[[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:self.serverUrl completion:^(NSString * _Nullable token) {
|
||||
if (token != nil) {
|
||||
NSError *error = [[NCNetworkingSync sharedManager] unlockEndToEndFolderEncrypted:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl serverUrl:self.serverUrl fileID:_metadataFolder.fileID token:token];
|
||||
if (error) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[appDelegate messageNotification:@"_e2e_error_unlock_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self reloadDatasource];
|
||||
});
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self reloadDatasource];
|
||||
});
|
||||
}];
|
||||
});
|
||||
|
||||
} else {
|
||||
|
@ -2208,7 +2201,7 @@
|
|||
|
||||
// Add new directory
|
||||
NSString *newDirectory = [NSString stringWithFormat:@"%@/%@", serverUrlTo, fileName];
|
||||
(void)[[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:newDirectory permissions:nil encrypted:false];
|
||||
(void)[[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:newDirectory fileID:nil permissions:nil encrypted:false];
|
||||
}
|
||||
|
||||
// next
|
||||
|
@ -2362,8 +2355,7 @@
|
|||
// Unauthorized
|
||||
if (errorCode == kOCErrorServerUnauthorized)
|
||||
[appDelegate openLoginView:self loginType:loginModifyPasswordUser];
|
||||
|
||||
if (message && errorCode != kOCErrorServerUnauthorized)
|
||||
else
|
||||
[appDelegate messageNotification:@"_create_folder_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
|
||||
|
||||
[[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", metadataNet.fileID] clearDateReadDirectoryID:nil];
|
||||
|
@ -2377,26 +2369,23 @@
|
|||
|
||||
- (void)createFolderSuccess:(CCMetadataNet *)metadataNet
|
||||
{
|
||||
NSString *newDirectory = [NSString stringWithFormat:@"%@/%@", metadataNet.serverUrl, metadataNet.fileName];
|
||||
(void)[[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:newDirectory permissions:nil encrypted:false];
|
||||
NSString *newDirectory = [NSString stringWithFormat:@"%@/%@", metadataNet.serverUrl, metadataNet.fileName];
|
||||
|
||||
tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileName = %@ AND directoryID = %@", metadataNet.fileName, metadataNet.directoryID]];
|
||||
if (_metadataFolder.e2eEncrypted) {
|
||||
|
||||
if (metadata) {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
NSError *error = [[NCNetworkingSync sharedManager] markEndToEndFolderEncrypted:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl fileID:metadataNet.fileID serverUrl:newDirectory];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (error) {
|
||||
[appDelegate messageNotification:@"_e2e_error_mark_folder_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
}
|
||||
[self readFolder:self.serverUrl];
|
||||
});
|
||||
});
|
||||
|
||||
[[NCManageDatabase sharedInstance] deleteMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileName = %@ AND directoryID = %@", metadataNet.fileName, metadataNet.directoryID] clearDateReadDirectoryID:nil];
|
||||
|
||||
metadata.fileID = metadataNet.fileID;
|
||||
metadata.date = metadataNet.date;
|
||||
metadata.permissions = @"RDNVCK";
|
||||
|
||||
(void)[[NCManageDatabase sharedInstance] addMetadata:metadata];
|
||||
|
||||
[self reloadDatasource];
|
||||
|
||||
} else {
|
||||
|
||||
[self readFileReloadFolder];
|
||||
|
||||
[self readFolder:self.serverUrl];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2958,25 +2947,6 @@
|
|||
[[CCActions sharedInstance] settingFavorite:metadata favorite:NO delegate:self];
|
||||
}
|
||||
|
||||
#pragma --------------------------------------------------------------------------------------------
|
||||
#pragma mark ===== E2E Encryption =====
|
||||
#pragma --------------------------------------------------------------------------------------------
|
||||
|
||||
- (void)unlockEndToEndFolderEncryptedSuccess:(CCMetadataNet *)metadataNet
|
||||
{
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithFileID:metadataNet.fileID token:@""];
|
||||
|
||||
[appDelegate messageNotification:@"_success_" description:@"_e2e_remove_folder_lock_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeSuccess errorCode:0];
|
||||
}
|
||||
|
||||
- (void)unlockEndToEndFolderEncryptedFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
|
||||
{
|
||||
if (errorCode == 404)
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithFileID:metadataNet.fileID token:@""];
|
||||
|
||||
[appDelegate messageNotification:@"_error_e2ee_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
|
||||
}
|
||||
|
||||
#pragma --------------------------------------------------------------------------------------------
|
||||
#pragma mark ===== Open in... =====
|
||||
#pragma --------------------------------------------------------------------------------------------
|
||||
|
@ -3432,8 +3402,13 @@
|
|||
[self saveSelectedFiles];
|
||||
}];
|
||||
|
||||
appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.deleteItem,appDelegate.moveItem, appDelegate.downloadItem, appDelegate.saveItem]];
|
||||
|
||||
// E2EE
|
||||
if (_metadataFolder.e2eEncrypted) {
|
||||
appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.deleteItem,appDelegate.downloadItem, appDelegate.saveItem]];
|
||||
} else {
|
||||
appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.deleteItem,appDelegate.moveItem, appDelegate.downloadItem, appDelegate.saveItem]];
|
||||
}
|
||||
|
||||
appDelegate.reSelectMenu.imageOffset = CGSizeMake(5, -1);
|
||||
|
||||
appDelegate.reSelectMenu.separatorOffset = CGSizeMake(50.0, 0.0);
|
||||
|
@ -3941,7 +3916,7 @@
|
|||
return NO;
|
||||
|
||||
// E2EE
|
||||
if ([CCUtility isFolderEncrypted:self.serverUrl account:appDelegate.activeAccount] && [CCUtility isEndToEndEnabled:appDelegate.activeAccount] == NO)
|
||||
if (_metadataFolder.e2eEncrypted && [CCUtility isEndToEndEnabled:appDelegate.activeAccount] == NO)
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
|
@ -4196,11 +4171,10 @@
|
|||
handler:^(AHKActionSheet *as) {
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
||||
NSString *token;
|
||||
NSError *error = [[NCNetworkingSync sharedManager] markEndToEndFolderEncrypted:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl fileID:_metadata.fileID serverUrl:[NSString stringWithFormat:@"%@/%@", self.serverUrl, _metadata.fileName] token:&token];
|
||||
NSError *error = [[NCNetworkingSync sharedManager] markEndToEndFolderEncrypted:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl fileID:_metadata.fileID serverUrl:[NSString stringWithFormat:@"%@/%@", self.serverUrl, _metadata.fileName]];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (error) {
|
||||
[appDelegate messageNotification:@"_error_e2ee_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
[appDelegate messageNotification:@"_e2e_error_mark_folder_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
} else {
|
||||
[[NCManageDatabase sharedInstance] deleteE2eEncryptionWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", appDelegate.activeAccount, [NSString stringWithFormat:@"%@/%@", self.serverUrl, _metadata.fileName]]];
|
||||
[self readFolder:self.serverUrl];
|
||||
|
@ -4219,12 +4193,11 @@
|
|||
type:AHKActionSheetButtonTypeEncrypted
|
||||
handler:^(AHKActionSheet *as) {
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
||||
NSString *token;
|
||||
NSError *error = [[NCNetworkingSync sharedManager] deletemarkEndToEndFolderEncrypted:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl fileID:_metadata.fileID serverUrl:[NSString stringWithFormat:@"%@/%@", self.serverUrl, _metadata.fileName] token:&token];
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
NSError *error = [[NCNetworkingSync sharedManager] deletemarkEndToEndFolderEncrypted:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl fileID:_metadata.fileID serverUrl:[NSString stringWithFormat:@"%@/%@", self.serverUrl, _metadata.fileName]];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (error) {
|
||||
[appDelegate messageNotification:@"_error_e2ee_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
[appDelegate messageNotification:@"_e2e_error_delete_mark_folder_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
} else {
|
||||
[[NCManageDatabase sharedInstance] deleteE2eEncryptionWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", appDelegate.activeAccount, [NSString stringWithFormat:@"%@/%@", self.serverUrl, _metadata.fileName]]];
|
||||
[self readFolder:self.serverUrl];
|
||||
|
@ -4233,28 +4206,7 @@
|
|||
});
|
||||
}];
|
||||
}
|
||||
|
||||
if (directory.e2eTokenLock.length > 0 && [CCUtility isEndToEndEnabled:appDelegate.activeAccount]) {
|
||||
|
||||
[actionSheet addButtonWithTitle:NSLocalizedString(@"_e2e_remove_folder_lock_", nil)
|
||||
image:[UIImage imageNamed:@"encrypted_empty"]
|
||||
backgroundColor:[NCBrandColor sharedInstance].backgroundView
|
||||
height:50.0
|
||||
type:AHKActionSheetButtonTypeEncrypted
|
||||
handler:^(AHKActionSheet *as) {
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
||||
|
||||
NSError *error = [[NCNetworkingSync sharedManager] unlockEndToEndFolderEncrypted:appDelegate.activeUser userID:appDelegate.activeUserID password:appDelegate.activePassword url:appDelegate.activeUrl fileID:_metadata.fileID token:directory.e2eTokenLock];
|
||||
if (error) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[appDelegate messageNotification:@"_error_e2ee_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
});
|
||||
}
|
||||
});
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
[actionSheet show];
|
||||
}
|
||||
|
||||
|
@ -4263,7 +4215,6 @@
|
|||
if (!_metadata.directory) {
|
||||
|
||||
UIImage *iconHeader;
|
||||
BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:self.serverUrl account:appDelegate.activeAccount];
|
||||
|
||||
// assegnamo l'immagine anteprima se esiste, altrimenti metti quella standars
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", appDelegate.directoryUser, _metadata.fileID]])
|
||||
|
@ -4280,7 +4231,7 @@
|
|||
];
|
||||
|
||||
|
||||
if (!isFolderEncrypted) {
|
||||
if (!_metadataFolder.e2eEncrypted) {
|
||||
|
||||
[actionSheet addButtonWithTitle:NSLocalizedString(@"_share_", nil)
|
||||
image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"actionSheetShare"]color:[NCBrandColor sharedInstance].brandElement]
|
||||
|
@ -4333,7 +4284,7 @@
|
|||
[self presentViewController:alertController animated:YES completion:nil];
|
||||
}];
|
||||
|
||||
if (!isFolderEncrypted) {
|
||||
if (!_metadataFolder.e2eEncrypted) {
|
||||
|
||||
[actionSheet addButtonWithTitle:NSLocalizedString(@"_move_", nil)
|
||||
image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"actionSheetMove"] color:[NCBrandColor sharedInstance].brandElement]
|
||||
|
@ -4427,7 +4378,7 @@
|
|||
_directoryOrder = [CCUtility getOrderSettings];
|
||||
|
||||
// Remove optimization for encrypted directory
|
||||
if ([CCUtility isFolderEncrypted:self.serverUrl account:appDelegate.activeAccount])
|
||||
if (_metadataFolder.e2eEncrypted)
|
||||
_dateReadDataSource = nil;
|
||||
|
||||
// current directoryID
|
||||
|
@ -5228,7 +5179,7 @@
|
|||
|
||||
} else {
|
||||
|
||||
if ([CCUtility isFolderEncrypted:self.serverUrl account:appDelegate.activeAccount] && ![CCUtility isEndToEndEnabled:appDelegate.activeAccount]) {
|
||||
if (_metadataFolder.e2eEncrypted && ![CCUtility isEndToEndEnabled:appDelegate.activeAccount]) {
|
||||
|
||||
[appDelegate messageNotification:@"_info_" description:@"_e2e_goto_settings_for_enable_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeInfo errorCode:0];
|
||||
|
||||
|
@ -5342,7 +5293,7 @@
|
|||
{
|
||||
NSString *nomeDir;
|
||||
|
||||
if(self.tableView.editing == NO) {
|
||||
if (self.tableView.editing == NO) {
|
||||
|
||||
NSString *serverUrl = [[NCManageDatabase sharedInstance] getServerUrl:_metadata.directoryID];
|
||||
if (!serverUrl) return;
|
||||
|
@ -5385,6 +5336,13 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// E2EE Check enable
|
||||
if (_metadata.e2eEncrypted && [CCUtility isEndToEndEnabled:appDelegate.activeAccount] == NO) {
|
||||
|
||||
[appDelegate messageNotification:@"_info_" description:@"_e2e_goto_settings_for_enable_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeInfo errorCode:0];
|
||||
return;
|
||||
}
|
||||
|
||||
nomeDir = _metadata.fileName;
|
||||
|
||||
NSString *serverUrlPush = [CCUtility stringAppendServerUrl:serverUrl addFileName:nomeDir];
|
||||
|
|
|
@ -110,26 +110,29 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource, CCLo
|
|||
|
||||
if NCBrandOptions.sharedInstance.disable_more_external_site == false {
|
||||
|
||||
menuExternalSite = NCManageDatabase.sharedInstance.getAllExternalSites(predicate: NSPredicate(format: "(account == '\(appDelegate.activeAccount!)')"))
|
||||
|
||||
for table in menuExternalSite! {
|
||||
menuExternalSite = NCManageDatabase.sharedInstance.getAllExternalSites()
|
||||
|
||||
item = OCExternalSites.init()
|
||||
if menuExternalSite != nil {
|
||||
|
||||
for table in menuExternalSite! {
|
||||
|
||||
item.name = table.name
|
||||
item.url = table.url
|
||||
item.icon = table.icon
|
||||
item = OCExternalSites.init()
|
||||
|
||||
if (table.type == "link") {
|
||||
item.icon = "moreExternalSite"
|
||||
functionMenu.append(item)
|
||||
}
|
||||
if (table.type == "settings") {
|
||||
item.icon = "moreSettingsExternalSite"
|
||||
settingsMenu.append(item)
|
||||
}
|
||||
if (table.type == "quota") {
|
||||
quotaMenu.append(item)
|
||||
item.name = table.name
|
||||
item.url = table.url
|
||||
item.icon = table.icon
|
||||
|
||||
if (table.type == "link") {
|
||||
item.icon = "moreExternalSite"
|
||||
functionMenu.append(item)
|
||||
}
|
||||
if (table.type == "settings") {
|
||||
item.icon = "moreSettingsExternalSite"
|
||||
settingsMenu.append(item)
|
||||
}
|
||||
if (table.type == "quota") {
|
||||
quotaMenu.append(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -375,9 +375,7 @@
|
|||
}
|
||||
|
||||
- (void)createFolderSuccess:(CCMetadataNet *)metadataNet
|
||||
{
|
||||
(void)[[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:[NSString stringWithFormat:@"%@/%@", metadataNet.serverUrl, metadataNet.fileName] permissions:nil encrypted:false];
|
||||
|
||||
{
|
||||
// Load Folder or the Datasource
|
||||
[self readFolder];
|
||||
}
|
||||
|
|
|
@ -982,9 +982,7 @@
|
|||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
||||
|
||||
// Send Metadata
|
||||
NSString *token;
|
||||
|
||||
NSError *error = [[NCNetworkingSync sharedManager] sendEndToEndMetadataOnServerUrl:serverUrl account:_activeAccount user:_activeUser userID:_activeUserID password:_activePassword url:_activeUrl fileNameRename:nil fileNameNewRename:nil token:&token];
|
||||
NSError *error = [[NCNetworkingSync sharedManager] sendEndToEndMetadataOnServerUrl:serverUrl account:_activeAccount user:_activeUser userID:_activeUserID password:_activePassword url:_activeUrl fileNameRename:nil fileNameNewRename:nil];
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
||||
|
@ -1185,23 +1183,31 @@
|
|||
// E2EE : UNLOCK
|
||||
if ([CCUtility isFolderEncrypted:serverUrl account:_activeAccount] && [CCUtility isEndToEndEnabled:_activeAccount]) {
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
|
||||
tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", _activeAccount, serverUrl]];
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
|
||||
tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", _activeAccount, serverUrl]];
|
||||
if (directory.e2eTokenLock.length > 0 && directory.e2eTokenLock) {
|
||||
NSError *error = [[NCNetworkingSync sharedManager] unlockEndToEndFolderEncrypted:_activeUser userID:_activeUserID password:_activePassword url:_activeUrl fileID:directory.fileID token:directory.e2eTokenLock];
|
||||
NSError *error = [[NCNetworkingSync sharedManager] unlockEndToEndFolderEncrypted:_activeUser userID:_activeUserID password:_activePassword url:_activeUrl serverUrl:serverUrl fileID:directory.fileID token:directory.e2eTokenLock];
|
||||
if (error) {
|
||||
#ifndef EXTENSION
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[(AppDelegate *)[[UIApplication sharedApplication] delegate] messageNotification:@"_error_e2ee_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
[(AppDelegate *)[[UIApplication sharedApplication] delegate] messageNotification:@"_e2e_error_unlock_" description:error.localizedDescription visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:error.code];
|
||||
});
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
NSLog(@"Error unlock not found");
|
||||
}
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[[self getDelegate:sessionID] uploadFileSuccessFailure:metadata.fileName fileID:metadata.fileID assetLocalIdentifier:metadata.assetLocalIdentifier serverUrl:serverUrl selector:metadata.sessionSelector selectorPost:metadata.sessionSelectorPost errorMessage:errorMessage errorCode:errorCode];
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
[[self getDelegate:sessionID] uploadFileSuccessFailure:metadata.fileName fileID:metadata.fileID assetLocalIdentifier:metadata.assetLocalIdentifier serverUrl:serverUrl selector:metadata.sessionSelector selectorPost:metadata.sessionSelectorPost errorMessage:errorMessage errorCode:errorCode];
|
||||
[[self getDelegate:sessionID] uploadFileSuccessFailure:metadata.fileName fileID:metadata.fileID assetLocalIdentifier:metadata.assetLocalIdentifier serverUrl:serverUrl selector:metadata.sessionSelector selectorPost:metadata.sessionSelectorPost errorMessage:errorMessage errorCode:errorCode];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma --------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -15,24 +15,24 @@
|
|||
|
||||
- (NSError *)uploadFile:(NSString *)localFilePathName remoteFilePathName:(NSString *)remoteFilePathName user:(NSString *)user userID:(NSString *)userID password:(NSString *)password;
|
||||
- (NSError *)checkServer:(NSString *)serverUrl user:(NSString *)user userID:(NSString *)userID password:(NSString *)password;
|
||||
- (NSError *)readFile:(NSString *)filePathName user:(NSString *)user userID:(NSString *)userID password:(NSString *)password items:(NSArray **)items;
|
||||
- (NSError *)readFolder:(NSString *)serverUrl user:(NSString *)user userID:(NSString *)userID password:(NSString *)password items:(NSArray **)items;
|
||||
- (NSError *)createFolderAutomaticUpload:(NSString *)folderPathName user:(NSString *)user userID:(NSString *)userID password:(NSString *)password;
|
||||
- (NSError *)readFile:(NSString *)filePathName user:(NSString *)user userID:(NSString *)userID password:(NSString *)password items:(NSArray **)items;
|
||||
- (NSError *)readFolder:(NSString *)serverUrl user:(NSString *)user userID:(NSString *)userID password:(NSString *)password items:(NSArray **)items;
|
||||
- (NSError *)createFolder:(NSString *)folderPathName user:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url encrypted:(BOOL)encrypted fileID:(NSString **)fileID;
|
||||
|
||||
// ===== End-to-End Encryption =====
|
||||
|
||||
- (NSError *)markEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl token:(NSString **)token;
|
||||
- (NSError *)deletemarkEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl token:(NSString **)token;
|
||||
- (NSError *)markEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl;
|
||||
- (NSError *)deletemarkEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl;
|
||||
|
||||
- (NSError *)getEndToEndMetadata:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID metadata:(NSString **)metadata;
|
||||
- (NSError *)deleteEndToEndMetadata:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID;
|
||||
- (NSError *)storeEndToEndMetadata:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID metadata:(NSString *)metadata token:(NSString **)token;
|
||||
- (NSError *)updateEndToEndMetadata:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID metadata:(NSString *)metadata token:(NSString **)token;
|
||||
- (NSError *)deleteEndToEndMetadata:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url serverUrl:(NSString *)serverUrl fileID:(NSString *)fileID unlock:(BOOL)unlock;
|
||||
- (NSError *)storeEndToEndMetadata:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url serverUrl:(NSString *)serverUrl fileID:(NSString *)fileID metadata:(NSString *)metadata unlock:(BOOL)unlock;
|
||||
- (NSError *)updateEndToEndMetadata:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url serverUrl:(NSString *)serverUrl fileID:(NSString *)fileID metadata:(NSString *)metadata unlock:(BOOL)unlock;
|
||||
|
||||
- (NSError *)lockEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID token:(NSString **)token;
|
||||
- (NSError *)unlockEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID token:(NSString *)token;
|
||||
- (NSError *)lockEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url serverUrl:(NSString *)serverUrl fileID:(NSString *)fileID;
|
||||
- (NSError *)unlockEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url serverUrl:(NSString *)serverUrl fileID:(NSString *)fileID token:(NSString *)token;
|
||||
|
||||
- (NSError *)sendEndToEndMetadataOnServerUrl:(NSString *)serverUrl account:(NSString *)account user:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileNameRename:(NSString *)fileName fileNameNewRename:(NSString *)fileNameNew token:(NSString **)token;
|
||||
- (NSError *)rebuildAndSendEndToEndMetadataOnServerUrl:(NSString *)serverUrl account:(NSString *)account user:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url token:(NSString **)token;
|
||||
- (NSError *)sendEndToEndMetadataOnServerUrl:(NSString *)serverUrl account:(NSString *)account user:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileNameRename:(NSString *)fileName fileNameNewRename:(NSString *)fileNameNew;
|
||||
- (NSError *)rebuildAndSendEndToEndMetadataOnServerUrl:(NSString *)serverUrl account:(NSString *)account user:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url;
|
||||
|
||||
@end
|
||||
|
|
|
@ -150,11 +150,12 @@
|
|||
return returnError;
|
||||
}
|
||||
|
||||
- (NSError *)createFolderAutomaticUpload:(NSString *)folderPathName user:(NSString *)user userID:(NSString *)userID password:(NSString *)password
|
||||
- (NSError *)createFolder:(NSString *)folderPathName user:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url encrypted:(BOOL)encrypted fileID:(NSString **)fileID
|
||||
{
|
||||
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
||||
|
||||
__block NSError *returnError = nil;
|
||||
__block NSString *returnFileID = nil;
|
||||
|
||||
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
||||
|
||||
|
@ -169,8 +170,28 @@
|
|||
|
||||
[communication createFolder:folderPathName onCommunication:communication withForbiddenCharactersSupported:YES successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
|
||||
[[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:[CCUtility deletingLastPathComponentFromServerUrl:folderPathName] directoryID:nil];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
NSDictionary *fields = [response allHeaderFields];
|
||||
returnFileID = [CCUtility removeForbiddenCharactersFileSystem:[fields objectForKey:@"OC-FileId"]];
|
||||
|
||||
if (encrypted) {
|
||||
|
||||
// MARK
|
||||
[communication markEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:returnFileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
|
||||
[[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:[CCUtility deletingLastPathComponentFromServerUrl:folderPathName] directoryID:nil];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_mark_folder_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
} else {
|
||||
|
||||
[[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:[CCUtility deletingLastPathComponentFromServerUrl:folderPathName] directoryID:nil];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
|
@ -188,6 +209,7 @@
|
|||
while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER))
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:k_timeout_webdav]];
|
||||
|
||||
*fileID = returnFileID;
|
||||
return returnError;
|
||||
}
|
||||
#pragma --------------------------------------------------------------------------------------------
|
||||
|
@ -195,157 +217,163 @@
|
|||
#pragma --------------------------------------------------------------------------------------------
|
||||
// E2EE
|
||||
|
||||
- (NSError *)markEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl token:(NSString **)token
|
||||
- (NSError *)markEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl
|
||||
{
|
||||
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
||||
|
||||
__block NSError *returnError = nil;
|
||||
__block NSString *returnToken = *token;
|
||||
|
||||
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
||||
|
||||
[communication setCredentialsWithUser:user andUserID:userID andPassword:password];
|
||||
[communication setUserAgent:[CCUtility getUserAgent]];
|
||||
|
||||
// Read Folder
|
||||
[communication readFolder:serverUrl depth:@"1" withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *tokenReadFolder) {
|
||||
|
||||
if (items.count > 1) {
|
||||
|
||||
returnError = [NSError errorWithDomain:@"com.nextcloud.nextcloud" code:999 userInfo:[NSDictionary dictionaryWithObject:NSLocalizedString(@"_e2e_error_directory_not_empty_", nil) forKey:NSLocalizedDescriptionKey]];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
return;
|
||||
}
|
||||
|
||||
// LOCK
|
||||
[communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:returnToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
||||
|
||||
returnToken = token;
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithFileID:fileID token:returnToken];
|
||||
[[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl completion:^(NSString * _Nullable tokenDatabase) {
|
||||
|
||||
// REMOVE METADATA
|
||||
[communication deleteEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
NSLog(@"[LOG] Found metadata and delete");
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
NSLog(@"[LOG] %@", [NSString stringWithFormat:@"Remove metadata error %d", (int)response.statusCode]);
|
||||
}];
|
||||
// Read Folder
|
||||
[communication readFolder:serverUrl depth:@"1" withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *tokenReadFolder) {
|
||||
|
||||
if (items.count > 1) {
|
||||
|
||||
returnError = [NSError errorWithDomain:@"com.nextcloud.nextcloud" code:999 userInfo:[NSDictionary dictionaryWithObject:NSLocalizedString(@"_e2e_error_directory_not_empty_", nil) forKey:NSLocalizedDescriptionKey]];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
return;
|
||||
}
|
||||
|
||||
// MARK
|
||||
[communication markEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
// LOCK
|
||||
[communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:tokenDatabase onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
||||
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
||||
|
||||
// UNLOCK
|
||||
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:returnToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
|
||||
returnToken = nil;
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithFileID:fileID token:@""];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
|
||||
// REMOVE METADATA
|
||||
[communication deleteEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
NSLog(@"[LOG] Found metadata and delete");
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
NSLog(@"[LOG] %@", [NSString stringWithFormat:@"Remove metadata error %d", (int)response.statusCode]);
|
||||
}];
|
||||
|
||||
// MARK
|
||||
[communication markEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
|
||||
// UNLOCK
|
||||
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_mark_folder_"];
|
||||
|
||||
// UNLOCK
|
||||
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
}];
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_mark_folder_"];
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_error_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_error_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
|
||||
}];
|
||||
|
||||
while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER))
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:k_timeout_webdav]];
|
||||
|
||||
*token = returnToken;
|
||||
return returnError;
|
||||
}
|
||||
|
||||
- (NSError *)deletemarkEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl token:(NSString **)token
|
||||
- (NSError *)deletemarkEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl
|
||||
{
|
||||
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
||||
|
||||
__block NSError *returnError = nil;
|
||||
__block NSString *returnToken = *token;
|
||||
|
||||
|
||||
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
||||
|
||||
[communication setCredentialsWithUser:user andUserID:userID andPassword:password];
|
||||
[communication setUserAgent:[CCUtility getUserAgent]];
|
||||
|
||||
// Read Folder
|
||||
[communication readFolder:serverUrl depth:@"1" withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *tokenReadFolder) {
|
||||
[[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl completion:^(NSString * _Nullable tokenDatabase) {
|
||||
|
||||
// Read Folder
|
||||
[communication readFolder:serverUrl depth:@"1" withUserSessionToken:nil onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer, NSString *tokenReadFolder) {
|
||||
|
||||
if (items.count > 1) {
|
||||
if (items.count > 1) {
|
||||
|
||||
returnError = [NSError errorWithDomain:@"com.nextcloud.nextcloud" code:999 userInfo:[NSDictionary dictionaryWithObject:NSLocalizedString(@"_e2e_error_directory_not_empty_", nil) forKey:NSLocalizedDescriptionKey]];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
return;
|
||||
}
|
||||
returnError = [NSError errorWithDomain:@"com.nextcloud.nextcloud" code:999 userInfo:[NSDictionary dictionaryWithObject:NSLocalizedString(@"_e2e_error_directory_not_empty_", nil) forKey:NSLocalizedDescriptionKey]];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
return;
|
||||
}
|
||||
|
||||
// LOCK
|
||||
[communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:returnToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
||||
// LOCK
|
||||
[communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:tokenDatabase onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
||||
|
||||
returnToken = token;
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithFileID:fileID token:returnToken];
|
||||
|
||||
// DELETE METADATA
|
||||
[communication deleteEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
NSLog(@"[LOG] Found metadata and delete");
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
NSLog(@"[LOG] %@", [NSString stringWithFormat:@"Remove metadata error %d", (int)response.statusCode]);
|
||||
}];
|
||||
|
||||
// DELETE MARK
|
||||
[communication deletemarkEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
||||
|
||||
// UNLOCK
|
||||
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:returnToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
|
||||
returnToken = nil;
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithFileID:fileID token:@""];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
|
||||
// DELETE METADATA
|
||||
[communication deleteEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
NSLog(@"[LOG] Found metadata and delete");
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
NSLog(@"[LOG] %@", [NSString stringWithFormat:@"Remove metadata error %d", (int)response.statusCode]);
|
||||
}];
|
||||
|
||||
// DELETE MARK
|
||||
[communication deletemarkEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
|
||||
// UNLOCK
|
||||
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_delete_mark_folder_"];
|
||||
|
||||
// UNLOCK
|
||||
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
}];
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_delete_mark_folder_"];
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_error_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *token, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_error_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
|
||||
while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER))
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:k_timeout_webdav]];
|
||||
|
||||
*token = returnToken;
|
||||
return returnError;
|
||||
}
|
||||
|
||||
|
@ -379,7 +407,7 @@
|
|||
return returnError;
|
||||
}
|
||||
|
||||
- (NSError *)deleteEndToEndMetadata:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID
|
||||
- (NSError *)deleteEndToEndMetadata:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url serverUrl:(NSString *)serverUrl fileID:(NSString *)fileID unlock:(BOOL)unlock
|
||||
{
|
||||
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
||||
|
||||
|
@ -390,140 +418,230 @@
|
|||
[communication setCredentialsWithUser:user andUserID:userID andPassword:password];
|
||||
[communication setUserAgent:[CCUtility getUserAgent]];
|
||||
|
||||
[communication deleteEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
[[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl completion:^(NSString * _Nullable tokenDatabase) {
|
||||
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_delete_metadata_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER))
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:k_timeout_webdav]];
|
||||
|
||||
return returnError;
|
||||
}
|
||||
|
||||
- (NSError *)storeEndToEndMetadata:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID metadata:(NSString *)metadata token:(NSString **)token
|
||||
{
|
||||
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
||||
|
||||
__block NSError *returnError = nil;
|
||||
__block NSString *returnToken = nil;
|
||||
|
||||
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
||||
|
||||
[communication setCredentialsWithUser:user andUserID:userID andPassword:password];
|
||||
[communication setUserAgent:[CCUtility getUserAgent]];
|
||||
|
||||
// LOCK
|
||||
[communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:*token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
||||
|
||||
returnToken = token;
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithFileID:fileID token:returnToken];
|
||||
|
||||
// STORE METADATA
|
||||
[communication storeEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID encryptedMetadata:metadata onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer) {
|
||||
// LOCK
|
||||
[communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:tokenDatabase onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
||||
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
||||
|
||||
// DELETE METADATA
|
||||
[communication deleteEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
|
||||
// UNLOCK
|
||||
if (unlock) {
|
||||
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
// Write DB token ""
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
} else {
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_delete_metadata_"];
|
||||
|
||||
// UNLOCK
|
||||
if (unlock) {
|
||||
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
// Write DB token ""
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
} else {
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}
|
||||
}];
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_store_metadata_"];
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER))
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:k_timeout_webdav]];
|
||||
|
||||
*token = returnToken;
|
||||
return returnError;
|
||||
}
|
||||
|
||||
- (NSError *)updateEndToEndMetadata:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID metadata:(NSString *)metadata token:(NSString **)token
|
||||
- (NSError *)storeEndToEndMetadata:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url serverUrl:(NSString *)serverUrl fileID:(NSString *)fileID metadata:(NSString *)metadata unlock:(BOOL)unlock
|
||||
{
|
||||
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
||||
|
||||
__block NSError *returnError = nil;
|
||||
__block NSString *returnToken = nil;
|
||||
|
||||
|
||||
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
||||
|
||||
[communication setCredentialsWithUser:user andUserID:userID andPassword:password];
|
||||
[communication setUserAgent:[CCUtility getUserAgent]];
|
||||
|
||||
// LOCK
|
||||
[communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:*token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
||||
[[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl completion:^(NSString * _Nullable tokenDatabase) {
|
||||
|
||||
// LOCK
|
||||
[communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:tokenDatabase onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
||||
|
||||
returnToken = token;
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithFileID:fileID token:returnToken];
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
||||
|
||||
// UPDATA METADATA
|
||||
[communication updateEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID encryptedMetadata:metadata token:returnToken onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer) {
|
||||
// STORE METADATA
|
||||
[communication storeEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID encryptedMetadata:metadata onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer) {
|
||||
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
// UNLOCK
|
||||
if (unlock) {
|
||||
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
// Write DB token ""
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
} else {
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_store_metadata_"];
|
||||
|
||||
// UNLOCK
|
||||
if (unlock) {
|
||||
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
// Write DB token ""
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
} else {
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}
|
||||
}];
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_update_metadata_"];
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
|
||||
while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER))
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:k_timeout_webdav]];
|
||||
|
||||
*token = returnToken;
|
||||
return returnError;
|
||||
}
|
||||
|
||||
- (NSError *)lockEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID token:(NSString **)token
|
||||
- (NSError *)updateEndToEndMetadata:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url serverUrl:(NSString *)serverUrl fileID:(NSString *)fileID metadata:(NSString *)metadata unlock:(BOOL)unlock
|
||||
{
|
||||
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
||||
|
||||
__block NSError *returnError = nil;
|
||||
__block NSString *returnToken = nil;
|
||||
|
||||
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
||||
|
||||
[communication setCredentialsWithUser:user andUserID:userID andPassword:password];
|
||||
[communication setUserAgent:[CCUtility getUserAgent]];
|
||||
|
||||
// LOCK
|
||||
[communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:*token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
||||
[[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl completion:^(NSString * _Nullable tokenDatabase) {
|
||||
|
||||
// LOCK
|
||||
[communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:tokenDatabase onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
||||
|
||||
// Write DB token
|
||||
returnToken = token;
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithFileID:fileID token:returnToken];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
// UPDATA METADATA
|
||||
[communication updateEndToEndMetadata:[url stringByAppendingString:@"/"] fileID:fileID encryptedMetadata:metadata token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *encryptedMetadata, NSString *redirectedServer) {
|
||||
|
||||
// UNLOCK
|
||||
if (unlock) {
|
||||
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
// Write DB token ""
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
} else {
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_update_metadata_"];
|
||||
|
||||
// UNLOCK
|
||||
if (unlock) {
|
||||
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
// Write DB token ""
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_unlock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
} else {
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}
|
||||
}];
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
}];
|
||||
|
||||
|
||||
while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER))
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:k_timeout_webdav]];
|
||||
|
||||
*token = returnToken;
|
||||
return returnError;
|
||||
}
|
||||
|
||||
- (NSError *)unlockEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileID:(NSString *)fileID token:(NSString *)token
|
||||
- (NSError *)lockEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url serverUrl:(NSString *)serverUrl fileID:(NSString *)fileID
|
||||
{
|
||||
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
||||
|
||||
__block NSError *returnError = nil;
|
||||
|
||||
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
||||
|
||||
[communication setCredentialsWithUser:user andUserID:userID andPassword:password];
|
||||
[communication setUserAgent:[CCUtility getUserAgent]];
|
||||
|
||||
[[NCManageDatabase sharedInstance] getDirectoryE2ETokenLockWithServerUrl:serverUrl completion:^(NSString * _Nullable tokenDatabase) {
|
||||
|
||||
// LOCK
|
||||
[communication lockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:tokenDatabase onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *token, NSString *redirectedServer) {
|
||||
|
||||
// Write DB token
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:token];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
||||
returnError = [self getError:response error:error descriptionDefault:@"_e2e_error_lock_"];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
}];
|
||||
|
||||
while (dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER))
|
||||
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:k_timeout_webdav]];
|
||||
|
||||
return returnError;
|
||||
}
|
||||
|
||||
- (NSError *)unlockEndToEndFolderEncrypted:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url serverUrl:(NSString *)serverUrl fileID:(NSString *)fileID token:(NSString *)token
|
||||
{
|
||||
OCCommunication *communication = [CCNetworking sharedNetworking].sharedOCCommunication;
|
||||
|
||||
|
@ -538,7 +656,7 @@
|
|||
[communication unlockEndToEndFolderEncrypted:[url stringByAppendingString:@"/"] fileID:fileID token:token onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
|
||||
// Write DB token ""
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithFileID:fileID token:@""];
|
||||
[[NCManageDatabase sharedInstance] setDirectoryE2ETokenLockWithServerUrl:serverUrl token:@""];
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
|
||||
} failureRequest:^(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer) {
|
||||
|
@ -553,12 +671,10 @@
|
|||
return returnError;
|
||||
}
|
||||
|
||||
- (NSError *)sendEndToEndMetadataOnServerUrl:(NSString *)serverUrl account:(NSString *)account user:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileNameRename:(NSString *)fileName fileNameNewRename:(NSString *)fileNameNew token:(NSString **)token
|
||||
- (NSError *)sendEndToEndMetadataOnServerUrl:(NSString *)serverUrl account:(NSString *)account user:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url fileNameRename:(NSString *)fileName fileNameNewRename:(NSString *)fileNameNew
|
||||
{
|
||||
tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", account, serverUrl]];
|
||||
*token = directory.e2eTokenLock;
|
||||
|
||||
NSString *e2eTokenLock = *token;
|
||||
NSString *metadata;
|
||||
NSError *error;
|
||||
|
||||
|
@ -586,17 +702,15 @@
|
|||
|
||||
// send Metadata
|
||||
if (error == nil)
|
||||
error = [[NCNetworkingSync sharedManager] updateEndToEndMetadata:user userID:userID password:password url:url fileID:directory.fileID metadata:e2eMetadataJSON token:&e2eTokenLock];
|
||||
error = [[NCNetworkingSync sharedManager] updateEndToEndMetadata:user userID:userID password:password url:url serverUrl:serverUrl fileID:directory.fileID metadata:e2eMetadataJSON unlock:NO];
|
||||
else if (error.code == 404)
|
||||
error = [[NCNetworkingSync sharedManager] storeEndToEndMetadata:user userID:userID password:password url:url fileID:directory.fileID metadata:e2eMetadataJSON token:&e2eTokenLock];
|
||||
error = [[NCNetworkingSync sharedManager] storeEndToEndMetadata:user userID:userID password:password url:url serverUrl:serverUrl fileID:directory.fileID metadata:e2eMetadataJSON unlock:NO];
|
||||
|
||||
*token = e2eTokenLock;
|
||||
return error;
|
||||
}
|
||||
|
||||
- (NSError *)rebuildAndSendEndToEndMetadataOnServerUrl:(NSString *)serverUrl account:(NSString *)account user:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url token:(NSString **)token
|
||||
- (NSError *)rebuildAndSendEndToEndMetadataOnServerUrl:(NSString *)serverUrl account:(NSString *)account user:(NSString *)user userID:(NSString *)userID password:(NSString *)password url:(NSString *)url
|
||||
{
|
||||
NSString *e2eTokenLock = *token;
|
||||
NSError *error;
|
||||
NSString *e2eMetadataJSON;
|
||||
|
||||
|
@ -611,14 +725,13 @@
|
|||
if (!e2eMetadataJSON)
|
||||
return [NSError errorWithDomain:@"com.nextcloud.nextcloud" code:k_CCErrorInternalError userInfo:[NSDictionary dictionaryWithObject:NSLocalizedString(@"_e2e_error_encode_metadata_", nil) forKey:NSLocalizedDescriptionKey]];
|
||||
|
||||
error = [[NCNetworkingSync sharedManager] updateEndToEndMetadata:user userID:userID password:password url:url fileID:directory.fileID metadata:e2eMetadataJSON token:&e2eTokenLock];
|
||||
error = [[NCNetworkingSync sharedManager] updateEndToEndMetadata:user userID:userID password:password url:url serverUrl:serverUrl fileID:directory.fileID metadata:e2eMetadataJSON unlock:YES];
|
||||
|
||||
} else {
|
||||
|
||||
error = [[NCNetworkingSync sharedManager] deleteEndToEndMetadata:user userID:userID password:password url:url fileID:directory.fileID];
|
||||
[[NCNetworkingSync sharedManager] deleteEndToEndMetadata:user userID:userID password:password url:url serverUrl:serverUrl fileID:directory.fileID unlock:YES];
|
||||
}
|
||||
|
||||
*token = e2eTokenLock;
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -633,8 +746,10 @@
|
|||
if (errorDescription == nil) errorDescription = NSLocalizedString(descriptionDefault, @"");
|
||||
}
|
||||
|
||||
if (errorDescription.length >= 200) {
|
||||
errorDescription = [errorDescription substringToIndex:200];
|
||||
errorDescription = [NSString stringWithFormat:@"%@ [%ld] - %@", NSLocalizedString(descriptionDefault, @""), errorCode, errorDescription];
|
||||
|
||||
if (errorDescription.length >= 250) {
|
||||
errorDescription = [errorDescription substringToIndex:250];
|
||||
errorDescription = [errorDescription stringByAppendingString:@" ..."];
|
||||
}
|
||||
|
||||
|
|
|
@ -57,8 +57,7 @@
|
|||
- (void)createFolderSuccess:(CCMetadataNet *)metadataNet;
|
||||
- (void)createFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
|
||||
|
||||
- (void)deleteFileOrFolderSuccess:(CCMetadataNet *)metadataNet;
|
||||
- (void)deleteFileOrFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
|
||||
- (void)deleteFileOrFolderSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode;
|
||||
|
||||
- (void)moveSuccess:(CCMetadataNet *)metadataNet;
|
||||
- (void)renameSuccess:(CCMetadataNet *)metadataNet;
|
||||
|
|
|
@ -242,7 +242,7 @@
|
|||
OCFileDto *itemDtoFolder = [items objectAtIndex:0];
|
||||
//NSDate *date = [NSDate dateWithTimeIntervalSince1970:itemDtoDirectory.date];
|
||||
|
||||
NSString *directoryID = [[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:_metadataNet.serverUrl permissions:itemDtoFolder.permissions encrypted:itemDtoFolder.isEncrypted];
|
||||
NSString *directoryID = [[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:_metadataNet.serverUrl fileID:itemDtoFolder.ocId permissions:itemDtoFolder.permissions encrypted:itemDtoFolder.isEncrypted];
|
||||
_metadataNet.directoryID = directoryID;
|
||||
|
||||
NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
|
||||
|
@ -290,18 +290,20 @@
|
|||
OCFileDto *itemDto = [itemsSortedArray objectAtIndex:i];
|
||||
|
||||
itemDto.fileName = [itemDto.fileName stringByRemovingPercentEncoding];
|
||||
NSString *fileName = itemDto.fileName;
|
||||
NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
|
||||
|
||||
// Skip hidden files
|
||||
if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
|
||||
if (fileName.length > 0) {
|
||||
if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
|
||||
continue;
|
||||
} else
|
||||
continue;
|
||||
|
||||
if (itemDto.isDirectory) {
|
||||
|
||||
fileName = [fileName substringToIndex:[fileName length] - 1];
|
||||
serverUrl = [CCUtility stringAppendServerUrl:_metadataNet.serverUrl addFileName:fileName];
|
||||
|
||||
(void)[[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:serverUrl permissions:itemDtoFolder.permissions encrypted:itemDto.isEncrypted];
|
||||
(void)[[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:serverUrl fileID:itemDtoFolder.ocId permissions:itemDtoFolder.permissions encrypted:itemDto.isEncrypted];
|
||||
}
|
||||
|
||||
// ----- BUG #942 ---------
|
||||
|
@ -381,7 +383,6 @@
|
|||
|
||||
NSMutableArray *metadatas = [NSMutableArray new];
|
||||
BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
|
||||
BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:_metadataNet.serverUrl account:_metadataNet.account];
|
||||
|
||||
NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
|
||||
NSString *autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:_activeUrl];
|
||||
|
@ -394,13 +395,13 @@
|
|||
NSString *serverUrl;
|
||||
|
||||
itemDto.fileName = [itemDto.fileName stringByRemovingPercentEncoding];
|
||||
|
||||
NSString *fileName = itemDto.fileName;
|
||||
if (itemDto.isDirectory)
|
||||
fileName = [fileName substringToIndex:[fileName length] - 1];
|
||||
|
||||
NSString *fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
|
||||
|
||||
// Skip hidden files
|
||||
if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
|
||||
if (fileName.length > 0) {
|
||||
if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
|
||||
continue;
|
||||
} else
|
||||
continue;
|
||||
|
||||
// ----- BUG #942 ---------
|
||||
|
@ -433,7 +434,8 @@
|
|||
serverUrl = [CCUtility stringAppendServerUrl:[_activeUrl stringByAppendingString:webDAV] addFileName:serverUrl];
|
||||
serverUrl = [serverUrl stringByRemovingPercentEncoding];
|
||||
|
||||
NSString *directoryID = [[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:serverUrl permissions:itemDto.permissions encrypted:itemDto.isEncrypted];
|
||||
NSString *directoryID = [[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:serverUrl fileID:itemDto.ocId permissions:itemDto.permissions encrypted:itemDto.isEncrypted];
|
||||
BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:_metadataNet.account];
|
||||
|
||||
[metadatas addObject:[CCUtility trasformedOCFileToCCMetadata:itemDto fileName:itemDto.fileName serverUrl:serverUrl directoryID:directoryID autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:_metadataNet.account directoryUser:directoryUser isFolderEncrypted:isFolderEncrypted]];
|
||||
}
|
||||
|
@ -531,7 +533,6 @@
|
|||
|
||||
NSMutableArray *metadatas = [NSMutableArray new];
|
||||
BOOL showHiddenFiles = [CCUtility getShowHiddenFiles];
|
||||
BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:_metadataNet.serverUrl account:_metadataNet.account];
|
||||
|
||||
NSString *autoUploadFileName = [[NCManageDatabase sharedInstance] getAccountAutoUploadFileName];
|
||||
NSString *autoUploadDirectory = [[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:_activeUrl];
|
||||
|
@ -552,17 +553,17 @@
|
|||
|
||||
for(OCFileDto *itemDto in items) {
|
||||
|
||||
NSString *serverUrl;
|
||||
NSString *serverUrl, *fileName;
|
||||
|
||||
itemDto.fileName = [itemDto.fileName stringByRemovingPercentEncoding];
|
||||
itemDto.filePath = [itemDto.filePath stringByRemovingPercentEncoding];
|
||||
|
||||
NSString *fileName = itemDto.fileName;
|
||||
if (itemDto.isDirectory)
|
||||
fileName = [fileName substringToIndex:[fileName length] - 1];
|
||||
fileName = [itemDto.fileName stringByReplacingOccurrencesOfString:@"/" withString:@""];
|
||||
|
||||
// Skip hidden files
|
||||
if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
|
||||
if (fileName.length > 0) {
|
||||
if (!showHiddenFiles && [[fileName substringToIndex:1] isEqualToString:@"."])
|
||||
continue;
|
||||
} else
|
||||
continue;
|
||||
|
||||
// ----- BUG #942 ---------
|
||||
|
@ -596,8 +597,9 @@
|
|||
serverUrl = [CCUtility stringAppendServerUrl:[_activeUrl stringByAppendingString:webDAV] addFileName:serverUrl];
|
||||
serverUrl = [serverUrl stringByRemovingPercentEncoding];
|
||||
|
||||
NSString *directoryID = [[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:serverUrl permissions:itemDto.permissions encrypted:itemDto.isEncrypted];
|
||||
|
||||
NSString *directoryID = [[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:serverUrl fileID:itemDto.ocId permissions:itemDto.permissions encrypted:itemDto.isEncrypted];
|
||||
BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:serverUrl account:_metadataNet.account];
|
||||
|
||||
[metadatas addObject:[CCUtility trasformedOCFileToCCMetadata:itemDto fileName:itemDto.fileName serverUrl:serverUrl directoryID:directoryID autoUploadFileName:autoUploadFileName autoUploadDirectory:autoUploadDirectory activeAccount:_metadataNet.account directoryUser:directoryUser isFolderEncrypted:isFolderEncrypted]];
|
||||
}
|
||||
|
||||
|
@ -720,8 +722,8 @@
|
|||
|
||||
[communication deleteFileOrFolder:serverFileUrl onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
|
||||
|
||||
if ([_metadataNet.selector rangeOfString:selectorDelete].location != NSNotFound && [self.delegate respondsToSelector:@selector(deleteFileOrFolderSuccess:)])
|
||||
[self.delegate deleteFileOrFolderSuccess:_metadataNet];
|
||||
if ([_metadataNet.selector rangeOfString:selectorDelete].location != NSNotFound && [self.delegate respondsToSelector:@selector(deleteFileOrFolderSuccessFailure:message:errorCode:)])
|
||||
[self.delegate deleteFileOrFolderSuccessFailure:_metadataNet message:@"" errorCode:0];
|
||||
|
||||
[self complete];
|
||||
|
||||
|
@ -732,12 +734,12 @@
|
|||
errorCode = error.code;
|
||||
|
||||
// Error
|
||||
if ([self.delegate respondsToSelector:@selector(deleteFileOrFolderFailure:message:errorCode:)]) {
|
||||
if ([self.delegate respondsToSelector:@selector(deleteFileOrFolderSuccessFailure:message:errorCode:)]) {
|
||||
|
||||
if (errorCode == 503)
|
||||
[self.delegate deleteFileOrFolderFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
|
||||
[self.delegate deleteFileOrFolderSuccessFailure:_metadataNet message:NSLocalizedStringFromTable(@"_server_error_retry_", @"Error", nil) errorCode:errorCode];
|
||||
else
|
||||
[self.delegate deleteFileOrFolderFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
|
||||
[self.delegate deleteFileOrFolderSuccessFailure:_metadataNet message:[error.userInfo valueForKey:@"NSLocalizedDescription"] errorCode:errorCode];
|
||||
}
|
||||
|
||||
// Request trusted certificated
|
||||
|
@ -837,7 +839,7 @@
|
|||
[communication readFile:fileName onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSArray *items, NSString *redirectedServer) {
|
||||
|
||||
tableAccount *recordAccount = [[NCManageDatabase sharedInstance] getAccountActive];
|
||||
BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:_metadataNet.serverUrl account:_metadataNet.account];
|
||||
BOOL isFolderEncrypted = [CCUtility isFolderEncrypted:fileName account:_metadataNet.account];
|
||||
|
||||
if ([recordAccount.account isEqualToString:_metadataNet.account] && [items count] > 0) {
|
||||
|
||||
|
|
|
@ -414,12 +414,7 @@
|
|||
#pragma mark ===== Delete =====
|
||||
#pragma--------------------------------------------------------------------------------------------
|
||||
|
||||
- (void)deleteFileOrFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
|
||||
{
|
||||
[self deleteFileOrFolderSuccess:metadataNet];
|
||||
}
|
||||
|
||||
- (void)deleteFileOrFolderSuccess:(CCMetadataNet *)metadataNet
|
||||
- (void)deleteFileOrFolderSuccessFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
|
||||
{
|
||||
[_queueMetadatas removeObject:metadataNet.selector];
|
||||
|
||||
|
|
|
@ -436,7 +436,9 @@
|
|||
NSString *versionNextcloud = [NSString stringWithFormat:[NCBrandOptions sharedInstance].textCopyrightNextcloudServer, versionServer];
|
||||
NSString *versionNextcloudiOS = [NSString stringWithFormat:[NCBrandOptions sharedInstance].textCopyrightNextcloudiOS, versionApp];
|
||||
|
||||
sectionName = [NSString stringWithFormat:@"%@\n%@", versionNextcloudiOS, versionNextcloud];
|
||||
NSString *nameSlogan = [NSString stringWithFormat:@"%@ - %@", capabilities.themingName, capabilities.themingSlogan];
|
||||
|
||||
sectionName = [NSString stringWithFormat:@"%@\n\n%@\n%@", versionNextcloudiOS, versionNextcloud,nameSlogan];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Двоичные данные
iOSClient/Supporting Files/cs-CZ.lproj/Error.strings
Двоичные данные
iOSClient/Supporting Files/cs-CZ.lproj/Error.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/cs-CZ.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/de.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/de.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/en-GB.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/en-GB.lproj/Localizable.strings
Двоичный файл не отображается.
|
@ -510,13 +510,12 @@
|
|||
"_e2e_settings_the_passphrase_is_" = "The passphrase is:";
|
||||
"_e2e_passphrase_request_title_" = "Request passphrase";
|
||||
"_e2e_passphrase_request_message_" = "Insert the 12 words";
|
||||
"_e2e_settings_remove_" = "Decrypt locally";
|
||||
"_e2e_settings_remove_" = "Remove locally the encryption";
|
||||
"_e2e_settings_remove_message_" = "Confirm removal of encryption along with the passphrase.";
|
||||
"_e2e_set_folder_encrypted_" = "Encrypt";
|
||||
"_e2e_remove_folder_encrypted_" = "Decrypt";
|
||||
"_e2e_goto_settings_for_enable_" = "You are in an encrypted directory, go to \"Settings\" and enable end-to-end encryption";
|
||||
"_e2e_goto_settings_for_enable_" = "This is an encrypted directory, go to \"Settings\" and enable end-to-end encryption";
|
||||
"_e2e_delete_folder_not_permitted_" = "Deletion of the directory marked as 'encrypted' is not allowed";
|
||||
"_e2e_remove_folder_lock_" = "Force remove folder lock";
|
||||
"_e2e_error_encode_metadata_" = "Serious internal error in encoding metadata";
|
||||
"_e2e_error_decode_metadata_" = "Serious internal error in decoding metadata";
|
||||
"_e2e_error_create_encrypted_" = "Could not create encrypted file";
|
||||
|
|
Двоичные данные
iOSClient/Supporting Files/es-419.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-419.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-CL.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-CL.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-CO.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-CO.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-CR.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-CR.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-DO.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-DO.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-EC.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-EC.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-GT.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-GT.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-HN.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-HN.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-MX.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-MX.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-NI.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-NI.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-PA.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-PA.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-PE.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-PE.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-PR.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-PR.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-PY.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-PY.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-SV.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-SV.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es-UY.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es-UY.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/es.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/es.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/fr.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/fr.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/hu.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/hu.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/is.lproj/Error.strings
Двоичные данные
iOSClient/Supporting Files/is.lproj/Error.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/is.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/is.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/it.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/it.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/ka-GE.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/ka-GE.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/ko.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/ko.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/nb-NO.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/nb-NO.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/nl.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/nl.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/pl.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/pl.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/pt-BR.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/pt-BR.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/ru.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/ru.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/sk-SK.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/sk-SK.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/sr.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/sr.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/sv.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/sv.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/tr.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/tr.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/zh-Hans.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/zh-Hans.lproj/Localizable.strings
Двоичный файл не отображается.
Двоичные данные
iOSClient/Supporting Files/zh-Hant-TW.lproj/Localizable.strings
Двоичные данные
iOSClient/Supporting Files/zh-Hant-TW.lproj/Localizable.strings
Двоичный файл не отображается.
|
@ -311,7 +311,7 @@
|
|||
tableDirectory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", metadataNet.account, serverUrl]];
|
||||
|
||||
if (!tableDirectory) {
|
||||
(void) [[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:serverUrl permissions:nil encrypted:false];
|
||||
(void) [[NCManageDatabase sharedInstance] addDirectoryWithServerUrl:serverUrl fileID:nil permissions:nil encrypted:metadata.e2eEncrypted];
|
||||
tableDirectory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND serverUrl = %@", metadataNet.account, serverUrl]];
|
||||
}
|
||||
|
||||
|
|
|
@ -358,8 +358,17 @@
|
|||
NSInteger queueDownload = [[[NCManageDatabase sharedInstance] getTableMetadataDownload] count] + [[NCManageDatabase sharedInstance] countQueueDownloadWithSession:k_download_session];
|
||||
NSInteger queueDownloadWWan = [[[NCManageDatabase sharedInstance] getTableMetadataDownloadWWan] count] + [[NCManageDatabase sharedInstance] countQueueDownloadWithSession:k_download_session_wwan];
|
||||
|
||||
NSInteger queueUpload = [[[NCManageDatabase sharedInstance] getTableMetadataUpload] count] + [[NCManageDatabase sharedInstance] countQueueUploadWithSession:k_upload_session];
|
||||
NSInteger queueUploadWWan = [[[NCManageDatabase sharedInstance] getTableMetadataUploadWWan] count] + [[NCManageDatabase sharedInstance] countQueueUploadWithSession:k_upload_session_wwan];
|
||||
NSInteger queueUpload = [[NCManageDatabase sharedInstance] countQueueUploadWithSession:k_upload_session];
|
||||
for (tableMetadata *record in [[NCManageDatabase sharedInstance] getTableMetadataUpload]) {
|
||||
if (record.e2eEncrypted == false)
|
||||
queueUpload++;
|
||||
}
|
||||
|
||||
NSInteger queueUploadWWan = [[NCManageDatabase sharedInstance] countQueueUploadWithSession:k_upload_session_wwan];
|
||||
for (tableMetadata *record in [[NCManageDatabase sharedInstance] getTableMetadataUploadWWan]) {
|
||||
if (record.e2eEncrypted == false)
|
||||
queueUploadWWan++;
|
||||
}
|
||||
|
||||
if ([[_sectionDataSource.sections objectAtIndex:section] isKindOfClass:[NSString class]]) titleSection = [_sectionDataSource.sections objectAtIndex:section];
|
||||
if ([[_sectionDataSource.sections objectAtIndex:section] isKindOfClass:[NSDate class]]) titleSection = [CCUtility getTitleSectionDate:[_sectionDataSource.sections objectAtIndex:section]];
|
||||
|
@ -479,7 +488,11 @@
|
|||
// Footer Upload
|
||||
if ([titleSection containsString:@"upload"] && ![titleSection containsString:@"wwan"] && titleSection != nil) {
|
||||
|
||||
NSInteger queueUpload = [[[NCManageDatabase sharedInstance] getTableMetadataUpload] count] + [[NCManageDatabase sharedInstance] countQueueUploadWithSession:k_upload_session];
|
||||
NSInteger queueUpload = [[NCManageDatabase sharedInstance] countQueueUploadWithSession:k_upload_session];
|
||||
for (tableMetadata *record in [[NCManageDatabase sharedInstance] getTableMetadataUpload]) {
|
||||
if (record.e2eEncrypted == false)
|
||||
queueUpload++;
|
||||
}
|
||||
|
||||
// element or elements ?
|
||||
if (queueUpload > 1) element_s = NSLocalizedString(@"_elements_",nil);
|
||||
|
@ -496,7 +509,11 @@
|
|||
// Footer Upload WWAN
|
||||
if ([titleSection containsString:@"upload"] && [titleSection containsString:@"wwan"] && titleSection != nil) {
|
||||
|
||||
NSInteger queueUploadWWan = [[[NCManageDatabase sharedInstance] getTableMetadataUploadWWan] count] + [[NCManageDatabase sharedInstance] countQueueUploadWithSession:k_upload_session_wwan];
|
||||
NSInteger queueUploadWWan = [[NCManageDatabase sharedInstance] countQueueUploadWithSession:k_upload_session_wwan];
|
||||
for (tableMetadata *record in [[NCManageDatabase sharedInstance] getTableMetadataUploadWWan]) {
|
||||
if (record.e2eEncrypted == false)
|
||||
queueUploadWWan++;
|
||||
}
|
||||
|
||||
// element or elements ?
|
||||
if (queueUploadWWan > 1) element_s = NSLocalizedString(@"_elements_",nil);
|
||||
|
|
|
@ -904,13 +904,20 @@
|
|||
|
||||
+ (BOOL)isFolderEncrypted:(NSString *)serverUrl account:(NSString *)account
|
||||
{
|
||||
NSArray *metadatas = [[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND directory = 1 AND e2eEncrypted = 1", account] sorted:@"directoryID" ascending:false];
|
||||
BOOL depth = NO;
|
||||
|
||||
for (tableMetadata *metadata in metadatas) {
|
||||
if (depth) {
|
||||
|
||||
NSString *serverUrlEncrypted = [NSString stringWithFormat:@"%@/%@", [[NCManageDatabase sharedInstance] getServerUrl:metadata.directoryID], metadata.fileName];
|
||||
//if ([serverUrl containsString:serverUrlEncrypted])
|
||||
if ([serverUrl isEqualToString:serverUrlEncrypted])
|
||||
NSArray *directories = [[NCManageDatabase sharedInstance] getTablesDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND e2eEncrypted = 1 AND serverUrl BEGINSWITH %@", account, serverUrl] sorted:@"serverUrl" ascending:false];
|
||||
for (tableDirectory *directory in directories) {
|
||||
if ([serverUrl containsString:directory.serverUrl])
|
||||
return true;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account = %@ AND e2eEncrypted = 1 AND serverUrl = %@", account, serverUrl]];
|
||||
if (directory != nil)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче