Improve UX for multiple “no longer verified” members of a group.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 509d2d0aaa
commit a039aac36d

@ -844,6 +844,12 @@ typedef enum : NSUInteger {
- (void)noLongerVerifiedBannerViewWasTapped:(UIGestureRecognizer *)sender - (void)noLongerVerifiedBannerViewWasTapped:(UIGestureRecognizer *)sender
{ {
if (sender.state == UIGestureRecognizerStateRecognized) { if (sender.state == UIGestureRecognizerStateRecognized) {
NSArray<NSString *> *noLongerVerifiedRecipientIds = [self noLongerVerifiedRecipientIds];
if (noLongerVerifiedRecipientIds.count < 1) {
return;
}
BOOL hasMultiple = noLongerVerifiedRecipientIds.count > 1;
UIAlertController *actionSheetController = UIAlertController *actionSheetController =
[UIAlertController alertControllerWithTitle:nil [UIAlertController alertControllerWithTitle:nil
message:nil message:nil
@ -851,12 +857,14 @@ typedef enum : NSUInteger {
__weak MessagesViewController *weakSelf = self; __weak MessagesViewController *weakSelf = self;
UIAlertAction *verifyAction = [UIAlertAction UIAlertAction *verifyAction = [UIAlertAction
actionWithTitle: actionWithTitle:(hasMultiple ? NSLocalizedString(@"VERIFY_PRIVACY_MULTIPLE",
NSLocalizedString(@"VERIFY_PRIVACY", @"Label for button or row which allows users to verify the safety "
@"Label for button or row which allows users to verify the safety number of another user.") @"numbers of multiple users.")
style:UIAlertActionStyleDefault : NSLocalizedString(@"VERIFY_PRIVACY",
@"Label for button or row which allows users to verify the safety "
@"number of another user."))style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) { handler:^(UIAlertAction *_Nonnull action) {
[weakSelf showConversationSettingsAndShowVerification:YES]; [weakSelf showNoLongerVerifiedUI];
}]; }];
[actionSheetController addAction:verifyAction]; [actionSheetController addAction:verifyAction];
@ -1952,6 +1960,18 @@ typedef enum : NSUInteger {
#pragma mark - Actions #pragma mark - Actions
- (void)showNoLongerVerifiedUI
{
NSArray<NSString *> *noLongerVerifiedRecipientIds = [self noLongerVerifiedRecipientIds];
if (noLongerVerifiedRecipientIds.count > 1) {
[self showConversationSettingsAndShowVerification:YES];
} else if (noLongerVerifiedRecipientIds.count == 1) {
// Pick one in an arbitrary but deterministic manner.
NSString *recipientId = noLongerVerifiedRecipientIds.lastObject;
[self showFingerprintWithRecipientId:recipientId];
}
}
- (void)showConversationSettings - (void)showConversationSettings
{ {
[self showConversationSettingsAndShowVerification:NO]; [self showConversationSettingsAndShowVerification:NO];

@ -121,24 +121,60 @@ NS_ASSUME_NONNULL_BEGIN
OWSTableContents *contents = [OWSTableContents new]; OWSTableContents *contents = [OWSTableContents new];
__weak ShowGroupMembersViewController *weakSelf = self;
ContactsViewHelper *helper = self.contactsViewHelper; ContactsViewHelper *helper = self.contactsViewHelper;
OWSTableSection *membersSection = [OWSTableSection new];
// Group Members // Group Members
OWSTableSection *section = [OWSTableSection new]; // If there are "no longer verified" members of the group,
// highlight them in a special section.
NSSet<NSString *> *noLongerVerifiedRecipientIds = [NSSet setWithArray:[self noLongerVerifiedRecipientIds]];
if (noLongerVerifiedRecipientIds.count > 0) {
OWSTableSection *noLongerVerifiedSection = [OWSTableSection new];
noLongerVerifiedSection.headerTitle = NSLocalizedString(@"GROUP_MEMBERS_SECTION_TITLE_NO_LONGER_VERIFIED",
@"Title for the 'no longer verified' section of the 'group members' view.");
membersSection.headerTitle = NSLocalizedString(
@"GROUP_MEMBERS_SECTION_TITLE_MEMBERS", @"Title for the 'members' section of the 'group members' view.");
[self addMembers:noLongerVerifiedRecipientIds.allObjects
toSection:noLongerVerifiedSection
noLongerVerifiedRecipientIds:noLongerVerifiedRecipientIds];
[contents addSection:noLongerVerifiedSection];
}
NSMutableSet *memberRecipientIds = [self.memberRecipientIds mutableCopy]; NSMutableSet *memberRecipientIds = [self.memberRecipientIds mutableCopy];
[memberRecipientIds removeObject:[helper localNumber]]; [memberRecipientIds removeObject:[helper localNumber]];
for (NSString *recipientId in [memberRecipientIds.allObjects sortedArrayUsingSelector:@selector(compare:)]) { [self addMembers:memberRecipientIds.allObjects
toSection:membersSection
noLongerVerifiedRecipientIds:noLongerVerifiedRecipientIds];
[contents addSection:membersSection];
self.contents = contents;
}
- (void)addMembers:(NSArray<NSString *> *)recipientIds
toSection:(OWSTableSection *)section
noLongerVerifiedRecipientIds:(NSSet<NSString *> *)noLongerVerifiedRecipientIds
{
OWSAssert(recipientIds);
OWSAssert(section);
OWSAssert(noLongerVerifiedRecipientIds);
__weak ShowGroupMembersViewController *weakSelf = self;
ContactsViewHelper *helper = self.contactsViewHelper;
for (NSString *recipientId in [recipientIds sortedArrayUsingSelector:@selector(compare:)]) {
[section addItem:[OWSTableItem itemWithCustomCellBlock:^{ [section addItem:[OWSTableItem itemWithCustomCellBlock:^{
ShowGroupMembersViewController *strongSelf = weakSelf; ShowGroupMembersViewController *strongSelf = weakSelf;
OWSAssert(strongSelf); OWSAssert(strongSelf);
ContactTableViewCell *cell = [ContactTableViewCell new]; ContactTableViewCell *cell = [ContactTableViewCell new];
SignalAccount *signalAccount = [helper signalAccountForRecipientId:recipientId]; SignalAccount *signalAccount = [helper signalAccountForRecipientId:recipientId];
BOOL isNoLongerVerified = [noLongerVerifiedRecipientIds containsObject:recipientId];
BOOL isBlocked = [helper isRecipientIdBlocked:recipientId]; BOOL isBlocked = [helper isRecipientIdBlocked:recipientId];
if (isBlocked) { if (isNoLongerVerified) {
cell.accessoryMessage = NSLocalizedString(
@"CONTACT_CELL_IS_NO_LONGER_VERIFIED", @"An indicator that a contact is no longer verified.");
} else if (isBlocked) {
cell.accessoryMessage cell.accessoryMessage
= NSLocalizedString(@"CONTACT_CELL_IS_BLOCKED", @"An indicator that a contact has been blocked."); = NSLocalizedString(@"CONTACT_CELL_IS_BLOCKED", @"An indicator that a contact has been blocked.");
} }
@ -162,9 +198,19 @@ NS_ASSUME_NONNULL_BEGIN
[weakSelf didSelectRecipientId:recipientId]; [weakSelf didSelectRecipientId:recipientId];
}]]; }]];
} }
[contents addSection:section]; }
self.contents = contents; // Returns a collection of the group members who are "no longer verified".
- (NSArray<NSString *> *)noLongerVerifiedRecipientIds
{
NSMutableArray<NSString *> *result = [NSMutableArray new];
for (NSString *recipientId in self.thread.recipientIdentifiers) {
if ([[OWSIdentityManager sharedManager] verificationStateForRecipientId:recipientId]
== OWSVerificationStateNoLongerVerified) {
[result addObject:recipientId];
}
}
return [result copy];
} }
- (void)didSelectRecipientId:(NSString *)recipientId - (void)didSelectRecipientId:(NSString *)recipientId

@ -268,6 +268,9 @@
/* An indicator that a contact has been blocked. */ /* An indicator that a contact has been blocked. */
"CONTACT_CELL_IS_BLOCKED" = "Blocked"; "CONTACT_CELL_IS_BLOCKED" = "Blocked";
/* An indicator that a contact is no longer verified. */
"CONTACT_CELL_IS_NO_LONGER_VERIFIED" = "Not Verified";
/* No comment provided by engineer. */ /* No comment provided by engineer. */
"CONTACT_DETAIL_COMM_TYPE_INSECURE" = "Unregistered Number"; "CONTACT_DETAIL_COMM_TYPE_INSECURE" = "Unregistered Number";
@ -577,6 +580,12 @@
/* Button label for the 'call group member' button */ /* Button label for the 'call group member' button */
"GROUP_MEMBERS_CALL" = "Call"; "GROUP_MEMBERS_CALL" = "Call";
/* Title for the 'members' section of the 'group members' view. */
"GROUP_MEMBERS_SECTION_TITLE_MEMBERS" = "Members";
/* Title for the 'no longer verified' section of the 'group members' view. */
"GROUP_MEMBERS_SECTION_TITLE_NO_LONGER_VERIFIED" = "No Longer Marked as Verified";
/* Button label for the 'send message to group member' button */ /* Button label for the 'send message to group member' button */
"GROUP_MEMBERS_SEND_MESSAGE" = "Send Message"; "GROUP_MEMBERS_SEND_MESSAGE" = "Send Message";
@ -1441,6 +1450,9 @@
/* Label for button or row which allows users to verify the safety number of another user. */ /* Label for button or row which allows users to verify the safety number of another user. */
"VERIFY_PRIVACY" = "Show Safety Number"; "VERIFY_PRIVACY" = "Show Safety Number";
/* Label for button or row which allows users to verify the safety numbers of multiple users. */
"VERIFY_PRIVACY_MULTIPLE" = "Review Safety Numbers";
/* Indicates how to cancel a voice message. */ /* Indicates how to cancel a voice message. */
"VOICE_MESSAGE_CANCEL_INSTRUCTIONS" = "Slide to Cancel"; "VOICE_MESSAGE_CANCEL_INSTRUCTIONS" = "Slide to Cancel";

Loading…
Cancel
Save