mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-25 20:50:47 +00:00
Merge branch 'beta'
This commit is contained in:
commit
e654d6095e
@ -65,16 +65,14 @@ final class ThemeAccentColorController: ViewController {
|
|||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let context = strongSelf.context
|
let context = strongSelf.context
|
||||||
let _ = (updatePresentationThemeSettingsInteractively(accountManager: context.sharedContext.accountManager, { current in
|
let _ = (updatePresentationThemeSettingsInteractively(accountManager: context.sharedContext.accountManager, { current in
|
||||||
let color = PresentationThemeAccentColor(baseColor: .custom, value: Int32(bitPattern: strongSelf.controllerNode.color))
|
|
||||||
|
|
||||||
let autoNightModeTriggered = context.sharedContext.currentPresentationData.with { $0 }.autoNightModeTriggered
|
let autoNightModeTriggered = context.sharedContext.currentPresentationData.with { $0 }.autoNightModeTriggered
|
||||||
|
|
||||||
var currentTheme = current.theme
|
var currentTheme = current.theme
|
||||||
if autoNightModeTriggered {
|
if autoNightModeTriggered {
|
||||||
currentTheme = current.automaticThemeSwitchSetting.theme
|
currentTheme = current.automaticThemeSwitchSetting.theme
|
||||||
}
|
}
|
||||||
|
|
||||||
var themeSpecificAccentColors = current.themeSpecificAccentColors
|
var themeSpecificAccentColors = current.themeSpecificAccentColors
|
||||||
|
let color = PresentationThemeAccentColor(baseColor: .custom, value: Int32(bitPattern: strongSelf.controllerNode.color))
|
||||||
themeSpecificAccentColors[currentTheme.index] = color
|
themeSpecificAccentColors[currentTheme.index] = color
|
||||||
|
|
||||||
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers
|
||||||
|
@ -447,7 +447,7 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
|||||||
if autoNightModeTriggered {
|
if autoNightModeTriggered {
|
||||||
currentTheme = current.automaticThemeSwitchSetting.theme
|
currentTheme = current.automaticThemeSwitchSetting.theme
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let theme = makePresentationTheme(mediaBox: context.sharedContext.accountManager.mediaBox, themeReference: currentTheme, accentColor: color.color, serviceBackgroundColor: defaultServiceBackgroundColor, baseColor: color.baseColor) else {
|
guard let theme = makePresentationTheme(mediaBox: context.sharedContext.accountManager.mediaBox, themeReference: currentTheme, accentColor: color.color, serviceBackgroundColor: defaultServiceBackgroundColor, baseColor: color.baseColor) else {
|
||||||
return current
|
return current
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ private func makeDarkPresentationTheme(accentColor: UIColor, baseColor: Presenta
|
|||||||
let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl(
|
let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl(
|
||||||
buttonColor: accentColor,
|
buttonColor: accentColor,
|
||||||
micLevelColor: accentColor.withAlphaComponent(0.2),
|
micLevelColor: accentColor.withAlphaComponent(0.2),
|
||||||
activeIconColor: .white
|
activeIconColor: secondaryBadgeTextColor
|
||||||
)
|
)
|
||||||
|
|
||||||
let inputPanel = PresentationThemeChatInputPanel(
|
let inputPanel = PresentationThemeChatInputPanel(
|
||||||
|
@ -22,6 +22,7 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
|
|||||||
private var actions: ChatAvailableMessageActions?
|
private var actions: ChatAvailableMessageActions?
|
||||||
|
|
||||||
private var theme: PresentationTheme
|
private var theme: PresentationTheme
|
||||||
|
private let peerMedia: Bool
|
||||||
|
|
||||||
private let canDeleteMessagesDisposable = MetaDisposable()
|
private let canDeleteMessagesDisposable = MetaDisposable()
|
||||||
|
|
||||||
@ -51,8 +52,9 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init(theme: PresentationTheme, strings: PresentationStrings) {
|
init(theme: PresentationTheme, strings: PresentationStrings, peerMedia: Bool = false) {
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
|
self.peerMedia = peerMedia
|
||||||
|
|
||||||
self.deleteButton = HighlightableButtonNode()
|
self.deleteButton = HighlightableButtonNode()
|
||||||
self.deleteButton.isEnabled = false
|
self.deleteButton.isEnabled = false
|
||||||
@ -150,24 +152,34 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
|
|||||||
self.forwardButton.isEnabled = actions.options.contains(.forward)
|
self.forwardButton.isEnabled = actions.options.contains(.forward)
|
||||||
self.shareButton.isEnabled = false
|
self.shareButton.isEnabled = false
|
||||||
|
|
||||||
self.deleteButton.isEnabled = true
|
if self.peerMedia {
|
||||||
|
self.deleteButton.isEnabled = !actions.options.intersection([.deleteLocally, .deleteGlobally]).isEmpty
|
||||||
|
} else {
|
||||||
|
self.deleteButton.isEnabled = true
|
||||||
|
}
|
||||||
self.shareButton.isEnabled = !actions.options.intersection([.forward]).isEmpty
|
self.shareButton.isEnabled = !actions.options.intersection([.forward]).isEmpty
|
||||||
self.reportButton.isEnabled = !actions.options.intersection([.report]).isEmpty
|
self.reportButton.isEnabled = !actions.options.intersection([.report]).isEmpty
|
||||||
|
|
||||||
self.deleteButton.isHidden = false
|
if self.peerMedia {
|
||||||
|
self.deleteButton.isHidden = !self.deleteButton.isEnabled
|
||||||
|
} else {
|
||||||
|
self.deleteButton.isHidden = false
|
||||||
|
}
|
||||||
self.reportButton.isHidden = !self.reportButton.isEnabled
|
self.reportButton.isHidden = !self.reportButton.isEnabled
|
||||||
} else {
|
} else {
|
||||||
self.deleteButton.isEnabled = false
|
self.deleteButton.isEnabled = false
|
||||||
self.deleteButton.isHidden = false
|
self.deleteButton.isHidden = self.peerMedia
|
||||||
self.reportButton.isEnabled = false
|
self.reportButton.isEnabled = false
|
||||||
self.reportButton.isHidden = true
|
self.reportButton.isHidden = true
|
||||||
self.forwardButton.isEnabled = false
|
self.forwardButton.isEnabled = false
|
||||||
self.shareButton.isEnabled = false
|
self.shareButton.isEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.reportButton.isHidden {
|
if self.reportButton.isHidden || (self.peerMedia && self.deleteButton.isHidden && self.reportButton.isHidden) {
|
||||||
if let peer = interfaceState.renderedPeer?.peer as? TelegramChannel, case .broadcast = peer.info {
|
if let peer = interfaceState.renderedPeer?.peer as? TelegramChannel, case .broadcast = peer.info {
|
||||||
self.reportButton.isHidden = false
|
self.reportButton.isHidden = false
|
||||||
|
} else if self.peerMedia {
|
||||||
|
self.deleteButton.isHidden = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ class PeerMediaCollectionControllerNode: ASDisplayNode {
|
|||||||
self.addSubnode(selectionPanelBackgroundNode)
|
self.addSubnode(selectionPanelBackgroundNode)
|
||||||
self.selectionPanelBackgroundNode = selectionPanelBackgroundNode
|
self.selectionPanelBackgroundNode = selectionPanelBackgroundNode
|
||||||
|
|
||||||
let selectionPanel = ChatMessageSelectionInputPanelNode(theme: self.chatPresentationInterfaceState.theme, strings: self.chatPresentationInterfaceState.strings)
|
let selectionPanel = ChatMessageSelectionInputPanelNode(theme: self.chatPresentationInterfaceState.theme, strings: self.chatPresentationInterfaceState.strings, peerMedia: true)
|
||||||
selectionPanel.context = self.context
|
selectionPanel.context = self.context
|
||||||
selectionPanel.backgroundColor = self.presentationData.theme.chat.inputPanel.panelBackgroundColor
|
selectionPanel.backgroundColor = self.presentationData.theme.chat.inputPanel.panelBackgroundColor
|
||||||
selectionPanel.interfaceInteraction = self.interfaceInteraction
|
selectionPanel.interfaceInteraction = self.interfaceInteraction
|
||||||
|
@ -51,7 +51,7 @@ public func stringWithAppliedEntities(_ text: String, entities: [MessageTextEnti
|
|||||||
let string = NSMutableAttributedString(string: text, attributes: [NSAttributedString.Key.font: baseFont, NSAttributedString.Key.foregroundColor: baseColor])
|
let string = NSMutableAttributedString(string: text, attributes: [NSAttributedString.Key.font: baseFont, NSAttributedString.Key.foregroundColor: baseColor])
|
||||||
var skipEntity = false
|
var skipEntity = false
|
||||||
var underlineAllLinks = false
|
var underlineAllLinks = false
|
||||||
if linkColor.isEqual(baseColor) {
|
if linkColor.argb == baseColor.argb {
|
||||||
underlineAllLinks = true
|
underlineAllLinks = true
|
||||||
}
|
}
|
||||||
var fontAttributes: [NSRange: ChatTextFontAttributes] = [:]
|
var fontAttributes: [NSRange: ChatTextFontAttributes] = [:]
|
||||||
|
@ -21,6 +21,7 @@ public final class UndoOverlayController: ViewController {
|
|||||||
private var action: (Bool) -> Void
|
private var action: (Bool) -> Void
|
||||||
|
|
||||||
private var didPlayPresentationAnimation = false
|
private var didPlayPresentationAnimation = false
|
||||||
|
private var dismissed = false
|
||||||
|
|
||||||
public init(presentationData: PresentationData, content: UndoOverlayContent, elevatedLayout: Bool, animateInAsReplacement: Bool = false, action: @escaping (Bool) -> Void) {
|
public init(presentationData: PresentationData, content: UndoOverlayContent, elevatedLayout: Bool, animateInAsReplacement: Bool = false, action: @escaping (Bool) -> Void) {
|
||||||
self.presentationData = presentationData
|
self.presentationData = presentationData
|
||||||
@ -75,6 +76,10 @@ public final class UndoOverlayController: ViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override public func dismiss(completion: (() -> Void)? = nil) {
|
override public func dismiss(completion: (() -> Void)? = nil) {
|
||||||
|
guard !self.dismissed else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.dismissed = true
|
||||||
(self.displayNode as! UndoOverlayControllerNode).animateOut(completion: { [weak self] in
|
(self.displayNode as! UndoOverlayControllerNode).animateOut(completion: { [weak self] in
|
||||||
self?.presentingViewController?.dismiss(animated: false, completion: nil)
|
self?.presentingViewController?.dismiss(animated: false, completion: nil)
|
||||||
completion?()
|
completion?()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user