Sfoglia il codice sorgente

drop SystemColor enum, use UIColor.systemRed/Green/Blue/etc. instead

B. Petersen 2 anni fa
parent
commit
0f8e1e307f

+ 1 - 1
DcCore/DcCore/Extensions/UIView+Extensions.swift

@@ -2,7 +2,7 @@ import UIKit
 
 public extension UIView {
 
-    func makeBorder(color: UIColor = UIColor.red) {
+    func makeBorder(color: UIColor = UIColor.systemRed) {
         self.layer.borderColor = color.cgColor
         self.layer.borderWidth = 2
     }

+ 1 - 33
DcCore/DcCore/Helper/DcColors.swift

@@ -35,41 +35,9 @@ public struct DcColors {
         dark: UIColor(red: 30 / 255, green: 30 / 255, blue: 30 / 255, alpha: 0.25))
     public static let placeholderColor = UIColor(red: 0.55, green: 0.55, blue: 0.55, alpha: 1)
     public static let providerPreparationBackground = UIColor.init(hexString: "fdf7b2")
-    public static let providerBrokenBackground = UIColor.themeColor(light: SystemColor.red.uiColor, dark: SystemColor.red.uiColor)
+    public static let providerBrokenBackground = UIColor.systemRed
     public static let systemMessageBackgroundColor = UIColor.init(hexString: "65444444")
     public static let systemMessageFontColor = UIColor.white
     public static let deaddropBackground = UIColor.themeColor(light: UIColor.init(hexString: "f2f2f6"), dark: UIColor.init(hexString: "1a1a1c"))
     public static let accountSwitchBackgroundColor = UIColor.themeColor(light: UIColor.init(hexString: "65CCCCCC"), dark: UIColor.init(hexString: "65444444"))
 }
-
-public enum SystemColor {
-    case red
-    case orange
-    case yellow
-    case green
-    case tealBlue
-    case blue
-    case purple
-    case pink
-
-    public var uiColor: UIColor {
-        switch self {
-        case .red:
-            return UIColor(red: 255 / 255, green: 59 / 255, blue: 48 / 255, alpha: 1)
-        case .orange:
-            return UIColor(red: 255 / 255, green: 149 / 255, blue: 0 / 255, alpha: 1)
-        case .yellow:
-            return UIColor(red: 255 / 255, green: 204 / 255, blue: 0 / 255, alpha: 1)
-        case .green:
-            return UIColor(red: 76 / 255, green: 217 / 255, blue: 100 / 255, alpha: 1)
-        case .tealBlue:
-            return UIColor(red: 90 / 255, green: 200 / 255, blue: 250 / 255, alpha: 1)
-        case .blue:
-            return UIColor(red: 0 / 255, green: 122 / 255, blue: 255 / 255, alpha: 1)
-        case .purple:
-            return UIColor(red: 88 / 255, green: 86 / 255, blue: 214 / 255, alpha: 1)
-        case .pink:
-            return UIColor(red: 255 / 255, green: 45 / 255, blue: 85 / 255, alpha: 1)
-        }
-    }
-}

+ 1 - 1
deltachat-ios/Controller/AddGroupMembersViewController.swift

@@ -37,7 +37,7 @@ class AddGroupMembersViewController: GroupMembersViewController {
 
     private lazy var newContactCell: ActionCell = {
         let cell = ActionCell()
-        cell.actionColor = SystemColor.blue.uiColor
+        cell.actionColor = UIColor.systemBlue
         cell.actionTitle = String.localized("menu_new_contact")
         return cell
     }()

+ 2 - 2
deltachat-ios/Controller/AudioRecorderController.swift

@@ -25,8 +25,8 @@ class AudioRecorderController: UIViewController, AVAudioRecorderDelegate {
     var recordingFilePath: String = ""
     var audioRecorder: AVAudioRecorder?
 
-    var normalTintColor: UIColor = UIColor.sendButtonBlue
-    var highlightedTintColor = UIColor.red
+    var normalTintColor: UIColor = UIColor.systemBlue
+    var highlightedTintColor = UIColor.systemRed
 
     var isFirstUsage: Bool = true
 

+ 8 - 8
deltachat-ios/Controller/ContactDetailViewController.swift

@@ -19,7 +19,7 @@ class ContactDetailViewController: UITableViewController {
 
     private lazy var startChatCell: ActionCell = {
         let cell = ActionCell()
-        cell.actionColor = SystemColor.blue.uiColor
+        cell.actionColor = UIColor.systemBlue
         cell.actionTitle = String.localized("send_message")
         return cell
     }()
@@ -37,42 +37,42 @@ class ContactDetailViewController: UITableViewController {
     private lazy var showEncrInfoCell: ActionCell = {
         let cell = ActionCell()
         cell.actionTitle = String.localized("encryption_info_title_desktop")
-        cell.actionColor = SystemColor.blue.uiColor
+        cell.actionColor = UIColor.systemBlue
         return cell
     }()
 
     private lazy var copyToClipboardCell: ActionCell = {
         let cell = ActionCell()
         cell.actionTitle = String.localized("menu_copy_to_clipboard")
-        cell.actionColor = SystemColor.blue.uiColor
+        cell.actionColor = UIColor.systemBlue
         return cell
     }()
 
     private lazy var blockContactCell: ActionCell = {
         let cell = ActionCell()
         cell.actionTitle = viewModel.contact.isBlocked ? String.localized("menu_unblock_contact") : String.localized("menu_block_contact")
-        cell.actionColor = viewModel.contact.isBlocked ? SystemColor.blue.uiColor : UIColor.red
+        cell.actionColor = viewModel.contact.isBlocked ? UIColor.systemBlue : UIColor.systemRed
         return cell
     }()
 
     private lazy var archiveChatCell: ActionCell = {
         let cell = ActionCell()
         cell.actionTitle = viewModel.chatIsArchived ? String.localized("menu_unarchive_chat") :  String.localized("menu_archive_chat")
-        cell.actionColor = SystemColor.blue.uiColor
+        cell.actionColor = UIColor.systemBlue
         return cell
     }()
 
     private lazy var clearChatCell: ActionCell = {
         let cell = ActionCell()
         cell.actionTitle = String.localized("clear_chat")
-        cell.actionColor = UIColor.red
+        cell.actionColor = UIColor.systemRed
         return cell
     }()
 
     private lazy var deleteChatCell: ActionCell = {
         let cell = ActionCell()
         cell.actionTitle = String.localized("menu_delete_chat")
-        cell.actionColor = UIColor.red
+        cell.actionColor = UIColor.systemRed
         return cell
     }()
 
@@ -371,7 +371,7 @@ class ContactDetailViewController: UITableViewController {
 
     private func updateBlockContactCell() {
         blockContactCell.actionTitle = viewModel.contact.isBlocked ? String.localized("menu_unblock_contact") : String.localized("menu_block_contact")
-        blockContactCell.actionColor = viewModel.contact.isBlocked ? SystemColor.blue.uiColor : UIColor.red
+        blockContactCell.actionColor = viewModel.contact.isBlocked ? UIColor.systemBlue : UIColor.systemRed
     }
 
 

+ 5 - 5
deltachat-ios/Controller/GroupChatDetailViewController.swift

@@ -99,28 +99,28 @@ class GroupChatDetailViewController: UIViewController {
     private lazy var leaveGroupCell: ActionCell = {
         let cell = ActionCell()
         cell.actionTitle = String.localized("menu_leave_group")
-        cell.actionColor = UIColor.red
+        cell.actionColor = UIColor.systemRed
         return cell
     }()
 
     private lazy var copyToClipboardCell: ActionCell = {
         let cell = ActionCell()
         cell.actionTitle = String.localized("menu_copy_to_clipboard")
-        cell.actionColor = SystemColor.blue.uiColor
+        cell.actionColor = UIColor.systemBlue
         return cell
     }()
 
     private lazy var clearChatCell: ActionCell = {
         let cell = ActionCell()
         cell.actionTitle = String.localized("clear_chat")
-        cell.actionColor = UIColor.red
+        cell.actionColor = UIColor.systemRed
         return cell
     }()
 
     private lazy var deleteChatCell: ActionCell = {
         let cell = ActionCell()
         cell.actionTitle = String.localized("menu_delete_chat")
-        cell.actionColor = UIColor.red
+        cell.actionColor = UIColor.systemRed
         return cell
     }()
 
@@ -616,7 +616,7 @@ extension GroupChatDetailViewController: UITableViewDelegate, UITableViewDataSou
                 alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
                 self.present(alert, animated: true, completion: nil)
             }
-            delete.backgroundColor = UIColor.red
+            delete.backgroundColor = UIColor.systemRed
             return [delete]
         }
         return nil

+ 1 - 1
deltachat-ios/Controller/NewGroupController.swift

@@ -279,7 +279,7 @@ class NewGroupController: UITableViewController, MediaPickerDelegate {
                     self.removeGroupContactFromList(at: indexPath)
                 }
             }
-            delete.backgroundColor = UIColor.red
+            delete.backgroundColor = UIColor.systemRed
             return [delete]
         } else {
             return nil

+ 1 - 1
deltachat-ios/View/MessageCounter.swift

@@ -27,7 +27,7 @@ class MessageCounter: UIView {
         let radius = size / 2
         layer.cornerRadius = radius
         translatesAutoresizingMaskIntoConstraints = false
-        self.backgroundColor = UIColor.red
+        self.backgroundColor = UIColor.systemRed
         addConstraint(constraintHeightTo(size))
         widthConstraint = constraintWidthTo(size)
         addConstraint(widthConstraint!)