Reimplement Contact List Images

This commit is contained in:
Alan Moon 2025-12-10 13:49:10 -08:00
parent 1e220a23a1
commit 9b350d4373

View File

@ -893,15 +893,20 @@ namespace qtcnet_client
{ {
case Contact.ContactStatus.AwaitingApprovalFromOther: case Contact.ContactStatus.AwaitingApprovalFromOther:
ctrl.Username = $"{user.Data.Username} [Request Sent]"; ctrl.Username = $"{user.Data.Username} [Request Sent]";
//await AddProfilePicToList(user.Data.Id);
//ctrl.Avatar = ilProfilePics.Images[user.Data.Id] ?? ilProfilePics.Images[0];
break; break;
case Contact.ContactStatus.Accepted: case Contact.ContactStatus.Accepted:
ctrl.Username = user.Data.Username; ctrl.Username = user.Data.Username;
//await AddProfilePicToList(user.Data.Id);
//ctrl.Avatar = ilProfilePics.Images[user.Data.Id] ?? ilProfilePics.Images[0];
break; break;
} }
// get profile image
var _pfpRes = await _apiService.GetUserProfilePic(contact.UserId);
if(_pfpRes.Success && _pfpRes.Data != null)
{
using var ms = new MemoryStream(_pfpRes.Data);
Image img = Image.FromStream(ms);
ctrl.ProfilePic = img;
}
} }
else if (contact.UserId == _apiService.CurrentUser.Id) else if (contact.UserId == _apiService.CurrentUser.Id)
{ {
@ -909,16 +914,21 @@ namespace qtcnet_client
{ {
case Contact.ContactStatus.AwaitingApprovalFromSelf: case Contact.ContactStatus.AwaitingApprovalFromSelf:
ctrl.Username = $"{user.Data.Username} [Contact Request]"; ctrl.Username = $"{user.Data.Username} [Contact Request]";
//await AddProfilePicToList(user.Data.Id);
//ctrl.Avatar = ilProfilePics.Images[user.Data.Id] ?? ilProfilePics.Images[0];
//AudioService.PlaySoundEffect("sndContactRequest"); //AudioService.PlaySoundEffect("sndContactRequest");
break; break;
case Contact.ContactStatus.Accepted: case Contact.ContactStatus.Accepted:
ctrl.Username = user.Data.Username; ctrl.Username = user.Data.Username;
//await AddProfilePicToList(user.Data.Id);
//ctrl.Avatar = ilProfilePics.Images[user.Data.Id] ?? ilProfilePics.Images[0];
break; break;
} }
// get profile image
var _pfpRes = await _apiService.GetUserProfilePic(contact.OwnerId);
if (_pfpRes.Success && _pfpRes.Data != null)
{
using var ms = new MemoryStream(_pfpRes.Data);
Image img = Image.FromStream(ms);
ctrl.ProfilePic = img;
}
} }
// return the control // return the control