marinofaggiana 5 yıl önce
ebeveyn
işleme
3375f05dc8

+ 1 - 1
iOSClient/Main/CCMore.swift

@@ -71,10 +71,10 @@ class CCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
         themingBackground.addGestureRecognizer(tapImageLogo)
         
         // Notification
-        NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(self.changeUserProfile), name: NSNotification.Name(rawValue: "changeUserProfile"), object: nil)
         
         // Theming view
+        NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
         changeTheming()
     }
     

+ 1 - 1
iOSClient/Settings/CCAdvanced.m

@@ -159,7 +159,7 @@
     
     // changeTheming
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:@"changeTheming" object:nil];
-    [self initializeForm];
+    [self changeTheming];
 }
 
 - (void)changeTheming

+ 1 - 1
iOSClient/Settings/CCManageAccount.m

@@ -337,7 +337,7 @@
     
     // changeTheming
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:@"changeTheming" object:nil];
-    [self initializeForm];
+    [self changeTheming];
 }
 
 - (void)changeTheming

+ 2 - 3
iOSClient/Settings/CCManageAutoUpload.m

@@ -191,7 +191,7 @@
     
     // changeTheming
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:@"changeTheming" object:nil];
-    [self initializeForm];
+    [self changeTheming];
 }
 
 - (void)viewWillAppear:(BOOL)animated
@@ -211,14 +211,13 @@
                 break;
         }
     }];
-
-    [self reloadForm];
 }
 
 - (void)changeTheming
 {
     [appDelegate changeTheming:self tableView:self.tableView collectionView:nil];
     [self initializeForm];
+    [self reloadForm];
 }
 
 -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue

+ 5 - 14
iOSClient/Settings/CCSettings.m

@@ -189,12 +189,7 @@
     
     // changeTheming
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:@"changeTheming" object:nil];
-    [self initializeForm];
-}
-
-- (void)viewWillAppear:(BOOL)animated
-{
-    [self reloadForm];
+    [self changeTheming];
 }
 
 - (void)changeTheming
@@ -301,9 +296,7 @@
             [CCUtility setDarkMode:false];
         }
         
-        [self changeTheming];
-        [self initializeForm];
-        [self reloadForm];
+        [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"changeTheming" object:nil];
     }
     
     if ([rowDescriptor.tag isEqualToString:@"darkModeDetect"]) {
@@ -319,15 +312,13 @@
                 } else {
                     [CCUtility setDarkMode:NO];
                 }
-                
-                [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"changeTheming" object:nil];
             }
             
         } else {
-            [CCUtility setDarkModeDetect:false];
-            
-            [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"changeTheming" object:nil];
+            [CCUtility setDarkModeDetect:false];            
         }
+        
+        [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"changeTheming" object:nil];
     }
 }
 

+ 10 - 20
iOSClient/Settings/NCManageAutoUploadFileName.swift

@@ -28,16 +28,6 @@ class NCManageAutoUploadFileName: XLFormViewController {
     let appDelegate = UIApplication.shared.delegate as! AppDelegate
     let dateExample = Date()
     
-    required init(coder aDecoder: NSCoder) {
-        super.init(coder: aDecoder)
-        self.initializeForm()
-    }
-    
-    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
-        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
-        self.initializeForm()
-    }
-        
     func initializeForm() {
         
         let form : XLFormDescriptor = XLFormDescriptor(title: NSLocalizedString("_autoupload_filename_title_", comment: "")) as XLFormDescriptor
@@ -109,6 +99,7 @@ class NCManageAutoUploadFileName: XLFormViewController {
 
         section.addFormRow(row)
         
+        self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
         self.form = form
     }
     
@@ -157,18 +148,11 @@ class NCManageAutoUploadFileName: XLFormViewController {
     // MARK: - View Life Cycle
     
     override func viewDidLoad() {
-        
         super.viewDidLoad()
         
-        self.navigationController?.navigationBar.isTranslucent = false
-        self.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.brand
-        self.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brandText
-        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCBrandColor.sharedInstance.brandText]
-        
-        self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
-        self.tableView.backgroundColor = NCBrandColor.sharedInstance.backgroundForm
-                
-        self.reloadForm()
+        // Theming view
+        NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
+        changeTheming()
     }
     
     func reloadForm() {
@@ -183,6 +167,12 @@ class NCManageAutoUploadFileName: XLFormViewController {
         self.form.delegate = self
     }
     
+    @objc func changeTheming() {
+        appDelegate.changeTheming(self, tableView: tableView, collectionView: nil)
+        initializeForm()
+        self.reloadForm()
+    }
+    
     // MARK: - Utility
     
     func previewFileName(valueRename : String?) -> String {