|
|
|
@ -396,21 +396,6 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
|
|
|
|
|
OWSAssertDebug(failureBlock);
|
|
|
|
|
OWSAssertDebug(avatarData == nil || avatarData.length > 0);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// We want to clear the local user's profile avatar as soon as
|
|
|
|
|
// we request the upload form, since that request clears our
|
|
|
|
|
// avatar on the service.
|
|
|
|
|
//
|
|
|
|
|
// TODO: Revisit this so that failed profile updates don't leave
|
|
|
|
|
// the profile avatar blank, etc.
|
|
|
|
|
void (^clearLocalAvatar)(void) = ^{
|
|
|
|
|
OWSUserProfile *userProfile = self.localUserProfile;
|
|
|
|
|
[userProfile updateWithAvatarUrlPath:nil avatarFileName:nil dbConnection:self.dbConnection completion:nil];
|
|
|
|
|
};
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
|
|
|
|
|
[[LKStorageAPI setProfilePicture:avatarData]
|
|
|
|
|
.thenOn(dispatch_get_main_queue(), ^(NSString *url) {
|
|
|
|
|
successBlock(url);
|
|
|
|
@ -427,6 +412,19 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
|
|
|
|
|
}) retainUntilComplete];
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// We want to clear the local user's profile avatar as soon as
|
|
|
|
|
// we request the upload form, since that request clears our
|
|
|
|
|
// avatar on the service.
|
|
|
|
|
//
|
|
|
|
|
// TODO: Revisit this so that failed profile updates don't leave
|
|
|
|
|
// the profile avatar blank, etc.
|
|
|
|
|
void (^clearLocalAvatar)(void) = ^{
|
|
|
|
|
OWSUserProfile *userProfile = self.localUserProfile;
|
|
|
|
|
[userProfile updateWithAvatarUrlPath:nil avatarFileName:nil dbConnection:self.dbConnection completion:nil];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
|
|
|
|
|
|
|
|
|
// See: https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-UsingHTTPPOST.html
|
|
|
|
|
TSRequest *formRequest = [OWSRequestFactory profileAvatarUploadFormRequest];
|
|
|
|
|
|
|
|
|
@ -539,8 +537,8 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
|
|
|
|
|
OWSLogError(@"Failed to get profile avatar upload form: %@", error);
|
|
|
|
|
return failureBlock(error);
|
|
|
|
|
}];
|
|
|
|
|
});
|
|
|
|
|
*/
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)updateServiceWithProfileName:(nullable NSString *)localProfileName
|
|
|
|
|