From 4777335ffafa60cdded36bb6b626407fe59c5333 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 21 Sep 2017 11:11:05 -0400 Subject: [PATCH] Don't attempt to sync profile until registered. Otherwise there's an unnecessary initial (innocuous) failed HTTP attempt on first launch for unregistered users. // FREEBIE --- Signal/src/Profiles/OWSProfileManager.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Signal/src/Profiles/OWSProfileManager.m b/Signal/src/Profiles/OWSProfileManager.m index 3724ad1c6..f523a400c 100644 --- a/Signal/src/Profiles/OWSProfileManager.m +++ b/Signal/src/Profiles/OWSProfileManager.m @@ -252,10 +252,15 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640; dispatch_async(dispatch_get_main_queue(), ^{ if (isLocalUserProfile) { - [MultiDeviceProfileKeyUpdateJob runWithProfileKey:userProfile.profileKey - identityManager:self.identityManager - messageSender:self.messageSender - profileManager:self]; + // We populate an initial (empty) profile on launch of a new install, but until + // we have a registered account, syncing will fail (and there could not be any + // linked device to sync to at this point anyway). + if ([TSAccountManager isRegistered]) { + [MultiDeviceProfileKeyUpdateJob runWithProfileKey:userProfile.profileKey + identityManager:self.identityManager + messageSender:self.messageSender + profileManager:self]; + } [[NSNotificationCenter defaultCenter] postNotificationNameAsync:kNSNotificationName_LocalProfileDidChange object:nil