Kontaktliste wird bei neuer Nachricht aktualisiert
Text ist markierbar
This commit is contained in:
@@ -30,13 +30,13 @@ namespace ChatController.Utilities
|
||||
|
||||
public static DateTime DefaultDate = new DateTime(1, 1, 1);
|
||||
|
||||
public static void DownloadProfilePictureAsync(string pathToProfilePicture, string key, Action<ImageSource> callback)
|
||||
public static void DownloadGroupProfilePictureAsync(string pathToProfilePicture, string key, Action<ImageSource> callback)
|
||||
{
|
||||
var cache = OwnChatCache.GetInstance();
|
||||
|
||||
var cachedProfileImage = cache.GetCachedProfilePicture(key, pathToProfilePicture);
|
||||
|
||||
if (cachedProfileImage != null)
|
||||
if (!(cachedProfileImage is null))
|
||||
{
|
||||
callback?.Invoke(cachedProfileImage);
|
||||
return;
|
||||
@@ -49,6 +49,24 @@ namespace ChatController.Utilities
|
||||
});
|
||||
}
|
||||
|
||||
public static void DownloadUserProfilePicturesAsync(Dictionary<long, string> userIds2Uris)
|
||||
{
|
||||
var cache = OwnChatCache.GetInstance();
|
||||
|
||||
foreach(var userId2Uri in userIds2Uris)
|
||||
{
|
||||
if(cache.IsUserProfilePictureInCache(userId2Uri.Key))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
DownloadImage(userId2Uri.Value, imageSource =>
|
||||
{
|
||||
cache.AddUserProfilePictureToCache(imageSource, userId2Uri.Key, userId2Uri.Value);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static void DownloadImage(string uri, Action<ImageSource> callback)
|
||||
{
|
||||
var client = new RestClient(uri);
|
||||
|
||||
Reference in New Issue
Block a user