diff --git a/submodules/SettingsUI/Sources/Themes/ThemeAccentColorController.swift b/submodules/SettingsUI/Sources/Themes/ThemeAccentColorController.swift index 0c23275db4..ec8f79206c 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeAccentColorController.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeAccentColorController.swift @@ -65,16 +65,14 @@ final class ThemeAccentColorController: ViewController { if let strongSelf = self { let context = strongSelf.context 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 - var currentTheme = current.theme if autoNightModeTriggered { currentTheme = current.automaticThemeSwitchSetting.theme } - + var themeSpecificAccentColors = current.themeSpecificAccentColors + let color = PresentationThemeAccentColor(baseColor: .custom, value: Int32(bitPattern: strongSelf.controllerNode.color)) themeSpecificAccentColors[currentTheme.index] = color var themeSpecificChatWallpapers = current.themeSpecificChatWallpapers diff --git a/submodules/SettingsUI/Sources/Themes/ThemeSettingsController.swift b/submodules/SettingsUI/Sources/Themes/ThemeSettingsController.swift index b38119f87a..55c6993aa5 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeSettingsController.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeSettingsController.swift @@ -447,7 +447,7 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The if autoNightModeTriggered { currentTheme = current.automaticThemeSwitchSetting.theme } - + guard let theme = makePresentationTheme(mediaBox: context.sharedContext.accountManager.mediaBox, themeReference: currentTheme, accentColor: color.color, serviceBackgroundColor: defaultServiceBackgroundColor, baseColor: color.baseColor) else { return current } diff --git a/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift index 4c7361ef0c..add0eee1aa 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDarkPresentationTheme.swift @@ -248,7 +248,7 @@ private func makeDarkPresentationTheme(accentColor: UIColor, baseColor: Presenta let inputPanelMediaRecordingControl = PresentationThemeChatInputPanelMediaRecordingControl( buttonColor: accentColor, micLevelColor: accentColor.withAlphaComponent(0.2), - activeIconColor: .white + activeIconColor: secondaryBadgeTextColor ) let inputPanel = PresentationThemeChatInputPanel( diff --git a/submodules/TelegramUI/TelegramUI/ChatMessageSelectionInputPanelNode.swift b/submodules/TelegramUI/TelegramUI/ChatMessageSelectionInputPanelNode.swift index 7587b9dad7..986f52b784 100644 --- a/submodules/TelegramUI/TelegramUI/ChatMessageSelectionInputPanelNode.swift +++ b/submodules/TelegramUI/TelegramUI/ChatMessageSelectionInputPanelNode.swift @@ -22,6 +22,7 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode { private var actions: ChatAvailableMessageActions? private var theme: PresentationTheme + private let peerMedia: Bool 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.peerMedia = peerMedia self.deleteButton = HighlightableButtonNode() self.deleteButton.isEnabled = false @@ -150,24 +152,34 @@ final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode { self.forwardButton.isEnabled = actions.options.contains(.forward) 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.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 } else { self.deleteButton.isEnabled = false - self.deleteButton.isHidden = false + self.deleteButton.isHidden = self.peerMedia self.reportButton.isEnabled = false self.reportButton.isHidden = true self.forwardButton.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 { self.reportButton.isHidden = false + } else if self.peerMedia { + self.deleteButton.isHidden = false } } diff --git a/submodules/TelegramUI/TelegramUI/PeerMediaCollectionControllerNode.swift b/submodules/TelegramUI/TelegramUI/PeerMediaCollectionControllerNode.swift index 008d2ef563..7745cb3cc8 100644 --- a/submodules/TelegramUI/TelegramUI/PeerMediaCollectionControllerNode.swift +++ b/submodules/TelegramUI/TelegramUI/PeerMediaCollectionControllerNode.swift @@ -273,7 +273,7 @@ class PeerMediaCollectionControllerNode: ASDisplayNode { self.addSubnode(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.backgroundColor = self.presentationData.theme.chat.inputPanel.panelBackgroundColor selectionPanel.interfaceInteraction = self.interfaceInteraction diff --git a/submodules/TextFormat/Sources/StringWithAppliedEntities.swift b/submodules/TextFormat/Sources/StringWithAppliedEntities.swift index 476efa7ddf..615d605e19 100644 --- a/submodules/TextFormat/Sources/StringWithAppliedEntities.swift +++ b/submodules/TextFormat/Sources/StringWithAppliedEntities.swift @@ -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]) var skipEntity = false var underlineAllLinks = false - if linkColor.isEqual(baseColor) { + if linkColor.argb == baseColor.argb { underlineAllLinks = true } var fontAttributes: [NSRange: ChatTextFontAttributes] = [:] diff --git a/submodules/UndoUI/Sources/UndoOverlayController.swift b/submodules/UndoUI/Sources/UndoOverlayController.swift index 49e1b0e111..fdb12ffcaf 100644 --- a/submodules/UndoUI/Sources/UndoOverlayController.swift +++ b/submodules/UndoUI/Sources/UndoOverlayController.swift @@ -21,6 +21,7 @@ public final class UndoOverlayController: ViewController { private var action: (Bool) -> Void private var didPlayPresentationAnimation = false + private var dismissed = false public init(presentationData: PresentationData, content: UndoOverlayContent, elevatedLayout: Bool, animateInAsReplacement: Bool = false, action: @escaping (Bool) -> Void) { self.presentationData = presentationData @@ -75,6 +76,10 @@ public final class UndoOverlayController: ViewController { } 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?.presentingViewController?.dismiss(animated: false, completion: nil) completion?()