Fix profile picture re-uploading

pull/220/head
nielsandriesse 5 years ago
parent 15eee23ad8
commit b8d713b834

@ -259,6 +259,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
[[self.syncManager syncLocalContact] retainUntilComplete]; [[self.syncManager syncLocalContact] retainUntilComplete];
} }
*/ */
if (requiresSync) { if (requiresSync) {
[LKSyncMessagesProtocol syncProfile]; [LKSyncMessagesProtocol syncProfile];
} }
@ -278,6 +279,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
[[self.syncManager syncLocalContact] retainUntilComplete]; [[self.syncManager syncLocalContact] retainUntilComplete];
} }
*/ */
if (requiresSync) { if (requiresSync) {
[LKSyncMessagesProtocol syncProfile]; [LKSyncMessagesProtocol syncProfile];
} }
@ -327,14 +329,6 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
// * Encrypt it // * Encrypt it
// * Upload it to asset service // * Upload it to asset service
// * Send asset service info to Signal Service // * Send asset service info to Signal Service
if (self.localProfileAvatarImage == avatarImage) {
OWSAssertDebug(userProfile.avatarUrlPath.length > 0);
OWSAssertDebug(userProfile.avatarFileName.length > 0);
OWSLogVerbose(@"Updating local profile on service with unchanged avatar.");
// If the avatar hasn't changed, reuse the existing metadata.
tryToUpdateService(userProfile.avatarUrlPath, userProfile.avatarFileName);
} else {
OWSLogVerbose(@"Updating local profile on service with new avatar."); OWSLogVerbose(@"Updating local profile on service with new avatar.");
[self writeAvatarToDisk:avatarImage [self writeAvatarToDisk:avatarImage
success:^(NSData *data, NSString *fileName) { success:^(NSData *data, NSString *fileName) {
@ -349,7 +343,6 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
failure:^(NSError *error) { failure:^(NSError *error) {
failureBlock(error); failureBlock(error);
}]; }];
}
} else if (userProfile.avatarUrlPath) { } else if (userProfile.avatarUrlPath) {
OWSLogVerbose(@"Updating local profile on service with cleared avatar."); OWSLogVerbose(@"Updating local profile on service with cleared avatar.");
[self uploadAvatarToService:nil [self uploadAvatarToService:nil

Loading…
Cancel
Save