From fa1f8386b4b541fd1ef903661d0796961649a510 Mon Sep 17 00:00:00 2001 From: Benoit Martins Date: Thu, 20 Nov 2025 17:49:14 +0100 Subject: [PATCH] Refresh presence info in history detail --- .../Fragments/HistoryContactFragment.swift | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Linphone/UI/Main/History/Fragments/HistoryContactFragment.swift b/Linphone/UI/Main/History/Fragments/HistoryContactFragment.swift index 8ecbc13ad..132d4442d 100644 --- a/Linphone/UI/Main/History/Fragments/HistoryContactFragment.swift +++ b/Linphone/UI/Main/History/Fragments/HistoryContactFragment.swift @@ -196,14 +196,8 @@ struct HistoryContactFragment: View { .padding(.top, 5) } - if let avatarModel = historyModel.avatarModel { - Text(avatarModel.lastPresenceInfo) - .foregroundStyle(avatarModel.lastPresenceInfo == "Online" ? Color.greenSuccess500 : Color.orangeWarning600) - .multilineTextAlignment(.center) - .default_text_style_300(styleSize: 12) - .frame(maxWidth: .infinity) - .frame(height: 20) - .padding(.top, 5) + if let avatar = historyModel.avatarModel { + AvatarPresenceView(avatarModel: avatar) } else { Text("") .multilineTextAlignment(.center) @@ -423,6 +417,21 @@ struct HistoryContactFragment: View { } } +struct AvatarPresenceView: View { + @ObservedObject var avatarModel: ContactAvatarModel + + var body: some View { + Text(avatarModel.lastPresenceInfo) + .foregroundStyle(avatarModel.lastPresenceInfo == "Online" ? Color.greenSuccess500 : Color.orangeWarning600) + .multilineTextAlignment(.center) + .default_text_style_300(styleSize: 12) + .frame(maxWidth: .infinity) + .frame(height: 20) + .padding(.top, 5) + } +} + + #Preview { HistoryContactFragment( isShowDeleteAllHistoryPopup: .constant(false),