Add bottom sheet to display message deletion choice

This commit is contained in:
Benoit Martins 2026-03-16 16:57:08 +01:00
parent c01f79dd20
commit 1ffcd3e1ae
7 changed files with 160 additions and 5 deletions

View file

@ -2,6 +2,6 @@ import Foundation
public enum AppGitInfo {
public static let branch = "master"
public static let commit = "65e685101"
public static let commit = "c01f79dd2"
public static let tag = "6.1.0-alpha"
}

View file

@ -221,8 +221,8 @@
"conversation_editing_message_title" = "Message being edited";
"conversation_message_edited_label" = "Edited";
"conversation_dialog_delete_chat_message_title" = "Delete this message?";
"conversation_dialog_delete_locally_label" = "For me";
"conversation_dialog_delete_for_everyone_label" = "For everyone";
"conversation_dialog_delete_locally_label" = "Delete for me";
"conversation_dialog_delete_for_everyone_label" = "Delete for everyone";
"conversation_message_content_deleted_label" = "This message has been deleted";
"conversation_message_content_deleted_by_us_label" = "You have deleted this message";
"conversation_end_to_end_encrypted_bottom_sheet_link" = "https://linphone.org/en/features/#security";

View file

@ -221,8 +221,8 @@
"conversation_editing_message_title" = "Modification du message";
"conversation_message_edited_label" = "Modifié";
"conversation_dialog_delete_chat_message_title" = "Supprimer le message ?";
"conversation_dialog_delete_locally_label" = "Pour moi";
"conversation_dialog_delete_for_everyone_label" = "Pour tout le monde";
"conversation_dialog_delete_locally_label" = "Supprimer pour moi";
"conversation_dialog_delete_for_everyone_label" = "Supprimer pour tout le monde";
"conversation_message_content_deleted_label" = "Le message a été supprimé";
"conversation_message_content_deleted_by_us_label" = "Vous avez supprimé le message";
"conversation_end_to_end_encrypted_bottom_sheet_link" = "https://linphone.org/en/features/#security";

View file

