Marino Faggiana 7 years ago
parent
commit
36c97cdaee

+ 23 - 0
iOSClient/Images.xcassets/no_red.imageset/Contents.json

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

BIN
iOSClient/Images.xcassets/no_red.imageset/no_red.png


BIN
iOSClient/Images.xcassets/no_red.imageset/no_red@2x.png


BIN
iOSClient/Images.xcassets/no_red.imageset/no_red@3x.png


+ 23 - 0
iOSClient/Images.xcassets/ok_green.imageset/Contents.json

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

BIN
iOSClient/Images.xcassets/ok_green.imageset/ok_green.png


BIN
iOSClient/Images.xcassets/ok_green.imageset/ok_green@2x.png


BIN
iOSClient/Images.xcassets/ok_green.imageset/ok_green@3x.png


+ 4 - 2
iOSClient/Security/NCEntoToEndInterface.swift

@@ -159,8 +159,8 @@ class NCEntoToEndInterface : NSObject, OCNetworkingDelegate  {
         // request Passphrase
         
         var passphraseTextField: UITextField?
-        
-        let alertController = UIAlertController(title: "UIAlertController", message: "UIAlertController With TextField", preferredStyle: .alert)
+                
+        let alertController = UIAlertController(title: NSLocalizedString("_e2e_passphrase_request_title_", comment: ""), message: NSLocalizedString("_e2e_passphrase_request_message_", comment: ""), preferredStyle: .alert)
         
         let ok = UIAlertAction(title: "OK", style: .default, handler: { (action) -> Void in
             
@@ -401,6 +401,8 @@ class NCEntoToEndInterface : NSObject, OCNetworkingDelegate  {
         let alertController = UIAlertController(title: NSLocalizedString(title, comment: ""), message: NSLocalizedString(message, comment: ""), preferredStyle: .alert)
         
         let OKAction = UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default) { action in
+            
+             NotificationCenter.default.post(name: Notification.Name("reloadManageEndToEndEncryption"), object: nil)
         }
         alertController.addAction(OKAction)
 

+ 57 - 6
iOSClient/Settings/NCManageEndToEndEncryption.m

@@ -36,7 +36,27 @@
 
 @implementation NCManageEndToEndEncryption
 
--(id)init
+- (id)initWithCoder:(NSCoder *)aDecoder
+{
+    self = [super initWithCoder:aDecoder];
+    if (self) {
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadForm) name:@"reloadManageEndToEndEncryption" object:nil];
+        [self initializeForm];
+    }
+    return self;
+}
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
+    if (self) {
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadForm) name:@"reloadManageEndToEndEncryption" object:nil];
+        [self initializeForm];
+    }
+    return self;
+}
+
+- (void)initializeForm
 {
     XLFormDescriptor *form ;
     XLFormSectionDescriptor *section;
@@ -48,17 +68,37 @@
 
     if (capabilities.endToEndEncryption == NO) {
         
-        section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_e2e_settings_not_available_", nil)];
+        // Section SERVICE NOT AVAILABLE -------------------------------------------------
+        
+        section = [XLFormSectionDescriptor formSection];
         [form addFormSection:section];
         
-        return [super initWithForm:form];
+        row = [XLFormRowDescriptor formRowDescriptorWithTag:@"serviceActivated" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_e2e_settings_not_available_", nil)];
+        [row.cellConfig setObject:[UIImage imageNamed:@"no_red"] forKey:@"imageView.image"];
+        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+        [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
+        [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
+        [section addFormRow:row];
+        
+        self.form = form;
+
+        return;
     }
     
     if ([CCUtility isEndToEndEnabled:app.activeAccount]) {
-   
-        section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_e2e_settings_activated_", nil)];
+        
+        // Section SERVICE ACTIVATED -------------------------------------------------
+        
+        section = [XLFormSectionDescriptor formSection];
         [form addFormSection:section];
         
+        row = [XLFormRowDescriptor formRowDescriptorWithTag:@"serviceActivated" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_e2e_settings_activated_", nil)];
+        [row.cellConfig setObject:[UIImage imageNamed:@"ok_green"] forKey:@"imageView.image"];
+        [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+        [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
+        [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
+        [section addFormRow:row];
+        
         // Section PASSPHRASE -------------------------------------------------
         
         section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_e2e_settings_read_passphrase_", nil)];
@@ -119,9 +159,18 @@
     
 #endif
     
-    return [super initWithForm:form];
+    self.form = form;
 }
 
+-(void)reloadForm
+{
+    [self initializeForm];
+}
+
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark === Action ===
+#pragma --------------------------------------------------------------------------------------------
+
 - (void)deletePublicKey:(XLFormRowDescriptor *)sender
 {
     [self deselectFormRow:sender];
@@ -147,6 +196,8 @@
     [self deselectFormRow:sender];
     
     [CCUtility initEndToEnd:app.activeAccount];
+    
+    [self initializeForm];
 }
 
 - (void)startE2E:(XLFormRowDescriptor *)sender

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

@@ -588,4 +588,6 @@
 "_e2e_settings_read_passphrase_"    = "Read passphrase";
 "_e2e_settings_lock_not_active_"    = "Lock not active, go back to \"Settings\" and activate it";
 "_e2e_settings_the_passphrase_is_"  = "The passphrase is:";
+"_e2e_passphrase_request_title_"    = "Request passphrase";
+"_e2e_passphrase_request_message_"  = "Insert the 12 word";