Various fixes

This commit is contained in:
Ilya Laktyushin 2023-12-01 00:48:11 +04:00
parent 4f172c0519
commit a2f2411eaa
5 changed files with 20 additions and 7 deletions

View File

@ -10596,3 +10596,8 @@ Sorry for the inconvenience.";
"Chat.InputPlaceholderMessageInTopic" = "Message in %1$@";
"Chat.Reactions.MultiplePremiumTooltip" = "You can set multiple reactions with [Telegram Premium]().";
"Notification.Wallpaper.Remove" = "Remove";
"Char.RemoveWallpaper.Title" = "Remove Wallpaper";
"Char.RemoveWallpaper.Text" = "Are you sure you want to reset the wallpaper?";
"Char.RemoveWallpaper.Remove" = "Remove";

View File

@ -158,7 +158,7 @@ final class ThemeAccentColorController: ViewController {
if let strongSelf = self {
strongSelf.dismiss()
}
}, apply: { [weak self] state, serviceBackgroundColor in
}, apply: { [weak self] state, serviceBackgroundColor, forBoth in
if let strongSelf = self {
let context = strongSelf.context
let autoNightModeTriggered = strongSelf.presentationData.autoNightModeTriggered
@ -175,7 +175,7 @@ final class ThemeAccentColorController: ViewController {
}
if case let .peer(peer) = strongSelf.resultMode {
let _ = strongSelf.context.engine.themes.setChatWallpaper(peerId: peer.id, wallpaper: coloredWallpaper, forBoth: false).start()
let _ = strongSelf.context.engine.themes.setChatWallpaper(peerId: peer.id, wallpaper: coloredWallpaper, forBoth: forBoth).start()
strongSelf.completion?()
return
}

View File

@ -225,7 +225,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
}
}
init(context: AccountContext, mode: ThemeAccentColorControllerMode, resultMode: ThemeAccentColorController.ResultMode, theme: PresentationTheme, wallpaper: TelegramWallpaper, dismiss: @escaping () -> Void, apply: @escaping (ThemeColorState, UIColor?) -> Void, ready: Promise<Bool>) {
init(context: AccountContext, mode: ThemeAccentColorControllerMode, resultMode: ThemeAccentColorController.ResultMode, theme: PresentationTheme, wallpaper: TelegramWallpaper, dismiss: @escaping () -> Void, apply: @escaping (ThemeColorState, UIColor?, Bool) -> Void, ready: Promise<Bool>) {
self.context = context
self.mode = mode
self.resultMode = resultMode
@ -437,7 +437,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
}
}
self.toolbarNode.done = { [weak self] _ in
self.toolbarNode.done = { [weak self] forBoth in
if let strongSelf = self {
if strongSelf.state.displayPatternPanel {
strongSelf.updateState({ current in
@ -448,7 +448,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
} else {
if !strongSelf.dismissed {
strongSelf.dismissed = true
apply(strongSelf.state, strongSelf.serviceBackgroundColor)
apply(strongSelf.state, strongSelf.serviceBackgroundColor, forBoth)
}
}
}

View File

@ -27,6 +27,7 @@ swift_library(
"//submodules/Markdown",
"//submodules/RadialStatusNode",
"//submodules/ComponentFlow",
"//submodules/PresentationDataUtils",
"//submodules/TelegramUI/Components/AudioTranscriptionPendingIndicatorComponent",
"//submodules/TelegramUI/Components/Chat/ChatMessageBubbleContentNode",
"//submodules/TelegramUI/Components/Chat/ChatMessageItemCommon",

View File

@ -22,6 +22,7 @@ import ChatMessageBubbleContentNode
import ChatMessageItemCommon
import WallpaperPreviewMedia
import ChatControllerInteraction
import PresentationDataUtils
public class ChatMessageWallpaperBubbleContentNode: ChatMessageBubbleContentNode {
private var mediaBackgroundContent: WallpaperBubbleBackgroundNode?
@ -193,7 +194,13 @@ public class ChatMessageWallpaperBubbleContentNode: ChatMessageBubbleContentNode
}
if canRemove {
let _ = item.context.engine.themes.revertChatWallpaper(peerId: item.message.id.peerId).startStandalone()
let controller = textAlertController(context: item.context, title: item.presentationData.strings.Chat_RemoveWallpaper_Title, text: item.presentationData.strings.Chat_RemoveWallpaper_Text, actions: [
TextAlertAction(type: .genericAction, title: item.presentationData.strings.Common_Cancel, action: {}),
TextAlertAction(type: .destructiveAction, title: item.presentationData.strings.Chat_RemoveWallpaper_Remove, action: { [weak item] in
let _ = item?.context.engine.themes.revertChatWallpaper(peerId: item.message.id.peerId).startStandalone()
})
])
item.controllerInteraction.presentController(controller, nil)
} else {
let _ = item.controllerInteraction.openMessage(item.message, OpenMessageParams(mode: .default))
}
@ -291,7 +298,7 @@ public class ChatMessageWallpaperBubbleContentNode: ChatMessageBubbleContentNode
let buttonText: String
if let wallpaper, forBoth && item.presentationData.theme.wallpaper.isBasicallyEqual(to: wallpaper) {
buttonText = "Remove"
buttonText = item.presentationData.strings.Notification_Wallpaper_Remove
} else {
buttonText = item.presentationData.strings.Notification_Wallpaper_View
}