Add deleted message bottom sheet when message is not retractable

This commit is contained in:
Benoit Martins 2026-03-18 15:30:13 +01:00
parent 068d2d2902
commit 83acef02d7
3 changed files with 10 additions and 5 deletions

View file

@ -2,6 +2,6 @@ import Foundation
public enum AppGitInfo { public enum AppGitInfo {
public static let branch = "master" public static let branch = "master"
public static let commit = "1943f0f21" public static let commit = "068d2d290"
public static let tag = "6.1.0-alpha" public static let tag = "6.1.0-alpha"
} }

View file

@ -28,6 +28,8 @@ struct ConversationDeleteMessageBottomSheet: View {
@State private var orientation = UIDevice.current.orientation @State private var orientation = UIDevice.current.orientation
@EnvironmentObject var conversationViewModel: ConversationViewModel
@Binding var showingSheet: Bool @Binding var showingSheet: Bool
var body: some View { var body: some View {
@ -52,6 +54,7 @@ struct ConversationDeleteMessageBottomSheet: View {
Spacer() Spacer()
Button { Button {
NotificationCenter.default.post(name: NSNotification.Name("DeleteMessageForEveryone"), object: nil) NotificationCenter.default.post(name: NSNotification.Name("DeleteMessageForEveryone"), object: nil)
@ -71,10 +74,10 @@ struct ConversationDeleteMessageBottomSheet: View {
Image("trash-simple") Image("trash-simple")
.renderingMode(.template) .renderingMode(.template)
.resizable() .resizable()
.foregroundStyle(Color.redDanger500) .foregroundStyle(conversationViewModel.selectedMessage?.message.isRetractable == true ? Color.redDanger500 : Color.gray200)
.frame(width: 25, height: 25, alignment: .leading) .frame(width: 25, height: 25, alignment: .leading)
Text("conversation_dialog_delete_for_everyone_label") Text("conversation_dialog_delete_for_everyone_label")
.foregroundStyle(Color.redDanger500) .foregroundStyle(conversationViewModel.selectedMessage?.message.isRetractable == true ? Color.redDanger500 : Color.gray200)
.default_text_style(styleSize: 16) .default_text_style(styleSize: 16)
Spacer() Spacer()
} }
@ -82,6 +85,7 @@ struct ConversationDeleteMessageBottomSheet: View {
} }
.padding(.horizontal, 30) .padding(.horizontal, 30)
.background(Color.gray100) .background(Color.gray100)
.disabled(conversationViewModel.selectedMessage?.message.isRetractable == false)
VStack { VStack {
Divider() Divider()

View file

@ -139,6 +139,7 @@ struct ConversationFragment: View {
ConversationDeleteMessageBottomSheet( ConversationDeleteMessageBottomSheet(
showingSheet: $isShowDeleteMessagePopup showingSheet: $isShowDeleteMessagePopup
) )
.environmentObject(conversationViewModel)
.presentationDetents([.fraction(0.15)]) .presentationDetents([.fraction(0.15)])
.ignoresSafeArea(.all) .ignoresSafeArea(.all)
}) })
@ -226,6 +227,7 @@ struct ConversationFragment: View {
ConversationDeleteMessageBottomSheet( ConversationDeleteMessageBottomSheet(
showingSheet: $isShowDeleteMessagePopup showingSheet: $isShowDeleteMessagePopup
) )
.environmentObject(conversationViewModel)
} onDismiss: { } onDismiss: {
isShowDeleteMessagePopup = false isShowDeleteMessagePopup = false
} }
@ -1505,8 +1507,7 @@ struct ConversationFragment: View {
Button { Button {
if conversationViewModel.selectedMessage!.message.isOutgoing if conversationViewModel.selectedMessage!.message.isOutgoing
&& !(SharedMainViewModel.shared.displayedConversation?.isReadOnly ?? cachedConversation!.isReadOnly) && !(SharedMainViewModel.shared.displayedConversation?.isReadOnly ?? cachedConversation!.isReadOnly) && !conversationViewModel.selectedMessage!.message.isRetracted {
&& conversationViewModel.selectedMessage!.message.isRetractable && !conversationViewModel.selectedMessage!.message.isRetracted {
isShowDeleteMessagePopup = true isShowDeleteMessagePopup = true
} else { } else {
conversationViewModel.deleteMessage() conversationViewModel.deleteMessage()