From a1a32ac42f171631acdc735934749b8419b151a3 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Wed, 31 Jan 2018 14:48:03 +0100 Subject: [PATCH] Add Accept-Language on flow Login --- iOSClient/Database/NCManageDatabase.swift | 2 +- iOSClient/Library/SwiftWebVC/SwiftWebVC.swift | 2 ++ iOSClient/Security/NCEndToEndMetadata.swift | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/iOSClient/Database/NCManageDatabase.swift b/iOSClient/Database/NCManageDatabase.swift index 1ee2af34d5..9f491965e6 100644 --- a/iOSClient/Database/NCManageDatabase.swift +++ b/iOSClient/Database/NCManageDatabase.swift @@ -1373,7 +1373,7 @@ class NCManageDatabase: NSObject { //MARK: Table Metadata @objc func addMetadata(_ metadata: tableMetadata) -> tableMetadata? { - + guard self.getAccountActive() != nil else { return nil } diff --git a/iOSClient/Library/SwiftWebVC/SwiftWebVC.swift b/iOSClient/Library/SwiftWebVC/SwiftWebVC.swift index 4feaa080c3..2703e67105 100755 --- a/iOSClient/Library/SwiftWebVC/SwiftWebVC.swift +++ b/iOSClient/Library/SwiftWebVC/SwiftWebVC.swift @@ -103,6 +103,8 @@ public class SwiftWebVC: UIViewController { self.init() self.request = aRequest self.request.addValue("true", forHTTPHeaderField: "OCS-APIRequest") + let language = NSLocale.preferredLanguages[0] as String + self.request.addValue(language, forHTTPHeaderField: "Accept-Language") self.hideToolbar = hideToolbar } diff --git a/iOSClient/Security/NCEndToEndMetadata.swift b/iOSClient/Security/NCEndToEndMetadata.swift index 1e91e63eb0..deb87bd7e2 100644 --- a/iOSClient/Security/NCEndToEndMetadata.swift +++ b/iOSClient/Security/NCEndToEndMetadata.swift @@ -219,7 +219,9 @@ class NCEndToEndMetadata : NSObject { // Update metadata on tableMetadata metadata?.fileNameView = encryptedFileAttributes.filename CCUtility.insertTypeFileIconName(encryptedFileAttributes.filename, metadata: metadata) - let _ = NCManageDatabase.sharedInstance.addMetadata(metadata!) + DispatchQueue.main.async { + _ = NCManageDatabase.sharedInstance.addMetadata(metadata!) + } } } catch let error {