From 167358f25c2ce459066c3e97f4271fae50d0b55d Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Tue, 12 May 2015 12:25:03 +0200 Subject: [PATCH] Add option to hide "Add Image" attachment button --- Classes/BITFeedbackComposeViewController.h | 8 ++++++++ Classes/BITFeedbackComposeViewController.m | 4 +++- Classes/BITFeedbackManager.h | 13 +++++++++++++ Classes/BITFeedbackManager.m | 1 + 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Classes/BITFeedbackComposeViewController.h b/Classes/BITFeedbackComposeViewController.h index a10090f190..c37cbb2e8b 100644 --- a/Classes/BITFeedbackComposeViewController.h +++ b/Classes/BITFeedbackComposeViewController.h @@ -69,6 +69,14 @@ ///----------------------------------------------------------------------------- +/** + Don't show the option to add images from the photo library + + This is helpful if your application is landscape only, since the system UI for + selecting an image from the photo library is portrait only + */ +@property (nonatomic) BOOL hideImageAttachmentButton; + /** An array of data objects that should be used to prefill the compose view content diff --git a/Classes/BITFeedbackComposeViewController.m b/Classes/BITFeedbackComposeViewController.m index 5156b63a6b..55e4ec39a3 100644 --- a/Classes/BITFeedbackComposeViewController.m +++ b/Classes/BITFeedbackComposeViewController.m @@ -248,7 +248,9 @@ [self.textAccessoryView addSubview:self.addPhotoButton]; - self.textView.inputAccessoryView = self.textAccessoryView; + if (!self.hideImageAttachmentButton) { + self.textView.inputAccessoryView = self.textAccessoryView; + } // This could be a subclass, yet self.attachmentScrollView = [[UIScrollView alloc] initWithFrame:CGRectZero]; diff --git a/Classes/BITFeedbackManager.h b/Classes/BITFeedbackManager.h index 20423e18e6..6538d29f2e 100644 --- a/Classes/BITFeedbackManager.h +++ b/Classes/BITFeedbackManager.h @@ -234,6 +234,19 @@ typedef NS_ENUM(NSInteger, BITFeedbackObservationMode) { @property (nonatomic, copy) NSArray *feedbackComposerPreparedItems; +/** + Don't show the option to add images from the photo library + + This is helpful if your application is landscape only, since the system UI for + selecting an image from the photo library is portrait only + + This setting is used for all feedback compose views that are created by the + `BITFeedbackManager`. If you invoke your own `BITFeedbackComposeViewController`, + then set the appropriate property on the view controller directl!. + */ +@property (nonatomic) BOOL feedbackComposeHideImageAttachmentButton; + + ///----------------------------------------------------------------------------- /// @name User Interface ///----------------------------------------------------------------------------- diff --git a/Classes/BITFeedbackManager.m b/Classes/BITFeedbackManager.m index 160ed3f8b2..b6caf209c0 100644 --- a/Classes/BITFeedbackManager.m +++ b/Classes/BITFeedbackManager.m @@ -225,6 +225,7 @@ NSString *const kBITFeedbackUpdateAttachmentThumbnail = @"BITFeedbackUpdateAttac - (BITFeedbackComposeViewController *)feedbackComposeViewController { BITFeedbackComposeViewController *composeViewController = [[BITFeedbackComposeViewController alloc] init]; [composeViewController prepareWithItems:self.feedbackComposerPreparedItems]; + [composeViewController setHideImageAttachmentButton:self.feedbackComposeHideImageAttachmentButton]; // by default set the delegate to be identical to the one of BITFeedbackManager [composeViewController setDelegate:self.delegate];