parent
83a02536a4
commit
a748987d72
|
@ -19,6 +19,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
- (UIViewController *)fromViewController;
|
||||
|
||||
- (BOOL)hasClearAvatarAction;
|
||||
|
||||
@optional
|
||||
|
||||
- (NSString *)clearAvatarActionLabel;
|
||||
|
||||
- (void)clearAvatar;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
|
|
@ -53,6 +53,15 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}];
|
||||
[actionSheetController addAction:choosePictureAction];
|
||||
|
||||
if (self.delegate.hasClearAvatarAction) {
|
||||
UIAlertAction *clearAction = [UIAlertAction actionWithTitle:self.delegate.clearAvatarActionLabel
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
[self.delegate clearAvatar];
|
||||
}];
|
||||
[actionSheetController addAction:clearAction];
|
||||
}
|
||||
|
||||
[self.delegate.fromViewController presentViewController:actionSheetController animated:true completion:nil];
|
||||
}
|
||||
|
||||
|
|
|
@ -626,6 +626,11 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)hasClearAvatarAction
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
#pragma mark - AddToGroupViewControllerDelegate
|
||||
|
||||
- (void)recipientIdWasAdded:(NSString *)recipientId
|
||||
|
|
|
@ -272,7 +272,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
- (NSString *)avatarActionSheetTitle
|
||||
{
|
||||
return NSLocalizedString(
|
||||
@"PROFILE_AVATAR_ACTIONSHEET_TITLE", @"Action Sheet title prompting the user for a profile avatar");
|
||||
@"PROFILE_VIEW_AVATAR_ACTIONSHEET_TITLE", @"Action Sheet title prompting the user for a profile avatar");
|
||||
}
|
||||
|
||||
- (void)avatarDidChange:(UIImage *)image
|
||||
|
@ -289,6 +289,21 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)hasClearAvatarAction
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSString *)clearAvatarActionLabel
|
||||
{
|
||||
return NSLocalizedString(@"PROFILE_VIEW_CLEAR_AVATAR", @"Label for action that clear's the user's profile avatar");
|
||||
}
|
||||
|
||||
- (void)clearAvatar
|
||||
{
|
||||
self.avatar = nil;
|
||||
}
|
||||
|
||||
#pragma mark - Logging
|
||||
|
||||
+ (NSString *)tag
|
||||
|
|
|
@ -507,6 +507,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)hasClearAvatarAction
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
#pragma mark - AddToGroupViewControllerDelegate
|
||||
|
||||
- (void)recipientIdWasAdded:(NSString *)recipientId
|
||||
|
|
|
@ -1037,7 +1037,7 @@
|
|||
"PROCEED_BUTTON" = "Proceed";
|
||||
|
||||
/* Action Sheet title prompting the user for a profile avatar */
|
||||
"PROFILE_AVATAR_ACTIONSHEET_TITLE" = "Set Profile Avatar";
|
||||
"PROFILE_VIEW_AVATAR_ACTIONSHEET_TITLE" = "Set Profile Avatar";
|
||||
|
||||
/* Instructions for how to change the profile avatar. */
|
||||
"PROFILE_VIEW_AVATAR_INSTRUCTIONS" = "Tap to Select Avatar";
|
||||
|
@ -1045,6 +1045,9 @@
|
|||
/* Header title for the profile avatar field of the profile view. */
|
||||
"PROFILE_VIEW_AVATAR_SECTION_HEADER" = "Avatar";
|
||||
|
||||
/* Label for action that clear's the user's profile avatar */
|
||||
"PROFILE_VIEW_CLEAR_AVATAR" = "Clear Avatar";
|
||||
|
||||
/* Default text for the profile name field of the profile view. */
|
||||
"PROFILE_VIEW_NAME_DEFAULT_TEXT" = "Enter your name.";
|
||||
|
||||
|
|
|
@ -443,6 +443,8 @@ static const NSInteger kProfileKeyLength = 16;
|
|||
return profileAvatarsDirPath;
|
||||
}
|
||||
|
||||
// TODO: We may want to clean up this directory in the "orphan cleanup" logic.
|
||||
|
||||
#pragma mark - Notifications
|
||||
|
||||
- (void)applicationDidBecomeActive:(NSNotification *)notification
|
||||
|
|
Loading…
Reference in New Issue