Fix updating

This commit is contained in:
nielsandriesse 2020-08-26 16:20:46 +10:00
parent 99893d8545
commit 2db3a31ade
3 changed files with 34 additions and 31 deletions

View file

@ -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 {

View file

@ -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

View file

@ -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")! }
}