Use the proper iOS approach for light mode

This commit is contained in:
nielsandriesse 2020-08-24 10:25:03 +10:00
parent f5c065df25
commit 1d980f1925
37 changed files with 955 additions and 58 deletions

View File

@ -585,6 +585,9 @@
C3638C0524C7F0B500AF29BC /* LK002RemoveFriendRequests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3638C0424C7F0B500AF29BC /* LK002RemoveFriendRequests.swift */; };
C369549D24D27A3500CEB4E3 /* MultiDeviceRemovalSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C369549C24D27A3500CEB4E3 /* MultiDeviceRemovalSheet.swift */; };
C36B8707243C50C60049991D /* SignalMessaging.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 453518921FC63DBF00210559 /* SignalMessaging.framework */; };
C39DD28824F3318C008590FC /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C39DD28724F3318C008590FC /* Colors.xcassets */; };
C39DD28A24F3336E008590FC /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C39DD28724F3318C008590FC /* Colors.xcassets */; };
C39DD28B24F3336F008590FC /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C39DD28724F3318C008590FC /* Colors.xcassets */; };
C3C3CF8924D8EED300E1CCE7 /* TextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C3CF8824D8EED300E1CCE7 /* TextView.swift */; };
C3DAB3242480CB2B00725F25 /* SRCopyableLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3DAB3232480CB2A00725F25 /* SRCopyableLabel.swift */; };
C3DFFAC623E96F0D0058DAF8 /* Sheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3DFFAC523E96F0D0058DAF8 /* Sheet.swift */; };
@ -1373,6 +1376,7 @@
C35E8AAD2485E51D00ACB629 /* IP2Country.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IP2Country.swift; sourceTree = "<group>"; };
C3638C0424C7F0B500AF29BC /* LK002RemoveFriendRequests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LK002RemoveFriendRequests.swift; sourceTree = "<group>"; };
C369549C24D27A3500CEB4E3 /* MultiDeviceRemovalSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiDeviceRemovalSheet.swift; sourceTree = "<group>"; };
C39DD28724F3318C008590FC /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = "<group>"; };
C3AA6BB824CE8F1B002358B6 /* Migrating Translations from Android.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = "Migrating Translations from Android.md"; sourceTree = "<group>"; };
C3AECBEA24EF5244005743DE /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = translations/fa.lproj/Localizable.strings; sourceTree = "<group>"; };
C3C3CF8824D8EED300E1CCE7 /* TextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; };
@ -2615,6 +2619,7 @@
children = (
B8C9689023FA1401005F64E0 /* AppMode.swift */,
B8BB829F238F322400BA5194 /* Colors.swift */,
C39DD28724F3318C008590FC /* Colors.xcassets */,
B8BB82BD2394D4CE00BA5194 /* Fonts.swift */,
B8BB82A8238F62FB00BA5194 /* Gradients.swift */,
B8BB82A1238F356100BA5194 /* Values.swift */,
@ -3174,6 +3179,7 @@
347850331FD7494A007B8332 /* fontawesome-webfont.ttf in Resources */,
3478504C1FD7496D007B8332 /* Images.xcassets in Resources */,
347850311FD7494A007B8332 /* dripicons-v2.ttf in Resources */,
C39DD28B24F3336F008590FC /* Colors.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -3181,6 +3187,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C39DD28824F3318C008590FC /* Colors.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -3241,6 +3248,7 @@
45B74A852044AAB600CD42F8 /* bamboo.aifc in Resources */,
45B74A782044AAB600CD42F8 /* bamboo-quiet.aifc in Resources */,
45B74A7B2044AAB600CD42F8 /* chord.aifc in Resources */,
C39DD28A24F3336E008590FC /* Colors.xcassets in Resources */,
45B74A812044AAB600CD42F8 /* chord-quiet.aifc in Resources */,
45B74A832044AAB600CD42F8 /* circles.aifc in Resources */,
45B74A892044AAB600CD42F8 /* circles-quiet.aifc in Resources */,

View File

@ -5,9 +5,9 @@
<key>BuildDetails</key>
<dict>
<key>CarthageVersion</key>
<string>0.35.0</string>
<string>0.34.0</string>
<key>OSXVersion</key>
<string>10.15.6</string>
<string>10.15.5</string>
<key>WebRTCCommit</key>
<string>1445d719bf05280270e9f77576f80f973fd847f8 M73</string>
</dict>

View File

@ -56,7 +56,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
static NSTimeInterval launchStartedAt;
@interface AppDelegate () <UNUserNotificationCenterDelegate>
@interface AppDelegate () <UNUserNotificationCenterDelegate, LKAppModeManagerDelegate>
@property (nonatomic) BOOL hasInitialRootViewController;
@property (nonatomic) BOOL areVersionMigrationsComplete;
@ -190,6 +190,8 @@ static NSTimeInterval launchStartedAt;
launchStartedAt = CACurrentMediaTime();
[LKAppModeManager configureWithDelegate:self];
BOOL isLoggingEnabled;
#ifdef DEBUG
// Specified at Product -> Scheme -> Edit Scheme -> Test -> Arguments -> Environment to avoid things like
@ -933,6 +935,35 @@ static NSTimeInterval launchStartedAt;
- (void)stopOpenGroupPollers { [LKPublicChatManager.shared stopPollers]; }
# pragma mark - App Mode
- (LKAppMode)getCurrentAppMode {
UIWindow *window = UIApplication.sharedApplication.keyWindow;
if (window == nil) { return LKAppModeLight; }
UIUserInterfaceStyle userInterfaceStyle = window.traitCollection.userInterfaceStyle;
BOOL isLightMode = userInterfaceStyle == UIUserInterfaceStyleUnspecified || userInterfaceStyle == UIUserInterfaceStyleLight;
return isLightMode ? LKAppModeLight : LKAppModeDark;
}
- (void)setCurrentAppModeTo:(LKAppMode)appMode {
UIWindow *window = UIApplication.sharedApplication.keyWindow;
if (window == nil) { return; }
switch (appMode) {
case LKAppModeLight: {
if (@available(iOS 13.0, *)) {
window.overrideUserInterfaceStyle = UIUserInterfaceStyleUnspecified;
}
break;
}
case LKAppModeDark: {
if (@available(iOS 13.0, *)) {
window.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
}
break;
}
}
}
# pragma mark - Other
- (void)handleDataNukeRequested:(NSNotification *)notification

View File

