diff --git a/Podfile b/Podfile index 2847f8fe3..8a7603e4b 100644 --- a/Podfile +++ b/Podfile @@ -10,7 +10,6 @@ target 'Signal' do pod 'FFCircularProgressView', '~> 0.5' pod 'SCWaveformView', '~> 1.0' pod 'ZXingObjC' - pod 'DJWActionSheet' pod 'JSQMessagesViewController' target 'SignalTests' do inherit! :search_paths diff --git a/Podfile.lock b/Podfile.lock index fba4ed70d..bef05e428 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -27,7 +27,6 @@ PODS: - CocoaLumberjack/Core - CocoaLumberjack/Extensions (2.2.0): - CocoaLumberjack/Default - - DJWActionSheet (1.0.4) - FFCircularProgressView (0.5) - HKDFKit (0.0.3) - JSQMessagesViewController (7.3.4): @@ -116,7 +115,6 @@ PODS: - ZXingObjC/All (3.1.0) DEPENDENCIES: - - DJWActionSheet - FFCircularProgressView (~> 0.5) - JSQMessagesViewController - OpenSSL @@ -145,7 +143,6 @@ SPEC CHECKSUMS: AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67 AxolotlKit: a33962f26943990e5d69d05b30470cea18caeed0 CocoaLumberjack: 17fe8581f84914d5d7e6360f7c70022b173c3ae0 - DJWActionSheet: 2fe54b1298a7f0fe44462233752c76a530e0cd80 FFCircularProgressView: 683a4ab1e1bd613246a3dffa61503ffdebcde8d8 HKDFKit: c058305d6f64b84f28c50bd7aa89574625bcb62a JSQMessagesViewController: 39fed975e3c9f8eba7292071e29eeb541d105e66 @@ -166,6 +163,6 @@ SPEC CHECKSUMS: YapDatabase: b1e43555a34a5298e23a045be96817a5ef0da58f ZXingObjC: bf15b3814f7a105b6d99f47da2333c93a063650a -PODFILE CHECKSUM: 93ccdbbb243044904d772ee53e00154890a9f82f +PODFILE CHECKSUM: d45e2cfeea550d3add129851420c851c5592f5ed COCOAPODS: 1.0.1 diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index e9f074779..c76b1e180 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -188,7 +188,6 @@ A1C32D5017A06538000A904E /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1C32D4F17A06537000A904E /* AddressBookUI.framework */; }; A1C32D5117A06544000A904E /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1C32D4D17A0652C000A904E /* AddressBook.framework */; }; A507A3B11A6C60E300BEED0D /* InboxTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A507A3AF1A6C60E300BEED0D /* InboxTableViewCell.xib */; }; - A547DD741A70A87800103EC7 /* DJWActionSheet+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = A547DD721A70A87800103EC7 /* DJWActionSheet+OWS.m */; }; A5509ECA1A69AB8B00ABA4BC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A5509EC91A69AB8B00ABA4BC /* Main.storyboard */; }; A5509ECD1A69B1D600ABA4BC /* CountryCodeTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A5509ECC1A69B1D600ABA4BC /* CountryCodeTableViewCell.m */; }; A5D0699B1A50E9CB004CB540 /* ShowGroupMembersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A5D069991A50E9CB004CB540 /* ShowGroupMembersViewController.m */; }; @@ -385,7 +384,6 @@ B660F7701C29988E00687D6E /* FLAnimatedImage.m in Sources */ = {isa = PBXBuildFile; fileRef = B68EF9B71C0B1EBD009C3DCD /* FLAnimatedImage.m */; }; B660F7711C29988E00687D6E /* FLAnimatedImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = B68EF9B91C0B1EBD009C3DCD /* FLAnimatedImageView.m */; }; B660F7721C29988E00687D6E /* AppStoreRating.m in Sources */ = {isa = PBXBuildFile; fileRef = B6DA6B061B8A2F9A00CA6F98 /* AppStoreRating.m */; }; - B660F7741C29988E00687D6E /* DJWActionSheet+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = A547DD721A70A87800103EC7 /* DJWActionSheet+OWS.m */; }; B660F7751C29988E00687D6E /* UIColor+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFA64B31A24F3880007FB87 /* UIColor+OWS.m */; }; B660F7761C29988E00687D6E /* UIFont+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFA64B61A24F6730007FB87 /* UIFont+OWS.m */; }; B660F7771C29988E00687D6E /* UIImage+normalizeImage.m in Sources */ = {isa = PBXBuildFile; fileRef = B68112E91A4D9EC400BA82FF /* UIImage+normalizeImage.m */; }; @@ -849,8 +847,6 @@ A1FDCBEE16DAA6C300868894 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; A33D3C7EB4B17BDBD47F0FCC /* libPods-SignalTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SignalTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; A507A3AF1A6C60E300BEED0D /* InboxTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = InboxTableViewCell.xib; path = "Signal/src/view controllers/InboxTableViewCell.xib"; sourceTree = SOURCE_ROOT; }; - A547DD721A70A87800103EC7 /* DJWActionSheet+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "DJWActionSheet+OWS.m"; path = "util/DJWActionSheet+OWS.m"; sourceTree = ""; }; - A547DD731A70A87800103EC7 /* DJWActionSheet+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "DJWActionSheet+OWS.h"; path = "util/DJWActionSheet+OWS.h"; sourceTree = ""; }; A5509EC91A69AB8B00ABA4BC /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Storyboard/Main.storyboard; sourceTree = ""; }; A5509ECB1A69B1D600ABA4BC /* CountryCodeTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CountryCodeTableViewCell.h; sourceTree = ""; }; A5509ECC1A69B1D600ABA4BC /* CountryCodeTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CountryCodeTableViewCell.m; sourceTree = ""; }; @@ -2437,8 +2433,6 @@ FCFA64B11A24F29E0007FB87 /* UI Categories */ = { isa = PBXGroup; children = ( - A547DD731A70A87800103EC7 /* DJWActionSheet+OWS.h */, - A547DD721A70A87800103EC7 /* DJWActionSheet+OWS.m */, FCFA64B21A24F3880007FB87 /* UIColor+OWS.h */, FCFA64B31A24F3880007FB87 /* UIColor+OWS.m */, FCFA64B51A24F6730007FB87 /* UIFont+OWS.h */, @@ -2893,7 +2887,6 @@ 76EB05A618170B33006006FC /* RtpPacket.m in Sources */, 76EB064218170B33006006FC /* StringUtil.m in Sources */, 45BFFFA81D898AF0004A12A7 /* OWSStaleNotificationObserver.m in Sources */, - A547DD741A70A87800103EC7 /* DJWActionSheet+OWS.m in Sources */, 45C681B71D305A580050903A /* OWSCall.m in Sources */, 76EB062618170B33006006FC /* Queue.m in Sources */, D221A09A169C9E5E00537ABF /* main.m in Sources */, @@ -3176,7 +3169,6 @@ B660F7701C29988E00687D6E /* FLAnimatedImage.m in Sources */, B660F7711C29988E00687D6E /* FLAnimatedImageView.m in Sources */, B660F7721C29988E00687D6E /* AppStoreRating.m in Sources */, - B660F7741C29988E00687D6E /* DJWActionSheet+OWS.m in Sources */, B660F7751C29988E00687D6E /* UIColor+OWS.m in Sources */, B660F7761C29988E00687D6E /* UIFont+OWS.m in Sources */, B660F7771C29988E00687D6E /* UIImage+normalizeImage.m in Sources */, diff --git a/Signal/src/util/DJWActionSheet+OWS.h b/Signal/src/util/DJWActionSheet+OWS.h deleted file mode 100644 index ad03db5b6..000000000 --- a/Signal/src/util/DJWActionSheet+OWS.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// UIFont+OWS.h -// Signal -// -// Created by Christine Corbett Moran on 01/21/15. -// Copyright (c) 2015 Open Whisper Systems. All rights reserved. -// - -#import "DJWActionSheet.h" - -@interface DJWActionSheet (OWS) -+ (UIColor *)DJWActionSheetButtonBackgroundColorForState:(UIControlState)controlState; -@end diff --git a/Signal/src/util/DJWActionSheet+OWS.m b/Signal/src/util/DJWActionSheet+OWS.m deleted file mode 100644 index 533089f6c..000000000 --- a/Signal/src/util/DJWActionSheet+OWS.m +++ /dev/null @@ -1,29 +0,0 @@ -// -// UIFont+OWS.m -// Signal -// -// Created by Christine Corbett Moran on 01/21/15. -// Copyright (c) 2015 Open Whisper Systems. All rights reserved. -// - -#import "DJWActionSheet+OWS.h" -#import "UIColor+OWS.h" - -@implementation DJWActionSheet (OWS) - -+ (UIColor *)DJWActionSheetButtonBackgroundColorForState:(UIControlState)controlState { - switch (controlState) { - case UIControlStateNormal: - return [UIColor whiteColor]; - break; - case UIControlStateHighlighted: - return [UIColor ows_materialBlueColor]; - break; - - default: - return [UIColor whiteColor]; - break; - } -} - -@end diff --git a/Signal/src/view controllers/FingerprintViewController.m b/Signal/src/view controllers/FingerprintViewController.m index 6805850c1..e98a93bcf 100644 --- a/Signal/src/view controllers/FingerprintViewController.m +++ b/Signal/src/view controllers/FingerprintViewController.m @@ -7,7 +7,6 @@ // #import "FingerprintViewController.h" -#import "DJWActionSheet+OWS.h" #import "Environment.h" #import "OWSConversationSettingsTableViewController.h" #import "Signal-Swift.h" diff --git a/Signal/src/view controllers/FullImageViewController.m b/Signal/src/view controllers/FullImageViewController.m index 6216ec229..76e3842d7 100644 --- a/Signal/src/view controllers/FullImageViewController.m +++ b/Signal/src/view controllers/FullImageViewController.m @@ -7,7 +7,6 @@ // Copyright (c) 2014 Open Whisper Systems. All rights reserved. // -#import "DJWActionSheet+OWS.h" #import "FLAnimatedImage.h" #import "FullImageViewController.h" #import "UIUtil.h" diff --git a/Signal/src/view controllers/MessagesViewController.m b/Signal/src/view controllers/MessagesViewController.m index 904400c3d..04771b048 100644 --- a/Signal/src/view controllers/MessagesViewController.m +++ b/Signal/src/view controllers/MessagesViewController.m @@ -8,7 +8,6 @@ #import "AppDelegate.h" -#import "DJWActionSheet+OWS.h" #import "Environment.h" #import "FingerprintViewController.h" #import "FullImageViewController.h" @@ -1460,34 +1459,41 @@ typedef enum : NSUInteger { #pragma mark Bubble User Actions - (void)handleUnsentMessageTap:(TSOutgoingMessage *)message { - [self dismissKeyBoard]; - [DJWActionSheet showInView:self.parentViewController.view - withTitle:message.mostRecentFailureText - cancelButtonTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - destructiveButtonTitle:NSLocalizedString(@"TXT_DELETE_TITLE", @"") - otherButtonTitles:@[ NSLocalizedString(@"SEND_AGAIN_BUTTON", @"") ] - tapBlock:^(DJWActionSheet *actionSheet, NSInteger tappedButtonIndex) { - if (tappedButtonIndex == actionSheet.cancelButtonIndex) { - DDLogDebug(@"%@ User cancelled unsent dialog", self.tag); - } else if (tappedButtonIndex == actionSheet.destructiveButtonIndex) { - DDLogInfo(@"%@ User chose to delete unsent message.", self.tag); - [message remove]; - } else { - [self.messageSender sendMessage:message - success:^{ - DDLogInfo(@"%@ Successfully resent failed message.", self.tag); - } - failure:^(NSError *_Nonnull error) { - DDLogWarn(@"%@ Failed to send message with error: %@", self.tag, error); - }]; - } - }]; + UIAlertController *actionSheetController = [UIAlertController alertControllerWithTitle:message.mostRecentFailureText + message:nil + preferredStyle:UIAlertControllerStyleActionSheet]; + + UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") + style:UIAlertActionStyleCancel + handler:nil]; + [actionSheetController addAction:dismissAction]; + + UIAlertAction *deleteMessageAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_DELETE_TITLE", @"") + style:UIAlertActionStyleDestructive + handler:^(UIAlertAction *_Nonnull action) { + [message remove]; + }]; + [actionSheetController addAction:deleteMessageAction]; + + UIAlertAction *resendMessageAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"SEND_AGAIN_BUTTON", @"") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * _Nonnull action) { + [self.messageSender sendMessage:message + success:^{ + DDLogInfo(@"%@ Successfully resent failed message.", self.tag); + } + failure:^(NSError *_Nonnull error) { + DDLogWarn(@"%@ Failed to send message with error: %@", self.tag, error); + }]; + }]; + + [actionSheetController addAction:resendMessageAction]; + + [self presentViewController:actionSheetController animated:YES completion:nil]; } - (void)handleErrorMessageTap:(TSErrorMessage *)message { - [self dismissKeyBoard]; - if ([message isKindOfClass:[TSInvalidIdentityKeyErrorMessage class]]) { [self tappedInvalidIdentityKeyErrorMessage:(TSInvalidIdentityKeyErrorMessage *)message]; } else if (message.errorType == TSErrorMessageInvalidMessage) { @@ -1500,41 +1506,35 @@ typedef enum : NSUInteger { - (void)tappedCorruptedMessage:(TSErrorMessage *)message { - NSString *actionSheetTitle = [NSString + NSString *alertMessage = [NSString stringWithFormat:NSLocalizedString(@"CORRUPTED_SESSION_DESCRIPTION", @"ActionSheet title"), self.thread.name]; - [DJWActionSheet showInView:self.view - withTitle:actionSheetTitle - cancelButtonTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - destructiveButtonTitle:nil - otherButtonTitles:@[ NSLocalizedString(@"FINGERPRINT_SHRED_KEYMATERIAL_BUTTON", nil) ] - tapBlock:^(DJWActionSheet *actionSheet, NSInteger tappedButtonIndex) { - if (tappedButtonIndex == actionSheet.cancelButtonIndex) { - DDLogDebug(@"User Cancelled"); - } else if (tappedButtonIndex == actionSheet.destructiveButtonIndex) { - DDLogDebug(@"Destructive button tapped"); - } else { - switch (tappedButtonIndex) { - case 0: { - if (![self.thread isKindOfClass:[TSContactThread class]]) { - // Corrupt Message errors only appear in contact threads. - DDLogError( - @"%@ Unexpected request to reset session in group thread. Refusing", - self.tag); - return; - } - TSContactThread *contactThread = (TSContactThread *)self.thread; - [OWSSessionResetJob runWithCorruptedMessage:message - contactThread:contactThread - messageSender:self.messageSender - storageManager:self.storageManager]; - break; - } - default: - break; - } - } - }]; + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil + message:alertMessage + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") + style:UIAlertActionStyleCancel + handler:nil]; + [alertController addAction:dismissAction]; + + UIAlertAction *resetSessionAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"FINGERPRINT_SHRED_KEYMATERIAL_BUTTON", @"") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * _Nonnull action) { + if (![self.thread isKindOfClass:[TSContactThread class]]) { + // Corrupt Message errors only appear in contact threads. + DDLogError(@"%@ Unexpected request to reset session in group thread. Refusing", self.tag); + return; + } + TSContactThread *contactThread = (TSContactThread *)self.thread; + [OWSSessionResetJob runWithCorruptedMessage:message + contactThread:contactThread + messageSender:self.messageSender + storageManager:self.storageManager]; + }]; + [alertController addAction:resetSessionAction]; + + [self presentViewController:alertController animated:YES completion:nil]; } - (void)tappedInvalidIdentityKeyErrorMessage:(TSInvalidIdentityKeyErrorMessage *)errorMessage @@ -1542,52 +1542,47 @@ typedef enum : NSUInteger { NSString *keyOwner = [self.contactsManager nameStringForPhoneIdentifier:errorMessage.theirSignalId]; NSString *titleFormat = NSLocalizedString(@"SAFETY_NUMBERS_ACTIONSHEET_TITLE", @"Action sheet heading"); NSString *titleText = [NSString stringWithFormat:titleFormat, keyOwner]; - NSArray *actions = @[ - NSLocalizedString(@"SHOW_SAFETY_NUMBER_ACTION", @"Action sheet item"), - NSLocalizedString(@"ACCEPT_NEW_IDENTITY_ACTION", @"Action sheet item") - ]; - - [DJWActionSheet showInView:self.parentViewController.view - withTitle:titleText - cancelButtonTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - destructiveButtonTitle:nil - otherButtonTitles:actions - tapBlock:^(DJWActionSheet *actionSheet, NSInteger tappedButtonIndex) { - if (tappedButtonIndex == actionSheet.cancelButtonIndex) { - DDLogDebug(@"%@ Remote Key Changed actions: Tapped cancel", self.tag); - } else { - switch (tappedButtonIndex) { - case 0: - DDLogInfo(@"%@ Remote Key Changed actions: Show fingerprint display", self.tag); - [self showFingerprintWithTheirIdentityKey:errorMessage.newIdentityKey - theirSignalId:errorMessage.theirSignalId]; - break; - case 1: - DDLogInfo(@"%@ Remote Key Changed actions: Accepted new identity key", self.tag); - - [errorMessage acceptNewIdentityKey]; - if ([errorMessage isKindOfClass:[TSInvalidIdentityKeySendingErrorMessage class]]) { - [self.messageSender - resendMessageFromKeyError:(TSInvalidIdentityKeySendingErrorMessage *) - errorMessage - success:^{ - DDLogDebug(@"%@ Successfully resent key-error message.", self.tag); - } - failure:^(NSError *_Nonnull error) { - DDLogError(@"%@ Failed to resend key-error message with error:%@", - self.tag, - error); - }]; - } - break; - default: - DDLogInfo(@"%@ Remote Key Changed actions: Unhandled button pressed: %d", - self.tag, - (int)tappedButtonIndex); - break; - } - } - }]; + + UIAlertController *actionSheetController = [UIAlertController alertControllerWithTitle:titleText + message:nil + preferredStyle:UIAlertControllerStyleActionSheet]; + + UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") + style:UIAlertActionStyleCancel + handler:nil]; + [actionSheetController addAction:dismissAction]; + + UIAlertAction *showSafteyNumberAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"SHOW_SAFETY_NUMBER_ACTION", @"Action sheet item") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * _Nonnull action) { + DDLogInfo(@"%@ Remote Key Changed actions: Show fingerprint display", self.tag); + [self showFingerprintWithTheirIdentityKey:errorMessage.newIdentityKey + theirSignalId:errorMessage.theirSignalId]; + }]; + [actionSheetController addAction:showSafteyNumberAction]; + + UIAlertAction *acceptSafetyNumberAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"ACCEPT_NEW_IDENTITY_ACTION", @"Action sheet item") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * _Nonnull action) { + DDLogInfo(@"%@ Remote Key Changed actions: Accepted new identity key", self.tag); + [errorMessage acceptNewIdentityKey]; + if ([errorMessage isKindOfClass:[TSInvalidIdentityKeySendingErrorMessage class]]) { + [self.messageSender + resendMessageFromKeyError:(TSInvalidIdentityKeySendingErrorMessage *) + errorMessage + success:^{ + DDLogDebug(@"%@ Successfully resent key-error message.", self.tag); + } + failure:^(NSError *_Nonnull error) { + DDLogError(@"%@ Failed to resend key-error message with error:%@", + self.tag, + error); + }]; + } + }]; + [actionSheetController addAction:acceptSafetyNumberAction]; + + [self presentViewController:actionSheetController animated:YES completion:nil]; } #pragma mark - Navigation @@ -2074,39 +2069,30 @@ typedef enum : NSUInteger { #pragma mark Accessory View - (void)didPressAccessoryButton:(UIButton *)sender { - [self dismissKeyBoard]; - - UIView *presenter = self.parentViewController.view; - - [DJWActionSheet showInView:presenter - withTitle:nil - cancelButtonTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - destructiveButtonTitle:nil - otherButtonTitles:@[ - NSLocalizedString(@"TAKE_MEDIA_BUTTON", @""), - NSLocalizedString(@"CHOOSE_MEDIA_BUTTON", @"") - ] //,@"Record audio"] - tapBlock:^(DJWActionSheet *actionSheet, NSInteger tappedButtonIndex) { - if (tappedButtonIndex == actionSheet.cancelButtonIndex) { - DDLogVerbose(@"User Cancelled"); - } else if (tappedButtonIndex == actionSheet.destructiveButtonIndex) { - DDLogVerbose(@"Destructive button tapped"); - } else { - switch (tappedButtonIndex) { - case 0: - [self takePictureOrVideo]; - break; - case 1: - [self chooseFromLibrary]; - break; - case 2: - [self recordAudio]; - break; - default: - break; - } - } - }]; + UIAlertController *actionSheetController = [UIAlertController alertControllerWithTitle:nil + message:nil + preferredStyle:UIAlertControllerStyleActionSheet]; + + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") + style:UIAlertActionStyleCancel + handler:nil]; + [actionSheetController addAction:cancelAction]; + + UIAlertAction *takeMediaAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TAKE_MEDIA_BUTTON", @"") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * _Nonnull action) { + [self takePictureOrVideo]; + }]; + [actionSheetController addAction:takeMediaAction]; + + UIAlertAction *chooseMediaAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"CHOOSE_MEDIA_BUTTON", @"") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * _Nonnull action) { + [self chooseFromLibrary]; + }]; + [actionSheetController addAction:chooseMediaAction]; + + [self presentViewController:actionSheetController animated:true completion:nil]; } - (void)markAllMessagesAsRead diff --git a/Signal/src/view controllers/NewGroupViewController.m b/Signal/src/view controllers/NewGroupViewController.m index 689f8e45d..f44fbefc4 100644 --- a/Signal/src/view controllers/NewGroupViewController.m +++ b/Signal/src/view controllers/NewGroupViewController.m @@ -7,7 +7,6 @@ // #import "NewGroupViewController.h" -#import "DJWActionSheet+OWS.h" #import "Environment.h" #import "FunctionalUtil.h" #import "OWSContactsManager.h" @@ -238,34 +237,29 @@ static NSString *const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue" } - (IBAction)addGroupPhoto:(id)sender { - [self.nameGroupTextField resignFirstResponder]; - [DJWActionSheet showInView:self.parentViewController.view - withTitle:nil - cancelButtonTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - destructiveButtonTitle:nil - otherButtonTitles:@[ - NSLocalizedString(@"TAKE_PICTURE_BUTTON", @""), - NSLocalizedString(@"CHOOSE_MEDIA_BUTTON", @"") - ] - tapBlock:^(DJWActionSheet *actionSheet, NSInteger tappedButtonIndex) { - - if (tappedButtonIndex == actionSheet.cancelButtonIndex) { - DDLogDebug(@"User Cancelled"); - } else if (tappedButtonIndex == actionSheet.destructiveButtonIndex) { - DDLogDebug(@"Destructive button tapped"); - } else { - switch (tappedButtonIndex) { - case 0: - [self takePicture]; - break; - case 1: - [self chooseFromLibrary]; - break; - default: - break; - } - } - }]; + UIAlertController *actionSheetController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"NEW_GROUP_ADD_PHOTO_ACTION", @"Action Sheet title prompting the user for a group avatar") + message:nil + preferredStyle:UIAlertControllerStyleActionSheet]; + UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") + style:UIAlertActionStyleCancel + handler:nil]; + [actionSheetController addAction:dismissAction]; + + UIAlertAction *takePictureAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TAKE_PICTURE_BUTTON", @"") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * _Nonnull action) { + [self takePicture]; + }]; + [actionSheetController addAction:takePictureAction]; + + UIAlertAction *choosePictureAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"CHOOSE_MEDIA_BUTTON", @"") + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * _Nonnull action) { + [self chooseFromLibrary]; + }]; + [actionSheetController addAction:choosePictureAction]; + + [self presentViewController:actionSheetController animated:true completion:nil]; } #pragma mark - Group Image diff --git a/Signal/src/view controllers/PrivacySettingsTableViewController.m b/Signal/src/view controllers/PrivacySettingsTableViewController.m index 36337acc6..5d89a8578 100644 --- a/Signal/src/view controllers/PrivacySettingsTableViewController.m +++ b/Signal/src/view controllers/PrivacySettingsTableViewController.m @@ -8,7 +8,6 @@ #import "PrivacySettingsTableViewController.h" -#import "DJWActionSheet+OWS.h" #import "Environment.h" #import "PropertyListPreferences.h" #import "UIUtil.h" @@ -144,22 +143,23 @@ typedef NS_ENUM(NSInteger, PrivacySettingsTableViewControllerSectionIndex) { switch (indexPath.section) { case PrivacySettingsTableViewControllerSectionIndexHistoryLog: { - [DJWActionSheet showInView:self.parentViewController.view - withTitle:NSLocalizedString(@"SETTINGS_DELETE_HISTORYLOG_CONFIRMATION", @"") - cancelButtonTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") - destructiveButtonTitle:NSLocalizedString(@"SETTINGS_DELETE_HISTORYLOG_CONFIRMATION_BUTTON", @"") - otherButtonTitles:@[] - tapBlock:^(DJWActionSheet *actionSheet, NSInteger tappedButtonIndex) { - [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; - if (tappedButtonIndex == actionSheet.cancelButtonIndex) { - DDLogDebug(@"User Cancelled"); - } else if (tappedButtonIndex == actionSheet.destructiveButtonIndex) { - [[TSStorageManager sharedManager] deleteThreadsAndMessages]; - } else { - DDLogDebug(@"The user tapped button at index: %li", (long)tappedButtonIndex); - } - }]; - + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil + message:NSLocalizedString(@"SETTINGS_DELETE_HISTORYLOG_CONFIRMATION", @"Alert message before user confirms clearing history") + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"") + style:UIAlertActionStyleCancel + handler:nil]; + [alertController addAction:dismissAction]; + + UIAlertAction *deleteAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"SETTINGS_DELETE_HISTORYLOG_CONFIRMATION_BUTTON", @"") + style:UIAlertActionStyleDestructive + handler:^(UIAlertAction * _Nonnull action) { + [[TSStorageManager sharedManager] deleteThreadsAndMessages]; + }]; + [alertController addAction:deleteAction]; + + [self presentViewController:alertController animated:true completion:nil]; break; } default: diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index d992f0907..b794f7100 100644 Binary files a/Signal/translations/en.lproj/Localizable.strings and b/Signal/translations/en.lproj/Localizable.strings differ