From b80d9ddbf728228497638279657eccdafa925077 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 31 May 2018 13:46:59 -0400 Subject: [PATCH] Add warning before sending group message invites. --- Signal/src/ViewControllers/InviteFlow.swift | 16 +++++++++++++++- .../translations/az_AZ.lproj/Localizable.strings | 3 +++ Signal/translations/en.lproj/Localizable.strings | 9 +++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Signal/src/ViewControllers/InviteFlow.swift b/Signal/src/ViewControllers/InviteFlow.swift index 7f4b9a852..f15fbdd8b 100644 --- a/Signal/src/ViewControllers/InviteFlow.swift +++ b/Signal/src/ViewControllers/InviteFlow.swift @@ -169,7 +169,21 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos public func dismissAndSendSMSTo(phoneNumbers: [String]) { self.presentingViewController.dismiss(animated: true) { - self.sendSMSTo(phoneNumbers: phoneNumbers) + if phoneNumbers.count > 0 { + let warning = UIAlertController(title: nil, + message: NSLocalizedString("INVITE_WARNING_MULTIPLE_INVITES_BY_TEXT", + comment: "Alert warning that sending an invite to multiple users will create a group message whose recipients will be able to see each other."), + preferredStyle: .alert) + warning.addAction(UIAlertAction(title: NSLocalizedString("BUTTON_CONTINUE", + comment: "Label for 'continue' button."), + style: .default, handler: { _ in + self.sendSMSTo(phoneNumbers: phoneNumbers) + })) + warning.addAction(OWSAlerts.cancelAction) + self.presentingViewController.present(warning, animated: true, completion: nil) + } else { + self.sendSMSTo(phoneNumbers: phoneNumbers) + } } } diff --git a/Signal/translations/az_AZ.lproj/Localizable.strings b/Signal/translations/az_AZ.lproj/Localizable.strings index 60c918b13..f0b09d368 100644 --- a/Signal/translations/az_AZ.lproj/Localizable.strings +++ b/Signal/translations/az_AZ.lproj/Localizable.strings @@ -280,6 +280,9 @@ /* Button text to enable batch selection mode */ "BUTTON_SELECT" = "Select"; +/* Button text to enable batch selection mode */ +"BUTTON_CONTINUE" = "Continue"; + /* Alert message when calling and permissions for microphone are missing */ "CALL_AUDIO_PERMISSION_MESSAGE" = "Signal requires access to your microphone to make calls and record voice messages. You can grant this permission in the Settings app."; diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index f1076c2e9..90c355165 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -274,6 +274,9 @@ /* Title format for action sheet that offers to block an unknown user.Embeds {{the unknown user's name or phone number}}. */ "BLOCK_OFFER_ACTIONSHEET_TITLE_FORMAT" = "Block %@?"; +/* Label for 'continue' button. */ +"BUTTON_CONTINUE" = "Continue"; + /* Label for generic done button. */ "BUTTON_DONE" = "Done"; @@ -794,6 +797,9 @@ /* Call setup status label */ "END_CALL_UNCATEGORIZED_FAILURE" = "Call Failed."; +/* Error indicating that the phone's contacts could not be retrieved. */ +"ERROR_COULD_NOT_FETCH_CONTACTS" = "ERROR_COULD_NOT_FETCH_CONTACTS"; + /* Generic notice when message failed to send. */ "ERROR_DESCRIPTION_CLIENT_SENDING_FAILURE" = "Failed to send message."; @@ -1040,6 +1046,9 @@ /* Navbar title */ "INVITE_FRIENDS_PICKER_TITLE" = "Invite Friends"; +/* Alert warning that sending an invite to multiple users will create a group message whose recipients will be able to see each other. */ +"INVITE_WARNING_MULTIPLE_INVITES_BY_TEXT" = "Inviting multiple users at the same time will send a group message whose recipients will be able to see each other."; + /* Slider label embeds {{TIME_AMOUNT}}, e.g. '2 hours'. See *_TIME_AMOUNT strings for examples. */ "KEEP_MESSAGES_DURATION" = "Messages disappear after %@.";