|
|
|
@ -782,12 +782,12 @@ static NSTimeInterval launchStartedAt;
|
|
|
|
|
NSUserDefaults *userDefaults = NSUserDefaults.standardUserDefaults;
|
|
|
|
|
NSDate *now = [NSDate new];
|
|
|
|
|
NSDate *lastProfilePictureUpload = (NSDate *)[userDefaults objectForKey:@"lastProfilePictureUpload"];
|
|
|
|
|
if ([now timeIntervalSinceDate:lastProfilePictureUpload] > 14 * 24 * 60 * 60) {
|
|
|
|
|
if (lastProfilePictureUpload != nil && [now timeIntervalSinceDate:lastProfilePictureUpload] > 14 * 24 * 60 * 60) {
|
|
|
|
|
OWSProfileManager *profileManager = OWSProfileManager.sharedManager;
|
|
|
|
|
NSString *displayName = [profileManager profileNameForRecipientId:userHexEncodedPublicKey];
|
|
|
|
|
UIImage *profilePicture = [profileManager profileAvatarForRecipientId:userHexEncodedPublicKey];
|
|
|
|
|
[profileManager updateLocalProfileName:displayName avatarImage:profilePicture success:^{
|
|
|
|
|
[userDefaults setObject:now forKey:@"lastProfilePictureUpload"];
|
|
|
|
|
// Do nothing; the user defaults flag is updated in LokiFileServerAPI
|
|
|
|
|
} failure:^(NSError *error) {
|
|
|
|
|
// Do nothing
|
|
|
|
|
} requiresSync:YES];
|
|
|
|
|