mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Fix add participants fragment
This commit is contained in:
parent
64a72c0704
commit
af5e25262c
2 changed files with 47 additions and 38 deletions
|
|
@ -96,6 +96,8 @@ struct AddParticipantsFragment: View {
|
|||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.grayMain2c500)
|
||||
.background(.white)
|
||||
.cornerRadius(12.5)
|
||||
.frame(width: 25, height: 25)
|
||||
.onTapGesture {
|
||||
addParticipantsViewModel.participantsToAdd.remove(at: index)
|
||||
|
|
@ -103,6 +105,7 @@ struct AddParticipantsFragment: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
.padding(.vertical, addParticipantsViewModel.participantsToAdd.isEmpty ? 0 : 10)
|
||||
}
|
||||
.padding(.leading, 16)
|
||||
|
||||
|
|
@ -155,7 +158,7 @@ struct AddParticipantsFragment: View {
|
|||
.inset(by: 0.5)
|
||||
.stroke(isSearchFieldFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||
)
|
||||
.padding(.vertical)
|
||||
.padding(.bottom)
|
||||
.padding(.horizontal)
|
||||
|
||||
ScrollView {
|
||||
|
|
@ -205,8 +208,19 @@ struct AddParticipantsFragment: View {
|
|||
.default_text_style(styleSize: 16)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
Spacer()
|
||||
|
||||
if let searchAddress = contactsManager.lastSearch[index].friend?.address?.asStringUriOnly() {
|
||||
if addParticipantsViewModel.participantsToAdd.contains(where: {
|
||||
$0.address.asStringUriOnly() == searchAddress
|
||||
}) {
|
||||
Image("check")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 25, height: 25)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.background(.white)
|
||||
|
|
@ -262,42 +276,30 @@ struct AddParticipantsFragment: View {
|
|||
HStack {
|
||||
if index < contactsManager.lastSearchSuggestions.count
|
||||
&& 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: ""))
|
||||
.resizable()
|
||||
.frame(width: 45, height: 45)
|
||||
.clipShape(Circle())
|
||||
|
||||
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)
|
||||
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)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
|
||||
if let searchAddress = contactsManager.lastSearchSuggestions[index].address?.asStringUriOnly() {
|
||||
if addParticipantsViewModel.participantsToAdd.contains(where: {
|
||||
$0.address.asStringUriOnly() == searchAddress
|
||||
}) {
|
||||
Image("check")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.foregroundStyle(Color.orangeMain500)
|
||||
.frame(width: 25, height: 25)
|
||||
.padding(.horizontal)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Image("profil-picture-default")
|
||||
|
|
|
|||
|
|
@ -71,6 +71,13 @@ final class MagicSearchSingleton: ObservableObject {
|
|||
lastSearchSuggestions.sort(by: {
|
||||
$0.address!.asStringUriOnly() < $1.address!.asStringUriOnly()
|
||||
})
|
||||
|
||||
if let defaultAccount = core.defaultAccount, let contactAddress = defaultAccount.contactAddress {
|
||||
lastSearchSuggestions.removeAll {
|
||||
$0.address?.weakEqual(address2: contactAddress) ?? false
|
||||
}
|
||||
}
|
||||
|
||||
let sortedLastSearch = lastSearchFriend.sorted(by: {
|
||||
$0.friend!.name!.lowercased().folding(options: .diacriticInsensitive, locale: .current)
|
||||
<
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue