forked from mirrors/linphone-iphone
Replaced all null address.username with address.asStringUriOnly
This commit is contained in:
parent
6d116b6cec
commit
992afa16cf
14 changed files with 201 additions and 65 deletions
|
|
@ -368,6 +368,8 @@ class TelecomManager: ObservableObject {
|
|||
completion(call.remoteAddress!.displayName!)
|
||||
} else if call.remoteAddress!.username != nil {
|
||||
completion(call.remoteAddress!.username!)
|
||||
} else {
|
||||
completion(String(call.remoteAddress!.asStringUriOnly().dropFirst(4)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -475,6 +477,8 @@ class TelecomManager: ObservableObject {
|
|||
displayName = call.remoteAddress!.displayName!
|
||||
} else if call.remoteAddress!.username != nil {
|
||||
displayName = call.remoteAddress!.username!
|
||||
} else {
|
||||
displayName = String(call.remoteAddress!.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,13 @@ class ParticipantModel: ObservableObject {
|
|||
if let addressFriend = friendResult {
|
||||
self.name = addressFriend.name!
|
||||
} else {
|
||||
self.name = address.displayName != nil ? address.displayName! : address.username!
|
||||
if address.displayName != nil {
|
||||
self.name = address.displayName!
|
||||
} else if address.username != nil {
|
||||
self.name = address.username!
|
||||
} else {
|
||||
self.name = String(address.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -170,6 +170,8 @@ class CallViewModel: ObservableObject {
|
|||
displayNameTmp = self.currentCall!.remoteAddress!.displayName!
|
||||
} else if self.currentCall!.remoteAddress!.username != nil && displayNameTmp.isEmpty {
|
||||
displayNameTmp = self.currentCall!.remoteAddress!.username!
|
||||
} else if displayNameTmp.isEmpty {
|
||||
displayNameTmp = String(self.currentCall!.remoteAddress!.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -351,6 +353,8 @@ class CallViewModel: ObservableObject {
|
|||
activeSpeakerNameTmp = activeSpeakerParticipantTmp!.address.displayName!
|
||||
} else if activeSpeakerParticipantTmp!.address.username != nil {
|
||||
activeSpeakerNameTmp = activeSpeakerParticipantTmp!.address.username!
|
||||
} else {
|
||||
activeSpeakerNameTmp = String(activeSpeakerParticipantTmp!.address.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -467,6 +471,8 @@ class CallViewModel: ObservableObject {
|
|||
activeSpeakerNameTmp = activeSpeakerParticipantTmp!.address.displayName!
|
||||
} else if activeSpeakerParticipantTmp!.address.username != nil {
|
||||
activeSpeakerNameTmp = activeSpeakerParticipantTmp!.address.username!
|
||||
} else {
|
||||
activeSpeakerNameTmp = String(activeSpeakerParticipantTmp!.address.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
|
|
@ -594,6 +600,8 @@ class CallViewModel: ObservableObject {
|
|||
activeSpeakerNameTmp = activeSpeakerParticipantTmp.address.displayName!
|
||||
} else if activeSpeakerParticipantTmp.address.username != nil {
|
||||
activeSpeakerNameTmp = activeSpeakerParticipantTmp.address.username!
|
||||
} else {
|
||||
activeSpeakerNameTmp = String(activeSpeakerParticipantTmp.address.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,8 @@ class MeetingWaitingRoomViewModel: ObservableObject {
|
|||
userNameTmp = core.defaultAccount!.contactAddress!.displayName!
|
||||
} else if core.defaultAccount!.contactAddress!.username != nil {
|
||||
userNameTmp = core.defaultAccount!.contactAddress!.username!
|
||||
} else {
|
||||
userNameTmp = String(core.defaultAccount!.contactAddress!.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,11 +149,25 @@ class ContactAvatarModel: ObservableObject, Identifiable {
|
|||
}
|
||||
completion(avatarModel!)
|
||||
} else {
|
||||
let name = address.displayName != nil ? address.displayName! : address.username!
|
||||
var name = ""
|
||||
if address.displayName != nil {
|
||||
name = address.displayName!
|
||||
} else if address.username != nil {
|
||||
name = address.username!
|
||||
} else {
|
||||
name = String(address.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
completion(ContactAvatarModel(friend: nil, name: name, address: address.asStringUriOnly(), withPresence: false))
|
||||
}
|
||||
} else {
|
||||
let name = address.displayName != nil ? address.displayName! : address.username!
|
||||
var name = ""
|
||||
if address.displayName != nil {
|
||||
name = address.displayName!
|
||||
} else if address.username != nil {
|
||||
name = address.username!
|
||||
} else {
|
||||
name = String(address.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
completion(ContactAvatarModel(friend: nil, name: name, address: address.asStringUriOnly(), withPresence: false))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,9 +276,20 @@ struct ConversationForwardMessageFragment: View {
|
|||
} label: {
|
||||
HStack {
|
||||
if index < contactsManager.lastSearchSuggestions.count
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil
|
||||
&& contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil {
|
||||
if contactsManager.lastSearchSuggestions[index].address!.displayName != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.displayName!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.displayName ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else if contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.username!,
|
||||
lastName: ""))
|
||||
|
|
@ -286,10 +297,23 @@ struct ConversationForwardMessageFragment: View {
|
|||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.username ?? "")
|
||||
Text(contactsManager.lastSearchSuggestions[index].address!.username ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)))
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
}
|
||||
} else {
|
||||
Image("profil-picture-default")
|
||||
.resizable()
|
||||
|
|
|
|||
|
|
@ -274,9 +274,20 @@ struct StartConversationFragment: View {
|
|||
} label: {
|
||||
HStack {
|
||||
if index < contactsManager.lastSearchSuggestions.count
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil
|
||||
&& contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil {
|
||||
if contactsManager.lastSearchSuggestions[index].address!.displayName != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.displayName!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.displayName ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else if contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.username!,
|
||||
lastName: ""))
|
||||
|
|
@ -284,10 +295,23 @@ struct StartConversationFragment: View {
|
|||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.username ?? "")
|
||||
Text(contactsManager.lastSearchSuggestions[index].address!.username ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)))
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
}
|
||||
} else {
|
||||
Image("profil-picture-default")
|
||||
.resizable()
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ class ConversationModel: ObservableObject, Identifiable {
|
|||
} else if lastMessage!.fromAddress!.username != nil {
|
||||
fromAddressFriend = lastMessage!.fromAddress!.username! + ": "
|
||||
} else {
|
||||
fromAddressFriend = ""
|
||||
fromAddressFriend = String(lastMessage!.fromAddress!.asStringUriOnly().dropFirst(4)) + ": "
|
||||
}
|
||||
} else {
|
||||
fromAddressFriend! += ": "
|
||||
|
|
|
|||
|
|
@ -45,7 +45,13 @@ class EventModel: ObservableObject {
|
|||
if let addressFriend = friendResult {
|
||||
name = addressFriend.name!
|
||||
} else {
|
||||
name = address!.displayName != nil ? address!.displayName! : address!.username!
|
||||
if address!.displayName != nil {
|
||||
name = address!.displayName!
|
||||
} else if address!.username != nil {
|
||||
name = address!.username!
|
||||
} else {
|
||||
name = String(address!.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
}
|
||||
|
||||
let textValue: String
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class ConversationsListViewModel: ObservableObject {
|
|||
} else if message.fromAddress!.username != nil {
|
||||
fromAddressFriend = message.fromAddress!.username! + ": "
|
||||
} else {
|
||||
fromAddressFriend = ""
|
||||
fromAddressFriend = String(message.fromAddress!.asStringUriOnly().dropFirst(4)) + ": "
|
||||
}
|
||||
} else {
|
||||
fromAddressFriend! += ": "
|
||||
|
|
|
|||
|
|
@ -375,9 +375,20 @@ struct StartCallFragment: View {
|
|||
} label: {
|
||||
HStack {
|
||||
if index < contactsManager.lastSearchSuggestions.count
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil
|
||||
&& contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil {
|
||||
if contactsManager.lastSearchSuggestions[index].address!.displayName != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.displayName!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.displayName ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else if contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.username!,
|
||||
lastName: ""))
|
||||
|
|
@ -385,10 +396,23 @@ struct StartCallFragment: View {
|
|||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.username ?? "")
|
||||
Text(contactsManager.lastSearchSuggestions[index].address!.username ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)))
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
}
|
||||
} else {
|
||||
Image("profil-picture-default")
|
||||
.resizable()
|
||||
|
|
|
|||
|
|
@ -258,9 +258,20 @@ struct AddParticipantsFragment: View {
|
|||
} label: {
|
||||
HStack {
|
||||
if index < contactsManager.lastSearchSuggestions.count
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil
|
||||
&& contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
&& contactsManager.lastSearchSuggestions[index].address != nil {
|
||||
if contactsManager.lastSearchSuggestions[index].address!.displayName != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.displayName!,
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.displayName ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else if contactsManager.lastSearchSuggestions[index].address!.username != nil {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: contactsManager.lastSearchSuggestions[index].address!.username!,
|
||||
lastName: ""))
|
||||
|
|
@ -268,10 +279,23 @@ struct AddParticipantsFragment: View {
|
|||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(contactsManager.lastSearchSuggestions[index].address?.username ?? "")
|
||||
Text(contactsManager.lastSearchSuggestions[index].address!.username ?? "")
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
} else {
|
||||
Image(uiImage: contactsManager.textToImage(
|
||||
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
|
||||
lastName: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)))
|
||||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
}
|
||||
} else {
|
||||
Image("profil-picture-default")
|
||||
.resizable()
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ extension Account {
|
|||
if address.username != nil && !address.username!.isEmpty {
|
||||
return address.username!
|
||||
}
|
||||
return address.asStringUriOnly()
|
||||
return String(address.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
|
||||
static func == (lhs: Account, rhs: Account) -> Bool {
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class NotificationService: UNNotificationServiceExtension {
|
|||
} else if chatRoom.peerAddress!.username != nil {
|
||||
bestAttemptContent.body = chatRoom.peerAddress!.username!
|
||||
} else {
|
||||
bestAttemptContent.body = "Peer Address Error"
|
||||
bestAttemptContent.body = String(chatRoom.peerAddress!.asStringUriOnly().dropFirst(4))
|
||||
}
|
||||
} else {
|
||||
bestAttemptContent.body = "Peer Address Error"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue