From 3a1e0bc77ef65c08db372a79cef28ddd2c378751 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 97271c986..d73b119ce 100644 --- a/Linphone/UI/Main/History/Fragments/HistoryContactFragment.swift +++ b/Linphone/UI/Main/History/Fragments/HistoryContactFragment.swift @@ -194,14 +194,8 @@ struct HistoryContactFragment: View { .frame(maxWidth: .infinity) .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) @@ -421,6 +415,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),