mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Debug
This commit is contained in:
parent
d54bded164
commit
be5338f073
|
@ -962,12 +962,14 @@ static NSTimeInterval launchStartedAt;
|
||||||
if (@available(iOS 13.0, *)) {
|
if (@available(iOS 13.0, *)) {
|
||||||
window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
|
window.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
|
||||||
}
|
}
|
||||||
|
window.backgroundColor = UIColor.whiteColor;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LKAppModeDark: {
|
case LKAppModeDark: {
|
||||||
if (@available(iOS 13.0, *)) {
|
if (@available(iOS 13.0, *)) {
|
||||||
window.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
|
window.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
|
||||||
}
|
}
|
||||||
|
window.backgroundColor = UIColor.blackColor;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class ConversationMediaView: UIView {
|
||||||
private let maxMessageWidth: CGFloat
|
private let maxMessageWidth: CGFloat
|
||||||
private var loadBlock: (() -> Void)?
|
private var loadBlock: (() -> Void)?
|
||||||
private var unloadBlock: (() -> Void)?
|
private var unloadBlock: (() -> Void)?
|
||||||
private let isProxied: Bool
|
private let isOnionRouted: Bool
|
||||||
|
|
||||||
// MARK: - LoadState
|
// MARK: - LoadState
|
||||||
|
|
||||||
|
@ -92,12 +92,12 @@ public class ConversationMediaView: UIView {
|
||||||
attachment: TSAttachment,
|
attachment: TSAttachment,
|
||||||
isOutgoing: Bool,
|
isOutgoing: Bool,
|
||||||
maxMessageWidth: CGFloat,
|
maxMessageWidth: CGFloat,
|
||||||
isProxied: Bool) {
|
isOnionRouted: Bool) {
|
||||||
self.mediaCache = mediaCache
|
self.mediaCache = mediaCache
|
||||||
self.attachment = attachment
|
self.attachment = attachment
|
||||||
self.isOutgoing = isOutgoing
|
self.isOutgoing = isOutgoing
|
||||||
self.maxMessageWidth = maxMessageWidth
|
self.maxMessageWidth = maxMessageWidth
|
||||||
self.isProxied = isProxied
|
self.isOnionRouted = isOnionRouted
|
||||||
|
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ public class ConversationMediaView: UIView {
|
||||||
}
|
}
|
||||||
guard !attachmentStream.isUploaded else { return false }
|
guard !attachmentStream.isUploaded else { return false }
|
||||||
let view: UIView
|
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)
|
let activityIndicatorView = UIActivityIndicatorView(style: .white)
|
||||||
activityIndicatorView.isHidden = false
|
activityIndicatorView.isHidden = false
|
||||||
activityIndicatorView.startAnimating()
|
activityIndicatorView.startAnimating()
|
||||||
|
|
|
@ -27,14 +27,14 @@ public class MediaAlbumCellView: UIStackView {
|
||||||
items: [ConversationMediaAlbumItem],
|
items: [ConversationMediaAlbumItem],
|
||||||
isOutgoing: Bool,
|
isOutgoing: Bool,
|
||||||
maxMessageWidth: CGFloat,
|
maxMessageWidth: CGFloat,
|
||||||
isProxied: Bool) {
|
isOnionRouted: Bool) {
|
||||||
self.items = items
|
self.items = items
|
||||||
self.itemViews = MediaAlbumCellView.itemsToDisplay(forItems: items).map {
|
self.itemViews = MediaAlbumCellView.itemsToDisplay(forItems: items).map {
|
||||||
let result = ConversationMediaView(mediaCache: mediaCache,
|
let result = ConversationMediaView(mediaCache: mediaCache,
|
||||||
attachment: $0.attachment,
|
attachment: $0.attachment,
|
||||||
isOutgoing: isOutgoing,
|
isOutgoing: isOutgoing,
|
||||||
maxMessageWidth: maxMessageWidth,
|
maxMessageWidth: maxMessageWidth,
|
||||||
isProxied: isProxied)
|
isOnionRouted: isOnionRouted)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -366,10 +366,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
CGFloat maxGradientHeight = 40.f;
|
CGFloat maxGradientHeight = 40.f;
|
||||||
CAGradientLayer *gradientLayer = [CAGradientLayer new];
|
CAGradientLayer *gradientLayer = [CAGradientLayer new];
|
||||||
CGFloat whiteLevel = LKAppModeUtilities.isLightMode ? 1.f : 0.f;
|
|
||||||
gradientLayer.colors = @[
|
gradientLayer.colors = @[
|
||||||
(id)[UIColor colorWithWhite:whiteLevel alpha:0.f].CGColor,
|
(id)[UIColor colorWithWhite:0.0f alpha:0.f].CGColor,
|
||||||
(id)[UIColor colorWithWhite:whiteLevel alpha:0.4f].CGColor,
|
(id)[UIColor colorWithWhite:0.0f alpha:0.4f].CGColor,
|
||||||
];
|
];
|
||||||
OWSLayerView *gradientView =
|
OWSLayerView *gradientView =
|
||||||
[[OWSLayerView alloc] initWithFrame:CGRectZero
|
[[OWSLayerView alloc] initWithFrame:CGRectZero
|
||||||
|
@ -806,24 +805,13 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
- (UIView *)loadViewForMediaAlbum
|
- (UIView *)loadViewForMediaAlbum
|
||||||
{
|
{
|
||||||
OWSAssertDebug(self.viewItem.mediaAlbumItems);
|
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 *albumView =
|
||||||
[[OWSMediaAlbumCellView alloc] initWithMediaCache:self.cellMediaCache
|
[[OWSMediaAlbumCellView alloc] initWithMediaCache:self.cellMediaCache
|
||||||
items:self.viewItem.mediaAlbumItems
|
items:self.viewItem.mediaAlbumItems
|
||||||
isOutgoing:self.isOutgoing
|
isOutgoing:self.isOutgoing
|
||||||
maxMessageWidth:self.conversationStyle.maxMessageWidth
|
maxMessageWidth:self.conversationStyle.maxMessageWidth
|
||||||
isProxied:isProxied];
|
isOnionRouted:YES];
|
||||||
self.loadCellContentBlock = ^{
|
self.loadCellContentBlock = ^{
|
||||||
[albumView loadMedia];
|
[albumView loadMedia];
|
||||||
};
|
};
|
||||||
|
|
|
@ -96,7 +96,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
UIColor *textColor;
|
UIColor *textColor;
|
||||||
if (isOverlayingMedia) {
|
if (isOverlayingMedia) {
|
||||||
textColor = LKColors.text;
|
textColor = UIColor.whiteColor;
|
||||||
} else {
|
} else {
|
||||||
textColor = [conversationStyle bubbleSecondaryTextColorWithIsIncoming:isIncoming];
|
textColor = [conversationStyle bubbleSecondaryTextColorWithIsIncoming:isIncoming];
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@ class MediaGalleryNavigationController: OWSNavigationController {
|
||||||
// MARK: View Lifecycle
|
// MARK: View Lifecycle
|
||||||
|
|
||||||
override var preferredStatusBarStyle: UIStatusBarStyle {
|
override var preferredStatusBarStyle: UIStatusBarStyle {
|
||||||
return .lightContent
|
return isLightMode ? .default : .lightContent
|
||||||
}
|
}
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
|
@ -291,7 +291,12 @@ class MediaGalleryNavigationController: OWSNavigationController {
|
||||||
return
|
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) {
|
override func viewDidAppear(_ animated: Bool) {
|
||||||
|
|
|
@ -144,7 +144,7 @@ class MenuActionsViewController: UIViewController, MenuActionSheetDelegate {
|
||||||
|
|
||||||
let backgroundDuration: TimeInterval = 0.1
|
let backgroundDuration: TimeInterval = 0.1
|
||||||
UIView.animate(withDuration: backgroundDuration) {
|
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)
|
self.view.backgroundColor = UIColor.black.withAlphaComponent(alpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ class MenuActionSheetView: UIView, MenuActionViewDelegate {
|
||||||
|
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
|
|
||||||
backgroundColor = (Theme.isDarkThemeEnabled
|
backgroundColor = (isDarkMode
|
||||||
? UIColor.ows_gray90
|
? UIColor.ows_gray90
|
||||||
: UIColor.ows_gray05)
|
: UIColor.ows_gray05)
|
||||||
addSubview(actionStackView)
|
addSubview(actionStackView)
|
||||||
|
@ -398,27 +398,25 @@ class MenuActionView: UIButton {
|
||||||
isUserInteractionEnabled = true
|
isUserInteractionEnabled = true
|
||||||
backgroundColor = defaultBackgroundColor
|
backgroundColor = defaultBackgroundColor
|
||||||
|
|
||||||
|
let textColor = isLightMode ? UIColor.black : UIColor.white
|
||||||
|
|
||||||
var image = action.image
|
var image = action.image
|
||||||
if Theme.isDarkThemeEnabled {
|
image = image.withRenderingMode(.alwaysTemplate)
|
||||||
image = image.withRenderingMode(.alwaysTemplate)
|
|
||||||
}
|
|
||||||
let imageView = UIImageView(image: image)
|
let imageView = UIImageView(image: image)
|
||||||
if Theme.isDarkThemeEnabled {
|
imageView.tintColor = textColor.withAlphaComponent(Values.unimportantElementOpacity)
|
||||||
imageView.tintColor = Colors.text.withAlphaComponent(Values.unimportantElementOpacity)
|
|
||||||
}
|
|
||||||
let imageWidth: CGFloat = 24
|
let imageWidth: CGFloat = 24
|
||||||
imageView.autoSetDimensions(to: CGSize(width: imageWidth, height: imageWidth))
|
imageView.autoSetDimensions(to: CGSize(width: imageWidth, height: imageWidth))
|
||||||
imageView.isUserInteractionEnabled = false
|
imageView.isUserInteractionEnabled = false
|
||||||
|
|
||||||
let titleLabel = UILabel()
|
let titleLabel = UILabel()
|
||||||
titleLabel.font = .systemFont(ofSize: Values.mediumFontSize)
|
titleLabel.font = .systemFont(ofSize: Values.mediumFontSize)
|
||||||
titleLabel.textColor = Colors.text
|
titleLabel.textColor = textColor
|
||||||
titleLabel.text = action.title
|
titleLabel.text = action.title
|
||||||
titleLabel.isUserInteractionEnabled = false
|
titleLabel.isUserInteractionEnabled = false
|
||||||
|
|
||||||
let subtitleLabel = UILabel()
|
let subtitleLabel = UILabel()
|
||||||
subtitleLabel.font = .systemFont(ofSize: Values.smallFontSize)
|
subtitleLabel.font = .systemFont(ofSize: Values.smallFontSize)
|
||||||
subtitleLabel.textColor = Colors.text.withAlphaComponent(Values.unimportantElementOpacity)
|
subtitleLabel.textColor = textColor.withAlphaComponent(Values.unimportantElementOpacity)
|
||||||
subtitleLabel.text = action.subtitle
|
subtitleLabel.text = action.subtitle
|
||||||
subtitleLabel.isUserInteractionEnabled = false
|
subtitleLabel.isUserInteractionEnabled = false
|
||||||
|
|
||||||
|
@ -443,11 +441,11 @@ class MenuActionView: UIButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
private var defaultBackgroundColor: UIColor {
|
private var defaultBackgroundColor: UIColor {
|
||||||
return Colors.cellBackground
|
return isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x1B1B1B)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var highlightedBackgroundColor: UIColor {
|
private var highlightedBackgroundColor: UIColor {
|
||||||
return Colors.cellSelected
|
return isLightMode ? UIColor(hex: 0xDFDFDF) : UIColor(hex: 0x0C0C0C)
|
||||||
}
|
}
|
||||||
|
|
||||||
override var isHighlighted: Bool {
|
override var isHighlighted: Bool {
|
||||||
|
|
|
@ -12,31 +12,31 @@
|
||||||
@objc(LKColors)
|
@objc(LKColors)
|
||||||
public final class Colors : NSObject {
|
public final class Colors : NSObject {
|
||||||
|
|
||||||
@objc public static var accent = UIColor(named: "session_accent")!
|
@objc public static let accent = UIColor(named: "session_accent")!
|
||||||
@objc public static var text = UIColor(named: "session_text")!
|
@objc public static let text = UIColor(named: "session_text")!
|
||||||
@objc public static var destructive = UIColor(named: "session_destructive")!
|
@objc public static let destructive = UIColor(named: "session_destructive")!
|
||||||
@objc public static var unimportant = UIColor(named: "session_unimportant")!
|
@objc public static let unimportant = UIColor(named: "session_unimportant")!
|
||||||
@objc public static var border = UIColor(named: "session_border")!
|
@objc public static let border = UIColor(named: "session_border")!
|
||||||
@objc public static var cellBackground = UIColor(named: "session_cell_background")!
|
@objc public static let cellBackground = UIColor(named: "session_cell_background")!
|
||||||
@objc public static var cellSelected = UIColor(named: "session_cell_selected")!
|
@objc public static let cellSelected = UIColor(named: "session_cell_selected")!
|
||||||
@objc public static var navigationBarBackground = UIColor(named: "session_navigation_bar_background")!
|
@objc public static let 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 let 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 let searchBarBackground = UIColor(named: "session_search_bar_background")!
|
||||||
@objc public static var newConversationButtonShadow = UIColor(named: "session_new_conversation_button_shadow")!
|
@objc public static let newConversationButtonShadow = UIColor(named: "session_new_conversation_button_shadow")!
|
||||||
@objc public static var separator = UIColor(named: "session_separator")!
|
@objc public static let separator = UIColor(named: "session_separator")!
|
||||||
@objc public static var unimportantButtonBackground = UIColor(named: "session_unimportant_button_background")!
|
@objc public static let unimportantButtonBackground = UIColor(named: "session_unimportant_button_background")!
|
||||||
@objc public static var buttonBackground = UIColor(named: "session_button_background")!
|
@objc public static let buttonBackground = UIColor(named: "session_button_background")!
|
||||||
@objc public static var settingButtonSelected = UIColor(named: "session_setting_button_selected")!
|
@objc public static let settingButtonSelected = UIColor(named: "session_setting_button_selected")!
|
||||||
@objc public static var modalBackground = UIColor(named: "session_modal_background")!
|
@objc public static let modalBackground = UIColor(named: "session_modal_background")!
|
||||||
@objc public static var modalBorder = UIColor(named: "session_modal_border")!
|
@objc public static let modalBorder = UIColor(named: "session_modal_border")!
|
||||||
@objc public static var fakeChatBubbleBackground = UIColor(named: "session_fake_chat_bubble_background")!
|
@objc public static let fakeChatBubbleBackground = UIColor(named: "session_fake_chat_bubble_background")!
|
||||||
@objc public static var fakeChatBubbleText = UIColor(named: "session_fake_chat_bubble_text")!
|
@objc public static let fakeChatBubbleText = UIColor(named: "session_fake_chat_bubble_text")!
|
||||||
@objc public static var composeViewBackground = UIColor(named: "session_compose_view_background")!
|
@objc public static let composeViewBackground = UIColor(named: "session_compose_view_background")!
|
||||||
@objc public static var composeViewTextFieldBackground = UIColor(named: "session_compose_view_text_field_background")!
|
@objc public static let composeViewTextFieldBackground = UIColor(named: "session_compose_view_text_field_background")!
|
||||||
@objc public static var receivedMessageBackground = UIColor(named: "session_received_message_background")!
|
@objc public static let receivedMessageBackground = UIColor(named: "session_received_message_background")!
|
||||||
@objc public static var sentMessageBackground = UIColor(named: "session_sent_message_background")!
|
@objc public static let sentMessageBackground = UIColor(named: "session_sent_message_background")!
|
||||||
@objc public static var newConversationButtonCollapsedBackground = UIColor(named: "session_new_conversation_button_collapsed_background")!
|
@objc public static let newConversationButtonCollapsedBackground = UIColor(named: "session_new_conversation_button_collapsed_background")!
|
||||||
@objc public static var pnOptionBackground = UIColor(named: "session_pn_option_background")!
|
@objc public static let pnOptionBackground = UIColor(named: "session_pn_option_background")!
|
||||||
@objc public static var pnOptionBorder = UIColor(named: "session_pn_option_border")!
|
@objc public static let pnOptionBorder = UIColor(named: "session_pn_option_border")!
|
||||||
@objc public static var pathsBuilding = UIColor(named: "session_paths_building")!
|
@objc public static let pathsBuilding = UIColor(named: "session_paths_building")!
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ class AttachmentApprovalInputAccessoryView: UIView {
|
||||||
|
|
||||||
// Use a background view that extends below the keyboard to avoid animation glitches.
|
// Use a background view that extends below the keyboard to avoid animation glitches.
|
||||||
let backgroundView = UIView()
|
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)
|
addSubview(backgroundView)
|
||||||
backgroundView.autoPinEdgesToSuperviewEdges()
|
backgroundView.autoPinEdgesToSuperviewEdges()
|
||||||
|
|
||||||
|
|
|
@ -438,6 +438,7 @@ extension AttachmentPrepViewController: ImageEditorViewDelegate {
|
||||||
? .overFullScreen
|
? .overFullScreen
|
||||||
: .fullScreen)
|
: .fullScreen)
|
||||||
navigationController.ows_prefersStatusBarHidden = true
|
navigationController.ows_prefersStatusBarHidden = true
|
||||||
|
navigationController.view.backgroundColor = Colors.navigationBarBackground
|
||||||
|
|
||||||
if let navigationBar = navigationController.navigationBar as? OWSNavigationBar {
|
if let navigationBar = navigationController.navigationBar as? OWSNavigationBar {
|
||||||
navigationBar.overrideTheme(type: .clear)
|
navigationBar.overrideTheme(type: .clear)
|
||||||
|
|
|
@ -41,7 +41,9 @@ NSString *NSStringForScreenLockUIState(ScreenLockUIState value)
|
||||||
self.view.backgroundColor = UIColor.clearColor;
|
self.view.backgroundColor = UIColor.clearColor;
|
||||||
CAGradientLayer *layer = [CAGradientLayer new];
|
CAGradientLayer *layer = [CAGradientLayer new];
|
||||||
layer.frame = UIScreen.mainScreen.bounds;
|
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];
|
[self.view.layer insertSublayer:layer atIndex:0];
|
||||||
|
|
||||||
UIView *edgesView = [UIView containerView];
|
UIView *edgesView = [UIView containerView];
|
||||||
|
@ -64,7 +66,7 @@ NSString *NSStringForScreenLockUIState(ScreenLockUIState value)
|
||||||
OWSFlatButton *button =
|
OWSFlatButton *button =
|
||||||
[OWSFlatButton buttonWithTitle:NSLocalizedString(@"Unlock Session", @"")
|
[OWSFlatButton buttonWithTitle:NSLocalizedString(@"Unlock Session", @"")
|
||||||
font:[UIFont boldSystemFontOfSize:LKValues.mediumFontSize]
|
font:[UIFont boldSystemFontOfSize:LKValues.mediumFontSize]
|
||||||
titleColor:UIColor.whiteColor
|
titleColor:LKAppModeUtilities.isLightMode ? UIColor.blackColor : UIColor.whiteColor
|
||||||
backgroundColor:UIColor.clearColor
|
backgroundColor:UIColor.clearColor
|
||||||
target:self
|
target:self
|
||||||
selector:@selector(showUnlockUI)];
|
selector:@selector(showUnlockUI)];
|
||||||
|
|
|
@ -81,7 +81,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
self.tableViewController.view.backgroundColor = UIColor.clearColor;
|
self.tableViewController.view.backgroundColor = UIColor.clearColor;
|
||||||
CAGradientLayer *layer = [CAGradientLayer new];
|
CAGradientLayer *layer = [CAGradientLayer new];
|
||||||
layer.frame = UIScreen.mainScreen.bounds;
|
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];
|
[self.tableViewController.view.layer insertSublayer:layer atIndex:0];
|
||||||
|
|
||||||
// Loki: Set navigation bar background color
|
// Loki: Set navigation bar background color
|
||||||
|
|
|
@ -10,7 +10,7 @@ public extension NSObject {
|
||||||
selector: Selector) -> UIView {
|
selector: Selector) -> UIView {
|
||||||
let button = OWSButton()
|
let button = OWSButton()
|
||||||
button.setImage(imageName: imageName)
|
button.setImage(imageName: imageName)
|
||||||
button.tintColor = Colors.text
|
button.tintColor = isLightMode ? UIColor.black : UIColor.white
|
||||||
button.addTarget(self, action: selector, for: .touchUpInside)
|
button.addTarget(self, action: selector, for: .touchUpInside)
|
||||||
return button
|
return button
|
||||||
}
|
}
|
||||||
|
@ -51,9 +51,10 @@ public extension UIViewController {
|
||||||
navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
|
navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
|
||||||
navigationBar.shadowImage = UIImage()
|
navigationBar.shadowImage = UIImage()
|
||||||
navigationBar.isTranslucent = false
|
navigationBar.isTranslucent = false
|
||||||
navigationBar.barTintColor = Colors.navigationBarBackground
|
let color = isLightMode ? UIColor(hex: 0xFCFCFC) : UIColor(hex: 0x161616)
|
||||||
navigationBar.backgroundColor = Colors.navigationBarBackground
|
navigationBar.barTintColor = color
|
||||||
let backgroundImage = UIImage(color: Colors.navigationBarBackground)
|
navigationBar.backgroundColor = color
|
||||||
|
let backgroundImage = UIImage(color: color)
|
||||||
navigationBar.setBackgroundImage(backgroundImage, for: .default)
|
navigationBar.setBackgroundImage(backgroundImage, for: .default)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,8 +140,7 @@ public class OWSFlatButton: UIView {
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
public func setBackgroundColors(upColor: UIColor ) {
|
public func setBackgroundColors(upColor: UIColor ) {
|
||||||
setBackgroundColors(upColor: upColor,
|
setBackgroundColors(upColor: upColor, downColor: upColor )
|
||||||
downColor: upColor.withAlphaComponent(0.7) )
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
|
|
|
@ -46,10 +46,6 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
|
||||||
{
|
{
|
||||||
OWSAssertIsOnMainThread();
|
OWSAssertIsOnMainThread();
|
||||||
|
|
||||||
if (!CurrentAppContext().isMainApp) {
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
return LKAppModeUtilities.isDarkMode;
|
return LKAppModeUtilities.isDarkMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,18 +56,7 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
|
||||||
|
|
||||||
- (void)setIsDarkThemeEnabled:(BOOL)value
|
- (void)setIsDarkThemeEnabled:(BOOL)value
|
||||||
{
|
{
|
||||||
OWSAssertIsOnMainThread();
|
return;
|
||||||
|
|
||||||
self.isDarkThemeEnabledNumber = @(value);
|
|
||||||
[OWSPrimaryStorage.sharedManager.dbReadWriteConnection setBool:value
|
|
||||||
forKey:ThemeKeyThemeEnabled
|
|
||||||
inCollection:ThemeCollection];
|
|
||||||
|
|
||||||
[UIUtil setupSignalAppearence];
|
|
||||||
|
|
||||||
[UIView performWithoutAnimation:^{
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:ThemeDidChangeNotification object:nil userInfo:nil];
|
|
||||||
}];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (UIColor *)backgroundColor
|
+ (UIColor *)backgroundColor
|
||||||
|
@ -197,7 +182,6 @@ NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled";
|
||||||
return UIKeyboardAppearanceDark;
|
return UIKeyboardAppearanceDark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Search Bar
|
#pragma mark - Search Bar
|
||||||
|
|
||||||
+ (UIBarStyle)barStyle
|
+ (UIBarStyle)barStyle
|
||||||
|
|
|
@ -47,7 +47,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
self.view.backgroundColor = UIColor.clearColor;
|
self.view.backgroundColor = UIColor.clearColor;
|
||||||
CAGradientLayer *layer = [CAGradientLayer new];
|
CAGradientLayer *layer = [CAGradientLayer new];
|
||||||
layer.frame = UIScreen.mainScreen.bounds;
|
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];
|
[self.view.layer insertSublayer:layer atIndex:0];
|
||||||
|
|
||||||
// Loki: Set navigation bar background color
|
// Loki: Set navigation bar background color
|
||||||
|
|
|
@ -10,7 +10,7 @@ import SessionServiceKit
|
||||||
import PromiseKit
|
import PromiseKit
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailedViewDelegate {
|
public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailedViewDelegate, AppModeManagerDelegate {
|
||||||
|
|
||||||
// MARK: - Dependencies
|
// MARK: - Dependencies
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed
|
||||||
let appContext = ShareAppExtensionContext(rootViewController: self)
|
let appContext = ShareAppExtensionContext(rootViewController: self)
|
||||||
SetCurrentAppContext(appContext)
|
SetCurrentAppContext(appContext)
|
||||||
|
|
||||||
|
AppModeManager.configure(delegate: self)
|
||||||
|
|
||||||
DebugLogger.shared().enableTTYLogging()
|
DebugLogger.shared().enableTTYLogging()
|
||||||
if _isDebugAssertConfiguration() {
|
if _isDebugAssertConfiguration() {
|
||||||
DebugLogger.shared().enableFileLogging()
|
DebugLogger.shared().enableFileLogging()
|
||||||
|
@ -1033,6 +1035,19 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed
|
||||||
// apply any conversion, so no need to relocate the app.
|
// apply any conversion, so no need to relocate the app.
|
||||||
return !itemProvider.registeredTypeIdentifiers.contains(kUTTypeMPEG4 as String)
|
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
|
// Exposes a Progress object, whose progress is updated by polling the return of a given block
|
||||||
|
|
Loading…
Reference in a new issue