Browse Source

improved dark mode

marinofaggiana 3 years ago
parent
commit
b1c08282bc

+ 10 - 8
iOSClient/Brand/NCBrand.swift

@@ -145,7 +145,7 @@ class NCBrandColor: NSObject {
     @objc public var connectionNo:          UIColor = UIColor(red: 204.0/255.0, green: 204.0/255.0, blue: 204.0/255.0, alpha: 1.0)
     @objc public var encrypted:             UIColor = .red
     
-    @objc public var systemBackground:        UIColor {
+    @objc public var systemBackground: UIColor {
         get {
             if #available(iOS 13, *) {
                 return .systemBackground
@@ -154,7 +154,15 @@ class NCBrandColor: NSObject {
             }
         }
     }
-    
+    @objc public var systemGroupedBackground: UIColor {
+        get {
+            if #available(iOS 13, *) {
+                return .systemGroupedBackground
+            } else {
+                return UIColor(red: 95.0/255.0, green: 95.0/255.0, blue: 97.0/255.0, alpha: 1.0)
+            }
+        }
+    }
     @objc public var label: UIColor {
         get {
             if #available(iOS 13, *) {
@@ -166,7 +174,6 @@ class NCBrandColor: NSObject {
     }
     
     @objc public var backgroundViewForm:    UIColor = .white
-    @objc public var backgroundSettings:    UIColor = UIColor(red: 242.0/255.0, green: 242.0/255.0, blue: 247.0/255.0, alpha: 1.0)  // Gray (6) Light
     @objc public var cellSettings:          UIColor = .white
     @objc public var separator:             UIColor = UIColor(red: 235.0/255.0, green: 235.0/255.0, blue: 235.0/255.0, alpha: 1.0)
     @objc public var tabBar:                UIColor = .white
@@ -178,7 +185,6 @@ class NCBrandColor: NSObject {
     @objc public let yellowFavorite:        UIColor = UIColor(red: 248.0/255.0, green: 205.0/255.0, blue: 70.0/255.0, alpha: 1.0)
     @objc public let textInfo:              UIColor = UIColor(red: 153.0/255.0, green: 153.0/255.0, blue: 153.0/255.0, alpha: 1.0)
     @objc public var select:                UIColor = .lightGray
-    @objc public var avatarBorder:          UIColor = .white
 
     override init() {
         self.brand = self.customer
@@ -225,11 +231,9 @@ class NCBrandColor: NSObject {
             backgroundViewForm = UIColor(red: 28.0/255.0, green: 28.0/255.0, blue: 30.0/255.0, alpha: 1.0)              // Gray (6) Dark
 
             cellSettings = UIColor(red: 28.0/255.0, green: 28.0/255.0, blue: 30.0/255.0, alpha: 1.0)                    // Gray (6) Dark
-            backgroundSettings = .black
             
             separator = UIColor(red: 60.0/255.0, green: 60.0/255.0, blue: 60.0/255.0, alpha: 1.0)
             select = UIColor.white.withAlphaComponent(0.2)
-            avatarBorder = .black
             
         } else {
             
@@ -237,12 +241,10 @@ class NCBrandColor: NSObject {
             
             backgroundViewForm = .white
 
-            backgroundSettings = UIColor(red: 242.0/255.0, green: 242.0/255.0, blue: 247.0/255.0, alpha: 1.0)           // Gray (6) Light
             cellSettings = .white
             
             separator = UIColor(red: 235.0/255.0, green: 235.0/255.0, blue: 235.0/255.0, alpha: 1.0)
             select = self.brandElement.withAlphaComponent(0.1)
-            avatarBorder = .white
         }
     }
     

+ 3 - 2
iOSClient/Main/Create cloud/NCCreateFormUploadAssets.swift

@@ -74,6 +74,9 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
         
         self.title = NSLocalizedString("_upload_photos_videos_", comment: "")
         
+        view.backgroundColor = NCBrandColor.shared.systemGroupedBackground
+        tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground
+        
         self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(cancel))
         self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
         
@@ -98,8 +101,6 @@ class NCCreateFormUploadAssets: XLFormViewController, NCSelectDelegate {
     }
     
     @objc func changeTheming() {
-        view.backgroundColor = NCBrandColor.shared.backgroundSettings
-        tableView.backgroundColor = NCBrandColor.shared.backgroundSettings
         tableView.reloadData()
         initializeForm()
         self.reloadForm()

+ 6 - 4
iOSClient/Main/Create cloud/NCCreateFormUploadDocuments.swift

@@ -56,6 +56,8 @@ import NCCommunication
     override func viewDidLoad() {
         super.viewDidLoad()
         
+        view.backgroundColor = NCBrandColor.shared.systemGroupedBackground
+        
         if serverUrl == NCUtilityFileSystem.shared.getHomeServer(urlBase: appDelegate.urlBase, account: appDelegate.account) {
             fileNameFolder = "/"
         } else {
@@ -63,7 +65,10 @@ import NCCommunication
         }
         
         self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
-                
+        tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground
+
+        collectionView.backgroundColor = NCBrandColor.shared.systemGroupedBackground
+
         let cancelButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(cancel))
         let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
         
@@ -83,9 +88,6 @@ import NCCommunication
     }
     
     @objc func changeTheming() {
-        view.backgroundColor = NCBrandColor.shared.backgroundSettings
-        collectionView.backgroundColor = NCBrandColor.shared.backgroundSettings
-        tableView.backgroundColor = NCBrandColor.shared.backgroundSettings
         collectionView.reloadData()
         tableView.reloadData()
         initializeForm()

+ 4 - 6
iOSClient/Main/Create cloud/NCCreateFormUploadScanDocument.swift

@@ -66,16 +66,16 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
         super.viewDidLoad()
         
         self.title = NSLocalizedString("_save_settings_", comment: "")
+        view.backgroundColor = NCBrandColor.shared.systemGroupedBackground
         
         let saveButton : UIBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
         self.navigationItem.rightBarButtonItem = saveButton
         
-        self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
+        tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
+        tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground
 
         //        self.tableView.sectionHeaderHeight = 10
-        //        self.tableView.sectionFooterHeight = 10
-        //        self.tableView.backgroundColor = NCBrandColor.shared.backgroundSettings
-        
+        //        self.tableView.sectionFooterHeight = 10        
         
         //        let row : XLFormRowDescriptor  = self.form.formRow(withTag: "fileName")!
         //        let rowCell = row.cell(forForm: self)
@@ -90,8 +90,6 @@ class NCCreateFormUploadScanDocument: XLFormViewController, NCSelectDelegate, NC
     }
     
     @objc func changeTheming() {
-        view.backgroundColor = NCBrandColor.shared.backgroundSettings
-        tableView.backgroundColor = NCBrandColor.shared.backgroundSettings
         tableView.reloadData()
         initializeForm()
     }

+ 4 - 4
iOSClient/Main/Create cloud/NCCreateFormUploadVoiceNote.swift

@@ -71,11 +71,14 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
     override func viewDidLoad() {
         super.viewDidLoad()
         
+        view.backgroundColor = NCBrandColor.shared.systemGroupedBackground
+        
         self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(cancel))
         self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_save_", comment: ""), style: UIBarButtonItem.Style.plain, target: self, action: #selector(save))
         
         self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none
-        
+        tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground
+
         // title
         self.title = NSLocalizedString("_voice_memo_title_", comment: "")
         
@@ -102,10 +105,7 @@ class NCCreateFormUploadVoiceNote: XLFormViewController, NCSelectDelegate, AVAud
     }
     
     @objc func changeTheming() {
-        view.backgroundColor = NCBrandColor.shared.backgroundSettings
-        tableView.backgroundColor = NCBrandColor.shared.backgroundSettings
         tableView.reloadData()
-                
         initializeForm()
     }
     

+ 4 - 4
iOSClient/More/NCMore.swift

@@ -47,10 +47,12 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
     override func viewDidLoad() {
         super.viewDidLoad()
 
+        self.navigationItem.title = NSLocalizedString("_more_", comment: "")
+        view.backgroundColor = NCBrandColor.shared.systemGroupedBackground
+
         tableView.delegate = self
         tableView.dataSource = self
-
-        self.navigationItem.title = NSLocalizedString("_more_", comment: "")
+        tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground
 
         tableView.register(UINib.init(nibName: "NCMoreUserCell", bundle: nil), forCellReuseIdentifier: "userCell")
         
@@ -76,9 +78,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
     // MARK: - NotificationCenter
 
     @objc func changeTheming() {
-        view.backgroundColor = NCBrandColor.shared.backgroundSettings
         progressQuota.progressTintColor = NCBrandColor.shared.brandElement
-        tableView.backgroundColor = NCBrandColor.shared.backgroundSettings
         tableView.separatorColor = NCBrandColor.shared.separator
         tableView.reloadData()
     }

+ 4 - 4
iOSClient/Settings/CCAdvanced.m

@@ -272,7 +272,10 @@
         
     self.title = NSLocalizedString(@"_advanced_", nil);
     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-
+    self.view.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
+    
+    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];
     
@@ -292,9 +295,6 @@
 
 - (void)changeTheming
 {
-    self.view.backgroundColor = NCBrandColor.shared.backgroundSettings;
-    self.tableView.backgroundColor = NCBrandColor.shared.backgroundSettings;
-    
     [self initializeForm];
     [self.tableView reloadData];
 }

+ 3 - 2
iOSClient/Settings/CCManageAccount.m

@@ -361,6 +361,9 @@
     
     self.title = NSLocalizedString(@"_credentials_", nil);
     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+    self.view.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
+    
+    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];
@@ -381,8 +384,6 @@
 
 - (void)changeTheming
 {
-    self.view.backgroundColor = NCBrandColor.shared.backgroundSettings;
-    self.tableView.backgroundColor = NCBrandColor.shared.backgroundSettings;
     [self.tableView reloadData];
     [self initializeForm];
 }

+ 3 - 2
iOSClient/Settings/CCManageAutoUpload.m

@@ -204,6 +204,9 @@
     
     self.title = NSLocalizedString(@"_settings_autoupload_", nil);
     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+    self.view.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
+    
+    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];
@@ -243,8 +246,6 @@
 
 - (void)changeTheming
 {
-    self.view.backgroundColor = NCBrandColor.shared.backgroundSettings;
-    self.tableView.backgroundColor = NCBrandColor.shared.backgroundSettings;
     [self.tableView reloadData];
     [self initializeForm];
     [self reloadForm];

+ 3 - 3
iOSClient/Settings/NCManageAutoUploadFileName.swift

@@ -109,6 +109,9 @@ class NCManageAutoUploadFileName: XLFormViewController {
         super.viewDidLoad()
         
         self.title = NSLocalizedString("_mode_filename_", comment: "")
+        view.backgroundColor = NCBrandColor.shared.systemGroupedBackground
+        
+        tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground
         
         // Theming view
         NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
@@ -124,10 +127,7 @@ class NCManageAutoUploadFileName: XLFormViewController {
     // MARK: - NotificationCenter
 
     @objc func changeTheming() {
-        view.backgroundColor = NCBrandColor.shared.backgroundSettings
-        tableView.backgroundColor = NCBrandColor.shared.backgroundSettings
         tableView.reloadData()
-        
         initializeForm()
         reloadForm()
     }

+ 3 - 3
iOSClient/Settings/NCManageEndToEndEncryption.m

@@ -175,6 +175,9 @@
     
     self.title = NSLocalizedString(@"_e2e_settings_", nil);
     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+    self.view.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
+    
+    self.tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
         
     // E2EE
     self.endToEndInitialize = [NCEndToEndInitialize new];
@@ -200,9 +203,6 @@
 
 - (void)changeTheming
 {
-    self.view.backgroundColor = NCBrandColor.shared.backgroundSettings;
-    self.tableView.backgroundColor = NCBrandColor.shared.backgroundSettings;
-    
     [self.tableView reloadData];
     [self initializeForm];
 }

+ 2 - 3
iOSClient/Settings/NCSettings.m

@@ -177,6 +177,8 @@
     [super viewDidLoad];
     
     self.title = NSLocalizedString(@"_settings_", nil);
+    self.view.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
+    self.tableView.backgroundColor = NCBrandColor.shared.systemGroupedBackground;
     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
     
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:NCGlobal.shared.notificationCenterChangeTheming object:nil];
@@ -199,9 +201,6 @@
 
 - (void)changeTheming
 {
-    self.view.backgroundColor = NCBrandColor.shared.backgroundSettings;
-    self.tableView.backgroundColor = NCBrandColor.shared.backgroundSettings;
-    
     [self initializeForm];
     [self reloadForm];
 }