Hide SIP domains in suggestion list

This commit is contained in:
Benoit Martins 2025-10-02 14:10:10 +02:00
parent e9eebbd45a
commit 068b93cf1c
5 changed files with 104 additions and 16 deletions

View file

@ -219,6 +219,11 @@ class CoreContext: ObservableObject {
account.params = newParams account.params = newParams
} }
// TODO: Temporary workaround until SDK fixs
if CorePreferences.defaultDomain == "" {
CorePreferences.defaultDomain = core.defaultAccount?.params?.domain ?? ""
}
self.actionsToPerformOnCoreQueueWhenCoreIsStarted.forEach { $0(core) } self.actionsToPerformOnCoreQueueWhenCoreIsStarted.forEach { $0(core) }
self.actionsToPerformOnCoreQueueWhenCoreIsStarted.removeAll() self.actionsToPerformOnCoreQueueWhenCoreIsStarted.removeAll()

View file

@ -275,6 +275,7 @@ struct ConversationForwardMessageFragment: View {
HStack { HStack {
if index < contactsManager.lastSearchSuggestions.count if index < contactsManager.lastSearchSuggestions.count
&& contactsManager.lastSearchSuggestions[index].address != nil { && contactsManager.lastSearchSuggestions[index].address != nil {
if contactsManager.lastSearchSuggestions[index].address!.domain != CorePreferences.defaultDomain {
Image(uiImage: contactsManager.textToImage( Image(uiImage: contactsManager.textToImage(
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)), firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
lastName: "")) lastName: ""))
@ -284,9 +285,29 @@ struct ConversationForwardMessageFragment: View {
Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4))) Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)))
.default_text_style(styleSize: 16) .default_text_style(styleSize: 16)
.lineLimit(1) .lineLimit(1)
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
.foregroundStyle(Color.orangeMain500) .foregroundStyle(Color.orangeMain500)
} else {
if let address = contactsManager.lastSearchSuggestions[index].address {
let nameTmp = address.displayName
?? address.username
?? String(address.asStringUriOnly().dropFirst(4))
Image(uiImage: contactsManager.textToImage(
firstName: nameTmp,
lastName: ""))
.resizable()
.frame(width: 45, height: 45)
.clipShape(Circle())
Text(nameTmp)
.default_text_style(styleSize: 16)
.lineLimit(1)
.frame(maxWidth: .infinity, alignment: .leading)
.foregroundStyle(Color.orangeMain500)
}
}
} else { } else {
Image("profil-picture-default") Image("profil-picture-default")
.resizable() .resizable()

View file

@ -257,6 +257,7 @@ struct StartConversationFragment: View {
HStack { HStack {
if index < contactsManager.lastSearchSuggestions.count if index < contactsManager.lastSearchSuggestions.count
&& contactsManager.lastSearchSuggestions[index].address != nil { && contactsManager.lastSearchSuggestions[index].address != nil {
if contactsManager.lastSearchSuggestions[index].address!.domain != CorePreferences.defaultDomain {
Image(uiImage: contactsManager.textToImage( Image(uiImage: contactsManager.textToImage(
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)), firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
lastName: "")) lastName: ""))
@ -266,9 +267,29 @@ struct StartConversationFragment: View {
Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4))) Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)))
.default_text_style(styleSize: 16) .default_text_style(styleSize: 16)
.lineLimit(1) .lineLimit(1)
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
.foregroundStyle(Color.orangeMain500) .foregroundStyle(Color.orangeMain500)
} else {
if let address = contactsManager.lastSearchSuggestions[index].address {
let nameTmp = address.displayName
?? address.username
?? String(address.asStringUriOnly().dropFirst(4))
Image(uiImage: contactsManager.textToImage(
firstName: nameTmp,
lastName: ""))
.resizable()
.frame(width: 45, height: 45)
.clipShape(Circle())
Text(nameTmp)
.default_text_style(styleSize: 16)
.lineLimit(1)
.frame(maxWidth: .infinity, alignment: .leading)
.foregroundStyle(Color.orangeMain500)
}
}
} else { } else {
Image("profil-picture-default") Image("profil-picture-default")
.resizable() .resizable()

View file

@ -385,6 +385,7 @@ struct StartCallFragment: View {
HStack { HStack {
if index < contactsManager.lastSearchSuggestions.count if index < contactsManager.lastSearchSuggestions.count
&& contactsManager.lastSearchSuggestions[index].address != nil { && contactsManager.lastSearchSuggestions[index].address != nil {
if contactsManager.lastSearchSuggestions[index].address!.domain != CorePreferences.defaultDomain {
Image(uiImage: contactsManager.textToImage( Image(uiImage: contactsManager.textToImage(
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)), firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
lastName: "")) lastName: ""))
@ -394,9 +395,29 @@ struct StartCallFragment: View {
Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4))) Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)))
.default_text_style(styleSize: 16) .default_text_style(styleSize: 16)
.lineLimit(1) .lineLimit(1)
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
.foregroundStyle(Color.orangeMain500) .foregroundStyle(Color.orangeMain500)
} else {
if let address = contactsManager.lastSearchSuggestions[index].address {
let nameTmp = address.displayName
?? address.username
?? String(address.asStringUriOnly().dropFirst(4))
Image(uiImage: contactsManager.textToImage(
firstName: nameTmp,
lastName: ""))
.resizable()
.frame(width: 45, height: 45)
.clipShape(Circle())
Text(nameTmp)
.default_text_style(styleSize: 16)
.lineLimit(1)
.frame(maxWidth: .infinity, alignment: .leading)
.foregroundStyle(Color.orangeMain500)
}
}
} else { } else {
Image("profil-picture-default") Image("profil-picture-default")
.resizable() .resizable()

View file

@ -282,19 +282,39 @@ struct AddParticipantsFragment: View {
HStack { HStack {
if index < contactsManager.lastSearchSuggestions.count if index < contactsManager.lastSearchSuggestions.count
&& contactsManager.lastSearchSuggestions[index].address != nil { && contactsManager.lastSearchSuggestions[index].address != nil {
Image(uiImage: contactsManager.textToImage( if contactsManager.lastSearchSuggestions[index].address!.domain != CorePreferences.defaultDomain {
firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)), Image(uiImage: contactsManager.textToImage(
lastName: "")) firstName: String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)),
.resizable() lastName: ""))
.frame(width: 45, height: 45) .resizable()
.clipShape(Circle()) .frame(width: 45, height: 45)
.clipShape(Circle())
Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)))
.default_text_style(styleSize: 16) Text(String(contactsManager.lastSearchSuggestions[index].address!.asStringUriOnly().dropFirst(4)))
.lineLimit(1) .default_text_style(styleSize: 16)
.lineLimit(1) .lineLimit(1)
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
.foregroundStyle(Color.orangeMain500) .foregroundStyle(Color.orangeMain500)
} else {
if let address = contactsManager.lastSearchSuggestions[index].address {
let nameTmp = address.displayName
?? address.username
?? String(address.asStringUriOnly().dropFirst(4))
Image(uiImage: contactsManager.textToImage(
firstName: nameTmp,
lastName: ""))
.resizable()
.frame(width: 45, height: 45)
.clipShape(Circle())
Text(nameTmp)
.default_text_style(styleSize: 16)
.lineLimit(1)
.frame(maxWidth: .infinity, alignment: .leading)
.foregroundStyle(Color.orangeMain500)
}
}
if let searchAddress = contactsManager.lastSearchSuggestions[index].address?.asStringUriOnly() { if let searchAddress = contactsManager.lastSearchSuggestions[index].address?.asStringUriOnly() {
if addParticipantsViewModel.participantsToAdd.contains(where: { if addParticipantsViewModel.participantsToAdd.contains(where: {