@ -1694,6 +1694,7 @@ struct ContentView: View {
}
}
/*
if isShowDeleteMessagePopup {
PopupView(
isShowPopup: $isShowDeleteMessagePopup,
@ -1718,6 +1719,7 @@ struct ContentView: View {
self.isShowDeleteMessagePopup.toggle()
}
}
*/
if isShowConversationInfoPopup {
PopupViewWithTextField(

View file

@ -0,0 +1,133 @@
/*
* Copyright (c) 2010-2023 Belledonne Communications SARL.
*
* This file is part of linphone-iphone
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import SwiftUI
import linphonesw
struct ConversationDeleteMessageBottomSheet: View {
@Environment(\.dismiss) var dismiss
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }
@State private var orientation = UIDevice.current.orientation
@Binding var showingSheet: Bool
var body: some View {
VStack(alignment: .leading) {
if idiom != .pad && (orientation == .landscapeLeft
|| orientation == .landscapeRight
|| UIScreen.main.bounds.size.width > UIScreen.main.bounds.size.height) {
Spacer()
HStack {
Spacer()
Button("dialog_close") {
if #available(iOS 16.0, *) {
showingSheet.toggle()
} else {
showingSheet.toggle()
dismiss()
}
}
}
.padding(.trailing)
}
Spacer()
Button {
NotificationCenter.default.post(name: NSNotification.Name("DeleteMessageForEveryone"), object: nil)
if #available(iOS 16.0, *) {
if idiom != .pad {
showingSheet.toggle()
} else {
showingSheet.toggle()
dismiss()
}
} else {
showingSheet.toggle()
dismiss()
}
} label: {
HStack {
Image("trash-simple")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.redDanger500)
.frame(width: 25, height: 25, alignment: .leading)
Text("conversation_dialog_delete_for_everyone_label")
.foregroundStyle(Color.redDanger500)
.default_text_style(styleSize: 16)
Spacer()
}
.frame(maxHeight: .infinity)
}
.padding(.horizontal, 30)
.background(Color.gray100)
VStack {
Divider()
}
.frame(maxWidth: .infinity)
Button {
NotificationCenter.default.post(name: NSNotification.Name("DeleteMessageForMe"), object: nil)
if #available(iOS 16.0, *) {
if idiom != .pad {
showingSheet.toggle()
} else {
showingSheet.toggle()
dismiss()
}
} else {
showingSheet.toggle()
dismiss()
}
} label: {
HStack {
Image("trash-simple")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.redDanger500)
.frame(width: 25, height: 25, alignment: .leading)
Text("conversation_dialog_delete_locally_label")
.foregroundStyle(Color.redDanger500)
.default_text_style(styleSize: 16)
Spacer()
}
.frame(maxHeight: .infinity)
}
.padding(.horizontal, 30)
.background(Color.gray100)
}
.padding(.bottom)
.background(Color.gray100)
.frame(maxWidth: .infinity)
.onRotate { newOrientation in
orientation = newOrientation
}
}
}
#Preview {
ConversationsListBottomSheet(showingSheet: .constant(true))
}

View file

@ -133,6 +133,15 @@ struct ConversationFragment: View {
.presentationDetents([.medium])
.presentationDragIndicator(.visible)
})
.sheet(isPresented: $isShowDeleteMessagePopup, onDismiss: {
isShowDeleteMessagePopup = false
}, content: {
ConversationDeleteMessageBottomSheet(
showingSheet: $isShowDeleteMessagePopup
)
.presentationDetents([.fraction(0.15)])
.ignoresSafeArea(.all)
})
.sheet(isPresented: $isShowPhotoLibrary, onDismiss: {
isShowPhotoLibrary = false
}, content: {
@ -213,6 +222,13 @@ struct ConversationFragment: View {
} onDismiss: {
conversationViewModel.isShowSelectedMessageToDisplayDetails = false
}
.halfSheet(showSheet: $isShowDeleteMessagePopup) {
ConversationDeleteMessageBottomSheet(
showingSheet: $isShowDeleteMessagePopup
)
} onDismiss: {
isShowDeleteMessagePopup = false
}
.sheet(isPresented: $isShowPhotoLibrary, onDismiss: {
isShowPhotoLibrary = false
}, content: {

View file

@ -198,6 +198,7 @@
D7D24D162AC1B4E800C6F35B /* NotoSans-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D7D24D102AC1B4E800C6F35B /* NotoSans-SemiBold.ttf */; };
D7D24D172AC1B4E800C6F35B /* NotoSans-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D7D24D112AC1B4E800C6F35B /* NotoSans-Bold.ttf */; };
D7D24D182AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D7D24D122AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf */; };
D7D3007A2F684EAF00836032 /* ConversationDeleteMessageBottomSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7D300792F684EAE00836032 /* ConversationDeleteMessageBottomSheet.swift */; };
D7D5AD7F2DD34F0E00016721 /* AppAuth in Frameworks */ = {isa = PBXBuildFile; productRef = D7D5AD7E2DD34F0E00016721 /* AppAuth */; };
D7D5AD812DD34F1A00016721 /* FirebaseAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = D7D5AD802DD34F1A00016721 /* FirebaseAnalytics */; };
D7D5AD832DD34F2300016721 /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = D7D5AD822DD34F2300016721 /* FirebaseCrashlytics */; };
@ -471,6 +472,7 @@
D7D24D102AC1B4E800C6F35B /* NotoSans-SemiBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NotoSans-SemiBold.ttf"; sourceTree = "<group>"; };
D7D24D112AC1B4E800C6F35B /* NotoSans-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NotoSans-Bold.ttf"; sourceTree = "<group>"; };
D7D24D122AC1B4E800C6F35B /* NotoSans-ExtraBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "NotoSans-ExtraBold.ttf"; sourceTree = "<group>"; };
D7D300792F684EAE00836032 /* ConversationDeleteMessageBottomSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationDeleteMessageBottomSheet.swift; sourceTree = "<group>"; };
D7D67B682F601F6100DD9976 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = Base.lproj/AppIntentVocabulary.plist; sourceTree = "<group>"; };
D7D67B6C2F601F6C00DD9976 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = en; path = en.lproj/AppIntentVocabulary.plist; sourceTree = "<group>"; };
D7D67B6D2F601F6D00DD9976 /* eu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = eu; path = eu.lproj/AppIntentVocabulary.plist; sourceTree = "<group>"; };
@ -1137,6 +1139,7 @@
D7CEE0392B7A232200FD79B7 /* Fragments */ = {
isa = PBXGroup;
children = (
D7D300792F684EAE00836032 /* ConversationDeleteMessageBottomSheet.swift */,
D7AEB9732F324A6E00298546 /* ConversationDocumentsListFragment.swift */,
D7AEB9712F324A5C00298546 /* ConversationMediaListFragment.swift */,
D7EFD1E32CD11F53005E67CD /* EphemeralFragment.swift */,
@ -1624,6 +1627,7 @@
D74C9CF82ACACECE0021626A /* WelcomePage1Fragment.swift in Sources */,
66E56BCE2BA9A1F8006CE56F /* MeetingModel.swift in Sources */,
D7DC09712CFDBF9A00A6D47C /* AccountProfileViewModel.swift in Sources */,
D7D3007A2F684EAF00836032 /* ConversationDeleteMessageBottomSheet.swift in Sources */,
D7E6D0552AEBFCCE00A57AAF /* ContactsInnerFragment.swift in Sources */,
D72343362AD037AF009AA24E /* ToastView.swift in Sources */,
D711B1302E8FCEDE00DF8C71 /* CardDavViewModel.swift in Sources */,