mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Update default profile picture when changing display name
This commit is contained in:
parent
0e635ec9fc
commit
8609f880fb
2 changed files with 23 additions and 16 deletions
|
|
@ -317,11 +317,19 @@ struct ConversationInfoFragment: View {
|
|||
}
|
||||
|
||||
VStack {
|
||||
Text(participantConversationModel.name)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.lineLimit(1)
|
||||
if conversationViewModel.myParticipantConversationModel != nil && conversationViewModel.myParticipantConversationModel!.address != participantConversationModel.address {
|
||||
Text(participantConversationModel.name)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.lineLimit(1)
|
||||
} else {
|
||||
Text(accountProfileViewModel.displayName.isEmpty ? participantConversationModel.name : accountProfileViewModel.displayName)
|
||||
.foregroundStyle(Color.grayMain2c700)
|
||||
.default_text_style(styleSize: 14)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.lineLimit(1)
|
||||
}
|
||||
|
||||
let participantConversationModelIsAdmin = conversationViewModel.participantConversationModelAdmin.first(
|
||||
where: {$0.address == participantConversationModel.address})
|
||||
|
|
|
|||
|
|
@ -36,22 +36,21 @@ class AccountProfileViewModel: ObservableObject {
|
|||
func saveChangesWhenLeaving() {
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
let newParams = core.defaultAccount!.params?.clone()
|
||||
print("getImagePath 0 \(self.displayName) \(newParams?.identityAddress?.displayName ?? "NIL")")
|
||||
if self.displayName != newParams?.identityAddress?.displayName {
|
||||
if (self.displayName != newParams?.identityAddress?.displayName)
|
||||
&& (newParams?.identityAddress?.displayName != nil || !self.displayName.isEmpty) {
|
||||
if let newIdentityAddress = newParams?.identityAddress?.clone() {
|
||||
try? newIdentityAddress.setDisplayname(newValue: self.displayName)
|
||||
try? newParams?.setIdentityaddress(newValue: newIdentityAddress)
|
||||
}
|
||||
|
||||
print("getImagePath 1 \(self.getImagePath().lastPathComponent)")
|
||||
|
||||
if self.getImagePath().lastPathComponent.contains("-default") {
|
||||
print("getImagePath 2")
|
||||
self.saveImage(
|
||||
image: ContactsManager.shared.textToImage(
|
||||
firstName: self.displayName.isEmpty ? core.defaultAccount!.displayName() : self.displayName, lastName: ""),
|
||||
name: self.displayName.isEmpty ? core.defaultAccount!.displayName() : self.displayName,
|
||||
prefix: "-default")
|
||||
if self.getImagePath().lastPathComponent.contains("-default") || self.getImagePath().lastPathComponent == "Documents" {
|
||||
DispatchQueue.main.async {
|
||||
self.saveImage(
|
||||
image: ContactsManager.shared.textToImage(
|
||||
firstName: self.displayName.isEmpty ? core.defaultAccount!.displayName() : self.displayName, lastName: ""),
|
||||
name: self.displayName.isEmpty ? core.defaultAccount!.displayName() : self.displayName,
|
||||
prefix: "-default")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue