mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-04-17 20:08:31 +00:00
Add deleted message bottom sheet when message is not retractable
This commit is contained in:
parent
068d2d2902
commit
83acef02d7
3 changed files with 10 additions and 5 deletions
|
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
|
|
||||||
|
|
@ -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()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue