Эх сурвалжийг харах

Add function CreateMenuEncrypted

Marino Faggiana 8 жил өмнө
parent
commit
ca4b014894

+ 4 - 1
iOSClient/AppDelegate.m

@@ -806,7 +806,10 @@
 {
     CreateMenuAdd *menuAdd = [[CreateMenuAdd alloc] init];
     
-    [menuAdd createMenuPlainWithView:self.window.rootViewController.view];
+    if ([CCUtility getCreateMenuEncrypted])
+        [menuAdd createMenuEncryptedWithView:self.window.rootViewController.view];
+    else
+        [menuAdd createMenuPlainWithView:self.window.rootViewController.view];
 }
 
 - (void)updateApplicationIconBadgeNumber

+ 8 - 0
iOSClient/Create/CCCreateCloud.swift

@@ -76,6 +76,8 @@ class CreateMenuAdd: NSObject {
         })
         
         actionSheet?.show()
+        
+        CCUtility.setCreateMenuEncrypted(false)
     }
     
     func createMenuEncrypted(view : UIView) {
@@ -118,7 +120,13 @@ class CreateMenuAdd: NSObject {
             self.createMenuTemplate(view: view)
         })
 
+        actionSheet?.addButton(withTitle: NSLocalizedString("Upload Plain mode", comment: ""), image: UIImage(named: "uploadPlainModeNextcloud"), backgroundColor: colorLightGray, height: 50.0, type: AHKActionSheetButtonType.default, handler: {(AHKActionSheet) -> Void in
+            self.createMenuPlain(view: view)
+        })
+        
         actionSheet?.show()
+        
+        CCUtility.setCreateMenuEncrypted(true)
     }
 
     func createMenuTemplate(view : UIView) {

+ 23 - 0
iOSClient/Nextcloud.xcassets/uploadPlainModeNextcloud.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "uploadPlainModeNextcloud@1x.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "uploadPlainModeNextcloud@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "uploadPlainModeNextcloud@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
iOSClient/Nextcloud.xcassets/uploadPlainModeNextcloud.imageset/uploadPlainModeNextcloud@1x.png


BIN
iOSClient/Nextcloud.xcassets/uploadPlainModeNextcloud.imageset/uploadPlainModeNextcloud@2x.png


BIN
iOSClient/Nextcloud.xcassets/uploadPlainModeNextcloud.imageset/uploadPlainModeNextcloud@3x.png


+ 4 - 0
iOSClient/Utility/CCUtility.h

@@ -82,6 +82,8 @@
 
 + (void)setFileNameMask:(NSString *)fileNameMask;
 
++ (void)setCreateMenuEncrypted:(BOOL)encrypted;
+
 // GET
 
 + (NSString *)getKeyChainPasscodeForUUID:(NSString *)uuid;
@@ -119,6 +121,8 @@
 
 + (NSString *)getFileNameMask;
 
++ (BOOL)getCreateMenuEncrypted;
+
 // ===== Varius =====
 
 + (NSString *)getUserAgent:(NSString *)typeCloud;

+ 11 - 0
iOSClient/Utility/CCUtility.m

@@ -195,6 +195,12 @@
     [UICKeyChainStore setString:fileNameMask forKey:@"fileNameMask" service:serviceShareKeyChain];
 }
 
++ (void)setCreateMenuEncrypted:(BOOL)encrypted
+{
+    NSString *sEncrypted = (encrypted) ? @"true" : @"false";
+    [UICKeyChainStore setString:sEncrypted forKey:@"createMenuEncrypted" service:serviceShareKeyChain];
+}
+
 #pragma ------------------------------ GET
 
 + (NSString *)getKeyChainPasscodeForUUID:(NSString *)uuid
@@ -371,6 +377,11 @@
     return mask;
 }
 
++ (BOOL)getCreateMenuEncrypted
+{
+    return [[UICKeyChainStore stringForKey:@"createMenuEncrypted" service:serviceShareKeyChain] boolValue];
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Varius =====
 #pragma --------------------------------------------------------------------------------------------