diff --git a/Signal/src/UserInterface/Strings.swift b/Signal/src/UserInterface/Strings.swift index 2dfe5c59a..6c77c4411 100644 --- a/Signal/src/UserInterface/Strings.swift +++ b/Signal/src/UserInterface/Strings.swift @@ -9,7 +9,7 @@ import Foundation */ @objc class CommonStrings: NSObject { - static let dismissActionText = NSLocalizedString("DISMISS_BUTTON_TEXT", comment: "Short text to dismiss current modal / actionsheet / screen") + static let dismissButton = NSLocalizedString("DISMISS_BUTTON_TEXT", comment: "Short text to dismiss current modal / actionsheet / screen") } @objc class CallStrings: NSObject { diff --git a/Signal/src/ViewControllers/CallViewController.swift b/Signal/src/ViewControllers/CallViewController.swift index a8b123dde..cf8d01788 100644 --- a/Signal/src/ViewControllers/CallViewController.swift +++ b/Signal/src/ViewControllers/CallViewController.swift @@ -371,7 +371,6 @@ class CallViewController: UIViewController, CallObserver, CallServiceObserver, R setButtonSelectedImage(button: videoModeMuteButton, imageName: "video-mute-selected") setButtonSelectedImage(button: audioModeVideoButton, imageName: "audio-call-video-active") setButtonSelectedImage(button: videoModeVideoButton, imageName: "video-video-selected") -// setButtonSelectedImage(button: audioRouteButton, imageName: "audio-call-speaker-active") ongoingCallView = createContainerForCallControls(controlGroups : [ [audioModeMuteButton, audioRouteButton, audioModeVideoButton ], @@ -392,7 +391,7 @@ class CallViewController: UIViewController, CallObserver, CallServiceObserver, R let actionSheetController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) - let dismissAction = UIAlertAction(title: CommonStrings.dismissActionText, style: .cancel, handler: nil) + let dismissAction = UIAlertAction(title: CommonStrings.dismissButton, style: .cancel, handler: nil) actionSheetController.addAction(dismissAction) let currentAudioSource = callUIAdapter.audioService.currentAudioSource(call: self.call) diff --git a/Signal/src/ViewControllers/CodeVerificationViewController.m b/Signal/src/ViewControllers/CodeVerificationViewController.m index ab919977d..4036ee98d 100644 --- a/Signal/src/ViewControllers/CodeVerificationViewController.m +++ b/Signal/src/ViewControllers/CodeVerificationViewController.m @@ -301,7 +301,7 @@ NS_ASSUME_NONNULL_BEGIN message:error.localizedDescription preferredStyle:UIAlertControllerStyleAlert]; } - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"DISMISS_BUTTON_TEXT", nil) + UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.dismissButton style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { [_challengeTextField becomeFirstResponder]; diff --git a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m index 84e9da8ac..73a046098 100644 --- a/Signal/src/ViewControllers/ConversationView/MessagesViewController.m +++ b/Signal/src/ViewControllers/ConversationView/MessagesViewController.m @@ -872,13 +872,11 @@ typedef enum : NSUInteger { }]; [actionSheetController addAction:verifyAction]; - UIAlertAction *dismissAction = - [UIAlertAction actionWithTitle:NSLocalizedString(@"DISMISS_BUTTON_TEXT", - @"Generic short text for button to dismiss a dialog") - style:UIAlertActionStyleCancel - handler:^(UIAlertAction *_Nonnull action) { - [weakSelf resetVerificationStateToDefault]; - }]; + UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.dismissButton + style:UIAlertActionStyleCancel + handler:^(UIAlertAction *_Nonnull action) { + [weakSelf resetVerificationStateToDefault]; + }]; [actionSheetController addAction:dismissAction]; [self presentViewController:actionSheetController animated:YES completion:nil]; @@ -2950,9 +2948,8 @@ typedef enum : NSUInteger { @"Alert body when picking a document fails because user picked a directory/bundle") preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"DISMISS_BUTTON_TEXT", nil) - style:UIAlertActionStyleCancel - handler:nil]; + UIAlertAction *dismissAction = + [UIAlertAction actionWithTitle:CommonStrings.dismissButton style:UIAlertActionStyleCancel handler:nil]; [alertController addAction:dismissAction]; dispatch_async(dispatch_get_main_queue(), ^{ @@ -2978,9 +2975,8 @@ typedef enum : NSUInteger { message:nil preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"DISMISS_BUTTON_TEXT", nil) - style:UIAlertActionStyleCancel - handler:nil]; + UIAlertAction *dismissAction = + [UIAlertAction actionWithTitle:CommonStrings.dismissButton style:UIAlertActionStyleCancel handler:nil]; [alertController addAction:dismissAction]; dispatch_async(dispatch_get_main_queue(), ^{ diff --git a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift index f960be65b..a2e41dbae 100644 --- a/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift +++ b/Signal/src/ViewControllers/ExperienceUpgradesPageViewController.swift @@ -194,7 +194,7 @@ class ExperienceUpgradesPageViewController: UIViewController, UIPageViewControll // Dismiss button let dismissButton = UIButton() view.addSubview(dismissButton) - dismissButton.setTitle(NSLocalizedString("DISMISS_BUTTON_TEXT", comment: ""), for: .normal) + dismissButton.setTitle(CommonStrings.dismissButton, for: .normal) dismissButton.setTitleColor(UIColor.white, for: .normal) dismissButton.isUserInteractionEnabled = true dismissButton.addTarget(self, action:#selector(didTapDismissButton), for: .touchUpInside) diff --git a/Signal/src/ViewControllers/FingerprintViewScanController.m b/Signal/src/ViewControllers/FingerprintViewScanController.m index c49b42c2c..b8561db6b 100644 --- a/Signal/src/ViewControllers/FingerprintViewScanController.m +++ b/Signal/src/ViewControllers/FingerprintViewScanController.m @@ -189,7 +189,6 @@ NS_ASSUME_NONNULL_BEGIN DDLogInfo(@"%@ Successfully verified safety numbers.", tag); NSString *successTitle = NSLocalizedString(@"SUCCESSFUL_VERIFICATION_TITLE", nil); - NSString *dismissText = NSLocalizedString(@"DISMISS_BUTTON_TEXT", nil); NSString *descriptionFormat = NSLocalizedString( @"SUCCESSFUL_VERIFICATION_DESCRIPTION", @"Alert body after verifying privacy with {{other user's name}}"); NSString *successDescription = [NSString stringWithFormat:descriptionFormat, contactName]; @@ -209,7 +208,7 @@ NS_ASSUME_NONNULL_BEGIN [viewController dismissViewControllerAnimated:true completion:nil]; }]]; UIAlertAction *dismissAction = - [UIAlertAction actionWithTitle:dismissText + [UIAlertAction actionWithTitle:CommonStrings.dismissButton style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { [viewController dismissViewControllerAnimated:true completion:nil]; diff --git a/Signal/src/ViewControllers/InviteFlow.swift b/Signal/src/ViewControllers/InviteFlow.swift index 3513af574..50eb09603 100644 --- a/Signal/src/ViewControllers/InviteFlow.swift +++ b/Signal/src/ViewControllers/InviteFlow.swift @@ -1,5 +1,6 @@ -// Created by Michael Kirk on 11/18/16. -// Copyright © 2016 Open Whisper Systems. All rights reserved. +// +// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// import Foundation import Social @@ -31,7 +32,7 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos super.init() actionSheetController.addAction(dismissAction()) - + if #available(iOS 9.0, *) { if let messageAction = messageAction() { actionSheetController.addAction(messageAction) @@ -72,7 +73,7 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos twitterViewController.add(#imageLiteral(resourceName: "twitter_sharing_image")) let tweetTitle = NSLocalizedString("SHARE_ACTION_TWEET", comment:"action sheet item") - return UIAlertAction(title: tweetTitle, style: .default) { action in + return UIAlertAction(title: tweetTitle, style: .default) { _ in Logger.debug("\(self.TAG) Chose tweet") self.presentingViewController.present(twitterViewController, animated: true, completion: nil) @@ -80,7 +81,7 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos } func dismissAction() -> UIAlertAction { - return UIAlertAction(title: NSLocalizedString("DISMISS_BUTTON_TEXT", comment:""), style: .cancel) + return UIAlertAction(title: CommonStrings.dismissButton, style: .cancel) } // MARK: ContactsPickerDelegate @@ -134,10 +135,10 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos } let messageTitle = NSLocalizedString("SHARE_ACTION_MESSAGE", comment: "action sheet item to open native messages app") - return UIAlertAction(title: messageTitle, style: .default) { action in + return UIAlertAction(title: messageTitle, style: .default) { _ in Logger.debug("\(self.TAG) Chose message.") self.channel = .message - let picker = ContactsPicker(delegate: self, multiSelection: true, subtitleCellType: .phoneNumber) + let picker = ContactsPicker(delegate: self, multiSelection: true, subtitleCellType: .phoneNumber) let navigationController = UINavigationController(rootViewController: picker) self.presentingViewController.present(navigationController, animated: true) } @@ -173,7 +174,7 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos switch result { case .failed: let warning = UIAlertController(title: nil, message: NSLocalizedString("SEND_INVITE_FAILURE", comment:"Alert body after invite failed"), preferredStyle: .alert) - warning.addAction(UIAlertAction(title: NSLocalizedString("DISMISS_BUTTON_TEXT", comment:""), style: .default, handler: nil)) + warning.addAction(UIAlertAction(title: CommonStrings.dismissButton, style: .default, handler: nil)) self.presentingViewController.present(warning, animated: true, completion: nil) case .sent: Logger.debug("\(self.TAG) user successfully invited their friends via SMS.") @@ -192,7 +193,7 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos } let mailActionTitle = NSLocalizedString("SHARE_ACTION_MAIL", comment: "action sheet item to open native mail app") - return UIAlertAction(title: mailActionTitle, style: .default) { action in + return UIAlertAction(title: mailActionTitle, style: .default) { _ in Logger.debug("\(self.TAG) Chose mail.") self.channel = .mail @@ -216,8 +217,8 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos mailComposeViewController.setMessageBody(body, isHTML: false) self.presentingViewController.dismiss(animated: true) { - self.presentingViewController.navigationController?.present(mailComposeViewController, animated:true) { - UIUtil.applySignalAppearence(); + self.presentingViewController.navigationController?.present(mailComposeViewController, animated:true) { + UIUtil.applySignalAppearence() } } } @@ -230,7 +231,7 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos switch result { case .failed: let warning = UIAlertController(title: nil, message: NSLocalizedString("SEND_INVITE_FAILURE", comment:"Alert body after invite failed"), preferredStyle: .alert) - warning.addAction(UIAlertAction(title: NSLocalizedString("DISMISS_BUTTON_TEXT", comment:""), style: .default, handler: nil)) + warning.addAction(UIAlertAction(title: CommonStrings.dismissButton, style: .default, handler: nil)) self.presentingViewController.present(warning, animated: true, completion: nil) case .sent: Logger.debug("\(self.TAG) user successfully invited their friends via mail.") diff --git a/Signal/src/ViewControllers/OWSLinkedDevicesTableViewController.m b/Signal/src/ViewControllers/OWSLinkedDevicesTableViewController.m index e08cbf6d4..32ad55e42 100644 --- a/Signal/src/ViewControllers/OWSLinkedDevicesTableViewController.m +++ b/Signal/src/ViewControllers/OWSLinkedDevicesTableViewController.m @@ -5,6 +5,7 @@ #import "OWSLinkedDevicesTableViewController.h" #import "OWSDeviceTableViewCell.h" #import "OWSLinkDeviceViewController.h" +#import "Signal-Swift.h" #import "UIViewController+CameraPermissions.h" #import #import @@ -166,10 +167,9 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1; }]; [alertController addAction:retryAction]; - NSString *dismissTitle - = NSLocalizedString(@"DISMISS_BUTTON_TEXT", @"Generic short text for button to dismiss a dialog"); - UIAlertAction *dismissAction = - [UIAlertAction actionWithTitle:dismissTitle style:UIAlertActionStyleCancel handler:nil]; + UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.dismissButton + style:UIAlertActionStyleCancel + handler:nil]; [alertController addAction:dismissAction]; dispatch_async(dispatch_get_main_queue(), ^{ diff --git a/Signal/src/ViewControllers/RegistrationViewController.m b/Signal/src/ViewControllers/RegistrationViewController.m index 989ed2004..6feaba7cf 100644 --- a/Signal/src/ViewControllers/RegistrationViewController.m +++ b/Signal/src/ViewControllers/RegistrationViewController.m @@ -379,8 +379,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi - (void)presentInvalidCountryCodeError { [OWSAlerts showAlertWithTitle:NSLocalizedString(@"REGISTER_CC_ERR_ALERT_VIEW_TITLE", @"") message:NSLocalizedString(@"REGISTER_CC_ERR_ALERT_VIEW_MESSAGE", @"") - buttonTitle:NSLocalizedString( - @"DISMISS_BUTTON_TEXT", @"Generic short text for button to dismiss a dialog")]; + buttonTitle:CommonStrings.dismissButton]; } #pragma mark - CountryCodeViewControllerDelegate diff --git a/Signal/src/util/UIViewController+CameraPermissions.m b/Signal/src/util/UIViewController+CameraPermissions.m index 58abd9685..18a63f33b 100644 --- a/Signal/src/util/UIViewController+CameraPermissions.m +++ b/Signal/src/util/UIViewController+CameraPermissions.m @@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN }]; [alert addAction:openSettingsAction]; - UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"DISMISS_BUTTON_TEXT", nil) + UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.dismissButton style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { failureCallback(); diff --git a/Signal/src/views/OWSAlerts.swift b/Signal/src/views/OWSAlerts.swift index ce3644a49..308c6ea09 100644 --- a/Signal/src/views/OWSAlerts.swift +++ b/Signal/src/views/OWSAlerts.swift @@ -12,8 +12,7 @@ import Foundation let alertTitle = NSLocalizedString("CALL_AUDIO_PERMISSION_TITLE", comment:"Alert title when calling and permissions for microphone are missing") let alertMessage = NSLocalizedString("CALL_AUDIO_PERMISSION_MESSAGE", comment:"Alert message when calling and permissions for microphone are missing") let alertController = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: .alert) - let dismiss = NSLocalizedString("DISMISS_BUTTON_TEXT", comment: "Generic short text for button to dismiss a dialog") - let dismissAction = UIAlertAction(title: dismiss, style: .cancel) + let dismissAction = UIAlertAction(title: CommonStrings.dismissButton, style: .cancel) let settingsString = NSLocalizedString("OPEN_SETTINGS_BUTTON", comment: "Button text which opens the settings app") let settingsAction = UIAlertAction(title: settingsString, style: .default) { _ in UIApplication.shared.openSystemSettings() diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 10096b7f2..49be66d5d 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -379,8 +379,7 @@ /* Accessibility label for disappearing messages */ "DISAPPEARING_MESSAGES_LABEL" = "Disappearing messages settings"; -/* Generic short text for button to dismiss a dialog - Short text to dismiss current modal / actionsheet / screen */ +/* Short text to dismiss current modal / actionsheet / screen */ "DISMISS_BUTTON_TEXT" = "Dismiss"; /* Section title for the 'domain fronting country' view. */