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