@ -128,12 +128,6 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
stackView.pin(to: scrollView)
view.addSubview(scrollView)
scrollView.pin(to: view)
// Register for notifications
NotificationCenter.default.addObserver(self, selector: #selector(handleAppModeSwitchedNotification(_:)), name: .appModeSwitched, object: nil)
}
deinit {
NotificationCenter.default.removeObserver(self)
}
private func getSettingButtons() -> [UIView] {
@ -239,12 +233,16 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
let closeButton = UIBarButtonItem(image: #imageLiteral(resourceName: "X"), style: .plain, target: self, action: #selector(close))
closeButton.tintColor = Colors.text
navigationItem.leftBarButtonItem = closeButton
let appModeIcon = UserDefaults.standard[.isUsingDarkMode] ? #imageLiteral(resourceName: "ic_dark_theme_on") : #imageLiteral(resourceName: "ic_dark_theme_off")
let appModeButton = UIBarButtonItem(image: appModeIcon, style: .plain, target: self, action: #selector(switchAppMode))
appModeButton.tintColor = Colors.text
let qrCodeButton = UIBarButtonItem(image: #imageLiteral(resourceName: "QRCode"), style: .plain, target: self, action: #selector(showQRCode))
qrCodeButton.tintColor = Colors.text
navigationItem.rightBarButtonItems = [ qrCodeButton/*, appModeButton*/ ]
var rightBarButtonItems: [UIBarButtonItem] = [ qrCodeButton ]
if #available(iOS 13, *) { // Pre iOS 13 the user can't switch actively but the app still responds to system changes
let appModeIcon = isDarkMode ? #imageLiteral(resourceName: "ic_dark_theme_on") : #imageLiteral(resourceName: "ic_dark_theme_off")
let appModeButton = UIBarButtonItem(image: appModeIcon, style: .plain, target: self, action: #selector(switchAppMode))
appModeButton.tintColor = Colors.text
rightBarButtonItems.append(appModeButton)
}
navigationItem.rightBarButtonItems = rightBarButtonItems
}
}
@ -297,9 +295,8 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
}
@objc private func switchAppMode() {
let isUsingDarkMode = UserDefaults.standard[.isUsingDarkMode]
UserDefaults.standard[.isUsingDarkMode] = !isUsingDarkMode
NotificationCenter.default.post(name: .appModeSwitched, object: nil)
let newAppMode: AppMode = isLightMode ? .dark : .light
AppModeManager.shared.setCurrentAppMode(to: newAppMode)
}
@objc private func showQRCode() {

View File

@ -1,28 +1,58 @@
public enum AppMode {
@objc(LKAppModeManager)
public final class AppModeManager : NSObject {
private let delegate: AppModeManagerDelegate
public var currentAppMode: AppMode {
return delegate.getCurrentAppMode()
}
public static var shared: AppModeManager!
@objc(configureWithDelegate:)
public static func configure(delegate: AppModeManagerDelegate) {
shared = AppModeManager(delegate: delegate)
}
private init(delegate: AppModeManagerDelegate) {
self.delegate = delegate
super.init()
}
private override init() { preconditionFailure("Use init(delegate:) instead.") }
public func setCurrentAppMode(to appMode: AppMode) {
delegate.setCurrentAppMode(to: appMode)
}
}
@objc(LKAppModeManagerDelegate)
public protocol AppModeManagerDelegate {
func getCurrentAppMode() -> AppMode
func setCurrentAppMode(to appMode: AppMode)
}
@objc(LKAppMode)
public enum AppMode : Int {
case light, dark
public static var current: AppMode = .dark
// public static var current: AppMode {
// return UserDefaults.standard[.isUsingDarkMode] ? .dark : .light
// }
}
public var isLightMode: Bool {
return AppMode.current == .light
return AppModeManager.shared.currentAppMode == .light
}
public var isDarkMode: Bool {
return AppMode.current == .dark
return AppModeManager.shared.currentAppMode == .dark
}
@objc public final class LKAppModeUtilities : NSObject {
@objc public static var isLightMode: Bool {
return AppMode.current == .light
return AppModeManager.shared.currentAppMode == .light
}
@objc public static var isDarkMode: Bool {
return AppMode.current == .dark
return AppModeManager.shared.currentAppMode == .dark
}
}

View File

@ -12,31 +12,31 @@
@objc(LKColors)
public final class Colors : NSObject {
@objc public static var accent = isLightMode ? UIColor(hex: 0x00E97B) : UIColor(hex: 0x00F782)
@objc public static var text = isLightMode ? UIColor(hex: 0x000000) : UIColor(hex: 0xFFFFFF)
@objc public static var destructive = UIColor(hex: 0xFF453A)
@objc public static var unimportant = UIColor(hex: 0xD8D8D8)
@objc public static var border = UIColor(hex: 0x979797)
@objc public static var cellBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B)
@objc public static var cellSelected = isLightMode ? UIColor(hex: 0xDFDFDF) : UIColor(hex: 0x0C0C0C)
@objc public static var navigationBarBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x161616)
@objc public static var searchBarPlaceholder = UIColor(hex: 0x8E8E93) // Also used for the icons
@objc public static var searchBarBackground = UIColor(red: 142 / 255, green: 142 / 255, blue: 147 / 255, alpha: 0.12)
@objc public static var newConversationButtonShadow = UIColor(hex: 0x077C44)
@objc public static var separator = UIColor(hex: 0x36383C)
@objc public static var unimportantButtonBackground = isLightMode ? UIColor.clear : UIColor(hex: 0x323232)
@objc public static var buttonBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B)
@objc public static var settingButtonSelected = isLightMode ? UIColor(hex: 0xDFDFDF) : UIColor(hex: 0x0C0C0C)
@objc public static var modalBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x101011)
@objc public static var modalBorder = UIColor(hex: 0x212121)
@objc public static var fakeChatBubbleBackground = isLightMode ? UIColor(hex: 0xF5F5F5) : UIColor(hex: 0x3F4146)
@objc public static var fakeChatBubbleText = UIColor(hex: 0x000000)
@objc public static var composeViewBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B)
@objc public static var composeViewTextFieldBackground = isLightMode ? UIColor(hex: 0xEDEDED) : UIColor(hex: 0x141414)
@objc public static var receivedMessageBackground = isLightMode ? UIColor(hex: 0xF5F5F5) : UIColor(hex: 0x222325)
@objc public static var sentMessageBackground = isLightMode ? UIColor(hex: 0x00E97B) : UIColor(hex: 0x3F4146)
@objc public static var newConversationButtonCollapsedBackground = isLightMode ? UIColor(hex: 0xF5F5F5) : UIColor(hex: 0x1F1F1F)
@objc public static var pnOptionBackground = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B)
@objc public static var pnOptionBorder = UIColor(hex: 0x212121)
@objc public static var pathsBuilding = UIColor(hex: 0xFFCE3A)
@objc public static var accent = UIColor(named: "session_accent")!
@objc public static var text = UIColor(named: "session_text")!
@objc public static var destructive = UIColor(named: "session_destructive")!
@objc public static var unimportant = UIColor(named: "session_unimportant")!
@objc public static var border = UIColor(named: "session_border")!
@objc public static var cellBackground = UIColor(named: "session_cell_background")!
@objc public static var cellSelected = UIColor(named: "session_cell_selected")!
@objc public static var navigationBarBackground = UIColor(named: "session_navigation_bar_background")!
@objc public static var searchBarPlaceholder = UIColor(named: "session_search_bar_placeholder")! // Also used for the icons
@objc public static var searchBarBackground = UIColor(named: "session_search_bar_background")!
@objc public static var newConversationButtonShadow = UIColor(named: "session_new_conversation_button_shadow")!
@objc public static var separator = UIColor(named: "session_separator")!
@objc public static var unimportantButtonBackground = UIColor(named: "session_unimportant_button_background")!
@objc public static var buttonBackground = UIColor(named: "session_button_background")!
@objc public static var settingButtonSelected = UIColor(named: "session_setting_button_selected")!
@objc public static var modalBackground = UIColor(named: "session_modal_background")!
@objc public static var modalBorder = UIColor(named: "session_modal_border")!
@objc public static var fakeChatBubbleBackground = UIColor(named: "session_fake_chat_bubble_background")!
@objc public static var fakeChatBubbleText = UIColor(named: "session_fake_chat_bubble_text")!
@objc public static var composeViewBackground = UIColor(named: "session_compose_view_background")!
@objc public static var composeViewTextFieldBackground = UIColor(named: "session_compose_view_text_field_background")!
@objc public static var receivedMessageBackground = UIColor(named: "session_received_message_background")!
@objc public static var sentMessageBackground = UIColor(named: "session_sent_message_background")!
@objc public static var newConversationButtonCollapsedBackground = UIColor(named: "session_new_conversation_button_collapsed_background")!
@objc public static var pnOptionBackground = UIColor(named: "session_pn_option_background")!
@objc public static var pnOptionBorder = UIColor(named: "session_pn_option_border")!
@objc public static var pathsBuilding = UIColor(named: "session_paths_building")!
}

View File

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x7B",
"green" : "0xE9",
"red" : "0x00"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x82",
"green" : "0xF7",
"red" : "0x00"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x97",
"green" : "0x97",
"red" : "0x97"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFC",
"green" : "0xFC",
"red" : "0xFC"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x1B",
"green" : "0x1B",
"red" : "0x1B"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFC",
"green" : "0xFC",
"red" : "0xFC"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x1B",
"green" : "0x1B",
"red" : "0x1B"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xDF",
"green" : "0xDF",
"red" : "0xDF"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x0C",
"green" : "0x0C",
"red" : "0x0C"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFC",
"green" : "0xFC",
"red" : "0xFC"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x1B",
"green" : "0x1B",
"red" : "0x1B"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xED",
"green" : "0xED",
"red" : "0xED"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x14",
"green" : "0x14",
"red" : "0x14"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x3A",
"green" : "0x45",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF5",
"green" : "0xF5",
"red" : "0xF5"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x46",
"green" : "0x41",
"red" : "0x3F"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x00",
"green" : "0x00",
"red" : "0x00"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFC",
"green" : "0xFC",
"red" : "0xFC"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x11",
"green" : "0x10",
"red" : "0x10"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x21",
"green" : "0x21",
"red" : "0x21"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFC",
"green" : "0xFC",
"red" : "0xFC"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x16",
"green" : "0x16",
"red" : "0x16"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF5",
"green" : "0xF5",
"red" : "0xF5"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x1F",
"green" : "0x1F",
"red" : "0x1F"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x44",
"green" : "0x7C",
"red" : "0x07"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x3A",
"green" : "0xCE",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFC",
"green" : "0xFC",
"red" : "0xFC"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x1B",
"green" : "0x1B",
"red" : "0x1B"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x21",
"green" : "0x21",
"red" : "0x21"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF5",
"green" : "0xF5",
"red" : "0xF5"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x25",
"green" : "0x23",
"red" : "0x22"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.120",
"blue" : "147",
"green" : "142",
"red" : "142"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x93",
"green" : "0x8E",
"red" : "0x8E"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x7B",
"green" : "0xE9",
"red" : "0x00"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x46",
"green" : "0x41",
"red" : "0x3F"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x3C",
"green" : "0x38",
"red" : "0x36"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xDF",
"green" : "0xDF",
"red" : "0xDF"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x0C",
"green" : "0x0C",
"red" : "0x0C"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.000",
"green" : "0.000",
"red" : "0.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xD8",
"green" : "0xD8",
"red" : "0xD8"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.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" : "0x32",
"green" : "0x32",
"red" : "0x32"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -27,14 +27,14 @@ public final class Gradient : NSObject {
final public class Gradients : NSObject {
@objc public static var defaultLokiBackground: Gradient {
switch AppMode.current {
switch AppModeManager.shared.currentAppMode {
case .light: return Gradient(start: UIColor(hex: 0xFCFCFC), end: UIColor(hex: 0xFFFFFF))
case .dark: return Gradient(start: UIColor(hex: 0x171717), end: UIColor(hex: 0x121212))
}
}
@objc public static var homeVCFade: Gradient {
switch AppMode.current {
switch AppModeManager.shared.currentAppMode {
case .light: return Gradient(start: UIColor(hex: 0xFFFFFF).withAlphaComponent(0), end: UIColor(hex: 0xFFFFFF))
case .dark: return Gradient(start: UIColor(hex: 0x000000).withAlphaComponent(0), end: UIColor(hex: 0x000000))
}

View File

@ -10,7 +10,6 @@ public enum LKUserDefaults {
case hasViewedSeed
/// Whether the device was unlinked as a slave device (used to notify the user on the landing screen).
case wasUnlinked
case isUsingDarkMode
case isUsingFullAPNs
}

View File

@ -2,7 +2,6 @@
public extension Notification.Name {
// State changes
public static let appModeSwitched = Notification.Name("appModeSwitched")
public static let blockedContactsUpdated = Notification.Name("blockedContactsUpdated")
public static let contactOnlineStatusChanged = Notification.Name("contactOnlineStatusChanged")
public static let groupThreadUpdated = Notification.Name("groupThreadUpdated")
@ -29,7 +28,6 @@ public extension Notification.Name {
@objc public extension NSNotification {
// State changes
@objc public static let appModeSwitched = Notification.Name.appModeSwitched.rawValue as NSString
@objc public static let blockedContactsUpdated = Notification.Name.blockedContactsUpdated.rawValue as NSString
@objc public static let contactOnlineStatusChanged = Notification.Name.contactOnlineStatusChanged.rawValue as NSString
@objc public static let groupThreadUpdated = Notification.Name.groupThreadUpdated.rawValue as NSString