mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Use background task while downloading profile avatar.
This commit is contained in:
parent
58ee518b26
commit
40729dbdd2
1 changed files with 5 additions and 0 deletions
|
@ -801,6 +801,8 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
|
|||
{
|
||||
OWSAssert(userProfile);
|
||||
|
||||
__block OWSBackgroundTask *backgroundTask = [OWSBackgroundTask backgroundTaskWithLabelStr:__PRETTY_FUNCTION__];
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
if (userProfile.avatarUrlPath.length < 1) {
|
||||
OWSFail(@"%@ Malformed avatar URL: %@", self.logTag, userProfile.avatarUrlPath);
|
||||
|
@ -884,6 +886,9 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
|
|||
[localUserProfile updateWithAvatarFileName:fileName dbConnection:self.dbConnection completion:nil];
|
||||
[self updateProfileAvatarCache:image filename:fileName];
|
||||
}
|
||||
|
||||
OWSAssert(backgroundTask);
|
||||
backgroundTask = nil;
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue