mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Add nil check for self.displayedConversation in ComputeComposingLabel
This commit is contained in:
parent
70405b0f1b
commit
75588af0e2
1 changed files with 40 additions and 38 deletions
|
|
@ -1862,48 +1862,50 @@ class ConversationViewModel: ObservableObject {
|
|||
}
|
||||
|
||||
func computeComposingLabel() {
|
||||
let composing = self.displayedConversation!.chatRoom.isRemoteComposing
|
||||
|
||||
if !composing {
|
||||
DispatchQueue.main.async {
|
||||
withAnimation {
|
||||
self.composingLabel = ""
|
||||
if self.displayedConversation != nil {
|
||||
let composing = self.displayedConversation!.chatRoom.isRemoteComposing
|
||||
|
||||
if !composing {
|
||||
DispatchQueue.main.async {
|
||||
withAnimation {
|
||||
self.composingLabel = ""
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var composingFriends: [String] = []
|
||||
var label = ""
|
||||
|
||||
for address in self.displayedConversation!.chatRoom.composingAddresses {
|
||||
if let addressCleaned = address.clone() {
|
||||
addressCleaned.clean()
|
||||
|
||||
if let avatar = self.participantConversationModel.first(where: {$0.address == addressCleaned.asStringUriOnly()}) {
|
||||
let name = avatar.name
|
||||
composingFriends.append(name)
|
||||
label += "\(name), "
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var composingFriends: [String] = []
|
||||
var label = ""
|
||||
|
||||
for address in self.displayedConversation!.chatRoom.composingAddresses {
|
||||
if let addressCleaned = address.clone() {
|
||||
addressCleaned.clean()
|
||||
|
||||
if !composingFriends.isEmpty {
|
||||
label = String(label.dropLast(2))
|
||||
|
||||
if let avatar = self.participantConversationModel.first(where: {$0.address == addressCleaned.asStringUriOnly()}) {
|
||||
let name = avatar.name
|
||||
composingFriends.append(name)
|
||||
label += "\(name), "
|
||||
let format = composingFriends.count > 1
|
||||
? String(format: NSLocalizedString("conversation_composing_label_multiple", comment: ""), label)
|
||||
: String(format: NSLocalizedString("conversation_composing_label_single", comment: ""), label)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
withAnimation {
|
||||
self.composingLabel = format
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !composingFriends.isEmpty {
|
||||
label = String(label.dropLast(2))
|
||||
|
||||
let format = composingFriends.count > 1
|
||||
? String(format: NSLocalizedString("conversation_composing_label_multiple", comment: ""), label)
|
||||
: String(format: NSLocalizedString("conversation_composing_label_single", comment: ""), label)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
withAnimation {
|
||||
self.composingLabel = format
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
withAnimation {
|
||||
self.composingLabel = ""
|
||||
} else {
|
||||
DispatchQueue.main.async {
|
||||
withAnimation {
|
||||
self.composingLabel = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue