forked from mirrors/linphone-iphone
Add a bottom sheet to display delivery status
This commit is contained in:
parent
c2f9f34ba8
commit
5ed0fc1f76
4 changed files with 920 additions and 674 deletions
|
|
@ -790,6 +790,9 @@
|
|||
},
|
||||
"Cancelled" : {
|
||||
|
||||
},
|
||||
"Categories" : {
|
||||
|
||||
},
|
||||
"Ce mode vous permet d’être interopérable avec d’autres services SIP.\nVos communications seront chiffrées de point à point. " : {
|
||||
|
||||
|
|
@ -1653,6 +1656,74 @@
|
|||
},
|
||||
"Message copied into clipboard" : {
|
||||
|
||||
},
|
||||
"message_delivery_info_error_title" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Error"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "En erreur"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"message_delivery_info_read_title" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Read"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Lu"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"message_delivery_info_received_title" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Received"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Reçu"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"message_delivery_info_sent_title" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
"en" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Sent"
|
||||
}
|
||||
},
|
||||
"fr" : {
|
||||
"stringUnit" : {
|
||||
"state" : "translated",
|
||||
"value" : "Envoyé"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"message_forwarded_label" : {
|
||||
"extractionState" : "manual",
|
||||
|
|
|
|||
|
|
@ -187,6 +187,10 @@ struct ChatBubbleView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
conversationViewModel.selectedMessageToDisplayDetails = eventLogMessage
|
||||
conversationViewModel.prepareBottomSheetForDeliveryStatus()
|
||||
}
|
||||
.padding(.top, -4)
|
||||
}
|
||||
.padding(.all, 15)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -48,9 +48,25 @@ class ConversationViewModel: ObservableObject {
|
|||
|
||||
var oldMessageReceived = false
|
||||
|
||||
@Published var isShowSelectedMessageToDisplayDetailsBottomSheet: Bool = false
|
||||
@Published var selectedMessageToDisplayDetails: EventLogMessage?
|
||||
@Published var selectedMessage: EventLogMessage?
|
||||
@Published var messageToReply: EventLogMessage?
|
||||
|
||||
struct SheetCategory: Identifiable {
|
||||
let id = UUID()
|
||||
let name: String
|
||||
let innerCategory: [InnerSheetCategory]
|
||||
}
|
||||
|
||||
struct InnerSheetCategory: Identifiable {
|
||||
let id = UUID()
|
||||
let contact: ContactAvatarModel
|
||||
let detail: String
|
||||
}
|
||||
|
||||
@Published var sheetCategories: [SheetCategory] = []
|
||||
|
||||
init() {}
|
||||
|
||||
func addConversationDelegate() {
|
||||
|
|
@ -1405,6 +1421,67 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func prepareBottomSheetForDeliveryStatus() {
|
||||
self.sheetCategories.removeAll()
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
if self.selectedMessageToDisplayDetails != nil && self.selectedMessageToDisplayDetails!.eventLog.chatMessage != nil {
|
||||
|
||||
let participantsImdnDisplayed = self.selectedMessageToDisplayDetails!.eventLog.chatMessage!.getParticipantsByImdnState(state: .Displayed)
|
||||
var participantListDisplayed: [InnerSheetCategory] = []
|
||||
participantsImdnDisplayed.forEach({ participantImdn in
|
||||
if participantImdn.participant != nil && participantImdn.participant!.address != nil {
|
||||
ContactAvatarModel.getAvatarModelFromAddress(address: participantImdn.participant!.address!) { avatarResult in
|
||||
let innerSheetCat = InnerSheetCategory(contact: avatarResult, detail: self.getMessageTime(startDate: participantImdn.stateChangeTime))
|
||||
participantListDisplayed.append(innerSheetCat)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
let participantsImdnDeliveredToUser = self.selectedMessageToDisplayDetails!.eventLog.chatMessage!.getParticipantsByImdnState(state: .DeliveredToUser)
|
||||
var participantListDeliveredToUser: [InnerSheetCategory] = []
|
||||
participantsImdnDeliveredToUser.forEach({ participantImdn in
|
||||
if participantImdn.participant != nil && participantImdn.participant!.address != nil {
|
||||
ContactAvatarModel.getAvatarModelFromAddress(address: participantImdn.participant!.address!) { avatarResult in
|
||||
let innerSheetCat = InnerSheetCategory(contact: avatarResult, detail: self.getMessageTime(startDate: participantImdn.stateChangeTime))
|
||||
participantListDeliveredToUser.append(innerSheetCat)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
let participantsImdnDelivered = self.selectedMessageToDisplayDetails!.eventLog.chatMessage!.getParticipantsByImdnState(state: .Delivered)
|
||||
var participantListDelivered: [InnerSheetCategory] = []
|
||||
participantsImdnDelivered.forEach({ participantImdn in
|
||||
if participantImdn.participant != nil && participantImdn.participant!.address != nil {
|
||||
ContactAvatarModel.getAvatarModelFromAddress(address: participantImdn.participant!.address!) { avatarResult in
|
||||
let innerSheetCat = InnerSheetCategory(contact: avatarResult, detail: self.getMessageTime(startDate: participantImdn.stateChangeTime))
|
||||
participantListDelivered.append(innerSheetCat)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
let participantsImdnNotDelivered = self.selectedMessageToDisplayDetails!.eventLog.chatMessage!.getParticipantsByImdnState(state: .NotDelivered)
|
||||
var participantListNotDelivered: [InnerSheetCategory] = []
|
||||
participantsImdnNotDelivered.forEach({ participantImdn in
|
||||
if participantImdn.participant != nil && participantImdn.participant!.address != nil {
|
||||
ContactAvatarModel.getAvatarModelFromAddress(address: participantImdn.participant!.address!) { avatarResult in
|
||||
let innerSheetCat = InnerSheetCategory(contact: avatarResult, detail: self.getMessageTime(startDate: participantImdn.stateChangeTime))
|
||||
participantListNotDelivered.append(innerSheetCat)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.sheetCategories.append(SheetCategory(name: "message_delivery_info_read_title" + "\(participantListDisplayed.count)", innerCategory: participantListDisplayed))
|
||||
self.sheetCategories.append(SheetCategory(name: "message_delivery_info_received_title" + "\(participantListDeliveredToUser.count)", innerCategory: participantListDeliveredToUser))
|
||||
self.sheetCategories.append(SheetCategory(name: "message_delivery_info_sent_title" + "\(participantListDelivered.count)", innerCategory: participantListDelivered))
|
||||
self.sheetCategories.append(SheetCategory(name: "message_delivery_info_error_title" + "\(participantListNotDelivered.count)", innerCategory: participantListNotDelivered))
|
||||
|
||||
self.isShowSelectedMessageToDisplayDetailsBottomSheet = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// swiftlint:enable line_length
|
||||
// swiftlint:enable type_body_length
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue