Переглянути джерело

improved error Files app

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 роки тому
батько
коміт
682b5e2752

+ 2 - 0
File Provider Extension UI/DocumentActionViewController.swift

@@ -31,6 +31,8 @@ class DocumentActionViewController: FPUIActionExtensionViewController {
            let code = userInfo["code"] as? Int {
             if code == NCGlobal.shared.errorUnauthorizedFilesPasscode {
                 titleError?.text = NSLocalizedString("_unauthorizedFilesPasscode_", comment: "")
+            } else if code == NCGlobal.shared.errorDisableFilesApp {
+                titleError?.text = NSLocalizedString("_disableFilesApp_", comment: "")
             }
         } else {
             titleError?.text = error.localizedDescription

+ 1 - 1
File Provider Extension/FileProviderData.swift

@@ -64,7 +64,7 @@ class fileProviderData: NSObject {
 
     func setupAccount(domain: NSFileProviderDomain?, providerExtension: NSFileProviderExtension) -> tableAccount? {
 
-        if CCUtility.getDisableFilesApp() || NCBrandOptions.shared.disable_openin_file {
+        if NCBrandOptions.shared.disable_openin_file {
             return nil
         }
 

+ 3 - 0
File Provider Extension/FileProviderExtension.swift

@@ -82,6 +82,9 @@ class FileProviderExtension: NSFileProviderExtension, NCNetworkingDelegate {
             if let passcode = CCUtility.getPasscode(), !passcode.isEmpty, CCUtility.isPasscodeAtStartEnabled() {
                 throw NSError(domain: NSFileProviderErrorDomain, code: NSFileProviderError.notAuthenticated.rawValue, userInfo: ["code" : NSNumber(value: NCGlobal.shared.errorUnauthorizedFilesPasscode)])
             }
+            if CCUtility.getDisableFilesApp() {
+                throw NSError(domain: NSFileProviderErrorDomain, code: NSFileProviderError.notAuthenticated.rawValue, userInfo: ["code" : NSNumber(value: NCGlobal.shared.errorDisableFilesApp)])
+            }
         }
 
         if containerItemIdentifier == NSFileProviderItemIdentifier.rootContainer {

+ 1 - 1
Nextcloud.xcodeproj/project.pbxproj

@@ -2234,12 +2234,12 @@
 				F7F67BAA1A24D27800EE80DA /* iOSClient */,
 				F7F67BAB1A24D27800EE80DA /* Supporting Files */,
 				F771E3D120E2392D00AFB62D /* File Provider Extension */,
+				F70716E42987F81500E72C1D /* File Provider Extension UI */,
 				F7C0F46D1C8880540059EC54 /* Share */,
 				2C33C48023E2C475005F963B /* Notification Service Extension */,
 				AF8ED1FA2757821000B8DBC4 /* NextcloudTests */,
 				F7346E1428B0EF5B006CE2D2 /* Widget */,
 				F7C9739328F17131002C43E2 /* WidgetDashboardIntentHandler */,
-				F70716E42987F81500E72C1D /* File Provider Extension UI */,
 				F7FC7D651DC1F98700BB2C6A /* Products */,
 				F7FC7D541DC1F93700BB2C6A /* Frameworks */,
 				F771E3D020E2392D00AFB62D /* File Provider Extension.appex */,

+ 1 - 0
iOSClient/NCGlobal.swift

@@ -245,6 +245,7 @@ class NCGlobal: NSObject {
     @objc let errorCreationFile: Int                = -99992
     @objc let errorReadFile: Int                    = -99991
     @objc let errorUnauthorizedFilesPasscode: Int   = -99990
+    @objc let errorDisableFilesApp: Int             = -99989
 
     // Constants to identify the different permissions of a file
     //

+ 2 - 1
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -924,7 +924,8 @@
 "_enable_livephoto_"        = "Enable Live Photo";
 "_disable_livephoto_"       = "Disable Live Photo";
 "_undo_modify_"             = "Undo the modify";
-"_unauthorizedFilesPasscode_" = "You cannot use Files with an activated passcode";
+"_unauthorizedFilesPasscode_" = "Files cannot be used with an activated passcode";
+"_disableFilesApp_"         = "Files cannot be used because is disabled";
 
 // Video
 "_select_trace_"            = "Select the trace";