Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 8a8f3d81fc
commit 03a4ebc4d8

@ -161,7 +161,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
DDLogInfo(@"%@ application: didFinishLaunchingWithOptions completed.", self.tag);
[OWSAnalytics appLaunchDidBegin];
[OWSProfilesManager sharedManager];
[OWSProfilesManager.sharedManager appLaunchDidBegin];
return YES;
}

@ -116,7 +116,7 @@ NS_ASSUME_NONNULL_BEGIN
if (rawAvatar) {
// We resize the avatar to fill a 210x210 square.
//
// See: AvatarCreateActivity.java in Signal-Android.java.
// See: GroupCreateActivity.java in Signal-Android.java.
UIImage *resizedAvatar = [rawAvatar resizedImageToFillPixelSize:CGSizeMake(210, 210)];
[self.delegate avatarDidChange:resizedAvatar];
}

@ -60,8 +60,6 @@ NS_ASSUME_NONNULL_BEGIN
@"PROFILE_VIEW_NAME_DEFAULT_TEXT", @"Default text for the profile name field of the profile view.");
_nameTextField.delegate = self;
_nameTextField.text = [OWSProfilesManager.sharedManager localProfileName];
DDLogError(@"_nameTextField.text: %@", _nameTextField.text);
[DDLog flushLog];
[_nameTextField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
_avatarView = [AvatarImageView new];
@ -85,7 +83,7 @@ NS_ASSUME_NONNULL_BEGIN
__weak ProfileViewController *weakSelf = self;
// Avatar
// Profile Avatar
OWSTableSection *avatarSection = [OWSTableSection new];
avatarSection.headerTitle = NSLocalizedString(
@"PROFILE_VIEW_AVATAR_SECTION_HEADER", @"Header title for the profile avatar field of the profile view.");
@ -124,7 +122,7 @@ NS_ASSUME_NONNULL_BEGIN
actionBlock:nil]];
[contents addSection:avatarSection];
// Profile
// Profile Name
OWSTableSection *nameSection = [OWSTableSection new];
nameSection.headerTitle = NSLocalizedString(
@"PROFILE_VIEW_NAME_SECTION_HEADER", @"Label for the profile name field of the profile view.");

@ -24,6 +24,8 @@ extern NSString *const kNSNotificationName_LocalProfileDidChange;
success:(void (^)())successBlock
failure:(void (^)())failureBlock;
- (void)appLaunchDidBegin;
@end
NS_ASSUME_NONNULL_END

@ -77,7 +77,7 @@ NSString *const kNSNotificationName_LocalProfileDidChange = @"kNSNotificationNam
NSString *const kOWSProfilesManager_Collection = @"kOWSProfilesManager_Collection";
// This key is used to persist the local user's profile key.
NSString *const kOWSProfilesManager_LocalProfileKey = @"kOWSProfilesManager_LocalProfileKey";
NSString *const kOWSProfilesManager_LocalProfileSecretKey = @"kOWSProfilesManager_LocalProfileSecretKey";
NSString *const kOWSProfilesManager_LocalProfileNameKey = @"kOWSProfilesManager_LocalProfileNameKey";
NSString *const kOWSProfilesManager_LocalProfileAvatarMetadataKey
= @"kOWSProfilesManager_LocalProfileAvatarMetadataKey";
@ -146,14 +146,14 @@ static const NSInteger kProfileKeyLength = 16;
[messageSender setProfilesManager:self];
// Try to load.
_localProfileKey = [self.storageManager objectForKey:kOWSProfilesManager_LocalProfileKey
_localProfileKey = [self.storageManager objectForKey:kOWSProfilesManager_LocalProfileSecretKey
inCollection:kOWSProfilesManager_Collection];
if (!_localProfileKey) {
// Generate
_localProfileKey = [OWSProfilesManager generateLocalProfileKey];
// Persist
[self.storageManager setObject:_localProfileKey
forKey:kOWSProfilesManager_LocalProfileKey
forKey:kOWSProfilesManager_LocalProfileSecretKey
inCollection:kOWSProfilesManager_Collection];
}
OWSAssert(_localProfileKey.length == kProfileKeyLength);
@ -176,6 +176,11 @@ static const NSInteger kProfileKeyLength = 16;
object:nil];
}
- (void)appLaunchDidBegin
{
// Do nothing; we only want to make sure this singleton is created on startup.
}
#pragma mark - Local Profile Key
+ (NSData *)generateLocalProfileKey
@ -380,7 +385,7 @@ static const NSInteger kProfileKeyLength = 16;
inCollection:kOWSProfilesManager_Collection];
UIImage *_Nullable localProfileAvatarImage = nil;
if (localProfileAvatarMetadata) {
localProfileAvatarImage = [self loadProfileAvatarsWithFilename:localProfileAvatarMetadata.fileName];
localProfileAvatarImage = [self loadProfileAvatarWithFilename:localProfileAvatarMetadata.fileName];
if (!localProfileAvatarImage) {
localProfileAvatarMetadata = nil;
}
@ -400,7 +405,7 @@ static const NSInteger kProfileKeyLength = 16;
#pragma mark - Avatar Disk Cache
- (nullable UIImage *)loadProfileAvatarsWithFilename:(NSString *)fileName
- (nullable UIImage *)loadProfileAvatarWithFilename:(NSString *)fileName
{
OWSAssert(fileName.length > 0);

Loading…
Cancel
Save