Browse Source

clear code

marinofaggiana 3 years ago
parent
commit
1e598c2dd3

+ 2 - 21
iOSClient/Settings/CCAdvanced.m

@@ -276,33 +276,14 @@
     
     self.tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
     
-    [[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];
+    [self initializeForm];
 }
 
 - (void)viewWillAppear:(BOOL)animated
 {
     [super viewWillAppear:animated];
-    appDelegate.activeViewController = self;
     
-    [self initializeForm];
-    [self.tableView reloadData];
-}
-
-#pragma mark - NotificationCenter
-
-- (void)changeTheming
-{
-    [self initializeForm];
-    [self.tableView reloadData];
-}
-
-- (void)initializeMain
-{
-    [self initializeForm];
-    [self.tableView reloadData];
+    appDelegate.activeViewController = self;
 }
 
 #pragma mark -

+ 2 - 12
iOSClient/Settings/CCManageAccount.m

@@ -365,33 +365,23 @@
     
     self.tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
     
-    [[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];
+    [self initializeForm];
 }
 
 - (void)viewWillAppear:(BOOL)animated
 {
     [super viewWillAppear:animated];
-    appDelegate.activeViewController = self;
     
-    [self initializeForm];
-    [self.tableView reloadData];
+    appDelegate.activeViewController = self;
 }
 
 #pragma mark - NotificationCenter
 
-- (void)changeTheming
-{
-    [self.tableView reloadData];
-    [self initializeForm];
-}
-
 - (void)initializeMain
 {
     [self initializeForm];
-    [self.tableView reloadData];
 }
 
 #pragma mark -

+ 3 - 11
iOSClient/Settings/CCManageAutoUpload.m

@@ -208,19 +208,17 @@
     
     self.tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
     
-    [[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];
+    [self initializeForm];
+    [self reloadForm];
 }
 
 - (void)viewWillAppear:(BOOL)animated
 {
     [super viewWillAppear:animated];
+    
     appDelegate.activeViewController = self;
-
-    [self initializeForm];
-    [self reloadForm];
     
     // Request permission for camera roll access
     [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) {
@@ -244,12 +242,6 @@
 
 #pragma mark - NotificationCenter
 
-- (void)changeTheming
-{
-    [self.tableView reloadData];
-    [self initializeForm];
-    [self reloadForm];
-}
 
 #pragma mark -
 

+ 3 - 12
iOSClient/Settings/NCManageAutoUploadFileName.swift

@@ -113,25 +113,16 @@ class NCManageAutoUploadFileName: XLFormViewController {
         
         tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground
         
-        // Theming view
-        NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
-        
-        changeTheming()
+        initializeForm()
+        reloadForm()
     }
     
     override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
+        
         appDelegate.activeViewController = self
     }
     
-    // MARK: - NotificationCenter
-
-    @objc func changeTheming() {
-        tableView.reloadData()
-        initializeForm()
-        reloadForm()
-    }
-    
     //MARK: XLForm
 
     func reloadForm() {

+ 2 - 11
iOSClient/Settings/NCManageEndToEndEncryption.m

@@ -183,30 +183,21 @@
     self.endToEndInitialize = [NCEndToEndInitialize new];
     self.endToEndInitialize.delegate = self;
     
-    [[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];
+    [self initializeForm];
 }
 
 - (void)viewWillAppear:(BOOL)animated
 {
     [super viewWillAppear:animated];
-    appDelegate.activeViewController = self;
     
-    [self initializeForm];
-    [self.tableView reloadData];
+    appDelegate.activeViewController = self;
 }
 
 #pragma mark - NotificationCenter
 
-- (void)changeTheming
-{
-    [self.tableView reloadData];
-    [self initializeForm];
-}
-
 - (void)applicationDidEnterBackground
 {
     if (passcodeViewController.view.window != nil) {

+ 1 - 3
iOSClient/Settings/NCSettings.m

@@ -191,10 +191,8 @@
 - (void)viewWillAppear:(BOOL)animated
 {
     [super viewWillAppear:animated];
-    appDelegate.activeViewController = self;
     
-    [self initializeForm];
-    [self reloadForm];
+    appDelegate.activeViewController = self;
 }
 
 #pragma mark - NotificationCenter