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

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