extract dismiss string -> CommonStrings.dismissButton

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 20a8e72198
commit a59eb25aef

@ -9,7 +9,7 @@ import Foundation
*/ */
@objc class CommonStrings: NSObject { @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 { @objc class CallStrings: NSObject {

@ -371,7 +371,6 @@ class CallViewController: UIViewController, CallObserver, CallServiceObserver, R
setButtonSelectedImage(button: videoModeMuteButton, imageName: "video-mute-selected") setButtonSelectedImage(button: videoModeMuteButton, imageName: "video-mute-selected")
setButtonSelectedImage(button: audioModeVideoButton, imageName: "audio-call-video-active") setButtonSelectedImage(button: audioModeVideoButton, imageName: "audio-call-video-active")
setButtonSelectedImage(button: videoModeVideoButton, imageName: "video-video-selected") setButtonSelectedImage(button: videoModeVideoButton, imageName: "video-video-selected")
// setButtonSelectedImage(button: audioRouteButton, imageName: "audio-call-speaker-active")
ongoingCallView = createContainerForCallControls(controlGroups : [ ongoingCallView = createContainerForCallControls(controlGroups : [
[audioModeMuteButton, audioRouteButton, audioModeVideoButton ], [audioModeMuteButton, audioRouteButton, audioModeVideoButton ],
@ -392,7 +391,7 @@ class CallViewController: UIViewController, CallObserver, CallServiceObserver, R
let actionSheetController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) 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) actionSheetController.addAction(dismissAction)
let currentAudioSource = callUIAdapter.audioService.currentAudioSource(call: self.call) let currentAudioSource = callUIAdapter.audioService.currentAudioSource(call: self.call)

@ -301,7 +301,7 @@ NS_ASSUME_NONNULL_BEGIN
message:error.localizedDescription message:error.localizedDescription
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
} }
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"DISMISS_BUTTON_TEXT", nil) UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.dismissButton
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[_challengeTextField becomeFirstResponder]; [_challengeTextField becomeFirstResponder];

@ -872,13 +872,11 @@ typedef enum : NSUInteger {
}]; }];
[actionSheetController addAction:verifyAction]; [actionSheetController addAction:verifyAction];
UIAlertAction *dismissAction = UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.dismissButton
[UIAlertAction actionWithTitle:NSLocalizedString(@"DISMISS_BUTTON_TEXT", style:UIAlertActionStyleCancel
@"Generic short text for button to dismiss a dialog") handler:^(UIAlertAction *_Nonnull action) {
style:UIAlertActionStyleCancel [weakSelf resetVerificationStateToDefault];
handler:^(UIAlertAction *_Nonnull action) { }];
[weakSelf resetVerificationStateToDefault];
}];
[actionSheetController addAction:dismissAction]; [actionSheetController addAction:dismissAction];
[self presentViewController:actionSheetController animated:YES completion:nil]; [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") @"Alert body when picking a document fails because user picked a directory/bundle")
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"DISMISS_BUTTON_TEXT", nil) UIAlertAction *dismissAction =
style:UIAlertActionStyleCancel [UIAlertAction actionWithTitle:CommonStrings.dismissButton style:UIAlertActionStyleCancel handler:nil];
handler:nil];
[alertController addAction:dismissAction]; [alertController addAction:dismissAction];
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
@ -2978,9 +2975,8 @@ typedef enum : NSUInteger {
message:nil message:nil
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"DISMISS_BUTTON_TEXT", nil) UIAlertAction *dismissAction =
style:UIAlertActionStyleCancel [UIAlertAction actionWithTitle:CommonStrings.dismissButton style:UIAlertActionStyleCancel handler:nil];
handler:nil];
[alertController addAction:dismissAction]; [alertController addAction:dismissAction];
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{

@ -194,7 +194,7 @@ class ExperienceUpgradesPageViewController: UIViewController, UIPageViewControll
// Dismiss button // Dismiss button
let dismissButton = UIButton() let dismissButton = UIButton()
view.addSubview(dismissButton) 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.setTitleColor(UIColor.white, for: .normal)
dismissButton.isUserInteractionEnabled = true dismissButton.isUserInteractionEnabled = true
dismissButton.addTarget(self, action:#selector(didTapDismissButton), for: .touchUpInside) dismissButton.addTarget(self, action:#selector(didTapDismissButton), for: .touchUpInside)

@ -189,7 +189,6 @@ NS_ASSUME_NONNULL_BEGIN
DDLogInfo(@"%@ Successfully verified safety numbers.", tag); DDLogInfo(@"%@ Successfully verified safety numbers.", tag);
NSString *successTitle = NSLocalizedString(@"SUCCESSFUL_VERIFICATION_TITLE", nil); NSString *successTitle = NSLocalizedString(@"SUCCESSFUL_VERIFICATION_TITLE", nil);
NSString *dismissText = NSLocalizedString(@"DISMISS_BUTTON_TEXT", nil);
NSString *descriptionFormat = NSLocalizedString( NSString *descriptionFormat = NSLocalizedString(
@"SUCCESSFUL_VERIFICATION_DESCRIPTION", @"Alert body after verifying privacy with {{other user's name}}"); @"SUCCESSFUL_VERIFICATION_DESCRIPTION", @"Alert body after verifying privacy with {{other user's name}}");
NSString *successDescription = [NSString stringWithFormat:descriptionFormat, contactName]; NSString *successDescription = [NSString stringWithFormat:descriptionFormat, contactName];
@ -209,7 +208,7 @@ NS_ASSUME_NONNULL_BEGIN
[viewController dismissViewControllerAnimated:true completion:nil]; [viewController dismissViewControllerAnimated:true completion:nil];
}]]; }]];
UIAlertAction *dismissAction = UIAlertAction *dismissAction =
[UIAlertAction actionWithTitle:dismissText [UIAlertAction actionWithTitle:CommonStrings.dismissButton
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[viewController dismissViewControllerAnimated:true completion:nil]; [viewController dismissViewControllerAnimated:true completion:nil];

@ -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 Foundation
import Social import Social
@ -31,7 +32,7 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos
super.init() super.init()
actionSheetController.addAction(dismissAction()) actionSheetController.addAction(dismissAction())
if #available(iOS 9.0, *) { if #available(iOS 9.0, *) {
if let messageAction = messageAction() { if let messageAction = messageAction() {
actionSheetController.addAction(messageAction) actionSheetController.addAction(messageAction)
@ -72,7 +73,7 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos
twitterViewController.add(#imageLiteral(resourceName: "twitter_sharing_image")) twitterViewController.add(#imageLiteral(resourceName: "twitter_sharing_image"))
let tweetTitle = NSLocalizedString("SHARE_ACTION_TWEET", comment:"action sheet item") 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") Logger.debug("\(self.TAG) Chose tweet")
self.presentingViewController.present(twitterViewController, animated: true, completion: nil) self.presentingViewController.present(twitterViewController, animated: true, completion: nil)
@ -80,7 +81,7 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos
} }
func dismissAction() -> UIAlertAction { func dismissAction() -> UIAlertAction {
return UIAlertAction(title: NSLocalizedString("DISMISS_BUTTON_TEXT", comment:""), style: .cancel) return UIAlertAction(title: CommonStrings.dismissButton, style: .cancel)
} }
// MARK: ContactsPickerDelegate // 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") 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.") Logger.debug("\(self.TAG) Chose message.")
self.channel = .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) let navigationController = UINavigationController(rootViewController: picker)
self.presentingViewController.present(navigationController, animated: true) self.presentingViewController.present(navigationController, animated: true)
} }
@ -173,7 +174,7 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos
switch result { switch result {
case .failed: case .failed:
let warning = UIAlertController(title: nil, message: NSLocalizedString("SEND_INVITE_FAILURE", comment:"Alert body after invite failed"), preferredStyle: .alert) 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) self.presentingViewController.present(warning, animated: true, completion: nil)
case .sent: case .sent:
Logger.debug("\(self.TAG) user successfully invited their friends via SMS.") 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") 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.") Logger.debug("\(self.TAG) Chose mail.")
self.channel = .mail self.channel = .mail
@ -216,8 +217,8 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos
mailComposeViewController.setMessageBody(body, isHTML: false) mailComposeViewController.setMessageBody(body, isHTML: false)
self.presentingViewController.dismiss(animated: true) { self.presentingViewController.dismiss(animated: true) {
self.presentingViewController.navigationController?.present(mailComposeViewController, animated:true) { self.presentingViewController.navigationController?.present(mailComposeViewController, animated:true) {
UIUtil.applySignalAppearence(); UIUtil.applySignalAppearence()
} }
} }
} }
@ -230,7 +231,7 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos
switch result { switch result {
case .failed: case .failed:
let warning = UIAlertController(title: nil, message: NSLocalizedString("SEND_INVITE_FAILURE", comment:"Alert body after invite failed"), preferredStyle: .alert) 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) self.presentingViewController.present(warning, animated: true, completion: nil)
case .sent: case .sent:
Logger.debug("\(self.TAG) user successfully invited their friends via mail.") Logger.debug("\(self.TAG) user successfully invited their friends via mail.")

@ -5,6 +5,7 @@
#import "OWSLinkedDevicesTableViewController.h" #import "OWSLinkedDevicesTableViewController.h"
#import "OWSDeviceTableViewCell.h" #import "OWSDeviceTableViewCell.h"
#import "OWSLinkDeviceViewController.h" #import "OWSLinkDeviceViewController.h"
#import "Signal-Swift.h"
#import "UIViewController+CameraPermissions.h" #import "UIViewController+CameraPermissions.h"
#import <SignalServiceKit/NSTimer+OWS.h> #import <SignalServiceKit/NSTimer+OWS.h>
#import <SignalServiceKit/OWSDevice.h> #import <SignalServiceKit/OWSDevice.h>
@ -166,10 +167,9 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1;
}]; }];
[alertController addAction:retryAction]; [alertController addAction:retryAction];
NSString *dismissTitle UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.dismissButton
= NSLocalizedString(@"DISMISS_BUTTON_TEXT", @"Generic short text for button to dismiss a dialog"); style:UIAlertActionStyleCancel
UIAlertAction *dismissAction = handler:nil];
[UIAlertAction actionWithTitle:dismissTitle style:UIAlertActionStyleCancel handler:nil];
[alertController addAction:dismissAction]; [alertController addAction:dismissAction];
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{

@ -379,8 +379,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
- (void)presentInvalidCountryCodeError { - (void)presentInvalidCountryCodeError {
[OWSAlerts showAlertWithTitle:NSLocalizedString(@"REGISTER_CC_ERR_ALERT_VIEW_TITLE", @"") [OWSAlerts showAlertWithTitle:NSLocalizedString(@"REGISTER_CC_ERR_ALERT_VIEW_TITLE", @"")
message:NSLocalizedString(@"REGISTER_CC_ERR_ALERT_VIEW_MESSAGE", @"") message:NSLocalizedString(@"REGISTER_CC_ERR_ALERT_VIEW_MESSAGE", @"")
buttonTitle:NSLocalizedString( buttonTitle:CommonStrings.dismissButton];
@"DISMISS_BUTTON_TEXT", @"Generic short text for button to dismiss a dialog")];
} }
#pragma mark - CountryCodeViewControllerDelegate #pragma mark - CountryCodeViewControllerDelegate

@ -44,7 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
}]; }];
[alert addAction:openSettingsAction]; [alert addAction:openSettingsAction];
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"DISMISS_BUTTON_TEXT", nil) UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:CommonStrings.dismissButton
style:UIAlertActionStyleCancel style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
failureCallback(); failureCallback();

@ -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 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 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 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: CommonStrings.dismissButton, style: .cancel)
let dismissAction = UIAlertAction(title: dismiss, style: .cancel)
let settingsString = NSLocalizedString("OPEN_SETTINGS_BUTTON", comment: "Button text which opens the settings app") let settingsString = NSLocalizedString("OPEN_SETTINGS_BUTTON", comment: "Button text which opens the settings app")
let settingsAction = UIAlertAction(title: settingsString, style: .default) { _ in let settingsAction = UIAlertAction(title: settingsString, style: .default) { _ in
UIApplication.shared.openSystemSettings() UIApplication.shared.openSystemSettings()

@ -379,8 +379,7 @@
/* Accessibility label for disappearing messages */ /* Accessibility label for disappearing messages */
"DISAPPEARING_MESSAGES_LABEL" = "Disappearing messages settings"; "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"; "DISMISS_BUTTON_TEXT" = "Dismiss";
/* Section title for the 'domain fronting country' view. */ /* Section title for the 'domain fronting country' view. */

Loading…
Cancel
Save