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 static let branch = "master"
public static let commit = "1943f0f21"
public static let commit = "068d2d290"
public static let tag = "6.1.0-alpha"
}

View file

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

View file

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