mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Collect side menu account info on core thread
This commit is contained in:
parent
e3a04b9b2f
commit
ef56935228
2 changed files with 9 additions and 3 deletions
|
|
@ -28,14 +28,14 @@ struct SideMenuAccountRow: View {
|
|||
|
||||
Avatar(contactAvatarModel:
|
||||
ContactAvatarModel(friend: nil,
|
||||
name: model.account.displayName(),
|
||||
address: model.account.params!.identityAddress!.asString(),
|
||||
name: model.displayName,
|
||||
address: model.address,
|
||||
withPresence: true),
|
||||
avatarSize: 45)
|
||||
.padding(.leading, 6)
|
||||
|
||||
VStack {
|
||||
Text(model.account.displayName())
|
||||
Text(model.displayName)
|
||||
.default_text_style_grey_400(styleSize: 14)
|
||||
.lineLimit(1)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ class AccountModel: ObservableObject {
|
|||
@Published var registrationStateAssociatedUIColor: Color = .clear
|
||||
@Published var notificationsCount: Int = 0
|
||||
@Published var isDefaultAccount: Bool = false
|
||||
@Published var displayName: String = ""
|
||||
@Published var address: String = ""
|
||||
|
||||
init(account: Account, corePublisher: CoreDelegatePublisher?) {
|
||||
self.account = account
|
||||
|
|
@ -56,6 +58,8 @@ class AccountModel: ObservableObject {
|
|||
if let defaultAccount = account.core?.defaultAccount {
|
||||
isDefault = (defaultAccount == account)
|
||||
}
|
||||
let displayName = account.displayName()
|
||||
let address = account.params?.identityAddress?.asString()
|
||||
DispatchQueue.main.async { [self] in
|
||||
switch state {
|
||||
case .Cleared, .None:
|
||||
|
|
@ -75,6 +79,8 @@ class AccountModel: ObservableObject {
|
|||
registrationStateAssociatedUIColor = .grayMain2c500
|
||||
}
|
||||
isDefaultAccount = isDefault
|
||||
self.displayName = displayName
|
||||
address.map {self.address = $0}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue