Browse Source

normalize

marinofaggiana 4 years ago
parent
commit
a649b6c8f8

+ 13 - 1
iOSClient/Settings/CCAdvanced.m

@@ -257,6 +257,8 @@
     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
 
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:NCGlobal.shared.notificationCenterChangeTheming object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initializeMain) name:NCGlobal.shared.notificationCenterInitializeMain object:nil];
+    
     [self changeTheming];
 }
 
@@ -265,19 +267,29 @@
     [super viewWillAppear:animated];
     appDelegate.activeViewController = self;
     
-    [self.tableView reloadData];
     [self initializeForm];
+    [self.tableView reloadData];
 }
 
+#pragma mark - NotificationCenter
+
 - (void)changeTheming
 {
     self.view.backgroundColor = NCBrandColor.shared.backgroundView;
     self.tableView.backgroundColor = NCBrandColor.shared.backgroundView;
     
+    [self initializeForm];
     [self.tableView reloadData];
+}
+
+- (void)initializeMain
+{
     [self initializeForm];
+    [self.tableView reloadData];
 }
 
+#pragma mark -
+
 - (void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
 {
     [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];

+ 17 - 19
iOSClient/Settings/CCManageAccount.m

@@ -348,6 +348,8 @@
     }
 }
 
+#pragma mark - Life Cycle
+
 - (void)viewDidLoad
 {
     [super viewDidLoad];
@@ -355,8 +357,8 @@
     self.title = NSLocalizedString(@"_credentials_", nil);
     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
     
-    // changeTheming
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:NCGlobal.shared.notificationCenterChangeTheming object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initializeMain) name:NCGlobal.shared.notificationCenterInitializeMain object:nil];
     
     [self changeTheming];
 }
@@ -366,10 +368,12 @@
     [super viewWillAppear:animated];
     appDelegate.activeViewController = self;
     
-    [self.tableView reloadData];
     [self initializeForm];
+    [self.tableView reloadData];
 }
 
+#pragma mark - NotificationCenter
+
 - (void)changeTheming
 {
     self.view.backgroundColor = NCBrandColor.shared.backgroundView;
@@ -378,9 +382,13 @@
     [self initializeForm];
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark === Delegate ===
-#pragma --------------------------------------------------------------------------------------------
+- (void)initializeMain
+{
+    [self initializeForm];
+    [self.tableView reloadData];
+}
+
+#pragma mark -
 
 -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
 {
@@ -409,9 +417,7 @@
     [self initializeForm];
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark === Add Account ===
-#pragma --------------------------------------------------------------------------------------------
+#pragma mark -
 
 - (void)addAccount:(XLFormRowDescriptor *)sender
 {
@@ -420,9 +426,7 @@
     [appDelegate openLoginWithViewController:self selector:NCGlobal.shared.introLogin openLoginWeb:false];
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark === Delete Account  ===
-#pragma --------------------------------------------------------------------------------------------
+#pragma mark -
 
 - (void)deleteAccount:(XLFormRowDescriptor *)sender
 {
@@ -456,9 +460,7 @@
     [self presentViewController:alertController animated:YES completion:nil];
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark === Set User Status  ===
-#pragma --------------------------------------------------------------------------------------------
+#pragma mark -
 
 - (void)setUserStatus:(XLFormRowDescriptor *)sender
 {
@@ -470,9 +472,7 @@
     }
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark === Change Default Account ===
-#pragma --------------------------------------------------------------------------------------------
+#pragma mark -
 
 - (void)ChangeDefaultAccount:(NSString *)account
 {
@@ -484,8 +484,6 @@
         // Init home
         [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:NCGlobal.shared.notificationCenterInitializeMain object:nil userInfo:nil];
     }
-    
-    [self initializeForm];
 }
 
 @end

+ 12 - 1
iOSClient/Settings/CCManageAutoUpload.m

@@ -197,6 +197,8 @@
     self.form = form;
 }
 
+#pragma mark - Life Cycle
+
 - (void)viewDidLoad
 {
     [super viewDidLoad];
@@ -204,8 +206,8 @@
     self.title = NSLocalizedString(@"_settings_autoupload_", nil);
     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
     
-    // changeTheming
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:NCGlobal.shared.notificationCenterChangeTheming object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initializeMain) name:NCGlobal.shared.notificationCenterInitializeMain object:nil];
     
     [self changeTheming];
 }
@@ -233,6 +235,13 @@
     }];
 }
 
+- (void)initializeMain
+{
+    [[self navigationController] popViewControllerAnimated:YES];
+}
+
+#pragma mark - NotificationCenter
+
 - (void)changeTheming
 {
     self.view.backgroundColor = NCBrandColor.shared.backgroundView;
@@ -242,6 +251,8 @@
     [self reloadForm];
 }
 
+#pragma mark -
+
 -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
 {
     [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];

+ 43 - 40
iOSClient/Settings/NCManageAutoUploadFileName.swift

@@ -28,46 +28,6 @@ class NCManageAutoUploadFileName: XLFormViewController {
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
     let dateExample = Date()
     
-    // MARK: - View Life Cycle
-    
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        
-        self.title = NSLocalizedString("_mode_filename_", comment: "")
-        
-        // Theming view
-        NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
-        
-        changeTheming()
-    }
-    
-    override func viewWillAppear(_ animated: Bool) {
-        super.viewWillAppear(animated)
-        appDelegate.activeViewController = self
-    }
-    
-    func reloadForm() {
-        
-        self.form.delegate = nil
-        
-        let maskFileName : XLFormRowDescriptor = self.form.formRow(withTag: "maskFileName")!
-        let previewFileName : XLFormRowDescriptor  = self.form.formRow(withTag: "previewFileName")!
-        previewFileName.value = self.previewFileName(valueRename: maskFileName.value as? String)
-        
-        self.tableView.reloadData()
-        self.form.delegate = self
-    }
-    
-    @objc func changeTheming() {
-        view.backgroundColor = NCBrandColor.shared.backgroundView
-        tableView.backgroundColor = NCBrandColor.shared.backgroundView
-        tableView.reloadData()
-        initializeForm()
-        self.reloadForm()
-    }
-    
-    //MARK: XLForm
-
     func initializeForm() {
         
         let form : XLFormDescriptor = XLFormDescriptor() as XLFormDescriptor
@@ -143,6 +103,49 @@ class NCManageAutoUploadFileName: XLFormViewController {
         self.form = form
     }
     
+    // MARK: - View Life Cycle
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        
+        self.title = NSLocalizedString("_mode_filename_", comment: "")
+        
+        // Theming view
+        NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
+        
+        changeTheming()
+    }
+    
+    override func viewWillAppear(_ animated: Bool) {
+        super.viewWillAppear(animated)
+        appDelegate.activeViewController = self
+    }
+    
+    // MARK: - NotificationCenter
+
+    @objc func changeTheming() {
+        view.backgroundColor = NCBrandColor.shared.backgroundView
+        tableView.backgroundColor = NCBrandColor.shared.backgroundView
+        tableView.reloadData()
+        
+        initializeForm()
+        reloadForm()
+    }
+    
+    //MARK: XLForm
+
+    func reloadForm() {
+        
+        self.form.delegate = nil
+        
+        let maskFileName : XLFormRowDescriptor = self.form.formRow(withTag: "maskFileName")!
+        let previewFileName : XLFormRowDescriptor  = self.form.formRow(withTag: "previewFileName")!
+        previewFileName.value = self.previewFileName(valueRename: maskFileName.value as? String)
+        
+        self.tableView.reloadData()
+        self.form.delegate = self
+    }
+    
     override func formRowDescriptorValueHasChanged(_ formRow: XLFormRowDescriptor!, oldValue: Any!, newValue: Any!) {
         
         super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)

+ 11 - 2
iOSClient/Settings/NCManageEndToEndEncryption.m

@@ -167,6 +167,8 @@
     self.form = form;
 }
 
+#pragma mark - Life Cycle
+
 - (void)viewDidLoad
 {
     [super viewDidLoad];
@@ -178,9 +180,9 @@
     self.endToEndInitialize = [NCEndToEndInitialize new];
     self.endToEndInitialize.delegate = self;
     
-    // changeTheming
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:NCGlobal.shared.notificationCenterChangeTheming object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidEnterBackground) name:NCGlobal.shared.notificationCenterApplicationDidEnterBackground object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initializeMain) name:NCGlobal.shared.notificationCenterInitializeMain object:nil];
 
     [self changeTheming];
 }
@@ -190,10 +192,12 @@
     [super viewWillAppear:animated];
     appDelegate.activeViewController = self;
     
-    [self.tableView reloadData];
     [self initializeForm];
+    [self.tableView reloadData];
 }
 
+#pragma mark - NotificationCenter
+
 - (void)changeTheming
 {
     self.view.backgroundColor = NCBrandColor.shared.backgroundView;
@@ -210,6 +214,11 @@
     }
 }
 
+- (void)initializeMain
+{
+    [[self navigationController] popViewControllerAnimated:YES];
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark === Action ===
 #pragma --------------------------------------------------------------------------------------------

+ 15 - 8
iOSClient/Settings/NCSettings.m

@@ -176,6 +176,8 @@
     self.form = form;
 }
 
+#pragma mark - Life Cycle
+
 - (void)viewDidLoad
 {
     [super viewDidLoad];
@@ -185,6 +187,7 @@
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:NCGlobal.shared.notificationCenterChangeTheming object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidEnterBackground) name:NCGlobal.shared.notificationCenterApplicationDidEnterBackground object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initializeMain) name:NCGlobal.shared.notificationCenterInitializeMain object:nil];
 
     [self changeTheming];
 }
@@ -198,11 +201,19 @@
     [self reloadForm];
 }
 
+#pragma mark - NotificationCenter
+
 - (void)changeTheming
 {
     self.view.backgroundColor = NCBrandColor.shared.backgroundView;
     self.tableView.backgroundColor = NCBrandColor.shared.backgroundView;
-    [self.tableView reloadData];    
+    
+    [self initializeForm];
+    [self reloadForm];
+}
+
+- (void)initializeMain
+{
     [self initializeForm];
     [self reloadForm];
 }
@@ -217,9 +228,7 @@
     }
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark === Chiamate dal Form ===
-#pragma --------------------------------------------------------------------------------------------
+#pragma mark -
 
 - (void)reloadForm
 {
@@ -307,7 +316,7 @@
     }
 }
 
-#pragma mark - Passcode -
+#pragma mark - Passcode
 
 - (void)didPerformBiometricValidationRequestInPasscodeViewController:(TOPasscodeViewController *)passcodeViewController
 {
@@ -403,9 +412,7 @@
     }
 }
 
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark === Table View ===
-#pragma --------------------------------------------------------------------------------------------
+#pragma mark -
 
 - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
 {