Refresh presence info in history detail

This commit is contained in:
Benoit Martins 2025-11-20 17:49:14 +01:00
parent a421d90d0c
commit fa1f8386b4

View file

@ -196,14 +196,8 @@ struct HistoryContactFragment: View {
.padding(.top, 5) .padding(.top, 5)
} }
if let avatarModel = historyModel.avatarModel { if let avatar = historyModel.avatarModel {
Text(avatarModel.lastPresenceInfo) AvatarPresenceView(avatarModel: avatar)
.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)
} else { } else {
Text("") Text("")
.multilineTextAlignment(.center) .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 { #Preview {
HistoryContactFragment( HistoryContactFragment(
isShowDeleteAllHistoryPopup: .constant(false), isShowDeleteAllHistoryPopup: .constant(false),