From ae1908c40c5b57d659e9035b642d29355f48d281 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 21 Aug 2017 16:58:26 -0400 Subject: [PATCH] Show "share profile with group" banner. // FREEBIE --- .../AppSettingsViewController.m | 4 +- Signal/src/ViewControllers/AvatarViewHelper.m | 6 +- .../ConversationView/MessagesViewController.m | 75 ++++++++++--------- .../FingerprintViewScanController.m | 7 +- .../MessageComposeTableViewController.m | 8 +- .../ViewControllers/NewGroupViewController.m | 4 +- .../OWSConversationSettingsViewController.m | 27 ++----- .../OWSLinkedDevicesTableViewController.m | 12 +-- .../PrivacySettingsTableViewController.m | 5 +- .../ViewControllers/ProfileViewController.m | 4 +- .../SafetyNumberConfirmationAlert.swift | 3 +- .../ShowGroupMembersViewController.m | 11 +-- Signal/src/util/ThreadUtil.h | 2 + Signal/src/util/ThreadUtil.m | 31 +++++++- Signal/src/views/OWSAlerts.swift | 9 +++ .../translations/en.lproj/Localizable.strings | 5 +- 16 files changed, 106 insertions(+), 107 deletions(-) diff --git a/Signal/src/ViewControllers/AppSettingsViewController.m b/Signal/src/ViewControllers/AppSettingsViewController.m index 9a91317fb..ee385d514 100644 --- a/Signal/src/ViewControllers/AppSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettingsViewController.m @@ -354,9 +354,7 @@ handler:^(UIAlertAction *action) { [self proceedToUnregistration]; }]]; - [alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - style:UIAlertActionStyleCancel - handler:nil]]; + [alertController addAction:[OWSAlerts cancelAction]]; [self presentViewController:alertController animated:YES completion:nil]; } diff --git a/Signal/src/ViewControllers/AvatarViewHelper.m b/Signal/src/ViewControllers/AvatarViewHelper.m index 3a300e0c3..9e97d54e9 100644 --- a/Signal/src/ViewControllers/AvatarViewHelper.m +++ b/Signal/src/ViewControllers/AvatarViewHelper.m @@ -4,6 +4,7 @@ #import "AvatarViewHelper.h" #import "OWSContactsManager.h" +#import "Signal-Swift.h" #import "UIUtil.h" #import #import @@ -32,10 +33,7 @@ NS_ASSUME_NONNULL_BEGIN [UIAlertController alertControllerWithTitle:self.delegate.avatarActionSheetTitle message:nil preferredStyle:UIAlertControllerStyleActionSheet]; - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - style:UIAlertActionStyleCancel - handler:nil]; - [actionSheetController addAction:dismissAction]; + [actionSheetController addAction:[OWSAlerts cancelAction]]; UIAlertAction *takePictureAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"MEDIA_FROM_CAMERA_BUTTON", @"media picker option to take photo or video") diff --git a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m index 57342956c..5d9d439bf 100644 --- a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m +++ b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m @@ -784,6 +784,15 @@ typedef enum : NSUInteger { [self createBannerWithTitle:blockStateMessage bannerColor:[UIColor ows_destructiveRedColor] tapSelector:@selector(blockBannerViewWasTapped:)]; + return; + } + + if ([ThreadUtil shouldShowGroupProfileBannerInThread:self.thread blockingManager:self.blockingManager]) { + [self createBannerWithTitle: + NSLocalizedString(@"MESSAGES_VIEW_GROUP_PROFILE_WHITELIST_BANNER", + @"Text for banner in group conversation view that offers to share your profile with this group.") + bannerColor:[UIColor ows_reminderYellowColor] + tapSelector:@selector(groupProfileWhitelistBannerWasTapped:)]; } } @@ -866,6 +875,30 @@ typedef enum : NSUInteger { } } +- (void)groupProfileWhitelistBannerWasTapped:(UIGestureRecognizer *)sender +{ + if (sender.state != UIGestureRecognizerStateRecognized) { + return; + } + + UIAlertController *alertController = + [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; + + UIAlertAction *leaveAction = [UIAlertAction + actionWithTitle:NSLocalizedString(@"CONVERSATION_SETTINGS_VIEW_SHARE_PROFILE", + @"Button to confirm that user wants to share their profile with a user or group.") + style:UIAlertActionStyleDestructive + handler:^(UIAlertAction *_Nonnull action) { + [OWSProfileManager.sharedManager addThreadToProfileWhitelist:self.thread]; + + [self ensureBannerState]; + }]; + [alertController addAction:leaveAction]; + [alertController addAction:[OWSAlerts cancelAction]]; + + [self presentViewController:alertController animated:YES completion:nil]; +} + - (void)noLongerVerifiedBannerViewWasTapped:(UIGestureRecognizer *)sender { if (sender.state == UIGestureRecognizerStateRecognized) { @@ -2388,10 +2421,7 @@ typedef enum : NSUInteger { message:nil preferredStyle:UIAlertControllerStyleActionSheet]; - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - style:UIAlertActionStyleCancel - handler:nil]; - [actionSheetController addAction:dismissAction]; + [actionSheetController addAction:[OWSAlerts cancelAction]]; UIAlertAction *deleteMessageAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_DELETE_TITLE", @"") style:UIAlertActionStyleDestructive @@ -2430,10 +2460,7 @@ typedef enum : NSUInteger { message:nil preferredStyle:UIAlertControllerStyleActionSheet]; - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - style:UIAlertActionStyleCancel - handler:nil]; - [actionSheetController addAction:dismissAction]; + [actionSheetController addAction:[OWSAlerts cancelAction]]; UIAlertAction *deleteMessageAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_DELETE_TITLE", @"") style:UIAlertActionStyleDestructive @@ -2566,10 +2593,7 @@ typedef enum : NSUInteger { message:alertMessage preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - style:UIAlertActionStyleCancel - handler:nil]; - [alertController addAction:dismissAction]; + [alertController addAction:[OWSAlerts cancelAction]]; UIAlertAction *resetSessionAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"FINGERPRINT_SHRED_KEYMATERIAL_BUTTON", @"") @@ -2601,10 +2625,7 @@ typedef enum : NSUInteger { message:nil preferredStyle:UIAlertControllerStyleActionSheet]; - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - style:UIAlertActionStyleCancel - handler:nil]; - [actionSheetController addAction:dismissAction]; + [actionSheetController addAction:[OWSAlerts cancelAction]]; UIAlertAction *showSafteyNumberAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"SHOW_SAFETY_NUMBER_ACTION", @"Action sheet item") @@ -2657,10 +2678,7 @@ typedef enum : NSUInteger { [weakSelf callAction:nil]; }]; [alertController addAction:callAction]; - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", nil) - style:UIAlertActionStyleCancel - handler:nil]; - [alertController addAction:dismissAction]; + [alertController addAction:[OWSAlerts cancelAction]]; [[UIApplication sharedApplication].frontmostViewController presentViewController:alertController animated:YES @@ -2687,10 +2705,7 @@ typedef enum : NSUInteger { UIAlertController *actionSheetController = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet]; - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - style:UIAlertActionStyleCancel - handler:nil]; - [actionSheetController addAction:dismissAction]; + [actionSheetController addAction:[OWSAlerts cancelAction]]; UIAlertAction *blockAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_OFFER_ACTIONSHEET_BLOCK_ACTION", @@ -2762,12 +2777,7 @@ typedef enum : NSUInteger { }]; [alertController addAction:leaveAction]; - UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", nil) - style:UIAlertActionStyleCancel - handler:^(UIAlertAction *_Nonnull action){ - // Do nothing. - }]; - [alertController addAction:cancelAction]; + [alertController addAction:[OWSAlerts cancelAction]]; [self presentViewController:alertController animated:YES completion:nil]; } @@ -3757,10 +3767,7 @@ typedef enum : NSUInteger { UIAlertController *actionSheetController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; - UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - style:UIAlertActionStyleCancel - handler:nil]; - [actionSheetController addAction:cancelAction]; + [actionSheetController addAction:[OWSAlerts cancelAction]]; UIAlertAction *takeMediaAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"MEDIA_FROM_CAMERA_BUTTON", @"media picker option to take photo or video") diff --git a/Signal/src/ViewControllers/FingerprintViewScanController.m b/Signal/src/ViewControllers/FingerprintViewScanController.m index d1a461dab..c289c88ef 100644 --- a/Signal/src/ViewControllers/FingerprintViewScanController.m +++ b/Signal/src/ViewControllers/FingerprintViewScanController.m @@ -249,12 +249,7 @@ NS_ASSUME_NONNULL_BEGIN }]]; } - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", nil) - style:UIAlertActionStyleCancel - handler:^(UIAlertAction *action) { - cancelBlock(); - }]; - [alertController addAction:dismissAction]; + [alertController addAction:[OWSAlerts cancelAction]]; [viewController presentViewController:alertController animated:YES completion:nil]; diff --git a/Signal/src/ViewControllers/MessageComposeTableViewController.m b/Signal/src/ViewControllers/MessageComposeTableViewController.m index 78c33b0c8..0b28d7094 100644 --- a/Signal/src/ViewControllers/MessageComposeTableViewController.m +++ b/Signal/src/ViewControllers/MessageComposeTableViewController.m @@ -516,12 +516,6 @@ NS_ASSUME_NONNULL_BEGIN message:confirmMessage preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - style:UIAlertActionStyleCancel - handler:^(UIAlertAction *action) { - DDLogDebug(@"Cancel action"); - }]; - UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"") style:UIAlertActionStyleDefault @@ -545,7 +539,7 @@ NS_ASSUME_NONNULL_BEGIN } }]; - [alertController addAction:cancelAction]; + [alertController addAction:[OWSAlerts cancelAction]]; [alertController addAction:okAction]; self.searchBar.text = @""; diff --git a/Signal/src/ViewControllers/NewGroupViewController.m b/Signal/src/ViewControllers/NewGroupViewController.m index 7af2fbaab..1866c8773 100644 --- a/Signal/src/ViewControllers/NewGroupViewController.m +++ b/Signal/src/ViewControllers/NewGroupViewController.m @@ -572,9 +572,7 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68; handler:^(UIAlertAction *action) { [self.navigationController popViewControllerAnimated:YES]; }]]; - [controller addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", nil) - style:UIAlertActionStyleCancel - handler:nil]]; + [controller addAction:[OWSAlerts cancelAction]]; [self presentViewController:controller animated:YES completion:nil]; } diff --git a/Signal/src/ViewControllers/OWSConversationSettingsViewController.m b/Signal/src/ViewControllers/OWSConversationSettingsViewController.m index add27d599..632f4a540 100644 --- a/Signal/src/ViewControllers/OWSConversationSettingsViewController.m +++ b/Signal/src/ViewControllers/OWSConversationSettingsViewController.m @@ -774,6 +774,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)showShareProfileAlert { + [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES]; + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; @@ -785,14 +787,7 @@ NS_ASSUME_NONNULL_BEGIN [self shareProfile]; }]; [alertController addAction:leaveAction]; - - UIAlertAction *cancelAction = [UIAlertAction - actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", nil) - style:UIAlertActionStyleCancel - handler:^(UIAlertAction *_Nonnull action) { - [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES]; - }]; - [alertController addAction:cancelAction]; + [alertController addAction:[OWSAlerts cancelAction]]; [self presentViewController:alertController animated:YES completion:nil]; } @@ -872,6 +867,8 @@ NS_ASSUME_NONNULL_BEGIN - (void)didTapLeaveGroup { + [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES]; + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"CONFIRM_LEAVE_GROUP_TITLE", @"Alert title") message:NSLocalizedString(@"CONFIRM_LEAVE_GROUP_DESCRIPTION", @"Alert body") @@ -884,14 +881,7 @@ NS_ASSUME_NONNULL_BEGIN [self leaveGroup]; }]; [alertController addAction:leaveAction]; - - UIAlertAction *cancelAction = [UIAlertAction - actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", nil) - style:UIAlertActionStyleCancel - handler:^(UIAlertAction *_Nonnull action) { - [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES]; - }]; - [alertController addAction:cancelAction]; + [alertController addAction:[OWSAlerts cancelAction]]; [self presentViewController:alertController animated:YES completion:nil]; } @@ -1114,10 +1104,7 @@ NS_ASSUME_NONNULL_BEGIN }]]; } - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - style:UIAlertActionStyleCancel - handler:nil]; - [actionSheetController addAction:dismissAction]; + [actionSheetController addAction:[OWSAlerts cancelAction]]; [self presentViewController:actionSheetController animated:YES completion:nil]; } diff --git a/Signal/src/ViewControllers/OWSLinkedDevicesTableViewController.m b/Signal/src/ViewControllers/OWSLinkedDevicesTableViewController.m index 32ad55e42..6106886c4 100644 --- a/Signal/src/ViewControllers/OWSLinkedDevicesTableViewController.m +++ b/Signal/src/ViewControllers/OWSLinkedDevicesTableViewController.m @@ -338,10 +338,7 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1; message:confirmationMessage preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", nil) - style:UIAlertActionStyleCancel - handler:nil]; - [alertController addAction:cancelAction]; + [alertController addAction:[OWSAlerts cancelAction]]; UIAlertAction *unlinkAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"UNLINK_ACTION", "button title for unlinking a device") @@ -377,12 +374,7 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1; [self unlinkDevice:device success:successCallback]; }]; [alertController addAction:retryAction]; - - UIAlertAction *cancelRetryAction = - [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", nil) - style:UIAlertActionStyleCancel - handler:nil]; - [alertController addAction:cancelRetryAction]; + [alertController addAction:[OWSAlerts cancelAction]]; dispatch_async(dispatch_get_main_queue(), ^{ [self presentViewController:alertController animated:YES completion:nil]; diff --git a/Signal/src/ViewControllers/PrivacySettingsTableViewController.m b/Signal/src/ViewControllers/PrivacySettingsTableViewController.m index 5ae04bd71..2186ada46 100644 --- a/Signal/src/ViewControllers/PrivacySettingsTableViewController.m +++ b/Signal/src/ViewControllers/PrivacySettingsTableViewController.m @@ -116,10 +116,7 @@ NS_ASSUME_NONNULL_BEGIN @"Alert message before user confirms clearing history") preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - style:UIAlertActionStyleCancel - handler:nil]; - [alertController addAction:dismissAction]; + [alertController addAction:[OWSAlerts cancelAction]]; UIAlertAction *deleteAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"SETTINGS_DELETE_HISTORYLOG_CONFIRMATION_BUTTON", @"") diff --git a/Signal/src/ViewControllers/ProfileViewController.m b/Signal/src/ViewControllers/ProfileViewController.m index 9ac0fea8b..0cb6a4ea1 100644 --- a/Signal/src/ViewControllers/ProfileViewController.m +++ b/Signal/src/ViewControllers/ProfileViewController.m @@ -294,9 +294,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat handler:^(UIAlertAction *action) { [self profileCompletedOrSkipped]; }]]; - [controller addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", nil) - style:UIAlertActionStyleCancel - handler:nil]]; + [controller addAction:[OWSAlerts cancelAction]]; [self presentViewController:controller animated:YES completion:nil]; } diff --git a/Signal/src/ViewControllers/SafetyNumberConfirmationAlert.swift b/Signal/src/ViewControllers/SafetyNumberConfirmationAlert.swift index 311f1b9fc..e50c6eeed 100644 --- a/Signal/src/ViewControllers/SafetyNumberConfirmationAlert.swift +++ b/Signal/src/ViewControllers/SafetyNumberConfirmationAlert.swift @@ -74,8 +74,7 @@ class SafetyNumberConfirmationAlert: NSObject { } actionSheetController.addAction(showSafetyNumberAction) - let dismissAction = UIAlertAction(title: NSLocalizedString("TXT_CANCEL_TITLE", comment: "generic cancel text"), style: .cancel) - actionSheetController.addAction(dismissAction) + actionSheetController.addAction(OWSAlerts.cancelAction()) UIApplication.shared.frontmostViewController?.present(actionSheetController, animated: true) return true diff --git a/Signal/src/ViewControllers/ShowGroupMembersViewController.m b/Signal/src/ViewControllers/ShowGroupMembersViewController.m index 605aaedba..445cfd1d3 100644 --- a/Signal/src/ViewControllers/ShowGroupMembersViewController.m +++ b/Signal/src/ViewControllers/ShowGroupMembersViewController.m @@ -227,11 +227,7 @@ NS_ASSUME_NONNULL_BEGIN [weakSelf resetAllNoLongerVerified]; }]; [actionSheetController addAction:verifyAction]; - - UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - style:UIAlertActionStyleCancel - handler:nil]; - [actionSheetController addAction:cancelAction]; + [actionSheetController addAction:[OWSAlerts cancelAction]]; [self presentViewController:actionSheetController animated:YES completion:nil]; } @@ -390,10 +386,7 @@ NS_ASSUME_NONNULL_BEGIN }]]; } - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - style:UIAlertActionStyleCancel - handler:nil]; - [actionSheetController addAction:dismissAction]; + [actionSheetController addAction:[OWSAlerts cancelAction]]; [self presentViewController:actionSheetController animated:YES completion:nil]; } diff --git a/Signal/src/util/ThreadUtil.h b/Signal/src/util/ThreadUtil.h index 355e4338d..3aa4da3d1 100644 --- a/Signal/src/util/ThreadUtil.h +++ b/Signal/src/util/ThreadUtil.h @@ -93,6 +93,8 @@ NS_ASSUME_NONNULL_BEGIN firstUnseenInteractionTimestamp:(nullable NSNumber *)firstUnseenInteractionTimestamp maxRangeSize:(int)maxRangeSize; ++ (BOOL)shouldShowGroupProfileBannerInThread:(TSThread *)thread blockingManager:(OWSBlockingManager *)blockingManager; + // This method should be called right _before_ we send a message to a thread, // since we want to auto-add contact threads to the profile whitelist if the // conversation was initiated by the local user. diff --git a/Signal/src/util/ThreadUtil.m b/Signal/src/util/ThreadUtil.m index 78d7e10e3..2204d0ab3 100644 --- a/Signal/src/util/ThreadUtil.m +++ b/Signal/src/util/ThreadUtil.m @@ -422,7 +422,7 @@ NS_ASSUME_NONNULL_BEGIN if (!hasUnwhitelistedMember) { // Don't show offer in group thread if all members are already individually // whitelisted. - hasUnwhitelistedMember = YES; + shouldHaveAddToProfileWhitelistOffer = NO; } } @@ -531,6 +531,35 @@ NS_ASSUME_NONNULL_BEGIN return result; } ++ (BOOL)shouldShowGroupProfileBannerInThread:(TSThread *)thread blockingManager:(OWSBlockingManager *)blockingManager +{ + OWSAssert(thread); + OWSAssert(blockingManager); + + if (!thread.isGroupThread) { + return NO; + } + if ([OWSProfileManager.sharedManager isThreadInProfileWhitelist:thread]) { + return NO; + } + if (![OWSProfileManager.sharedManager hasLocalProfile]) { + return NO; + } + BOOL hasUnwhitelistedMember = NO; + NSArray *blockedPhoneNumbers = [blockingManager blockedPhoneNumbers]; + for (NSString *recipientId in thread.recipientIdentifiers) { + if (![blockedPhoneNumbers containsObject:recipientId] + && ![OWSProfileManager.sharedManager isUserInProfileWhitelist:recipientId]) { + hasUnwhitelistedMember = YES; + break; + } + } + if (!hasUnwhitelistedMember) { + return NO; + } + return YES; +} + + (BOOL)addThreadToProfileWhitelistIfEmptyContactThread:(TSThread *)thread { OWSAssert(thread); diff --git a/Signal/src/views/OWSAlerts.swift b/Signal/src/views/OWSAlerts.swift index 308c6ea09..1b1c3fb0d 100644 --- a/Signal/src/views/OWSAlerts.swift +++ b/Signal/src/views/OWSAlerts.swift @@ -39,4 +39,13 @@ import Foundation alert.addAction(UIAlertAction(title: actionTitle, style: .default, handler: nil)) UIApplication.shared.frontmostViewController?.present(alert, animated: true, completion: nil) } + + public class func cancelAction() -> UIAlertAction { + let action = UIAlertAction(title: NSLocalizedString("TXT_CANCEL_TITLE", comment:"Label for the cancel button in an alert or action sheet."), style: .cancel) { _ in + Logger.debug("Cancel item") + // Do nothing. + } + return action + } + } diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index cc28579a8..ee221eb3f 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -814,6 +814,9 @@ /* Indicates that some members of this group has been blocked. Embeds {{the number of blocked users in this group}}. */ "MESSAGES_VIEW_GROUP_N_MEMBERS_BLOCKED_FORMAT" = "You Blocked %@ Members of this Group"; +/* Text for banner in group conversation view that offers to share your profile with this group. */ +"MESSAGES_VIEW_GROUP_PROFILE_WHITELIST_BANNER" = "Share Your Profile With This Group?"; + /* Indicates that more than one member of this group conversation is no longer verified. */ "MESSAGES_VIEW_N_MEMBERS_NO_LONGER_VERIFIED" = "More than one member of this group is no longer marked as verified. Tap for options."; @@ -1450,7 +1453,7 @@ /* {{number of weeks}}, embedded in strings, e.g. 'Alice updated disappearing messages expiration to {{5 weeks}}'. See other *_TIME_AMOUNT strings */ "TIME_AMOUNT_WEEKS" = "%@ weeks"; -/* generic cancel text */ +/* Label for the cancel button in an alert or action sheet. */ "TXT_CANCEL_TITLE" = "Cancel"; /* No comment provided by engineer. */