diff --git a/SignalMessaging/profiles/OWSProfileManager.m b/SignalMessaging/profiles/OWSProfileManager.m index 47e91fcb4..d2383ea5a 100644 --- a/SignalMessaging/profiles/OWSProfileManager.m +++ b/SignalMessaging/profiles/OWSProfileManager.m @@ -912,25 +912,13 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640; return; } - // If we're transitioning from (no avatar -> no avatar) or from (same avatar -> same avatar), - // don't bother updating the avatar. - BOOL canSkipAvatarUpdate = ((avatarUrlPath.length == 0 && userProfile.avatarUrlPath.length == 0 - && userProfile.avatarFileName.length == 0) - || (avatarUrlPath.length > 0 && userProfile.avatarUrlPath.length > 0 && - [avatarUrlPath isEqualToString:userProfile.avatarUrlPath] && userProfile.avatarFileName)); - NSString *_Nullable profileName = [self decryptProfileNameData:profileNameEncrypted profileKey:userProfile.profileKey]; - if (canSkipAvatarUpdate) { - [userProfile updateWithProfileName:profileName dbConnection:self.dbConnection completion:nil]; - } else { - [userProfile updateWithProfileName:profileName - avatarUrlPath:avatarUrlPath - avatarFileName:nil - dbConnection:self.dbConnection - completion:nil]; - } + [userProfile updateWithProfileName:profileName + avatarUrlPath:avatarUrlPath + dbConnection:self.dbConnection + completion:nil]; // If we're updating the profile that corresponds to our local number, // update the local profile as well. diff --git a/SignalMessaging/profiles/OWSUserProfile.h b/SignalMessaging/profiles/OWSUserProfile.h index 6499db695..35402fff1 100644 --- a/SignalMessaging/profiles/OWSUserProfile.h +++ b/SignalMessaging/profiles/OWSUserProfile.h @@ -41,10 +41,6 @@ extern NSString *const kLocalProfileUniqueId; #pragma mark - Update With... Methods -- (void)updateWithProfileName:(nullable NSString *)profileName - dbConnection:(YapDatabaseConnection *)dbConnection - completion:(nullable OWSUserProfileCompletion)completion; - - (void)updateWithProfileName:(nullable NSString *)profileName avatarUrlPath:(nullable NSString *)avatarUrlPath avatarFileName:(nullable NSString *)avatarFileName diff --git a/SignalMessaging/profiles/OWSUserProfile.m b/SignalMessaging/profiles/OWSUserProfile.m index 0b229a93b..4017f3a4f 100644 --- a/SignalMessaging/profiles/OWSUserProfile.m +++ b/SignalMessaging/profiles/OWSUserProfile.m @@ -109,7 +109,7 @@ NSString *const kLocalProfileUniqueId = @"kLocalProfileUniqueId"; BOOL didChange; if (_avatarUrlPath == nil && avatarUrlPath == nil) { didChange = NO; - } else if (_avatarUrlPath != nil && avatarUrlPath != nil) { + } else if (_avatarUrlPath != nil || avatarUrlPath != nil) { didChange = YES; } else { didChange = [_avatarUrlPath isEqualToString:avatarUrlPath]; @@ -204,18 +204,6 @@ NSString *const kLocalProfileUniqueId = @"kLocalProfileUniqueId"; }); } -- (void)updateWithProfileName:(nullable NSString *)profileName - dbConnection:(YapDatabaseConnection *)dbConnection - completion:(nullable OWSUserProfileCompletion)completion -{ - [self applyChanges:^(OWSUserProfile *userProfile) { - [userProfile setProfileName:[profileName ows_stripped]]; - } - functionName:__PRETTY_FUNCTION__ - dbConnection:dbConnection - completion:completion]; -} - - (void)updateWithProfileName:(nullable NSString *)profileName avatarUrlPath:(nullable NSString *)avatarUrlPath avatarFileName:(nullable NSString *)avatarFileName