From 1d980f192590db5448ae13747b597bba60dca297 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Mon, 24 Aug 2020 10:25:03 +1000 Subject: [PATCH 01/14] Use the proper iOS approach for light mode --- Signal.xcodeproj/project.pbxproj | 8 +++ Signal/Signal-Info.plist | 4 +- Signal/src/AppDelegate.m | 33 +++++++++++- .../Loki/View Controllers/SettingsVC.swift | 23 ++++---- .../Loki/Redesign/Style Guide/AppMode.swift | 50 +++++++++++++---- .../Loki/Redesign/Style Guide/Colors.swift | 54 +++++++++---------- .../Style Guide/Colors.xcassets/Contents.json | 6 +++ .../session_accent.colorset/Contents.json | 38 +++++++++++++ .../session_border.colorset/Contents.json | 20 +++++++ .../Contents.json | 38 +++++++++++++ .../Contents.json | 38 +++++++++++++ .../Contents.json | 38 +++++++++++++ .../Contents.json | 38 +++++++++++++ .../Contents.json | 38 +++++++++++++ .../Contents.json | 20 +++++++ .../Contents.json | 38 +++++++++++++ .../Contents.json | 20 +++++++ .../Contents.json | 38 +++++++++++++ .../Contents.json | 20 +++++++ .../Contents.json | 38 +++++++++++++ .../Contents.json | 38 +++++++++++++ .../Contents.json | 20 +++++++ .../Contents.json | 20 +++++++ .../Contents.json | 38 +++++++++++++ .../Contents.json | 20 +++++++ .../Contents.json | 38 +++++++++++++ .../Contents.json | 20 +++++++ .../Contents.json | 20 +++++++ .../Contents.json | 38 +++++++++++++ .../session_separator.colorset/Contents.json | 20 +++++++ .../Contents.json | 38 +++++++++++++ .../session_text.colorset/Contents.json | 38 +++++++++++++ .../Contents.json | 20 +++++++ .../Contents.json | 38 +++++++++++++ .../Loki/Redesign/Style Guide/Gradients.swift | 4 +- .../src/Loki/Utilities/LKUserDefaults.swift | 1 - .../Loki/Utilities/Notification+Loki.swift | 2 - 37 files changed, 955 insertions(+), 58 deletions(-) create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_accent.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_border.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_button_background.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_cell_background.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_cell_selected.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_compose_view_background.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_compose_view_text_field_background.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_destructive.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_fake_chat_bubble_background.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_fake_chat_bubble_text.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_modal_background.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_modal_border.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_navigation_bar_background.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_new_conversation_button_collapsed_background.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_new_conversation_button_shadow.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_paths_building.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_pn_option_background.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_pn_option_border.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_received_message_background.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_search_bar_background.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_search_bar_placeholder.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_sent_message_background.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_separator.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_setting_button_selected.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_text.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_unimportant.colorset/Contents.json create mode 100644 SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_unimportant_button_background.colorset/Contents.json diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 1e7755115..fb942f767 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -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 = ""; }; C3638C0424C7F0B500AF29BC /* LK002RemoveFriendRequests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LK002RemoveFriendRequests.swift; sourceTree = ""; }; C369549C24D27A3500CEB4E3 /* MultiDeviceRemovalSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiDeviceRemovalSheet.swift; sourceTree = ""; }; + C39DD28724F3318C008590FC /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; C3AA6BB824CE8F1B002358B6 /* Migrating Translations from Android.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = "Migrating Translations from Android.md"; sourceTree = ""; }; C3AECBEA24EF5244005743DE /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = translations/fa.lproj/Localizable.strings; sourceTree = ""; }; C3C3CF8824D8EED300E1CCE7 /* TextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = ""; }; @@ -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 */, diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index af121ada0..b91d44ca3 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -5,9 +5,9 @@ BuildDetails CarthageVersion - 0.35.0 + 0.34.0 OSXVersion - 10.15.6 + 10.15.5 WebRTCCommit 1445d719bf05280270e9f77576f80f973fd847f8 M73 diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 4faa52ac1..eeb6fc4d9 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -56,7 +56,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; static NSTimeInterval launchStartedAt; -@interface AppDelegate () +@interface AppDelegate () @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 diff --git a/Signal/src/Loki/View Controllers/SettingsVC.swift b/Signal/src/Loki/View Controllers/SettingsVC.swift index 9f93aed86..231de81d5 100644 --- a/Signal/src/Loki/View Controllers/SettingsVC.swift +++ b/Signal/src/Loki/View Controllers/SettingsVC.swift @@ -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() { diff --git a/SignalMessaging/Loki/Redesign/Style Guide/AppMode.swift b/SignalMessaging/Loki/Redesign/Style Guide/AppMode.swift index 26fadb3d5..aa507d26b 100644 --- a/SignalMessaging/Loki/Redesign/Style Guide/AppMode.swift +++ b/SignalMessaging/Loki/Redesign/Style Guide/AppMode.swift @@ -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 } } diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift b/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift index a76bba513..8b08ddc50 100644 --- a/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift @@ -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")! } diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/Contents.json new file mode 100644 index 000000000..73c00596a --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_accent.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_accent.colorset/Contents.json new file mode 100644 index 000000000..eb0929bd3 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_accent.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_border.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_border.colorset/Contents.json new file mode 100644 index 000000000..d26719158 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_border.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_button_background.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_button_background.colorset/Contents.json new file mode 100644 index 000000000..9f3131695 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_button_background.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_cell_background.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_cell_background.colorset/Contents.json new file mode 100644 index 000000000..9f3131695 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_cell_background.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_cell_selected.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_cell_selected.colorset/Contents.json new file mode 100644 index 000000000..6ac8ef346 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_cell_selected.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_compose_view_background.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_compose_view_background.colorset/Contents.json new file mode 100644 index 000000000..9f3131695 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_compose_view_background.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_compose_view_text_field_background.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_compose_view_text_field_background.colorset/Contents.json new file mode 100644 index 000000000..474c4bdf7 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_compose_view_text_field_background.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_destructive.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_destructive.colorset/Contents.json new file mode 100644 index 000000000..afefc4599 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_destructive.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_fake_chat_bubble_background.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_fake_chat_bubble_background.colorset/Contents.json new file mode 100644 index 000000000..9e50983f0 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_fake_chat_bubble_background.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_fake_chat_bubble_text.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_fake_chat_bubble_text.colorset/Contents.json new file mode 100644 index 000000000..7e8f38fe3 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_fake_chat_bubble_text.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_modal_background.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_modal_background.colorset/Contents.json new file mode 100644 index 000000000..d49aebfdc --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_modal_background.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_modal_border.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_modal_border.colorset/Contents.json new file mode 100644 index 000000000..5c9b7b975 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_modal_border.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_navigation_bar_background.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_navigation_bar_background.colorset/Contents.json new file mode 100644 index 000000000..0ecfa5c92 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_navigation_bar_background.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_new_conversation_button_collapsed_background.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_new_conversation_button_collapsed_background.colorset/Contents.json new file mode 100644 index 000000000..624351106 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_new_conversation_button_collapsed_background.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_new_conversation_button_shadow.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_new_conversation_button_shadow.colorset/Contents.json new file mode 100644 index 000000000..da8b43bc7 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_new_conversation_button_shadow.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_paths_building.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_paths_building.colorset/Contents.json new file mode 100644 index 000000000..78122617a --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_paths_building.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_pn_option_background.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_pn_option_background.colorset/Contents.json new file mode 100644 index 000000000..9f3131695 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_pn_option_background.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_pn_option_border.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_pn_option_border.colorset/Contents.json new file mode 100644 index 000000000..5c9b7b975 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_pn_option_border.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_received_message_background.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_received_message_background.colorset/Contents.json new file mode 100644 index 000000000..07b1767dd --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_received_message_background.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_search_bar_background.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_search_bar_background.colorset/Contents.json new file mode 100644 index 000000000..2e2e0b5ba --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_search_bar_background.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_search_bar_placeholder.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_search_bar_placeholder.colorset/Contents.json new file mode 100644 index 000000000..11d344a13 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_search_bar_placeholder.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_sent_message_background.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_sent_message_background.colorset/Contents.json new file mode 100644 index 000000000..3ecf00826 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_sent_message_background.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_separator.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_separator.colorset/Contents.json new file mode 100644 index 000000000..e8339b30e --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_separator.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_setting_button_selected.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_setting_button_selected.colorset/Contents.json new file mode 100644 index 000000000..6ac8ef346 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_setting_button_selected.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_text.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_text.colorset/Contents.json new file mode 100644 index 000000000..d89071918 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_text.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_unimportant.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_unimportant.colorset/Contents.json new file mode 100644 index 000000000..615ea3a00 --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_unimportant.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_unimportant_button_background.colorset/Contents.json b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_unimportant_button_background.colorset/Contents.json new file mode 100644 index 000000000..a8196c65c --- /dev/null +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.xcassets/session_unimportant_button_background.colorset/Contents.json @@ -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 + } +} diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift b/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift index e95c8a17a..e9e2f4821 100644 --- a/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift +++ b/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift @@ -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)) } diff --git a/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift b/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift index 7023b3a49..21ab9158d 100644 --- a/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift +++ b/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift @@ -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 } diff --git a/SignalServiceKit/src/Loki/Utilities/Notification+Loki.swift b/SignalServiceKit/src/Loki/Utilities/Notification+Loki.swift index 1385a044a..da6894d6d 100644 --- a/SignalServiceKit/src/Loki/Utilities/Notification+Loki.swift +++ b/SignalServiceKit/src/Loki/Utilities/Notification+Loki.swift @@ -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 From 99721586cdea13dcf25924def6898d3720765e1c Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Mon, 24 Aug 2020 11:28:56 +1000 Subject: [PATCH 02/14] Make remaining UI responsive to app mode changes --- Signal/src/Loki/View Controllers/BaseVC.swift | 13 ++++++++-- Signal/src/Loki/View Controllers/HomeVC.swift | 7 ++++++ .../Loki/View Controllers/SettingsVC.swift | 25 ++++++++++++++++--- .../Loki/Redesign/Style Guide/Gradients.swift | 6 ++++- .../Loki/Utilities/Notification+Loki.swift | 2 ++ 5 files changed, 47 insertions(+), 6 deletions(-) diff --git a/Signal/src/Loki/View Controllers/BaseVC.swift b/Signal/src/Loki/View Controllers/BaseVC.swift index a29414787..764a02694 100644 --- a/Signal/src/Loki/View Controllers/BaseVC.swift +++ b/Signal/src/Loki/View Controllers/BaseVC.swift @@ -1,5 +1,6 @@ class BaseVC : UIViewController { + private var hasGradient = false override var preferredStatusBarStyle: UIStatusBarStyle { return isLightMode ? .default : .lightContent } @@ -23,10 +24,12 @@ class BaseVC : UIViewController { override func viewDidLoad() { setNeedsStatusBarAppearanceUpdate() - NotificationCenter.default.addObserver(self, selector: #selector(handleUnexpectedDeviceLinkRequestReceivedNotification), name: .unexpectedDeviceLinkRequestReceived, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(handleUnexpectedDeviceLinkRequestReceivedNotification(_:)), name: .unexpectedDeviceLinkRequestReceived, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(handleAppModeChangedNotification(_:)), name: .appModeChanged, object: nil) } internal func setUpGradientBackground() { + hasGradient = true view.backgroundColor = .clear let gradient = Gradients.defaultLokiBackground view.setGradient(gradient) @@ -68,7 +71,7 @@ class BaseVC : UIViewController { NotificationCenter.default.removeObserver(self) } - @objc private func handleUnexpectedDeviceLinkRequestReceivedNotification() { + @objc private func handleUnexpectedDeviceLinkRequestReceivedNotification(_ notification: Notification) { guard DeviceLinkingUtilities.shouldShowUnexpectedDeviceLinkRequestReceivedAlert else { return } DispatchQueue.main.async { let alert = UIAlertController(title: "Device Link Request Received", message: "Open the device link screen by going to \"Settings\" > \"Devices\" > \"Link a Device\" to link your devices.", preferredStyle: .alert) @@ -76,4 +79,10 @@ class BaseVC : UIViewController { self.present(alert, animated: true, completion: nil) } } + + @objc internal func handleAppModeChangedNotification(_ notification: Notification) { + if hasGradient { + setUpGradientBackground() // Re-do the gradient + } + } } diff --git a/Signal/src/Loki/View Controllers/HomeVC.swift b/Signal/src/Loki/View Controllers/HomeVC.swift index 585042111..728935795 100644 --- a/Signal/src/Loki/View Controllers/HomeVC.swift +++ b/Signal/src/Loki/View Controllers/HomeVC.swift @@ -348,6 +348,13 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol pathStatusViewContainer.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(showPath))) navigationItem.rightBarButtonItem = UIBarButtonItem(customView: pathStatusViewContainer) } + + @objc override internal func handleAppModeChangedNotification(_ notification: Notification) { + super.handleAppModeChangedNotification(notification) + let gradient = Gradients.homeVCFade + fadeView.setGradient(gradient) // Re-do gradient + tableView.reloadData() + } // MARK: Interaction func handleContinueButtonTapped(from seedReminderView: SeedReminderView) { diff --git a/Signal/src/Loki/View Controllers/SettingsVC.swift b/Signal/src/Loki/View Controllers/SettingsVC.swift index 231de81d5..a7c263fe9 100644 --- a/Signal/src/Loki/View Controllers/SettingsVC.swift +++ b/Signal/src/Loki/View Controllers/SettingsVC.swift @@ -49,6 +49,13 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { result.addTarget(self, action: #selector(copyPublicKey), for: UIControl.Event.touchUpInside) return result }() + + private lazy var settingButtonsStackView: UIStackView = { + let result = UIStackView() + result.axis = .vertical + result.alignment = .fill + return result + }() // MARK: Lifecycle override func viewDidLoad() { @@ -110,9 +117,9 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { topStackView.layoutMargins = UIEdgeInsets(top: 0, left: Values.largeSpacing, bottom: 0, right: Values.largeSpacing) topStackView.isLayoutMarginsRelativeArrangement = true // Set up setting buttons stack view - let settingButtonsStackView = UIStackView(arrangedSubviews: getSettingButtons() ) - settingButtonsStackView.axis = .vertical - settingButtonsStackView.alignment = .fill + getSettingButtons().forEach { settingButton in + settingButtonsStackView.addArrangedSubview(settingButton) + } // Set up stack view let stackView = UIStackView(arrangedSubviews: [ topStackView, settingButtonsStackView ]) stackView.axis = .vertical @@ -288,6 +295,17 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { }, requiresSync: true) } } + + @objc override internal func handleAppModeChangedNotification(_ notification: Notification) { + super.handleAppModeChangedNotification(notification) + settingButtonsStackView.arrangedSubviews.forEach { settingButton in + settingButtonsStackView.removeArrangedSubview(settingButton) + settingButton.removeFromSuperview() + } + getSettingButtons().forEach { settingButton in + settingButtonsStackView.addArrangedSubview(settingButton) // Re-do setting buttons + } + } // MARK: Interaction @objc private func close() { @@ -297,6 +315,7 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { @objc private func switchAppMode() { let newAppMode: AppMode = isLightMode ? .dark : .light AppModeManager.shared.setCurrentAppMode(to: newAppMode) + NotificationCenter.default.post(name: .appModeChanged, object: nil) } @objc private func showQRCode() { diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift b/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift index e9e2f4821..bbb3b884e 100644 --- a/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift +++ b/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift @@ -19,7 +19,11 @@ public final class Gradient : NSObject { let layer = CAGradientLayer() layer.frame = UIScreen.main.bounds layer.colors = [ gradient.start.cgColor, gradient.end.cgColor ] - self.layer.insertSublayer(layer, at: 0) + if let existingSublayer = self.layer.sublayers?[0] { + self.layer.replaceSublayer(existingSublayer, with: layer) + } else { + self.layer.insertSublayer(layer, at: 0) + } } } diff --git a/SignalServiceKit/src/Loki/Utilities/Notification+Loki.swift b/SignalServiceKit/src/Loki/Utilities/Notification+Loki.swift index da6894d6d..2830f82bc 100644 --- a/SignalServiceKit/src/Loki/Utilities/Notification+Loki.swift +++ b/SignalServiceKit/src/Loki/Utilities/Notification+Loki.swift @@ -2,6 +2,7 @@ public extension Notification.Name { // State changes + public static let appModeChanged = Notification.Name("appModeChanged") public static let blockedContactsUpdated = Notification.Name("blockedContactsUpdated") public static let contactOnlineStatusChanged = Notification.Name("contactOnlineStatusChanged") public static let groupThreadUpdated = Notification.Name("groupThreadUpdated") @@ -28,6 +29,7 @@ public extension Notification.Name { @objc public extension NSNotification { // State changes + @objc public static let appModeChanged = Notification.Name.appModeChanged.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 From 3e5a0be7d8548566fac88054b04298ff59c78573 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Mon, 24 Aug 2020 11:49:08 +1000 Subject: [PATCH 03/14] Fix crash --- Signal/src/Loki/View Controllers/HomeVC.swift | 2 +- Signal/src/Loki/View Controllers/SettingsVC.swift | 8 ++++---- SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Signal/src/Loki/View Controllers/HomeVC.swift b/Signal/src/Loki/View Controllers/HomeVC.swift index 728935795..3f1564d6f 100644 --- a/Signal/src/Loki/View Controllers/HomeVC.swift +++ b/Signal/src/Loki/View Controllers/HomeVC.swift @@ -352,7 +352,7 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol @objc override internal func handleAppModeChangedNotification(_ notification: Notification) { super.handleAppModeChangedNotification(notification) let gradient = Gradients.homeVCFade - fadeView.setGradient(gradient) // Re-do gradient + fadeView.setGradient(gradient) // Re-do the gradient tableView.reloadData() } diff --git a/Signal/src/Loki/View Controllers/SettingsVC.swift b/Signal/src/Loki/View Controllers/SettingsVC.swift index a7c263fe9..dc65e60a2 100644 --- a/Signal/src/Loki/View Controllers/SettingsVC.swift +++ b/Signal/src/Loki/View Controllers/SettingsVC.swift @@ -117,8 +117,8 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { topStackView.layoutMargins = UIEdgeInsets(top: 0, left: Values.largeSpacing, bottom: 0, right: Values.largeSpacing) topStackView.isLayoutMarginsRelativeArrangement = true // Set up setting buttons stack view - getSettingButtons().forEach { settingButton in - settingButtonsStackView.addArrangedSubview(settingButton) + getSettingButtons().forEach { settingButtonOrSeparator in + settingButtonsStackView.addArrangedSubview(settingButtonOrSeparator) } // Set up stack view let stackView = UIStackView(arrangedSubviews: [ topStackView, settingButtonsStackView ]) @@ -302,8 +302,8 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { settingButtonsStackView.removeArrangedSubview(settingButton) settingButton.removeFromSuperview() } - getSettingButtons().forEach { settingButton in - settingButtonsStackView.addArrangedSubview(settingButton) // Re-do setting buttons + getSettingButtons().forEach { settingButtonOrSeparator in + settingButtonsStackView.addArrangedSubview(settingButtonOrSeparator) // Re-do the setting buttons } } diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift b/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift index bbb3b884e..1af4d69d3 100644 --- a/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift +++ b/SignalMessaging/Loki/Redesign/Style Guide/Gradients.swift @@ -19,7 +19,7 @@ public final class Gradient : NSObject { let layer = CAGradientLayer() layer.frame = UIScreen.main.bounds layer.colors = [ gradient.start.cgColor, gradient.end.cgColor ] - if let existingSublayer = self.layer.sublayers?[0] { + if let existingSublayer = self.layer.sublayers?[0], existingSublayer is CAGradientLayer { self.layer.replaceSublayer(existingSublayer, with: layer) } else { self.layer.insertSublayer(layer, at: 0) From 9299883caa917600a43f9e35863b7087aba663e5 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Mon, 24 Aug 2020 12:14:22 +1000 Subject: [PATCH 04/14] Clean --- Signal/src/Loki/View Controllers/PathVC.swift | 1 - .../Loki/View Controllers/SettingsVC.swift | 26 ++++++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Signal/src/Loki/View Controllers/PathVC.swift b/Signal/src/Loki/View Controllers/PathVC.swift index de99463dc..3924a856a 100644 --- a/Signal/src/Loki/View Controllers/PathVC.swift +++ b/Signal/src/Loki/View Controllers/PathVC.swift @@ -1,5 +1,4 @@ import NVActivityIndicatorView -import SwiftCSV final class PathVC : BaseVC { diff --git a/Signal/src/Loki/View Controllers/SettingsVC.swift b/Signal/src/Loki/View Controllers/SettingsVC.swift index dc65e60a2..f2277f609 100644 --- a/Signal/src/Loki/View Controllers/SettingsVC.swift +++ b/Signal/src/Loki/View Controllers/SettingsVC.swift @@ -240,16 +240,27 @@ 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 qrCodeButton = UIBarButtonItem(image: #imageLiteral(resourceName: "QRCode"), style: .plain, target: self, action: #selector(showQRCode)) - qrCodeButton.tintColor = Colors.text - 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)) + let appModeIcon = isDarkMode ? #imageLiteral(resourceName: "ic_dark_theme_on").withTintColor(.white) : #imageLiteral(resourceName: "ic_dark_theme_off").withTintColor(.black) + let appModeButton = UIButton() + appModeButton.setImage(appModeIcon, for: UIControl.State.normal) appModeButton.tintColor = Colors.text - rightBarButtonItems.append(appModeButton) + appModeButton.addTarget(self, action: #selector(switchAppMode), for: UIControl.Event.touchUpInside) + let qrCodeIcon = isDarkMode ? #imageLiteral(resourceName: "QRCode").withTintColor(.white) : #imageLiteral(resourceName: "QRCode").withTintColor(.black) + let qrCodeButton = UIButton() + qrCodeButton.setImage(qrCodeIcon, for: UIControl.State.normal) + qrCodeButton.tintColor = Colors.text + qrCodeButton.addTarget(self, action: #selector(showQRCode), for: UIControl.Event.touchUpInside) + let stackView = UIStackView(arrangedSubviews: [ appModeButton, qrCodeButton ]) + stackView.axis = .horizontal + stackView.spacing = Values.mediumSpacing + navigationItem.rightBarButtonItem = UIBarButtonItem(customView: stackView) + } else { + let qrCodeIcon = isDarkMode ? #imageLiteral(resourceName: "QRCode").asTintedImage(color: .white) : #imageLiteral(resourceName: "QRCode").asTintedImage(color: .black) + let qrCodeButton = UIBarButtonItem(image: qrCodeIcon, style: .plain, target: self, action: #selector(showQRCode)) + qrCodeButton.tintColor = Colors.text + navigationItem.rightBarButtonItem = qrCodeButton } - navigationItem.rightBarButtonItems = rightBarButtonItems } } @@ -298,6 +309,7 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { @objc override internal func handleAppModeChangedNotification(_ notification: Notification) { super.handleAppModeChangedNotification(notification) + updateNavigationBarButtons() settingButtonsStackView.arrangedSubviews.forEach { settingButton in settingButtonsStackView.removeArrangedSubview(settingButton) settingButton.removeFromSuperview() From f3f55d3aeebdf01d6760ef0988f46dbfa84c0638 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Mon, 24 Aug 2020 14:08:56 +1000 Subject: [PATCH 05/14] Debug --- Signal/src/AppDelegate.m | 18 ++++++++++++++---- .../src/Loki/View Controllers/SettingsVC.swift | 1 - .../Loki/Redesign/Style Guide/AppMode.swift | 1 + .../src/Loki/Utilities/LKUserDefaults.swift | 9 +++++++++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index eeb6fc4d9..7fc1ec39e 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -254,6 +254,9 @@ static NSTimeInterval launchStartedAt; mainWindow.rootViewController = [LoadingViewController new]; [mainWindow makeKeyAndVisible]; + LKAppMode appMode = [NSUserDefaults.standardUserDefaults integerForKey:@"appMode"]; + [self setCurrentAppMode:appMode]; + if (@available(iOS 11, *)) { // This must happen in appDidFinishLaunching or earlier to ensure we don't // miss notifications. @@ -308,6 +311,9 @@ static NSTimeInterval launchStartedAt; [self ensureRootViewController]; + LKAppMode appMode = [NSUserDefaults.standardUserDefaults integerForKey:@"appMode"]; + [self setCurrentAppMode:appMode]; + [AppReadiness runNowOrWhenAppDidBecomeReady:^{ [self handleActivation]; }]; @@ -937,21 +943,24 @@ static NSTimeInterval launchStartedAt; # pragma mark - App Mode -- (LKAppMode)getCurrentAppMode { +- (LKAppMode)getCurrentAppMode +{ UIWindow *window = UIApplication.sharedApplication.keyWindow; if (window == nil) { return LKAppModeLight; } UIUserInterfaceStyle userInterfaceStyle = window.traitCollection.userInterfaceStyle; - BOOL isLightMode = userInterfaceStyle == UIUserInterfaceStyleUnspecified || userInterfaceStyle == UIUserInterfaceStyleLight; + BOOL isLightMode = userInterfaceStyle == UIUserInterfaceStyleLight || userInterfaceStyle == UIUserInterfaceStyleUnspecified; return isLightMode ? LKAppModeLight : LKAppModeDark; } -- (void)setCurrentAppModeTo:(LKAppMode)appMode { +- (void)setCurrentAppMode:(LKAppMode)appMode +{ UIWindow *window = UIApplication.sharedApplication.keyWindow; if (window == nil) { return; } + [NSUserDefaults.standardUserDefaults setInteger:appMode forKey:@"appMode"]; switch (appMode) { case LKAppModeLight: { if (@available(iOS 13.0, *)) { - window.overrideUserInterfaceStyle = UIUserInterfaceStyleUnspecified; + window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight; } break; } @@ -962,6 +971,7 @@ static NSTimeInterval launchStartedAt; break; } } + [NSNotificationCenter.defaultCenter postNotificationName:NSNotification.appModeChanged object:nil]; } # pragma mark - Other diff --git a/Signal/src/Loki/View Controllers/SettingsVC.swift b/Signal/src/Loki/View Controllers/SettingsVC.swift index f2277f609..1203c262f 100644 --- a/Signal/src/Loki/View Controllers/SettingsVC.swift +++ b/Signal/src/Loki/View Controllers/SettingsVC.swift @@ -327,7 +327,6 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { @objc private func switchAppMode() { let newAppMode: AppMode = isLightMode ? .dark : .light AppModeManager.shared.setCurrentAppMode(to: newAppMode) - NotificationCenter.default.post(name: .appModeChanged, object: nil) } @objc private func showQRCode() { diff --git a/SignalMessaging/Loki/Redesign/Style Guide/AppMode.swift b/SignalMessaging/Loki/Redesign/Style Guide/AppMode.swift index aa507d26b..640a2129d 100644 --- a/SignalMessaging/Loki/Redesign/Style Guide/AppMode.swift +++ b/SignalMessaging/Loki/Redesign/Style Guide/AppMode.swift @@ -30,6 +30,7 @@ public final class AppModeManager : NSObject { public protocol AppModeManagerDelegate { func getCurrentAppMode() -> AppMode + @objc(setCurrentAppMode:) func setCurrentAppMode(to appMode: AppMode) } diff --git a/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift b/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift index 21ab9158d..9b8184df6 100644 --- a/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift +++ b/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift @@ -20,6 +20,10 @@ public enum LKUserDefaults { public enum Double : Swift.String { case lastDeviceTokenUpload = "lastDeviceTokenUploadTime" } + + public enum Int: Swift.String { + case appMode + } public enum String { case slaveDeviceName(Swift.String) @@ -53,6 +57,11 @@ public extension UserDefaults { get { return self.double(forKey: double.rawValue) } set { set(newValue, forKey: double.rawValue) } } + + public subscript(int: LKUserDefaults.Int) -> Int { + get { return self.integer(forKey: int.rawValue) } + set { set(newValue, forKey: int.rawValue) } + } public subscript(string: LKUserDefaults.String) -> String? { get { return self.string(forKey: string.key) } From 67df07537e13a24235e794408760cc0dc346c9df Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Mon, 24 Aug 2020 14:24:44 +1000 Subject: [PATCH 06/14] Debug a bit more --- Signal/src/Loki/Components/Button.swift | 14 ++++++++++++-- .../Components/NewConversationButtonSet.swift | 17 ++++++++++++++--- Signal/src/Loki/View Controllers/BaseVC.swift | 4 ++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Signal/src/Loki/Components/Button.swift b/Signal/src/Loki/Components/Button.swift index 517e207cd..6ad7163e8 100644 --- a/Signal/src/Loki/Components/Button.swift +++ b/Signal/src/Loki/Components/Button.swift @@ -2,6 +2,7 @@ final class Button : UIButton { private let style: Style private let size: Size + private var heightConstraint: NSLayoutConstraint! enum Style { case unimportant, regular, prominentOutline, prominentFilled, regularBorderless @@ -16,6 +17,7 @@ final class Button : UIButton { self.size = size super.init(frame: .zero) setUpStyle() + NotificationCenter.default.addObserver(self, selector: #selector(handleAppModeChangedNotification(_:)), name: .appModeChanged, object: nil) } override init(frame: CGRect) { @@ -25,7 +27,11 @@ final class Button : UIButton { required init?(coder: NSCoder) { preconditionFailure("Use init(style:) instead.") } - + + deinit { + NotificationCenter.default.removeObserver(self) + } + private func setUpStyle() { let fillColor: UIColor switch style { @@ -57,7 +63,7 @@ final class Button : UIButton { case .medium: height = Values.mediumButtonHeight case .large: height = Values.largeButtonHeight } - set(.height, to: height) + if heightConstraint == nil { heightConstraint = set(.height, to: height) } layer.cornerRadius = height / 2 backgroundColor = fillColor layer.borderColor = borderColor.cgColor @@ -66,4 +72,8 @@ final class Button : UIButton { titleLabel!.font = .boldSystemFont(ofSize: fontSize) setTitleColor(textColor, for: UIControl.State.normal) } + + @objc private func handleAppModeChangedNotification(_ notification: Notification) { + setUpStyle() + } } diff --git a/Signal/src/Loki/Components/NewConversationButtonSet.swift b/Signal/src/Loki/Components/NewConversationButtonSet.swift index c53fc2f1b..668302253 100644 --- a/Signal/src/Loki/Components/NewConversationButtonSet.swift +++ b/Signal/src/Loki/Components/NewConversationButtonSet.swift @@ -217,6 +217,7 @@ private final class NewConversationButton : UIImageView { self.icon = icon super.init(frame: CGRect.zero) setUpViewHierarchy() + NotificationCenter.default.addObserver(self, selector: #selector(handleAppModeChangedNotification(_:)), name: .appModeChanged, object: nil) } override init(frame: CGRect) { @@ -226,8 +227,12 @@ private final class NewConversationButton : UIImageView { required init?(coder: NSCoder) { preconditionFailure("Use init(isMainButton:) instead.") } + + deinit { + NotificationCenter.default.removeObserver(self) + } - private func setUpViewHierarchy() { + private func setUpViewHierarchy(isUpdate: Bool = false) { backgroundColor = isMainButton ? Colors.accent : Colors.newConversationButtonCollapsedBackground let size = Values.newConversationButtonCollapsedSize layer.cornerRadius = size / 2 @@ -238,8 +243,14 @@ private final class NewConversationButton : UIImageView { let iconColor = (isMainButton && isLightMode) ? UIColor.white : Colors.text image = icon.asTintedImage(color: iconColor)! contentMode = .center - widthConstraint = set(.width, to: size) - heightConstraint = set(.height, to: size) + if !isUpdate { + widthConstraint = set(.width, to: size) + heightConstraint = set(.height, to: size) + } + } + + @objc private func handleAppModeChangedNotification(_ notification: Notification) { + setUpViewHierarchy(isUpdate: true) } } diff --git a/Signal/src/Loki/View Controllers/BaseVC.swift b/Signal/src/Loki/View Controllers/BaseVC.swift index 764a02694..514a38e7f 100644 --- a/Signal/src/Loki/View Controllers/BaseVC.swift +++ b/Signal/src/Loki/View Controllers/BaseVC.swift @@ -80,6 +80,10 @@ class BaseVC : UIViewController { } } + override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + // TODO: Post an appModeChanged notification? + } + @objc internal func handleAppModeChangedNotification(_ notification: Notification) { if hasGradient { setUpGradientBackground() // Re-do the gradient From e26ce2a4854c09fba112305227639e0b09077f5e Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Mon, 24 Aug 2020 14:42:14 +1000 Subject: [PATCH 07/14] Update version number --- Signal.xcodeproj/project.pbxproj | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index fb942f767..370a17c07 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -4096,7 +4096,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 101; + CURRENT_PROJECT_VERSION = 102; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -4110,7 +4110,7 @@ INFOPLIST_FILE = SignalShareExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.4.4; + MARKETING_VERSION = 1.4.5; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.share-extension"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -4158,7 +4158,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 101; + CURRENT_PROJECT_VERSION = 102; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -4177,7 +4177,7 @@ INFOPLIST_FILE = SignalShareExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.4.4; + MARKETING_VERSION = 1.4.5; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.share-extension"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -4212,7 +4212,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 101; + CURRENT_PROJECT_VERSION = 102; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = SUQ8J2PCT7; @@ -4231,7 +4231,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 1.4.4; + MARKETING_VERSION = 1.4.5; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.utilities"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -4282,7 +4282,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 101; + CURRENT_PROJECT_VERSION = 102; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = SUQ8J2PCT7; @@ -4306,7 +4306,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 1.4.4; + MARKETING_VERSION = 1.4.5; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.utilities"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -4344,7 +4344,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 101; + CURRENT_PROJECT_VERSION = 102; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -4356,7 +4356,7 @@ INFOPLIST_FILE = LokiPushNotificationService/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.4.4; + MARKETING_VERSION = 1.4.5; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.push-notification-service"; @@ -4407,7 +4407,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 101; + CURRENT_PROJECT_VERSION = 102; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -4424,7 +4424,7 @@ INFOPLIST_FILE = LokiPushNotificationService/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.4.4; + MARKETING_VERSION = 1.4.5; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.push-notification-service"; @@ -4608,7 +4608,7 @@ CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 101; + CURRENT_PROJECT_VERSION = 102; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4643,7 +4643,7 @@ "$(SRCROOT)", ); LLVM_LTO = NO; - MARKETING_VERSION = 1.4.4; + MARKETING_VERSION = 1.4.5; OTHER_LDFLAGS = "$(inherited)"; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger"; @@ -4676,7 +4676,7 @@ CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 101; + CURRENT_PROJECT_VERSION = 102; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4711,7 +4711,7 @@ "$(SRCROOT)", ); LLVM_LTO = NO; - MARKETING_VERSION = 1.4.4; + MARKETING_VERSION = 1.4.5; OTHER_LDFLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger"; PRODUCT_NAME = Session; From e840fa4bc4768c6febe7ee2e8188446f192e285a Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Wed, 26 Aug 2020 11:06:37 +1000 Subject: [PATCH 08/14] Reduce amount of green on white --- Signal/src/Loki/Components/Button.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Signal/src/Loki/Components/Button.swift b/Signal/src/Loki/Components/Button.swift index 6ad7163e8..81449460e 100644 --- a/Signal/src/Loki/Components/Button.swift +++ b/Signal/src/Loki/Components/Button.swift @@ -35,26 +35,26 @@ final class Button : UIButton { private func setUpStyle() { let fillColor: UIColor switch style { - case .unimportant: fillColor = Colors.unimportantButtonBackground + case .unimportant: fillColor = isLightMode ? UIColor.clear : Colors.unimportantButtonBackground case .regular: fillColor = UIColor.clear case .prominentOutline: fillColor = UIColor.clear - case .prominentFilled: fillColor = Colors.accent + case .prominentFilled: fillColor = isLightMode ? Colors.text : Colors.accent case .regularBorderless: fillColor = UIColor.clear } let borderColor: UIColor switch style { case .unimportant: borderColor = isLightMode ? Colors.text : Colors.unimportantButtonBackground case .regular: borderColor = Colors.text - case .prominentOutline: borderColor = Colors.accent - case .prominentFilled: borderColor = Colors.accent + case .prominentOutline: borderColor = isLightMode ? Colors.text : Colors.accent + case .prominentFilled: borderColor = isLightMode ? Colors.text : Colors.accent case .regularBorderless: borderColor = UIColor.clear } let textColor: UIColor switch style { case .unimportant: textColor = Colors.text case .regular: textColor = Colors.text - case .prominentOutline: textColor = Colors.accent - case .prominentFilled: textColor = Colors.text + case .prominentOutline: textColor = isLightMode ? Colors.text : Colors.accent + case .prominentFilled: textColor = isLightMode ? UIColor.white : Colors.text case .regularBorderless: textColor = Colors.text } let height: CGFloat From be5338f073daa8b7956c11fcfa24128ab7d3e6ec Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Wed, 26 Aug 2020 12:02:27 +1000 Subject: [PATCH 09/14] Debug --- Signal/src/AppDelegate.m | 2 + .../Cells/ConversationMediaView.swift | 8 +-- .../Cells/MediaAlbumCellView.swift | 4 +- .../Cells/OWSMessageBubbleView.m | 18 ++----- .../Cells/OWSMessageFooterView.m | 2 +- .../MediaGalleryViewController.swift | 9 +++- .../MenuActionsViewController.swift | 22 ++++---- .../Loki/Redesign/Style Guide/Colors.swift | 54 +++++++++---------- ...AttachmentApprovalInputAccessoryView.swift | 2 +- .../AttachmentPrepViewController.swift | 1 + .../ScreenLockViewController.m | 6 ++- .../SelectThreadViewController.m | 4 +- .../OWSViewController+ImageEditor.swift | 9 ++-- SignalMessaging/Views/OWSFlatButton.swift | 3 +- SignalMessaging/appearance/Theme.m | 18 +------ .../SAEScreenLockViewController.m | 4 +- .../ShareViewController.swift | 17 +++++- 17 files changed, 91 insertions(+), 92 deletions(-) diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index ddb965ad1..c78843423 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -962,12 +962,14 @@ static NSTimeInterval launchStartedAt; if (@available(iOS 13.0, *)) { window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight; } + window.backgroundColor = UIColor.whiteColor; break; } case LKAppModeDark: { if (@available(iOS 13.0, *)) { window.overrideUserInterfaceStyle = UIUserInterfaceStyleDark; } + window.backgroundColor = UIColor.blackColor; break; } } diff --git a/Signal/src/ViewControllers/ConversationView/Cells/ConversationMediaView.swift b/Signal/src/ViewControllers/ConversationView/Cells/ConversationMediaView.swift index 747b6559d..304ede4d0 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/ConversationMediaView.swift +++ b/Signal/src/ViewControllers/ConversationView/Cells/ConversationMediaView.swift @@ -28,7 +28,7 @@ public class ConversationMediaView: UIView { private let maxMessageWidth: CGFloat private var loadBlock: (() -> Void)? private var unloadBlock: (() -> Void)? - private let isProxied: Bool + private let isOnionRouted: Bool // MARK: - LoadState @@ -92,12 +92,12 @@ public class ConversationMediaView: UIView { attachment: TSAttachment, isOutgoing: Bool, maxMessageWidth: CGFloat, - isProxied: Bool) { + isOnionRouted: Bool) { self.mediaCache = mediaCache self.attachment = attachment self.isOutgoing = isOutgoing self.maxMessageWidth = maxMessageWidth - self.isProxied = isProxied + self.isOnionRouted = isOnionRouted super.init(frame: .zero) @@ -185,7 +185,7 @@ public class ConversationMediaView: UIView { } guard !attachmentStream.isUploaded else { return false } let view: UIView - if isProxied { // Loki: Due to the way proxying works we can't get upload progress for those attachments + if isOnionRouted { // Loki: Due to the way onion routing works we can't get upload progress for those attachments let activityIndicatorView = UIActivityIndicatorView(style: .white) activityIndicatorView.isHidden = false activityIndicatorView.startAnimating() diff --git a/Signal/src/ViewControllers/ConversationView/Cells/MediaAlbumCellView.swift b/Signal/src/ViewControllers/ConversationView/Cells/MediaAlbumCellView.swift index c1f0085cc..969254144 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/MediaAlbumCellView.swift +++ b/Signal/src/ViewControllers/ConversationView/Cells/MediaAlbumCellView.swift @@ -27,14 +27,14 @@ public class MediaAlbumCellView: UIStackView { items: [ConversationMediaAlbumItem], isOutgoing: Bool, maxMessageWidth: CGFloat, - isProxied: Bool) { + isOnionRouted: Bool) { self.items = items self.itemViews = MediaAlbumCellView.itemsToDisplay(forItems: items).map { let result = ConversationMediaView(mediaCache: mediaCache, attachment: $0.attachment, isOutgoing: isOutgoing, maxMessageWidth: maxMessageWidth, - isProxied: isProxied) + isOnionRouted: isOnionRouted) return result } diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m index 0f09a2689..bcc3a24d5 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m @@ -366,10 +366,9 @@ NS_ASSUME_NONNULL_BEGIN CGFloat maxGradientHeight = 40.f; CAGradientLayer *gradientLayer = [CAGradientLayer new]; - CGFloat whiteLevel = LKAppModeUtilities.isLightMode ? 1.f : 0.f; gradientLayer.colors = @[ - (id)[UIColor colorWithWhite:whiteLevel alpha:0.f].CGColor, - (id)[UIColor colorWithWhite:whiteLevel alpha:0.4f].CGColor, + (id)[UIColor colorWithWhite:0.0f alpha:0.f].CGColor, + (id)[UIColor colorWithWhite:0.0f alpha:0.4f].CGColor, ]; OWSLayerView *gradientView = [[OWSLayerView alloc] initWithFrame:CGRectZero @@ -806,24 +805,13 @@ NS_ASSUME_NONNULL_BEGIN - (UIView *)loadViewForMediaAlbum { OWSAssertDebug(self.viewItem.mediaAlbumItems); - - BOOL isProxied = NO; - if ([self.viewItem.interaction isKindOfClass:TSOutgoingMessage.class]) { - TSOutgoingMessage *message = (TSOutgoingMessage *)self.viewItem.interaction; - if ([message.thread isKindOfClass:TSGroupThread.class]) { - TSGroupThread *groupThread = (TSGroupThread *)message.thread; - isProxied = (groupThread.groupModel.groupType == closedGroup); - } else if ([message.thread isKindOfClass:TSContactThread.class]) { - isProxied = YES; - } - } OWSMediaAlbumCellView *albumView = [[OWSMediaAlbumCellView alloc] initWithMediaCache:self.cellMediaCache items:self.viewItem.mediaAlbumItems isOutgoing:self.isOutgoing maxMessageWidth:self.conversationStyle.maxMessageWidth - isProxied:isProxied]; + isOnionRouted:YES]; self.loadCellContentBlock = ^{ [albumView loadMedia]; }; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m index d63a8baa8..bcf2ac806 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageFooterView.m @@ -96,7 +96,7 @@ NS_ASSUME_NONNULL_BEGIN UIColor *textColor; if (isOverlayingMedia) { - textColor = LKColors.text; + textColor = UIColor.whiteColor; } else { textColor = [conversationStyle bubbleSecondaryTextColorWithIsIncoming:isIncoming]; } diff --git a/Signal/src/ViewControllers/MediaGalleryViewController.swift b/Signal/src/ViewControllers/MediaGalleryViewController.swift index 8005d2737..1eb0591c2 100644 --- a/Signal/src/ViewControllers/MediaGalleryViewController.swift +++ b/Signal/src/ViewControllers/MediaGalleryViewController.swift @@ -263,7 +263,7 @@ class MediaGalleryNavigationController: OWSNavigationController { // MARK: View Lifecycle override var preferredStatusBarStyle: UIStatusBarStyle { - return .lightContent + return isLightMode ? .default : .lightContent } override func viewDidLoad() { @@ -291,7 +291,12 @@ class MediaGalleryNavigationController: OWSNavigationController { return } - navigationBar.overrideTheme(type: .alwaysDark) + view.backgroundColor = Colors.navigationBarBackground + + navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default) + navigationBar.shadowImage = UIImage() + navigationBar.isTranslucent = false + navigationBar.barTintColor = Colors.navigationBarBackground } override func viewDidAppear(_ animated: Bool) { diff --git a/Signal/src/ViewControllers/MenuActionsViewController.swift b/Signal/src/ViewControllers/MenuActionsViewController.swift index b466bed99..f9357a4b8 100644 --- a/Signal/src/ViewControllers/MenuActionsViewController.swift +++ b/Signal/src/ViewControllers/MenuActionsViewController.swift @@ -144,7 +144,7 @@ class MenuActionsViewController: UIViewController, MenuActionSheetDelegate { let backgroundDuration: TimeInterval = 0.1 UIView.animate(withDuration: backgroundDuration) { - let alpha: CGFloat = Theme.isDarkThemeEnabled ? 0.7 : 0.4 + let alpha: CGFloat = isDarkMode ? 0.7 : 0.4 self.view.backgroundColor = UIColor.black.withAlphaComponent(alpha) } @@ -272,7 +272,7 @@ class MenuActionSheetView: UIView, MenuActionViewDelegate { super.init(frame: frame) - backgroundColor = (Theme.isDarkThemeEnabled + backgroundColor = (isDarkMode ? UIColor.ows_gray90 : UIColor.ows_gray05) addSubview(actionStackView) @@ -398,27 +398,25 @@ class MenuActionView: UIButton { isUserInteractionEnabled = true backgroundColor = defaultBackgroundColor + let textColor = isLightMode ? UIColor.black : UIColor.white + var image = action.image - if Theme.isDarkThemeEnabled { - image = image.withRenderingMode(.alwaysTemplate) - } + image = image.withRenderingMode(.alwaysTemplate) let imageView = UIImageView(image: image) - if Theme.isDarkThemeEnabled { - imageView.tintColor = Colors.text.withAlphaComponent(Values.unimportantElementOpacity) - } + imageView.tintColor = textColor.withAlphaComponent(Values.unimportantElementOpacity) let imageWidth: CGFloat = 24 imageView.autoSetDimensions(to: CGSize(width: imageWidth, height: imageWidth)) imageView.isUserInteractionEnabled = false let titleLabel = UILabel() titleLabel.font = .systemFont(ofSize: Values.mediumFontSize) - titleLabel.textColor = Colors.text + titleLabel.textColor = textColor titleLabel.text = action.title titleLabel.isUserInteractionEnabled = false let subtitleLabel = UILabel() subtitleLabel.font = .systemFont(ofSize: Values.smallFontSize) - subtitleLabel.textColor = Colors.text.withAlphaComponent(Values.unimportantElementOpacity) + subtitleLabel.textColor = textColor.withAlphaComponent(Values.unimportantElementOpacity) subtitleLabel.text = action.subtitle subtitleLabel.isUserInteractionEnabled = false @@ -443,11 +441,11 @@ class MenuActionView: UIButton { } private var defaultBackgroundColor: UIColor { - return Colors.cellBackground + return isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B) } private var highlightedBackgroundColor: UIColor { - return Colors.cellSelected + return isLightMode ? UIColor(hex: 0xDFDFDF) : UIColor(hex: 0x0C0C0C) } override var isHighlighted: Bool { diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift b/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift index 8b08ddc50..bada7a0da 100644 --- a/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift @@ -12,31 +12,31 @@ @objc(LKColors) public final class Colors : NSObject { - @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")! + @objc public static let accent = UIColor(named: "session_accent")! + @objc public static let text = UIColor(named: "session_text")! + @objc public static let destructive = UIColor(named: "session_destructive")! + @objc public static let unimportant = UIColor(named: "session_unimportant")! + @objc public static let border = UIColor(named: "session_border")! + @objc public static let cellBackground = UIColor(named: "session_cell_background")! + @objc public static let cellSelected = UIColor(named: "session_cell_selected")! + @objc public static let navigationBarBackground = UIColor(named: "session_navigation_bar_background")! + @objc public static let searchBarPlaceholder = UIColor(named: "session_search_bar_placeholder")! // Also used for the icons + @objc public static let searchBarBackground = UIColor(named: "session_search_bar_background")! + @objc public static let newConversationButtonShadow = UIColor(named: "session_new_conversation_button_shadow")! + @objc public static let separator = UIColor(named: "session_separator")! + @objc public static let unimportantButtonBackground = UIColor(named: "session_unimportant_button_background")! + @objc public static let buttonBackground = UIColor(named: "session_button_background")! + @objc public static let settingButtonSelected = UIColor(named: "session_setting_button_selected")! + @objc public static let modalBackground = UIColor(named: "session_modal_background")! + @objc public static let modalBorder = UIColor(named: "session_modal_border")! + @objc public static let fakeChatBubbleBackground = UIColor(named: "session_fake_chat_bubble_background")! + @objc public static let fakeChatBubbleText = UIColor(named: "session_fake_chat_bubble_text")! + @objc public static let composeViewBackground = UIColor(named: "session_compose_view_background")! + @objc public static let composeViewTextFieldBackground = UIColor(named: "session_compose_view_text_field_background")! + @objc public static let receivedMessageBackground = UIColor(named: "session_received_message_background")! + @objc public static let sentMessageBackground = UIColor(named: "session_sent_message_background")! + @objc public static let newConversationButtonCollapsedBackground = UIColor(named: "session_new_conversation_button_collapsed_background")! + @objc public static let pnOptionBackground = UIColor(named: "session_pn_option_background")! + @objc public static let pnOptionBorder = UIColor(named: "session_pn_option_border")! + @objc public static let pathsBuilding = UIColor(named: "session_paths_building")! } diff --git a/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentApprovalInputAccessoryView.swift b/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentApprovalInputAccessoryView.swift index f46d83dea..64b579467 100644 --- a/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentApprovalInputAccessoryView.swift +++ b/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentApprovalInputAccessoryView.swift @@ -60,7 +60,7 @@ class AttachmentApprovalInputAccessoryView: UIView { // Use a background view that extends below the keyboard to avoid animation glitches. let backgroundView = UIView() - backgroundView.backgroundColor = UIColor.black.withAlphaComponent(0.6) + backgroundView.backgroundColor = isLightMode ? UIColor.black.withAlphaComponent(0.2) : UIColor.black.withAlphaComponent(0.6) addSubview(backgroundView) backgroundView.autoPinEdgesToSuperviewEdges() diff --git a/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentPrepViewController.swift b/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentPrepViewController.swift index 039338131..1615d8bbf 100644 --- a/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentPrepViewController.swift +++ b/SignalMessaging/ViewControllers/AttachmentApproval/AttachmentPrepViewController.swift @@ -438,6 +438,7 @@ extension AttachmentPrepViewController: ImageEditorViewDelegate { ? .overFullScreen : .fullScreen) navigationController.ows_prefersStatusBarHidden = true + navigationController.view.backgroundColor = Colors.navigationBarBackground if let navigationBar = navigationController.navigationBar as? OWSNavigationBar { navigationBar.overrideTheme(type: .clear) diff --git a/SignalMessaging/ViewControllers/ScreenLockViewController.m b/SignalMessaging/ViewControllers/ScreenLockViewController.m index 841fb0fb0..21d4c3514 100644 --- a/SignalMessaging/ViewControllers/ScreenLockViewController.m +++ b/SignalMessaging/ViewControllers/ScreenLockViewController.m @@ -41,7 +41,9 @@ NSString *NSStringForScreenLockUIState(ScreenLockUIState value) self.view.backgroundColor = UIColor.clearColor; CAGradientLayer *layer = [CAGradientLayer new]; layer.frame = UIScreen.mainScreen.bounds; - layer.colors = @[ (id)[UIColor colorWithRGBHex:0x171717].CGColor, (id)[UIColor colorWithRGBHex:0x121212].CGColor ]; + UIColor *gradientStartColor = LKAppModeUtilities.isLightMode ? [UIColor colorWithRGBHex:0xFCFCFC] : [UIColor colorWithRGBHex:0x171717]; + UIColor *gradientEndColor = LKAppModeUtilities.isLightMode ? [UIColor colorWithRGBHex:0xFFFFFF] : [UIColor colorWithRGBHex:0x121212]; + layer.colors = @[ (id)gradientStartColor.CGColor, (id)gradientEndColor.CGColor ]; [self.view.layer insertSublayer:layer atIndex:0]; UIView *edgesView = [UIView containerView]; @@ -64,7 +66,7 @@ NSString *NSStringForScreenLockUIState(ScreenLockUIState value) OWSFlatButton *button = [OWSFlatButton buttonWithTitle:NSLocalizedString(@"Unlock Session", @"") font:[UIFont boldSystemFontOfSize:LKValues.mediumFontSize] - titleColor:UIColor.whiteColor + titleColor:LKAppModeUtilities.isLightMode ? UIColor.blackColor : UIColor.whiteColor backgroundColor:UIColor.clearColor target:self selector:@selector(showUnlockUI)]; diff --git a/SignalMessaging/ViewControllers/SelectThreadViewController.m b/SignalMessaging/ViewControllers/SelectThreadViewController.m index 02ee286eb..f4d3b0bfe 100644 --- a/SignalMessaging/ViewControllers/SelectThreadViewController.m +++ b/SignalMessaging/ViewControllers/SelectThreadViewController.m @@ -81,7 +81,9 @@ NS_ASSUME_NONNULL_BEGIN self.tableViewController.view.backgroundColor = UIColor.clearColor; CAGradientLayer *layer = [CAGradientLayer new]; layer.frame = UIScreen.mainScreen.bounds; - layer.colors = @[ (id)[UIColor colorWithRGBHex:0x171717].CGColor, (id)[UIColor colorWithRGBHex:0x121212].CGColor ]; + UIColor *gradientStartColor = LKAppModeUtilities.isLightMode ? [UIColor colorWithRGBHex:0xFCFCFC] : [UIColor colorWithRGBHex:0x171717]; + UIColor *gradientEndColor = LKAppModeUtilities.isLightMode ? [UIColor colorWithRGBHex:0xFFFFFF] : [UIColor colorWithRGBHex:0x121212]; + layer.colors = @[ (id)gradientStartColor.CGColor, (id)gradientEndColor.CGColor ]; [self.tableViewController.view.layer insertSublayer:layer atIndex:0]; // Loki: Set navigation bar background color diff --git a/SignalMessaging/Views/ImageEditor/OWSViewController+ImageEditor.swift b/SignalMessaging/Views/ImageEditor/OWSViewController+ImageEditor.swift index 60e3b7a92..eb47a8f29 100644 --- a/SignalMessaging/Views/ImageEditor/OWSViewController+ImageEditor.swift +++ b/SignalMessaging/Views/ImageEditor/OWSViewController+ImageEditor.swift @@ -10,7 +10,7 @@ public extension NSObject { selector: Selector) -> UIView { let button = OWSButton() button.setImage(imageName: imageName) - button.tintColor = Colors.text + button.tintColor = isLightMode ? UIColor.black : UIColor.white button.addTarget(self, action: selector, for: .touchUpInside) return button } @@ -51,9 +51,10 @@ public extension UIViewController { navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default) navigationBar.shadowImage = UIImage() navigationBar.isTranslucent = false - navigationBar.barTintColor = Colors.navigationBarBackground - navigationBar.backgroundColor = Colors.navigationBarBackground - let backgroundImage = UIImage(color: Colors.navigationBarBackground) + let color = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x161616) + navigationBar.barTintColor = color + navigationBar.backgroundColor = color + let backgroundImage = UIImage(color: color) navigationBar.setBackgroundImage(backgroundImage, for: .default) } } diff --git a/SignalMessaging/Views/OWSFlatButton.swift b/SignalMessaging/Views/OWSFlatButton.swift index 5cb2ff2d5..934492344 100644 --- a/SignalMessaging/Views/OWSFlatButton.swift +++ b/SignalMessaging/Views/OWSFlatButton.swift @@ -140,8 +140,7 @@ public class OWSFlatButton: UIView { @objc public func setBackgroundColors(upColor: UIColor ) { - setBackgroundColors(upColor: upColor, - downColor: upColor.withAlphaComponent(0.7) ) + setBackgroundColors(upColor: upColor, downColor: upColor ) } @objc diff --git a/SignalMessaging/appearance/Theme.m b/SignalMessaging/appearance/Theme.m index cae2f7b9a..b24a3ffd0 100644 --- a/SignalMessaging/appearance/Theme.m +++ b/SignalMessaging/appearance/Theme.m @@ -46,10 +46,6 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled"; { OWSAssertIsOnMainThread(); - if (!CurrentAppContext().isMainApp) { - return NO; - } - return LKAppModeUtilities.isDarkMode; } @@ -60,18 +56,7 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled"; - (void)setIsDarkThemeEnabled:(BOOL)value { - OWSAssertIsOnMainThread(); - - self.isDarkThemeEnabledNumber = @(value); - [OWSPrimaryStorage.sharedManager.dbReadWriteConnection setBool:value - forKey:ThemeKeyThemeEnabled - inCollection:ThemeCollection]; - - [UIUtil setupSignalAppearence]; - - [UIView performWithoutAnimation:^{ - [[NSNotificationCenter defaultCenter] postNotificationName:ThemeDidChangeNotification object:nil userInfo:nil]; - }]; + return; } + (UIColor *)backgroundColor @@ -197,7 +182,6 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled"; return UIKeyboardAppearanceDark; } - #pragma mark - Search Bar + (UIBarStyle)barStyle diff --git a/SignalShareExtension/SAEScreenLockViewController.m b/SignalShareExtension/SAEScreenLockViewController.m index e20531b69..a875b70f6 100644 --- a/SignalShareExtension/SAEScreenLockViewController.m +++ b/SignalShareExtension/SAEScreenLockViewController.m @@ -47,7 +47,9 @@ NS_ASSUME_NONNULL_BEGIN self.view.backgroundColor = UIColor.clearColor; CAGradientLayer *layer = [CAGradientLayer new]; layer.frame = UIScreen.mainScreen.bounds; - layer.colors = @[ (id)[UIColor colorWithRGBHex:0x171717].CGColor, (id)[UIColor colorWithRGBHex:0x121212].CGColor ]; + UIColor *gradientStartColor = LKAppModeUtilities.isLightMode ? [UIColor colorWithRGBHex:0xFCFCFC] : [UIColor colorWithRGBHex:0x171717]; + UIColor *gradientEndColor = LKAppModeUtilities.isLightMode ? [UIColor colorWithRGBHex:0xFFFFFF] : [UIColor colorWithRGBHex:0x121212]; + layer.colors = @[ (id)gradientStartColor.CGColor, (id)gradientEndColor.CGColor ]; [self.view.layer insertSublayer:layer atIndex:0]; // Loki: Set navigation bar background color diff --git a/SignalShareExtension/ShareViewController.swift b/SignalShareExtension/ShareViewController.swift index d3451efff..503c5eb47 100644 --- a/SignalShareExtension/ShareViewController.swift +++ b/SignalShareExtension/ShareViewController.swift @@ -10,7 +10,7 @@ import SessionServiceKit import PromiseKit @objc -public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailedViewDelegate { +public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailedViewDelegate, AppModeManagerDelegate { // MARK: - Dependencies @@ -43,6 +43,8 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed let appContext = ShareAppExtensionContext(rootViewController: self) SetCurrentAppContext(appContext) + AppModeManager.configure(delegate: self) + DebugLogger.shared().enableTTYLogging() if _isDebugAssertConfiguration() { DebugLogger.shared().enableFileLogging() @@ -1033,6 +1035,19 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed // apply any conversion, so no need to relocate the app. return !itemProvider.registeredTypeIdentifiers.contains(kUTTypeMPEG4 as String) } + + // MARK: App Mode + + public func getCurrentAppMode() -> AppMode { + guard let window = self.view.window else { return .light } + let userInterfaceStyle = window.traitCollection.userInterfaceStyle + let isLightMode = (userInterfaceStyle == .light || userInterfaceStyle == .unspecified) + return isLightMode ? .light : .dark + } + + public func setCurrentAppMode(to appMode: AppMode) { + return // Not applicable to share extensions + } } // Exposes a Progress object, whose progress is updated by polling the return of a given block From 9cb902fb9b0657325ed8d789ece73c24e0685285 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Wed, 26 Aug 2020 15:07:25 +1000 Subject: [PATCH 10/14] Update version number --- Signal.xcodeproj/project.pbxproj | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 7bacafded..7eb2a166e 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -4096,7 +4096,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 103; + CURRENT_PROJECT_VERSION = 104; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -4110,7 +4110,7 @@ INFOPLIST_FILE = SignalShareExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.4.5; + MARKETING_VERSION = 1.4.6; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.share-extension"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -4158,7 +4158,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 103; + CURRENT_PROJECT_VERSION = 104; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -4177,7 +4177,7 @@ INFOPLIST_FILE = SignalShareExtension/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.4.5; + MARKETING_VERSION = 1.4.6; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.share-extension"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -4212,7 +4212,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 103; + CURRENT_PROJECT_VERSION = 104; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = SUQ8J2PCT7; @@ -4231,7 +4231,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 1.4.5; + MARKETING_VERSION = 1.4.6; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.utilities"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -4282,7 +4282,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 103; + CURRENT_PROJECT_VERSION = 104; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = SUQ8J2PCT7; @@ -4306,7 +4306,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MARKETING_VERSION = 1.4.5; + MARKETING_VERSION = 1.4.6; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.utilities"; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -4344,7 +4344,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 103; + CURRENT_PROJECT_VERSION = 104; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -4356,7 +4356,7 @@ INFOPLIST_FILE = LokiPushNotificationService/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.4.5; + MARKETING_VERSION = 1.4.6; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.push-notification-service"; @@ -4407,7 +4407,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 103; + CURRENT_PROJECT_VERSION = 104; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -4424,7 +4424,7 @@ INFOPLIST_FILE = LokiPushNotificationService/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 1.4.5; + MARKETING_VERSION = 1.4.6; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.push-notification-service"; @@ -4608,7 +4608,7 @@ CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 103; + CURRENT_PROJECT_VERSION = 104; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4643,7 +4643,7 @@ "$(SRCROOT)", ); LLVM_LTO = NO; - MARKETING_VERSION = 1.4.5; + MARKETING_VERSION = 1.4.6; OTHER_LDFLAGS = "$(inherited)"; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger"; @@ -4676,7 +4676,7 @@ CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 103; + CURRENT_PROJECT_VERSION = 104; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4711,7 +4711,7 @@ "$(SRCROOT)", ); LLVM_LTO = NO; - MARKETING_VERSION = 1.4.5; + MARKETING_VERSION = 1.4.6; OTHER_LDFLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger"; PRODUCT_NAME = Session; From 99893d85454c6ca882be90e5bb6cf747a65595f1 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Wed, 26 Aug 2020 16:04:06 +1000 Subject: [PATCH 11/14] Remove unused code --- Signal/src/Loki/View Controllers/SettingsVC.swift | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Signal/src/Loki/View Controllers/SettingsVC.swift b/Signal/src/Loki/View Controllers/SettingsVC.swift index 1203c262f..39bdd0e64 100644 --- a/Signal/src/Loki/View Controllers/SettingsVC.swift +++ b/Signal/src/Loki/View Controllers/SettingsVC.swift @@ -210,11 +210,6 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { } // MARK: Updating - @objc private func handleAppModeSwitchedNotification(_ notification: Notification) { - updateNavigationBarButtons() - // TODO: Redraw UI - } - private func handleIsEditingDisplayNameChanged() { updateNavigationBarButtons() UIView.animate(withDuration: 0.25) { From 2db3a31ade2203ff4b78a1a35680b34b7009f5e2 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Wed, 26 Aug 2020 16:20:46 +1000 Subject: [PATCH 12/14] Fix updating --- .../Components/NewConversationButtonSet.swift | 5 +- .../Loki/View Controllers/SettingsVC.swift | 6 ++- .../Loki/Redesign/Style Guide/Colors.swift | 54 +++++++++---------- 3 files changed, 34 insertions(+), 31 deletions(-) diff --git a/Signal/src/Loki/Components/NewConversationButtonSet.swift b/Signal/src/Loki/Components/NewConversationButtonSet.swift index 668302253..7a1e583c9 100644 --- a/Signal/src/Loki/Components/NewConversationButtonSet.swift +++ b/Signal/src/Loki/Components/NewConversationButtonSet.swift @@ -233,14 +233,15 @@ private final class NewConversationButton : UIImageView { } private func setUpViewHierarchy(isUpdate: Bool = false) { - backgroundColor = isMainButton ? Colors.accent : Colors.newConversationButtonCollapsedBackground + let newConversationButtonCollapsedBackground = isLightMode ? UIColor(hex: 0xF5F5F5) : UIColor(hex: 0x1F1F1F) + backgroundColor = isMainButton ? Colors.accent : newConversationButtonCollapsedBackground let size = Values.newConversationButtonCollapsedSize layer.cornerRadius = size / 2 let glowColor = isMainButton ? Colors.newConversationButtonShadow : (isLightMode ? UIColor.black.withAlphaComponent(0.4) : UIColor.black) let glowConfiguration = UIView.CircularGlowConfiguration(size: size, color: glowColor, isAnimated: false, radius: isLightMode ? 4 : 6) setCircularGlow(with: glowConfiguration) layer.masksToBounds = false - let iconColor = (isMainButton && isLightMode) ? UIColor.white : Colors.text + let iconColor = (isMainButton && isLightMode) ? UIColor.white : (isLightMode ? UIColor.black : UIColor.white) image = icon.asTintedImage(color: iconColor)! contentMode = .center if !isUpdate { diff --git a/Signal/src/Loki/View Controllers/SettingsVC.swift b/Signal/src/Loki/View Controllers/SettingsVC.swift index 39bdd0e64..d59257085 100644 --- a/Signal/src/Loki/View Controllers/SettingsVC.swift +++ b/Signal/src/Loki/View Controllers/SettingsVC.swift @@ -160,8 +160,10 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { UIGraphicsEndImageContext() return image! } - button.setBackgroundImage(getImage(withColor: Colors.buttonBackground), for: UIControl.State.normal) - button.setBackgroundImage(getImage(withColor: Colors.settingButtonSelected), for: UIControl.State.highlighted) + let backgroundColor = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B) + button.setBackgroundImage(getImage(withColor: backgroundColor), for: UIControl.State.normal) + let selectedColor = isLightMode ? UIColor(hex: 0xDFDFDF) : UIColor(hex: 0x0C0C0C) + button.setBackgroundImage(getImage(withColor: selectedColor), for: UIControl.State.highlighted) button.addTarget(self, action: selector, for: UIControl.Event.touchUpInside) button.set(.height, to: Values.settingButtonHeight) return button diff --git a/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift b/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift index bada7a0da..36cbfbb5f 100644 --- a/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift +++ b/SignalMessaging/Loki/Redesign/Style Guide/Colors.swift @@ -12,31 +12,31 @@ @objc(LKColors) public final class Colors : NSObject { - @objc public static let accent = UIColor(named: "session_accent")! - @objc public static let text = UIColor(named: "session_text")! - @objc public static let destructive = UIColor(named: "session_destructive")! - @objc public static let unimportant = UIColor(named: "session_unimportant")! - @objc public static let border = UIColor(named: "session_border")! - @objc public static let cellBackground = UIColor(named: "session_cell_background")! - @objc public static let cellSelected = UIColor(named: "session_cell_selected")! - @objc public static let navigationBarBackground = UIColor(named: "session_navigation_bar_background")! - @objc public static let searchBarPlaceholder = UIColor(named: "session_search_bar_placeholder")! // Also used for the icons - @objc public static let searchBarBackground = UIColor(named: "session_search_bar_background")! - @objc public static let newConversationButtonShadow = UIColor(named: "session_new_conversation_button_shadow")! - @objc public static let separator = UIColor(named: "session_separator")! - @objc public static let unimportantButtonBackground = UIColor(named: "session_unimportant_button_background")! - @objc public static let buttonBackground = UIColor(named: "session_button_background")! - @objc public static let settingButtonSelected = UIColor(named: "session_setting_button_selected")! - @objc public static let modalBackground = UIColor(named: "session_modal_background")! - @objc public static let modalBorder = UIColor(named: "session_modal_border")! - @objc public static let fakeChatBubbleBackground = UIColor(named: "session_fake_chat_bubble_background")! - @objc public static let fakeChatBubbleText = UIColor(named: "session_fake_chat_bubble_text")! - @objc public static let composeViewBackground = UIColor(named: "session_compose_view_background")! - @objc public static let composeViewTextFieldBackground = UIColor(named: "session_compose_view_text_field_background")! - @objc public static let receivedMessageBackground = UIColor(named: "session_received_message_background")! - @objc public static let sentMessageBackground = UIColor(named: "session_sent_message_background")! - @objc public static let newConversationButtonCollapsedBackground = UIColor(named: "session_new_conversation_button_collapsed_background")! - @objc public static let pnOptionBackground = UIColor(named: "session_pn_option_background")! - @objc public static let pnOptionBorder = UIColor(named: "session_pn_option_border")! - @objc public static let pathsBuilding = UIColor(named: "session_paths_building")! + @objc public static var accent: UIColor { UIColor(named: "session_accent")! } + @objc public static var text: UIColor { UIColor(named: "session_text")! } + @objc public static var destructive: UIColor { UIColor(named: "session_destructive")! } + @objc public static var unimportant: UIColor { UIColor(named: "session_unimportant")! } + @objc public static var border: UIColor { UIColor(named: "session_border")! } + @objc public static var cellBackground: UIColor { UIColor(named: "session_cell_background")! } + @objc public static var cellSelected: UIColor { UIColor(named: "session_cell_selected")! } + @objc public static var navigationBarBackground: UIColor { UIColor(named: "session_navigation_bar_background")! } + @objc public static var searchBarPlaceholder: UIColor { UIColor(named: "session_search_bar_placeholder")! } // Also used for the icons + @objc public static var searchBarBackground: UIColor { UIColor(named: "session_search_bar_background")! } + @objc public static var newConversationButtonShadow: UIColor { UIColor(named: "session_new_conversation_button_shadow")! } + @objc public static var separator: UIColor { UIColor(named: "session_separator")! } + @objc public static var unimportantButtonBackground: UIColor { UIColor(named: "session_unimportant_button_background")! } + @objc public static var buttonBackground: UIColor { UIColor(named: "session_button_background")! } + @objc public static var settingButtonSelected: UIColor { UIColor(named: "session_setting_button_selected")! } + @objc public static var modalBackground: UIColor { UIColor(named: "session_modal_background")! } + @objc public static var modalBorder: UIColor { UIColor(named: "session_modal_border")! } + @objc public static var fakeChatBubbleBackground: UIColor { UIColor(named: "session_fake_chat_bubble_background")! } + @objc public static var fakeChatBubbleText: UIColor { UIColor(named: "session_fake_chat_bubble_text")! } + @objc public static var composeViewBackground: UIColor { UIColor(named: "session_compose_view_background")! } + @objc public static var composeViewTextFieldBackground: UIColor { UIColor(named: "session_compose_view_text_field_background")! } + @objc public static var receivedMessageBackground: UIColor { UIColor(named: "session_received_message_background")! } + @objc public static var sentMessageBackground: UIColor { UIColor(named: "session_sent_message_background")! } + @objc public static var newConversationButtonCollapsedBackground: UIColor { UIColor(named: "session_new_conversation_button_collapsed_background")! } + @objc public static var pnOptionBackground: UIColor { UIColor(named: "session_pn_option_background")! } + @objc public static var pnOptionBorder: UIColor { UIColor(named: "session_pn_option_border")! } + @objc public static var pathsBuilding: UIColor { UIColor(named: "session_paths_building")! } } From 717d44c204e0a9a39d076209221c18839910a482 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Wed, 26 Aug 2020 16:21:18 +1000 Subject: [PATCH 13/14] Update build number --- Signal.xcodeproj/project.pbxproj | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 7eb2a166e..b579a2939 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -4096,7 +4096,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 104; + CURRENT_PROJECT_VERSION = 105; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -4158,7 +4158,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 104; + CURRENT_PROJECT_VERSION = 105; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -4212,7 +4212,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 104; + CURRENT_PROJECT_VERSION = 105; DEBUG_INFORMATION_FORMAT = dwarf; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = SUQ8J2PCT7; @@ -4282,7 +4282,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 104; + CURRENT_PROJECT_VERSION = 105; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = SUQ8J2PCT7; @@ -4344,7 +4344,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 104; + CURRENT_PROJECT_VERSION = 105; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -4407,7 +4407,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 104; + CURRENT_PROJECT_VERSION = 105; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -4608,7 +4608,7 @@ CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 104; + CURRENT_PROJECT_VERSION = 105; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -4676,7 +4676,7 @@ CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 104; + CURRENT_PROJECT_VERSION = 105; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", From 44ca8c293a82229a49b5f0bdfbae340a9534cae9 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Thu, 27 Aug 2020 10:16:38 +1000 Subject: [PATCH 14/14] Show light mode announcement sheet to existing users --- Signal.xcodeproj/project.pbxproj | 4 ++ .../Loki V2/Sun.imageset/Contents.json | 12 +++++ .../Loki V2/Sun.imageset/Sun.pdf | Bin 0 -> 5351 bytes Signal/src/Loki/View Controllers/HomeVC.swift | 17 +++---- .../View Controllers/LightModeSheet.swift | 47 ++++++++++++++++++ .../src/Loki/View Controllers/PNModeVC.swift | 1 + Signal/src/Loki/View Controllers/Sheet.swift | 9 ++-- .../src/Loki/Utilities/LKUserDefaults.swift | 1 + 8 files changed, 77 insertions(+), 14 deletions(-) create mode 100644 Signal/Images.xcassets/Loki V2/Sun.imageset/Contents.json create mode 100644 Signal/Images.xcassets/Loki V2/Sun.imageset/Sun.pdf create mode 100644 Signal/src/Loki/View Controllers/LightModeSheet.swift diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index b579a2939..483ea7fad 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -573,6 +573,7 @@ BFF3FB9730634F37D25903F4 /* Pods_Signal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D17BB5C25D615AB49813100C /* Pods_Signal.framework */; }; C31A6C5A247F214E001123EF /* UIView+Glow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C31A6C59247F214E001123EF /* UIView+Glow.swift */; }; C31A6C5C247F2CF3001123EF /* CGRect+Utilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C31A6C5B247F2CF3001123EF /* CGRect+Utilities.swift */; }; + C329FEEC24F7277900B1C64C /* LightModeSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C329FEEB24F7277900B1C64C /* LightModeSheet.swift */; }; C34C8F7423A7830B00D82669 /* SpaceMono-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = C34C8F7323A7830A00D82669 /* SpaceMono-Bold.ttf */; }; C353F8F9244809150011121A /* PNOptionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C353F8F8244809150011121A /* PNOptionView.swift */; }; C3548F0624456447009433A8 /* PNModeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3548F0524456447009433A8 /* PNModeVC.swift */; }; @@ -1365,6 +1366,7 @@ B9EB5ABC1884C002007CBB57 /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; }; C31A6C59247F214E001123EF /* UIView+Glow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Glow.swift"; sourceTree = ""; }; C31A6C5B247F2CF3001123EF /* CGRect+Utilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CGRect+Utilities.swift"; sourceTree = ""; }; + C329FEEB24F7277900B1C64C /* LightModeSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightModeSheet.swift; sourceTree = ""; }; C34C8F7323A7830A00D82669 /* SpaceMono-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SpaceMono-Bold.ttf"; sourceTree = ""; }; C353F8F8244809150011121A /* PNOptionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PNOptionView.swift; sourceTree = ""; }; C3548F0524456447009433A8 /* PNModeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PNModeVC.swift; sourceTree = ""; }; @@ -2716,6 +2718,7 @@ B8BB82A4238F627000BA5194 /* HomeVC.swift */, B8CCF63E23975CFB0091D419 /* JoinPublicChatVC.swift */, B82B40872399EB0E00A248E7 /* LandingVC.swift */, + C329FEEB24F7277900B1C64C /* LightModeSheet.swift */, B85357C423A1F13800AAF6CD /* LinkDeviceVC.swift */, B85357C623A1FB5100AAF6CD /* LinkDeviceVCDelegate.swift */, B86BD08323399ACF000F5AE3 /* Modal.swift */, @@ -3843,6 +3846,7 @@ 45A6DAD61EBBF85500893231 /* ReminderView.swift in Sources */, 34D1F0881F8678AA0066283D /* ConversationViewLayout.m in Sources */, B82B408E239DC00D00A248E7 /* DisplayNameVC.swift in Sources */, + C329FEEC24F7277900B1C64C /* LightModeSheet.swift in Sources */, 4CA485BB2232339F004B9E7D /* PhotoCaptureViewController.swift in Sources */, 34330AA31E79686200DF2FB9 /* OWSProgressView.m in Sources */, 344825C6211390C800DB4BD8 /* OWSOrphanDataCleaner.m in Sources */, diff --git a/Signal/Images.xcassets/Loki V2/Sun.imageset/Contents.json b/Signal/Images.xcassets/Loki V2/Sun.imageset/Contents.json new file mode 100644 index 000000000..4676691e4 --- /dev/null +++ b/Signal/Images.xcassets/Loki V2/Sun.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "Sun.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Signal/Images.xcassets/Loki V2/Sun.imageset/Sun.pdf b/Signal/Images.xcassets/Loki V2/Sun.imageset/Sun.pdf new file mode 100644 index 0000000000000000000000000000000000000000..e4555bc54cc6e53a70076d49099750ac6484d368 GIT binary patch literal 5351 zcmai&2T)Vl+r}wTAaq4g5D7>JA)y7NNe!Shw1;--Qk+x_%BuGgK=z+x` z;jTa*^5irtH(n@R$do70s+IHjL}86)Gl}vdjZ6Ti&CDU?zLw77xUBoK2Ga+}Vbn`g zquEu)lhPC7lJx!%PVDDMp~$*GZz>yC1;nKX|9))RqZuJs(9<=WjT|^%TOXcCe8Mb? z&84F7qSvS9Ix^Ku<>lhL64ji;;LRoK9r8AP?I-kv4b9MeVSjCH%5}#1r`}0#UETNW zsqKa7sjOo|&j$%cvoVRg)i2&3+;u%(J<+E&f7J2(35?14Jd3l3jsBO0T)z~H-mHS` zy|Tv_de)xsfWM;2sK)5D6=CNV9_))kkXHIW@*-$%V)#R0*3~W3VZn=U4rJ(Qjo$^~ z%qBX6Xz8A;3_53)xz{=oy)?4pe9NC4s7?4GYm|%B_pgvARWh_SZhY8`O_qyK8 zluutv#f^6CHzAgie{d73*$$V-Vc=pp7HbJEbIKL$24_Kaa8ACUgYT_^1lyc%pL7!O zX{uWqel7~imCW`_7@perS6n7s1(^F;!mrrQhB5g93*_DOE8;0q#nn*{*6k8Mo$qb@ zTxP2~&g?(ao~$XJf1^xn_m<@zJ8nL~^3qX;!`4cqWWH{T4XUGdp6Mj4az#Vj?wR^c3=kjc)a9xk$J| zMpAd205@Kn+D5|&_TmM6>}#1p7M|8$tm{CU}W+hWP%bMA1_ zovJtof^$yDz=6KeHB+6^plJu`4As+u-Fhn*UTvwE!xg+%0dXR)!X$KB;l0cYw+7H}8Z zFgD`>eNVJA?9mcbs3F|B&9n4&%4gA1-{}rJRSm)Ai z6UuHcGF%3P94f2e*+18F#%>DQ`g(S4l;sUzU(Z}y9AJ-~351j;2&ovz9`zur7ou9`F+R#&M3rU)J7ByyA zH%l1xysMddC2pQPlt9FxECfY$zdf(HPE&fF`cPS}Cs%5_cJyp*>i4Zxf2JYz*ae{B zV24Qmr{|CElv;=emp}DxEw=>Jjl>UrE8V`mVt(fA8r*)oSvCS9NgR@fj>xo3?7twmShDGX08 z?oe^f)WJ>|W7r##)4CkXKd)}3uhj&r(7)-gKNlu{WR{rgJDVlGquz7a&w@D5cD?|T z(x5N*jB3RxR#Im>@`BpkYRItTc`A&4AX&Z63-`tD?ht9aMFouEn)p#nDlyx>EW>v3N#2o5o&5bZW8iTJW1 zC%~XRHW0GS1RWmQ^yY|Z1GaU4xDvD=V{N8o9`-J-;Q{RR5KB5#hfb@q@0HKW``Uq) z?m*bW#enABqP*j@S4SbfyJ7gw%r&htz^WIb)q7dgoxA7g(afrfF2(4$8ny4R8PmSg z$}+0oyNSxAMv&3uSSVdQl^K;EiPbj74(&BTPF@hHs&iA;x#rz{KLC+#cE5v%G&;?z z(~vrSLS&?5PG?WY6934uyARxvAaQ-T!>?Zq(hUoe{4>|?AU)8Y7+a(VNajyL4ef>{ z&3k}Ov+&Mo#{I5$I{#NT>SNHhhDa>Pf>cyp6J!MvS3{%F7(;isEfRDZo@yQt5cGF} zf7FouM~&b4D)-AJu1i{wxXNk9x{(4FB(9G1a*=zH2zn8cx7N@gL9e zfcUoAeQ7|0@>&-F1`*l;`V?Uy{9fv3G+CI1jP35WlEcDzY&BSDgM$!bG@DHNooxo{ z8gmoTE;MW9(p!@m$6aPq;|q0T;|^=Mu|_ieqaeUrtSNbbRE{aj>QbBKx%0gpyA&6h z$Qew@TZ#7e0N9>7#qbecF+IIVtFwA%RV=`+>5FKKKEKE4iGMr~RE_s68Bk+HM!}Dt zZH^+zu=?F4i4(y4?PMW|Fo*y`5CjH3_ zK4M-pAjdL|Z`vX65fu`DS384jZdY(9Mi4k|)IgXPj{#3lt9byA1i z8w^9#zMNwgna>M{*+@WyHsS^ISenz^_ip=xjcUVv1VkjM{WkHj&n?1s4c!wkTR~K%8J?OyyJe$_|z3Y!(+v6-$SDf{$)azN_3Xl6l%Fl9M4L&!)yMO zv${Fih^)r-?2S2MncfJq^!T}epWuzPNmI{yI{0?2L9fmJg^itkb2&#?ZTpShl zIZ!H43``+vLw`9y(w%Y=L>3aD#YCAxDW*l?bOZ28Md=e6PzCad+$-4GooqPJ_ai_z zNXGrFCBUSW-kp{%0Cocy)^-z2J{jml9kkALAy=g&jy0b#U3HX+!<_nonu@+G3*|et zh&ZN%8~Y#mi!KTWm*lAFD{f!KvNuv&1s^=8`UsLbdrXcCVNRnMg42H@dmS)dC4ZS3 z_O^Fg-RHtHDz?@yM4ft8C5F1UY($QAGSN`$w~5p@x~VA#G)<{FHq=$)OnJ$fxn1IU z@+pcnGU6EWIT~WL;_uH=o(<1|r(I<2yfhPT7EMGL!$%Q1;E^=jG~-)r^D_2Kl7ag{ z1&EQCFH8l>l)Y$Vn4iX6>oB&7wXvv5eM$KVzAS&4p{w=Mx6AH+^%pHA+@vc2b&O-t zO#w^o^hEv*pEtsjENelGZ6520N8HUo|I7YYree7|TLj{0%mFSzjNB<8UKHf;dRw^9ayMS57CFs26`mI$GjPd=%<(Z0;Do5-Ra#>;kxS17$E@UFHqj}^ZnKb||W z=eivXbJ6U^J-rIvY>+h{V}i1Nk{~~ep3Y?r)p1=porW6^Zah#cxIy;H5lvIVTU{dIo6II5>GXuHv77?@XO zoTEvsd8-(zt&x$NjChR5Ktv#dze&F{;Cqu0m{504ulUA~szJU2Zg$n7f(L{3HMeW7 ze@1==bHbqcheL@!-feSz$8Xah`H&WKf^(PW*ypO>-#PmhY_lhM=Tbp*Vsuko{YJS1*xtY zM|0X*fcc#HLhU_pa{6lDU3Sij~4^14{W5rHbXYMb)MbdAim8=dBXNETAfN zmUV{Ss(LrYO~tJ%4c2m$46@6!^IKpo7XI&BKY~8nM5#P&E6Rz?X@O_K^N6-rOX5oh zg!9bvO%xi|Yz= zp0Ta&e=#v%TV8x^%By7sC!b+eHNo1X+eFx5*x@p$Owm#&}p%S5jf(0y}~B-s99tlX#QLx`bWCn)6zr z(siW>r5L62&0fu=IPpFBF~zah!Nk_s`oh83p&mdMP)73|m=Dkd7*i?HO3<7;;|XYQ zBX4U8;u0UU=CvGVrBFRm^9ogaP!Q&F?(S z+WFO_0}Pq{-k^_petR}!)~%PbXRGJXPugDE+tZ=h>u1K*C=YGuN{ zy4?9oD$l)vKM=j&BERYJeN9-JGQ*kdPxS4Ctl$fF3J$%ey{NsvPW))xGEGOA-5dW{ zF>O^o*SDFwS=VH;+-wZDxNpPg6l)h-BT@7UuT$v^8!24OUkqfA&6vk8KCD~G{M_|r ztYym8e~3JW@*S1Z6_(3y{JVGcUCLEl-@(5U%i0M`xr>c04*u5u>ML3s@dQ{Xtf1>{ ztmlaQ@EEiRnk4f!CZY4?%>6F(@$?^R56_qW(3i|>*aOIN%WZt?+T&WwqEi@u5Q!`K zA#j|%^ZKKCqBnfzixt6YOI+Z%&e%YnCuNqt-QCRa4V#a&QeZI2Cj>opkGr0mlJ>jepdMu^^zp74FS{cgQCI(29!v_)qsm(riEPL%ai`r(@k^ zU@2W$XR@eS?qGDsb;0iY?2xz9+Ka--$GdOD%( zKoB_%30bJ65Xit2j=}nZNDTiA`+cxNBy=a8XkkfjsgpPyD5!p20xSUr%Su4OU@&QO z%)wv*(oOQ+M%$fQK>xqx??w7xkoG_@2m%3;s{Fn{GSbqL(ja@#Z%s-TOzOhv1#FG^zi8j@3zDfC2(4gRqm9gF>P9 xPzi{=EK&jimzB0hlD6Cqf`r>E0spt<&o9UWOX}sXjh2#wN&)%!H1srq{|9sGhpqqs literal 0 HcmV?d00001 diff --git a/Signal/src/Loki/View Controllers/HomeVC.swift b/Signal/src/Loki/View Controllers/HomeVC.swift index 3f1564d6f..c12cf8891 100644 --- a/Signal/src/Loki/View Controllers/HomeVC.swift +++ b/Signal/src/Loki/View Controllers/HomeVC.swift @@ -183,16 +183,13 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) isViewVisible = true - let hasSeenMultiDeviceRemovalSheet = UserDefaults.standard[.hasSeenMultiDeviceRemovalSheet] - if !hasSeenMultiDeviceRemovalSheet { - let _ = FileServerAPI.getDeviceLinks(associatedWith: getUserHexEncodedPublicKey()).done(on: DispatchQueue.main) { [weak self] deviceLinks in - guard !deviceLinks.isEmpty else { return } - let multiDeviceRemovalSheet = MultiDeviceRemovalSheet() - multiDeviceRemovalSheet.modalPresentationStyle = .overFullScreen - multiDeviceRemovalSheet.modalTransitionStyle = .crossDissolve - self?.present(multiDeviceRemovalSheet, animated: true, completion: nil) - } - UserDefaults.standard[.hasSeenMultiDeviceRemovalSheet] = true + let hasSeenLightModeSheet = UserDefaults.standard[.hasSeenLightModeSheet] + if !hasSeenLightModeSheet { + let lightModeSheet = LightModeSheet() + lightModeSheet.modalPresentationStyle = .overFullScreen + lightModeSheet.modalTransitionStyle = .crossDissolve + present(lightModeSheet, animated: true, completion: nil) + UserDefaults.standard[.hasSeenLightModeSheet] = true } UserDefaults.standard[.hasLaunchedOnce] = true } diff --git a/Signal/src/Loki/View Controllers/LightModeSheet.swift b/Signal/src/Loki/View Controllers/LightModeSheet.swift new file mode 100644 index 000000000..6f956bed5 --- /dev/null +++ b/Signal/src/Loki/View Controllers/LightModeSheet.swift @@ -0,0 +1,47 @@ + +final class LightModeSheet : Sheet { + + override func populateContentView() { + // Set up image view + let imageView = UIImageView(image: #imageLiteral(resourceName: "Sun")) + // Set up title label + let titleLabel = UILabel() + titleLabel.textColor = Colors.text + titleLabel.font = .boldSystemFont(ofSize: isIPhone5OrSmaller ? Values.largeFontSize : Values.veryLargeFontSize) + titleLabel.text = "Light Mode" + titleLabel.numberOfLines = 0 + titleLabel.lineBreakMode = .byWordWrapping + // Set up top stack view + let topStackView = UIStackView(arrangedSubviews: [ imageView, titleLabel ]) + topStackView.axis = .vertical + topStackView.spacing = Values.largeSpacing + topStackView.alignment = .center + // Set up explanation label + let explanationLabel = UILabel() + explanationLabel.textColor = Colors.text + explanationLabel.font = .systemFont(ofSize: Values.smallFontSize) + explanationLabel.text = """ + Who left the lights on? bla bla bla + + Feeling the dark side more? Just pop into the in-app settings and tap the app mode button in the top-right to toggle dark mode again. + """ + explanationLabel.numberOfLines = 0 + explanationLabel.lineBreakMode = .byWordWrapping + // Set up OK button + let okButton = Button(style: .prominentOutline, size: .large) + okButton.set(.width, to: 240) + okButton.setTitle(NSLocalizedString("OK", comment: ""), for: UIControl.State.normal) + okButton.addTarget(self, action: #selector(close), for: UIControl.Event.touchUpInside) + // Set up main stack view + let stackView = UIStackView(arrangedSubviews: [ topStackView, explanationLabel, okButton ]) + stackView.axis = .vertical + stackView.spacing = Values.veryLargeSpacing + stackView.alignment = .center + // Set up constraints + contentView.addSubview(stackView) + stackView.pin(.leading, to: .leading, of: contentView, withInset: Values.veryLargeSpacing) + stackView.pin(.top, to: .top, of: contentView, withInset: Values.largeSpacing) + contentView.pin(.trailing, to: .trailing, of: stackView, withInset: Values.veryLargeSpacing) + contentView.pin(.bottom, to: .bottom, of: stackView, withInset: Values.veryLargeSpacing + overshoot) + } +} diff --git a/Signal/src/Loki/View Controllers/PNModeVC.swift b/Signal/src/Loki/View Controllers/PNModeVC.swift index f09be912d..23c8b9f2f 100644 --- a/Signal/src/Loki/View Controllers/PNModeVC.swift +++ b/Signal/src/Loki/View Controllers/PNModeVC.swift @@ -90,6 +90,7 @@ final class PNModeVC : BaseVC, OptionViewDelegate { } UserDefaults.standard[.isUsingFullAPNs] = (selectedOptionView == apnsOptionView) UserDefaults.standard[.hasSeenMultiDeviceRemovalSheet] = true + UserDefaults.standard[.hasSeenLightModeSheet] = true TSAccountManager.sharedInstance().didRegister() let homeVC = HomeVC() navigationController!.setViewControllers([ homeVC ], animated: true) diff --git a/Signal/src/Loki/View Controllers/Sheet.swift b/Signal/src/Loki/View Controllers/Sheet.swift index 7f2ad7ccc..b34530dcd 100644 --- a/Signal/src/Loki/View Controllers/Sheet.swift +++ b/Signal/src/Loki/View Controllers/Sheet.swift @@ -11,18 +11,19 @@ class Sheet : BaseVC { result.backgroundColor = Colors.modalBackground result.layer.cornerRadius = 24 result.layer.masksToBounds = false - result.layer.borderColor = Colors.modalBorder.cgColor + result.layer.borderColor = isLightMode ? UIColor.white.cgColor : Colors.modalBorder.cgColor result.layer.borderWidth = Values.borderThickness result.layer.shadowColor = UIColor.black.cgColor - result.layer.shadowRadius = 8 - result.layer.shadowOpacity = 0.64 + result.layer.shadowRadius = isLightMode ? 2 : 8 + result.layer.shadowOpacity = isLightMode ? 0.1 : 0.64 return result }() // MARK: Lifecycle override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = UIColor(hex: 0x000000).withAlphaComponent(Values.modalBackgroundOpacity) + let alpha = isLightMode ? CGFloat(0.1) : Values.modalBackgroundOpacity + view.backgroundColor = UIColor(hex: 0x000000).withAlphaComponent(alpha) let swipeGestureRecognizer = UISwipeGestureRecognizer(target: self, action: #selector(close)) swipeGestureRecognizer.direction = .down view.addGestureRecognizer(swipeGestureRecognizer) diff --git a/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift b/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift index 9b8184df6..2fc7eaf0a 100644 --- a/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift +++ b/SignalServiceKit/src/Loki/Utilities/LKUserDefaults.swift @@ -5,6 +5,7 @@ public enum LKUserDefaults { public enum Bool : Swift.String { case hasLaunchedOnce case hasSeenGIFMetadataWarning + case hasSeenLightModeSheet case hasSeenMultiDeviceRemovalSheet case hasSeenOpenGroupSuggestionSheet case hasViewedSeed