diff --git a/Bark.xcodeproj/project.pbxproj b/Bark.xcodeproj/project.pbxproj index e9f3209..489497d 100644 --- a/Bark.xcodeproj/project.pbxproj +++ b/Bark.xcodeproj/project.pbxproj @@ -84,6 +84,7 @@ 0672CB06256903F700570C9D /* MessageListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0672CB05256903F700570C9D /* MessageListViewModel.swift */; }; 067B2EB525693E38008B6BE1 /* MessageTableViewCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067B2EB425693E38008B6BE1 /* MessageTableViewCellViewModel.swift */; }; 06802E5320ECC40C00767047 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0661A549204FDA4100965E4E /* Assets.xcassets */; }; + 06840DBB272298FB001B3193 /* BKColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06840DBA272298FB001B3193 /* BKColor.swift */; }; 06885EB6247FB9880004A303 /* MessageSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06885EB5247FB9880004A303 /* MessageSettingsViewController.swift */; }; 068F66B3247BD84C00DAD25A /* MessageListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 068F66B2247BD84C00DAD25A /* MessageListViewController.swift */; }; 06AE3118266F4E2E00B39FBB /* GroupFilterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06AE3117266F4E2E00B39FBB /* GroupFilterViewController.swift */; }; @@ -244,6 +245,7 @@ 0683486A2050F1310024B6DA /* Bark.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Bark.entitlements; sourceTree = ""; }; 0683487020510FB20024B6DA /* UserNotifications.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotifications.framework; path = System/Library/Frameworks/UserNotifications.framework; sourceTree = SDKROOT; }; 0683487220510FB20024B6DA /* UserNotificationsUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UserNotificationsUI.framework; path = System/Library/Frameworks/UserNotificationsUI.framework; sourceTree = SDKROOT; }; + 06840DBA272298FB001B3193 /* BKColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BKColor.swift; sourceTree = ""; }; 06885EB5247FB9880004A303 /* MessageSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageSettingsViewController.swift; sourceTree = ""; }; 068F66B2247BD84C00DAD25A /* MessageListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListViewController.swift; sourceTree = ""; }; 06AE3117266F4E2E00B39FBB /* GroupFilterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupFilterViewController.swift; sourceTree = ""; }; @@ -451,6 +453,7 @@ 06C5953224811505006B98F3 /* ArchiveSettingManager.swift */, 06BBB8C82567B6730076F63E /* Operators.swift */, 0633E809256A091B00ED0680 /* MJRefresh+Rx.swift */, + 06840DBA272298FB001B3193 /* BKColor.swift */, ); path = Common; sourceTree = ""; @@ -910,6 +913,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 06840DBB272298FB001B3193 /* BKColor.swift in Sources */, 06C2CF232685B88D0034B127 /* TextCell.swift in Sources */, 06BBB896256518760076F63E /* NewServerViewModel.swift in Sources */, 06BBB8C92567B6730076F63E /* Operators.swift in Sources */, diff --git a/Bark/AppDelegate.swift b/Bark/AppDelegate.swift index 28fb0b3..dcd557c 100644 --- a/Bark/AppDelegate.swift +++ b/Bark/AppDelegate.swift @@ -51,11 +51,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD setupRealm() self.window = UIWindow(frame: UIScreen.main.bounds) - if #available(iOS 13.0, *) { - self.window?.overrideUserInterfaceStyle = .light - } let tabBarController = StateStorageTabBarController() - tabBarController.tabBar.tintColor = UIColor.black + tabBarController.tabBar.tintColor = BKColor.grey.darken4 self.window?.backgroundColor = UIColor.black self.window?.rootViewController = BarkSnackbarController( @@ -96,7 +93,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD let bar = UINavigationBar.appearance(whenContainedInInstancesOf: [BarkNavigationController.self]) bar.backIndicatorImage = UIImage(named: "back") bar.backIndicatorTransitionMaskImage = UIImage(named: "back") - bar.tintColor = Color.darkText.primary + bar.tintColor = BKColor.grey.darken4 return true } @@ -123,8 +120,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { if let dict = userInfo as? [String: NSObject], - let notification = CKNotification(fromRemoteNotificationDictionary: dict), - let subscriptionID = notification.subscriptionID, IceCreamSubscription.allIDs.contains(subscriptionID) { + let notification = CKNotification(fromRemoteNotificationDictionary: dict), + let subscriptionID = notification.subscriptionID, IceCreamSubscription.allIDs.contains(subscriptionID) + { NotificationCenter.default.post(name: Notifications.cloudKitDataDidChangeRemotely.name, object: nil, userInfo: userInfo) completionHandler(.newData) } diff --git a/Bark/Assets.xcassets/Colors/Contents.json b/Bark/Assets.xcassets/Colors/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Bark/Assets.xcassets/Colors/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/background.colorset/Contents.json b/Bark/Assets.xcassets/Colors/background.colorset/Contents.json new file mode 100644 index 0000000..65c0a1c --- /dev/null +++ b/Bark/Assets.xcassets/Colors/background.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "245", + "green" : "245", + "red" : "245" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0", + "green" : "0", + "red" : "0" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/background_seconday.colorset/Contents.json b/Bark/Assets.xcassets/Colors/background_seconday.colorset/Contents.json new file mode 100644 index 0000000..4c2e26a --- /dev/null +++ b/Bark/Assets.xcassets/Colors/background_seconday.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "255", + "green" : "255", + "red" : "255" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "22", + "green" : "22", + "red" : "22" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/blue_base.colorset/Contents.json b/Bark/Assets.xcassets/Colors/blue_base.colorset/Contents.json new file mode 100644 index 0000000..c53c407 --- /dev/null +++ b/Bark/Assets.xcassets/Colors/blue_base.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "243", + "green" : "150", + "red" : "33" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "243", + "green" : "150", + "red" : "33" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/blue_darken1.colorset/Contents.json b/Bark/Assets.xcassets/Colors/blue_darken1.colorset/Contents.json new file mode 100644 index 0000000..b69ad6c --- /dev/null +++ b/Bark/Assets.xcassets/Colors/blue_darken1.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "229", + "green" : "136", + "red" : "30" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "245", + "green" : "165", + "red" : "66" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/darkText_primary.colorset/Contents.json b/Bark/Assets.xcassets/Colors/darkText_primary.colorset/Contents.json new file mode 100644 index 0000000..5c9ae75 --- /dev/null +++ b/Bark/Assets.xcassets/Colors/darkText_primary.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "0.870", + "blue" : "255", + "green" : "255", + "red" : "255" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "0.870", + "blue" : "0", + "green" : "0", + "red" : "0" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/darkText_secondary.colorset/Contents.json b/Bark/Assets.xcassets/Colors/darkText_secondary.colorset/Contents.json new file mode 100644 index 0000000..00a16a1 --- /dev/null +++ b/Bark/Assets.xcassets/Colors/darkText_secondary.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "0.540", + "blue" : "255", + "green" : "255", + "red" : "255" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "0.540", + "blue" : "0", + "green" : "0", + "red" : "0" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/grey_base.colorset/Contents.json b/Bark/Assets.xcassets/Colors/grey_base.colorset/Contents.json new file mode 100644 index 0000000..3f8a150 --- /dev/null +++ b/Bark/Assets.xcassets/Colors/grey_base.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "158", + "green" : "158", + "red" : "158" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "97", + "green" : "97", + "red" : "97" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/grey_darken1.colorset/Contents.json b/Bark/Assets.xcassets/Colors/grey_darken1.colorset/Contents.json new file mode 100644 index 0000000..5351a71 --- /dev/null +++ b/Bark/Assets.xcassets/Colors/grey_darken1.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "117", + "green" : "117", + "red" : "117" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "189", + "green" : "189", + "red" : "189" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/grey_darken2.colorset/Contents.json b/Bark/Assets.xcassets/Colors/grey_darken2.colorset/Contents.json new file mode 100644 index 0000000..c2559b3 --- /dev/null +++ b/Bark/Assets.xcassets/Colors/grey_darken2.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "97", + "green" : "97", + "red" : "97" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "224", + "green" : "224", + "red" : "224" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/grey_darken3.colorset/Contents.json b/Bark/Assets.xcassets/Colors/grey_darken3.colorset/Contents.json new file mode 100644 index 0000000..25350b8 --- /dev/null +++ b/Bark/Assets.xcassets/Colors/grey_darken3.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "66", + "green" : "66", + "red" : "66" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "238", + "green" : "238", + "red" : "238" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/grey_darken4.colorset/Contents.json b/Bark/Assets.xcassets/Colors/grey_darken4.colorset/Contents.json new file mode 100644 index 0000000..89bb0fd --- /dev/null +++ b/Bark/Assets.xcassets/Colors/grey_darken4.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "33", + "green" : "33", + "red" : "33" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "245", + "green" : "245", + "red" : "245" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/grey_lighten1.colorset/Contents.json b/Bark/Assets.xcassets/Colors/grey_lighten1.colorset/Contents.json new file mode 100644 index 0000000..43fb21e --- /dev/null +++ b/Bark/Assets.xcassets/Colors/grey_lighten1.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "189", + "green" : "189", + "red" : "189" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "117", + "green" : "117", + "red" : "117" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/grey_lighten3.colorset/Contents.json b/Bark/Assets.xcassets/Colors/grey_lighten3.colorset/Contents.json new file mode 100644 index 0000000..f2e48de --- /dev/null +++ b/Bark/Assets.xcassets/Colors/grey_lighten3.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "238", + "green" : "238", + "red" : "238" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "66", + "green" : "66", + "red" : "66" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/grey_lighten4.colorset/Contents.json b/Bark/Assets.xcassets/Colors/grey_lighten4.colorset/Contents.json new file mode 100644 index 0000000..6d0d25b --- /dev/null +++ b/Bark/Assets.xcassets/Colors/grey_lighten4.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "245", + "green" : "245", + "red" : "245" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "33", + "green" : "33", + "red" : "33" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/grey_lighten5.colorset/Contents.json b/Bark/Assets.xcassets/Colors/grey_lighten5.colorset/Contents.json new file mode 100644 index 0000000..c2b466b --- /dev/null +++ b/Bark/Assets.xcassets/Colors/grey_lighten5.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "250", + "green" : "250", + "red" : "250" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "28", + "green" : "28", + "red" : "28" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/Colors/lightBlue_darken3.colorset/Contents.json b/Bark/Assets.xcassets/Colors/lightBlue_darken3.colorset/Contents.json new file mode 100644 index 0000000..3d12f1a --- /dev/null +++ b/Bark/Assets.xcassets/Colors/lightBlue_darken3.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "189", + "green" : "119", + "red" : "2" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "250", + "green" : "212", + "red" : "129" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Assets.xcassets/notification_copy_color.colorset/Contents.json b/Bark/Assets.xcassets/Colors/notification_copy_color.colorset/Contents.json similarity index 100% rename from Bark/Assets.xcassets/notification_copy_color.colorset/Contents.json rename to Bark/Assets.xcassets/Colors/notification_copy_color.colorset/Contents.json diff --git a/Bark/Assets.xcassets/Colors/white.colorset/Contents.json b/Bark/Assets.xcassets/Colors/white.colorset/Contents.json new file mode 100644 index 0000000..0425637 --- /dev/null +++ b/Bark/Assets.xcassets/Colors/white.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000", + "red" : "1.000" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.000", + "green" : "0.000", + "red" : "0.000" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Bark/Base.lproj/LaunchScreen.storyboard b/Bark/Base.lproj/LaunchScreen.storyboard index f83f6fd..89119db 100644 --- a/Bark/Base.lproj/LaunchScreen.storyboard +++ b/Bark/Base.lproj/LaunchScreen.storyboard @@ -1,7 +1,10 @@ - - + + + - + + + @@ -11,10 +14,10 @@ - + - + @@ -22,4 +25,9 @@ + + + + + diff --git a/Common/BKColor.swift b/Common/BKColor.swift new file mode 100644 index 0000000..1c5cbea --- /dev/null +++ b/Common/BKColor.swift @@ -0,0 +1,40 @@ +// +// BKColor.swift +// Bark +// +// Created by huangfeng on 2021/10/22. +// Copyright © 2021 Fin. All rights reserved. +// + +import UIKit + +class BKColor: NSObject { + + enum grey { + public static let base = UIColor(named: "grey_base")! + public static let darken1 = UIColor(named: "grey_darken1")! + public static let darken2 = UIColor(named: "grey_darken2")! + public static let darken3 = UIColor(named: "grey_darken3")! + public static let darken4 = UIColor(named: "grey_darken4")! + public static let lighten1 = UIColor(named: "grey_lighten1")! + public static let lighten3 = UIColor(named: "grey_lighten3")! + public static let lighten4 = UIColor(named: "grey_lighten4")! + public static let lighten5 = UIColor(named: "grey_lighten5")! + } + + enum blue { + public static let base = UIColor(named: "blue_base")! + public static let darken1 = UIColor(named: "blue_darken1")! + } + + enum lightBlue { + public static let darken3 = UIColor(named: "lightBlue_darken3")! + } + + public static let white = UIColor(named: "white")! + + enum background { + public static let primary = UIColor(named: "background")! + public static let secondary = UIColor(named: "background_seconday")! + } +} diff --git a/Controller/BaseViewController.swift b/Controller/BaseViewController.swift index 5b1cfc6..9af8943 100644 --- a/Controller/BaseViewController.swift +++ b/Controller/BaseViewController.swift @@ -14,7 +14,7 @@ class BaseViewController: UIViewController { self.viewModel = viewModel super.init(nibName: nil, bundle: nil) - self.view.backgroundColor = Color.grey.lighten5 + self.view.backgroundColor = BKColor.background.primary } @available(*, unavailable) diff --git a/Controller/GroupFilterViewController.swift b/Controller/GroupFilterViewController.swift index a7ec9d4..3f81b34 100644 --- a/Controller/GroupFilterViewController.swift +++ b/Controller/GroupFilterViewController.swift @@ -36,8 +36,8 @@ class GroupFilterViewController: BaseViewController { let tableView: UITableView = { let tableView = UITableView(frame: CGRect.zero, style: .insetGrouped) tableView.separatorStyle = .singleLine - tableView.separatorColor = Color.grey.lighten3 - tableView.backgroundColor = Color.grey.lighten5 + tableView.separatorColor = BKColor.grey.lighten3 + tableView.backgroundColor = BKColor.background.primary tableView.register(GroupTableViewCell.self, forCellReuseIdentifier: "\(GroupTableViewCell.self)") return tableView }() diff --git a/Controller/HomeViewController.swift b/Controller/HomeViewController.swift index 644b7d4..97273da 100644 --- a/Controller/HomeViewController.swift +++ b/Controller/HomeViewController.swift @@ -16,13 +16,14 @@ class HomeViewController: BaseViewController { let newButton: BKButton = { let btn = BKButton() btn.setImage(Icon.add, for: .normal) + btn.imageView?.tintColor = BKColor.grey.darken4 btn.frame = CGRect(x: 0, y: 0, width: 40, height: 40) return btn }() let startButton: FABButton = { let button = FABButton(title: NSLocalizedString("RegisterDevice")) - button.backgroundColor = Color.white + button.backgroundColor = BKColor.white button.transition([.scale(0.75), .opacity(0)]) return button }() @@ -30,14 +31,14 @@ class HomeViewController: BaseViewController { let tableView: UITableView = { let tableView = UITableView() tableView.separatorStyle = .none - tableView.backgroundColor = Color.grey.lighten4 + tableView.backgroundColor = BKColor.background.primary tableView.register(PreviewCardCell.self, forCellReuseIdentifier: "\(PreviewCardCell.self)") tableView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 20, right: 0) return tableView }() override func makeUI() { - self.view.backgroundColor = Color.grey.lighten4 + self.view.backgroundColor = BKColor.background.primary navigationItem.setRightBarButtonItem( item: UIBarButtonItem(customView: newButton)) diff --git a/Controller/MessageListViewController.swift b/Controller/MessageListViewController.swift index f9aa2aa..3a32110 100644 --- a/Controller/MessageListViewController.swift +++ b/Controller/MessageListViewController.swift @@ -48,7 +48,7 @@ class MessageListViewController: BaseViewController { let tableView: UITableView = { let tableView = UITableView() tableView.separatorStyle = .none - tableView.backgroundColor = Color.grey.lighten5 + tableView.backgroundColor = BKColor.background.primary tableView.register(MessageTableViewCell.self, forCellReuseIdentifier: "\(MessageTableViewCell.self)") tableView.contentInset = UIEdgeInsets(top: 20, left: 0, bottom: 0, right: 0) return tableView diff --git a/Controller/MessageSettingsViewController.swift b/Controller/MessageSettingsViewController.swift index ed073c1..ae0078a 100644 --- a/Controller/MessageSettingsViewController.swift +++ b/Controller/MessageSettingsViewController.swift @@ -13,7 +13,7 @@ class MessageSettingsViewController: BaseViewController { let tableView: UITableView = { let tableView = UITableView() tableView.separatorStyle = .none - tableView.backgroundColor = Color.grey.lighten5 + tableView.backgroundColor = BKColor.background.primary tableView.register(LabelCell.self, forCellReuseIdentifier: "\(LabelCell.self)") tableView.register(iCloudStatusCell.self, forCellReuseIdentifier: "\(iCloudStatusCell.self)") tableView.register(ArchiveSettingCell.self, forCellReuseIdentifier: "\(ArchiveSettingCell.self)") diff --git a/Controller/MessageSettingsViewModel.swift b/Controller/MessageSettingsViewModel.swift index 07137ad..6b2f140 100644 --- a/Controller/MessageSettingsViewModel.swift +++ b/Controller/MessageSettingsViewModel.swift @@ -31,7 +31,7 @@ class MessageSettingsViewModel: ViewModel, ViewModelType { settings.append(.label(text: NSLocalizedString("defaultArchiveSettings"))) settings.append(.archiveSetting(viewModel: ArchiveSettingCellViewModel(on: ArchiveSettingManager.shared.isArchive))) settings.append(.label(text: NSLocalizedString("archiveNote"))) - + if let infoDict = Bundle.main.infoDictionary, let runId = infoDict["GitHub Run Id"] as? String { @@ -39,26 +39,26 @@ class MessageSettingsViewModel: ViewModel, ViewModelType { settings.append(.detail( title: "Github Run Id", text: "\(runId)", - textColor: Color.grey.darken2, + textColor: BKColor.grey.darken2, url: URL(string: "https://github.com/Finb/Bark/actions/runs/\(runId)"))) settings.append(.label(text: NSLocalizedString("buildDesc"))) } - + settings.append(.label(text: NSLocalizedString("other"))) settings.append(.detail( title: NSLocalizedString("faq"), text: nil, textColor: nil, url: URL(string: "https://day.app/2021/06/barkfaq/"))) - - settings.append(.spacer(height: 0.5, color: Color.grey.lighten4)) + + settings.append(.spacer(height: 0.5, color: BKColor.grey.lighten4)) settings.append(.detail( title: NSLocalizedString("appSC"), text: nil, textColor: nil, url: URL(string: "https://github.com/Finb/Bark"))) - - settings.append(.spacer(height: 0.5, color: Color.grey.lighten4)) + + settings.append(.spacer(height: 0.5, color: BKColor.grey.lighten4)) settings.append(.detail( title: NSLocalizedString("backendSC"), text: nil, @@ -66,7 +66,7 @@ class MessageSettingsViewModel: ViewModel, ViewModelType { url: URL(string: "https://github.com/Finb/bark-server"))) return settings }() - + settings.compactMap { item -> ArchiveSettingCellViewModel? in if case let MessageSettingItem.archiveSetting(viewModel) = item { return viewModel @@ -85,7 +85,7 @@ class MessageSettingsViewModel: ViewModel, ViewModelType { } return nil } - + return Output( settings: Driver<[SectionModel]> .just([SectionModel(model: "model", items: settings)]), diff --git a/Controller/NewServerViewController.swift b/Controller/NewServerViewController.swift index 2b96a69..c0bddfa 100644 --- a/Controller/NewServerViewController.swift +++ b/Controller/NewServerViewController.swift @@ -21,13 +21,16 @@ class NewServerViewController: BaseViewController { textField.detail = NSLocalizedString("ServerExample") textField.transition([.scale(0.85), .opacity(0)]) textField.detailLabel.transition([.scale(0.85), .opacity(0)]) + textField.textColor = BKColor.grey.darken4 + textField.placeholderNormalColor = BKColor.grey.base + textField.detailLabel.textColor = BKColor.grey.base return textField }() let noticeLabel: UILabel = { let label = UILabel() label.text = NSLocalizedString("DeploymentDocuments") - label.textColor = Color.blue.base + label.textColor = BKColor.blue.base label.font = UIFont.systemFont(ofSize: 12) label.transition([.scale(0.85), .opacity(0), .translate(x: 50)]) label.isUserInteractionEnabled = true @@ -40,6 +43,7 @@ class NewServerViewController: BaseViewController { doneButton.setImage(Icon.check, for: .normal) doneButton.frame = CGRect(x: 0, y: 0, width: 40, height: 40) navigationItem.setRightBarButtonItem(item: UIBarButtonItem(customView: doneButton)) + doneButton.tintColor = BKColor.grey.darken4 return doneButton }() diff --git a/Controller/SoundsViewController.swift b/Controller/SoundsViewController.swift index f10658a..d71c02e 100644 --- a/Controller/SoundsViewController.swift +++ b/Controller/SoundsViewController.swift @@ -18,7 +18,7 @@ import RxSwift class SoundsViewController: BaseViewController { let tableView: UITableView = { let tableView = UITableView() - tableView.backgroundColor = Color.grey.lighten5 + tableView.backgroundColor = BKColor.background.primary tableView.register(SoundCell.self, forCellReuseIdentifier: "\(SoundCell.self)") return tableView }() @@ -35,7 +35,7 @@ class SoundsViewController: BaseViewController { let header = UILabel() header.fontSize = 12 header.text = " \(NSLocalizedString("previewSound"))" - header.textColor = Color.darkText.secondary + header.textColor = BKColor.grey.darken1 header.frame = CGRect(x: 0, y: 0, width: 0, height: 40) return header }() diff --git a/View/ArchiveSettingCell.swift b/View/ArchiveSettingCell.swift index ca88a15..f764147 100644 --- a/View/ArchiveSettingCell.swift +++ b/View/ArchiveSettingCell.swift @@ -17,7 +17,7 @@ class ArchiveSettingCell: BaseTableViewCell { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) self.selectionStyle = .none - + self.backgroundColor = BKColor.background.secondary self.textLabel?.text = NSLocalizedString("defaultArchiveSettings") contentView.addSubview(switchButton) diff --git a/View/GroupTableViewCell.swift b/View/GroupTableViewCell.swift index f1b3120..f0cfef4 100644 --- a/View/GroupTableViewCell.swift +++ b/View/GroupTableViewCell.swift @@ -13,7 +13,7 @@ class GroupTableViewCell: BaseTableViewCell { let nameLabel: UILabel = { let label = UILabel() label.fontSize = 14 - label.textColor = Color.darkText.primary + label.textColor = BKColor.grey.darken4 return label }() @@ -21,7 +21,7 @@ class GroupTableViewCell: BaseTableViewCell { let btn = BKButton() btn.setImage(UIImage(named: "baseline_radio_button_unchecked_black_24pt"), for: .normal) btn.setImage(UIImage(named: "baseline_check_circle_outline_black_24pt"), for: .selected) - btn.tintColor = Color.lightGray + btn.tintColor = BKColor.grey.base btn.isUserInteractionEnabled = false return btn }() @@ -74,7 +74,7 @@ class GroupTableViewCell: BaseTableViewCell { viewModel.checked.subscribe( onNext: { [weak self] checked in - self?.checkButton.tintColor = checked ? Color.lightBlue.darken3 : Color.lightGray + self?.checkButton.tintColor = checked ? BKColor.lightBlue.darken3 : BKColor.grey.base }).disposed(by: rx.reuseBag) } } diff --git a/View/LabelCell.swift b/View/LabelCell.swift index b97620e..4c3f0af 100644 --- a/View/LabelCell.swift +++ b/View/LabelCell.swift @@ -14,8 +14,8 @@ class LabelCell: UITableViewCell { super.init(style: style, reuseIdentifier: reuseIdentifier) self.selectionStyle = .none - self.backgroundColor = Color.grey.lighten5 - self.textLabel?.textColor = Color.darkText.secondary + self.backgroundColor = BKColor.background.primary + self.textLabel?.textColor = BKColor.grey.darken1 self.textLabel?.fontSize = 12 self.textLabel?.numberOfLines = 0 } diff --git a/View/MessageTableViewCell.swift b/View/MessageTableViewCell.swift index d24f06a..dcb7dd8 100644 --- a/View/MessageTableViewCell.swift +++ b/View/MessageTableViewCell.swift @@ -13,14 +13,14 @@ class MessageTableViewCell: BaseTableViewCell { let view = UIView() view.layer.cornerRadius = 3 view.clipsToBounds = true - view.backgroundColor = UIColor.white + view.backgroundColor = BKColor.background.secondary return view }() let titleLabel: UILabel = { let label = UILabel() label.font = RobotoFont.medium(with: 16) - label.textColor = Color.darkText.primary + label.textColor = BKColor.grey.darken4 label.numberOfLines = 0 return label }() @@ -28,7 +28,7 @@ class MessageTableViewCell: BaseTableViewCell { let bodyLabel: UILabel = { let label = UILabel() label.font = RobotoFont.regular(with: 14) - label.textColor = Color.darkText.primary + label.textColor = BKColor.grey.darken4 label.numberOfLines = 0 return label }() @@ -38,7 +38,7 @@ class MessageTableViewCell: BaseTableViewCell { label.hitTestSlop = UIEdgeInsets(top: -20, left: -20, bottom: -20, right: -20) label.isUserInteractionEnabled = true label.font = RobotoFont.regular(with: 14) - label.textColor = Color.blue.darken1 + label.textColor = BKColor.blue.darken1 label.numberOfLines = 0 return label }() @@ -46,7 +46,7 @@ class MessageTableViewCell: BaseTableViewCell { let dateLabel: UILabel = { let label = UILabel() label.font = RobotoFont.medium(with: 11) - label.textColor = Color.darkText.others + label.textColor = BKColor.grey.base return label }() @@ -58,7 +58,7 @@ class MessageTableViewCell: BaseTableViewCell { let separatorLine: UIImageView = { let imageView = UIImageView() - imageView.backgroundColor = Color.grey.lighten5 + imageView.backgroundColor = BKColor.background.primary return imageView }() @@ -66,7 +66,7 @@ class MessageTableViewCell: BaseTableViewCell { super.init(style: style, reuseIdentifier: reuseIdentifier) self.selectionStyle = .none - self.backgroundColor = Color.grey.lighten5 + self.backgroundColor = BKColor.background.primary contentView.addSubview(backgroundPanel) contentView.addSubview(bodyStackView) diff --git a/View/PreviewCardCell.swift b/View/PreviewCardCell.swift index 7b8def4..a4b543b 100644 --- a/View/PreviewCardCell.swift +++ b/View/PreviewCardCell.swift @@ -10,13 +10,13 @@ import Material import UIKit class PreviewCardCell: BaseTableViewCell { - let previewButton = IconButton(image: Icon.cm.skipForward, tintColor: Color.grey.base) - let copyButton = IconButton(image: UIImage(named: "baseline_file_copy_white_24pt"), tintColor: Color.grey.base) + let previewButton = IconButton(image: Icon.cm.skipForward, tintColor: BKColor.grey.base) + let copyButton = IconButton(image: UIImage(named: "baseline_file_copy_white_24pt"), tintColor: BKColor.grey.base) let titleLabel: UILabel = { let label = UILabel() label.font = RobotoFont.regular(with: 14) - label.textColor = Color.grey.darken3 + label.textColor = BKColor.grey.darken3 label.numberOfLines = 0 return label }() @@ -24,7 +24,7 @@ class PreviewCardCell: BaseTableViewCell { let bodyLabel: UILabel = { let label = UILabel() label.font = RobotoFont.regular(with: 14) - label.textColor = Color.grey.darken2 + label.textColor = BKColor.grey.darken2 label.numberOfLines = 0 return label }() @@ -32,7 +32,7 @@ class PreviewCardCell: BaseTableViewCell { let noticeLabel: UILabel = { let label = UILabel() label.font = RobotoFont.regular(with: 12) - label.textColor = Color.grey.base + label.textColor = BKColor.grey.base label.numberOfLines = 0 label.isUserInteractionEnabled = true return label @@ -46,7 +46,7 @@ class PreviewCardCell: BaseTableViewCell { let card: UIView = { let view = UIView() - view.backgroundColor = Color.white + view.backgroundColor = BKColor.background.secondary view.layer.cornerRadius = 2 view.clipsToBounds = true return view @@ -70,7 +70,7 @@ class PreviewCardCell: BaseTableViewCell { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) self.selectionStyle = .none - self.backgroundColor = Color.grey.lighten4 + self.backgroundColor = BKColor.background.primary contentView.addSubview(card) card.addSubview(copyButton) diff --git a/View/PreviewCardCellViewModel.swift b/View/PreviewCardCellViewModel.swift index 2080351..8739b3e 100644 --- a/View/PreviewCardCellViewModel.swift +++ b/View/PreviewCardCellViewModel.swift @@ -47,13 +47,13 @@ class PreviewCardCellViewModel: ViewModel { let noticeStr = "\(previewModel.notice ?? "")" let noticeAttrStr = NSMutableAttributedString(string: noticeStr, attributes: [ - NSAttributedString.Key.foregroundColor: Color.grey.base, + NSAttributedString.Key.foregroundColor: BKColor.grey.base, NSAttributedString.Key.font: RobotoFont.regular(with: 12) ]) if let moreInfo = previewModel.moreInfo { noticeAttrStr.append(NSMutableAttributedString(string: " \(moreInfo)", attributes: [ - NSAttributedString.Key.foregroundColor: Color.blue.base, + NSAttributedString.Key.foregroundColor: BKColor.blue.base, NSAttributedString.Key.font: RobotoFont.regular(with: 12) ])) } @@ -68,30 +68,30 @@ class PreviewCardCellViewModel: ViewModel { let serverUrl = URL(string: ServerManager.shared.currentAddress)! let attrStr = NSMutableAttributedString(string: "") attrStr.append(NSAttributedString(string: serverUrl.absoluteString, attributes: [ - NSAttributedString.Key.foregroundColor: Color.grey.darken4, + NSAttributedString.Key.foregroundColor: BKColor.grey.darken4, NSAttributedString.Key.font: RobotoFont.regular(with: fontSize) ])) attrStr.append(NSAttributedString(string: "/\(Client.shared.key ?? "Your Key")", attributes: [ - NSAttributedString.Key.foregroundColor: Color.grey.darken3, + NSAttributedString.Key.foregroundColor: BKColor.grey.darken3, NSAttributedString.Key.font: RobotoFont.regular(with: fontSize) ])) if let modelTitle = previewModel.title { attrStr.append(NSAttributedString(string: "/\(modelTitle)", attributes: [ - NSAttributedString.Key.foregroundColor: Color.grey.darken1, + NSAttributedString.Key.foregroundColor: BKColor.grey.darken1, NSAttributedString.Key.font: RobotoFont.regular(with: fontSize) ])) } if let modelBody = previewModel.body { attrStr.append(NSAttributedString(string: "/\(modelBody)", attributes: [ - NSAttributedString.Key.foregroundColor: Color.grey.base, + NSAttributedString.Key.foregroundColor: BKColor.grey.base, NSAttributedString.Key.font: RobotoFont.regular(with: fontSize) ])) } if let queryParameter = previewModel.queryParameter { attrStr.append(NSAttributedString(string: "?\(queryParameter)", attributes: [ - NSAttributedString.Key.foregroundColor: Color.grey.lighten1, + NSAttributedString.Key.foregroundColor: BKColor.grey.lighten1, NSAttributedString.Key.font: RobotoFont.regular(with: fontSize) ])) } diff --git a/View/SoundCell.swift b/View/SoundCell.swift index 320107f..f57423a 100644 --- a/View/SoundCell.swift +++ b/View/SoundCell.swift @@ -11,25 +11,25 @@ import Material import UIKit class SoundCell: BaseTableViewCell { - let copyButton = IconButton(image: UIImage(named: "baseline_file_copy_white_24pt"), tintColor: Color.grey.base) + let copyButton = IconButton(image: UIImage(named: "baseline_file_copy_white_24pt"), tintColor: BKColor.grey.base) let nameLabel: UILabel = { let label = UILabel() label.fontSize = 14 - label.textColor = Color.darkText.primary + label.textColor = BKColor.grey.darken4 return label }() let durationLabel: UILabel = { let label = UILabel() label.fontSize = 12 - label.textColor = Color.darkText.secondary + label.textColor = BKColor.grey.darken1 return label }() override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) self.selectionStyle = .none - + self.backgroundColor = BKColor.background.secondary self.contentView.addSubview(nameLabel) self.contentView.addSubview(durationLabel) self.contentView.addSubview(copyButton) diff --git a/View/TextCell.swift b/View/TextCell.swift index a2f69aa..1057e5a 100644 --- a/View/TextCell.swift +++ b/View/TextCell.swift @@ -13,6 +13,7 @@ class DetailTextCell: UITableViewCell { super.init(style: .value1, reuseIdentifier: reuseIdentifier) self.selectionStyle = .none self.accessoryType = .disclosureIndicator + self.backgroundColor = BKColor.background.secondary } @available(*, unavailable) diff --git a/View/iCloudStatusCell.swift b/View/iCloudStatusCell.swift index dba620e..ef76151 100644 --- a/View/iCloudStatusCell.swift +++ b/View/iCloudStatusCell.swift @@ -13,7 +13,7 @@ class iCloudStatusCell: UITableViewCell { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: .value1, reuseIdentifier: reuseIdentifier) self.selectionStyle = .none - + self.backgroundColor = BKColor.background.secondary self.textLabel?.text = NSLocalizedString("iCloudSatatus") self.detailTextLabel?.text = "" CKContainer.default().accountStatus { status, _ in