@@ -151,13 +151,7 @@ - (void)keyboardWasShown:(NSNotification*)aNotification {
151
151
NSDictionary * info = [aNotification userInfo ];
152
152
CGSize kbSize = [[info objectForKey: UIKeyboardFrameBeginUserInfoKey] CGRectValue ].size ;
153
153
154
- BOOL isPortraitOrientation = NO ;
155
-
156
- #if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_8_0
157
- isPortraitOrientation = UIInterfaceOrientationIsPortrait ([[UIApplication sharedApplication ] statusBarOrientation ]);
158
- #else
159
- isPortraitOrientation = UIInterfaceOrientationIsPortrait (self.interfaceOrientation );
160
- #endif
154
+ BOOL isPortraitOrientation = isPortraitOrientation = UIInterfaceOrientationIsPortrait ([[UIApplication sharedApplication ] statusBarOrientation ]);
161
155
162
156
CGRect frame = CGRectMake (0 , 0 , self.view .frame .size .width , self.view .frame .size .height );
163
157
if (UI_USER_INTERFACE_IDIOM () != UIUserInterfaceIdiomPad) {
@@ -238,7 +232,7 @@ - (void)viewDidLoad {
238
232
if ([BITHockeyHelper isPhotoAccessPossible ]) {
239
233
self.textAccessoryView = [[UIView alloc ] initWithFrame: CGRectMake (0 , 0 , CGRectGetWidth (self .view.frame), 44 )];
240
234
self.textAccessoryView .backgroundColor = [UIColor colorWithRed: (CGFloat)0.9 green: (CGFloat)0.9 blue: (CGFloat)0.9 alpha: (CGFloat)1.0 ];
241
-
235
+
242
236
self.addPhotoButton = [UIButton buttonWithType: UIButtonTypeCustom];
243
237
[self .addPhotoButton setTitle: BITHockeyLocalizedString (@" HockeyFeedbackComposeAttachmentAddImage" ) forState: UIControlStateNormal];
244
238
[self .addPhotoButton setTitleColor: [UIColor darkGrayColor ] forState: UIControlStateNormal];
@@ -546,64 +540,48 @@ - (void)imageButtonAction:(UIButton *)sender {
546
540
NSInteger index = [self .attachmentScrollViewImageViews indexOfObject: sender];
547
541
548
542
self.selectedAttachmentIndex = (self.attachmentScrollViewImageViews .count - index - 1 );
549
- /* We won't use this for now until we have a more robust solution for displaying UIAlertController
550
- // requires iOS 8
551
- id uialertcontrollerClass = NSClassFromString(@"UIAlertController");
552
- if (uialertcontrollerClass) {
553
- __weak typeof(self) weakSelf = self;
554
-
555
- UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
556
- message:nil
557
- preferredStyle:UIAlertControllerStyleActionSheet];
558
-
559
-
560
- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeAttachmentCancel")
561
- style:UIAlertActionStyleCancel
562
- handler:^(UIAlertAction * action) {
563
- typeof(self) strongSelf = weakSelf;
564
- [strongSelf cancelAction];
565
- _actionSheetVisible = NO;
566
- }];
567
-
568
- [alertController addAction:cancelAction];
569
-
570
- UIAlertAction *editAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeAttachmentEdit")
571
- style:UIAlertActionStyleDefault
572
- handler:^(UIAlertAction * action) {
573
- typeof(self) strongSelf = weakSelf;
574
- [strongSelf editAction];
575
- _actionSheetVisible = NO;
576
- }];
577
-
578
- [alertController addAction:editAction];
579
-
580
- UIAlertAction *deleteAction = [UIAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackComposeAttachmentDelete")
581
- style:UIAlertActionStyleDestructive
582
- handler:^(UIAlertAction * action) {
583
- typeof(self) strongSelf = weakSelf;
584
- [strongSelf deleteAction];
585
- _actionSheetVisible = NO;
586
- }];
587
-
588
- [alertController addAction:deleteAction];
589
-
590
- [self presentViewController:alertController animated:YES completion:nil];
591
- } else {
592
- */
593
- #pragma clang diagnostic push
594
- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
595
- UIActionSheet *actionSheet = [[UIActionSheet alloc ] initWithTitle: nil
596
- delegate: self
597
- cancelButtonTitle: BITHockeyLocalizedString (@" HockeyFeedbackComposeAttachmentCancel" )
598
- destructiveButtonTitle: BITHockeyLocalizedString (@" HockeyFeedbackComposeAttachmentDelete" )
599
- otherButtonTitles: BITHockeyLocalizedString (@" HockeyFeedbackComposeAttachmentEdit" ), nil ];
600
543
601
- [actionSheet showFromRect: sender.frame inView: self .attachmentScrollView animated: YES ];
602
- #pragma clang diagnostic push
603
- /* }*/
544
+ __weak typeof (self) weakSelf = self;
545
+
546
+ UIAlertController *alertController = [UIAlertController alertControllerWithTitle: nil
547
+ message: nil
548
+ preferredStyle: UIAlertControllerStyleActionSheet];
549
+
550
+
551
+ UIAlertAction *cancelAction = [UIAlertAction actionWithTitle: BITHockeyLocalizedString (@" HockeyFeedbackComposeAttachmentCancel" )
552
+ style: UIAlertActionStyleCancel
553
+ handler: ^(UIAlertAction __unused *action) {
554
+ typeof (self) strongSelf = weakSelf;
555
+ [strongSelf cancelAction ];
556
+ strongSelf.actionSheetVisible = NO ;
557
+ }];
558
+
559
+ [alertController addAction: cancelAction];
560
+
561
+ UIAlertAction *editAction = [UIAlertAction actionWithTitle: BITHockeyLocalizedString (@" HockeyFeedbackComposeAttachmentEdit" )
562
+ style: UIAlertActionStyleDefault
563
+ handler: ^(UIAlertAction __unused *action) {
564
+ typeof (self) strongSelf = weakSelf;
565
+ [strongSelf editAction ];
566
+ strongSelf.actionSheetVisible = NO ;
567
+ }];
568
+
569
+ [alertController addAction: editAction];
570
+
571
+ UIAlertAction *deleteAction = [UIAlertAction actionWithTitle: BITHockeyLocalizedString (@" HockeyFeedbackComposeAttachmentDelete" )
572
+ style: UIAlertActionStyleDestructive
573
+ handler: ^(UIAlertAction __unused *action) {
574
+ typeof (self) strongSelf = weakSelf;
575
+ [strongSelf deleteAction ];
576
+ strongSelf.actionSheetVisible = NO ;
577
+ }];
578
+
579
+ [alertController addAction: deleteAction];
580
+
581
+ [self presentViewController: alertController animated: YES completion: nil ];
604
582
605
583
self.actionSheetVisible = YES ;
606
- if ((UI_USER_INTERFACE_IDIOM () == UIUserInterfaceIdiomPad) || ([[NSProcessInfo processInfo ] respondsToSelector: @selector ( isOperatingSystemAtLeastVersion: )] && [[ NSProcessInfo processInfo ] isOperatingSystemAtLeastVersion: (NSOperatingSystemVersion ){9 ,0 ,0 }])) {
584
+ if ((UI_USER_INTERFACE_IDIOM () == UIUserInterfaceIdiomPad) || ([[NSProcessInfo processInfo ] isOperatingSystemAtLeastVersion: (NSOperatingSystemVersion ){9 ,0 ,0 }])) {
607
585
[self .textView resignFirstResponder ];
608
586
}
609
587
}
0 commit comments