From 21e5ca3b9db68411fc8ed1fdec3db9546d00ec8a Mon Sep 17 00:00:00 2001 From: moritz haarmann Date: Mon, 24 Feb 2014 11:37:18 +0100 Subject: [PATCH] + prepareWithItems accepts UIImages now. --- Classes/BITFeedbackComposeViewController.h | 1 + Classes/BITFeedbackComposeViewController.m | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Classes/BITFeedbackComposeViewController.h b/Classes/BITFeedbackComposeViewController.h index 488e3004e6..5df188c1da 100644 --- a/Classes/BITFeedbackComposeViewController.h +++ b/Classes/BITFeedbackComposeViewController.h @@ -70,6 +70,7 @@ The follwoing data object classes are currently supported: - NSString - NSURL + - UIImage These are automatically concatenated to one text string. diff --git a/Classes/BITFeedbackComposeViewController.m b/Classes/BITFeedbackComposeViewController.m index 3d1bf6a144..b9ab0f15c0 100644 --- a/Classes/BITFeedbackComposeViewController.m +++ b/Classes/BITFeedbackComposeViewController.m @@ -95,6 +95,9 @@ self.text = [(self.text ? self.text : @"") stringByAppendingFormat:@"%@%@", (self.text ? @" " : @""), item]; } else if ([item isKindOfClass:[NSURL class]]) { self.text = [(self.text ? self.text : @"") stringByAppendingFormat:@"%@%@", (self.text ? @" " : @""), [(NSURL *)item absoluteString]]; + } else if ([item isKindOfClass:[UIImage class]]) { + UIImage *image = item; + [self.attachments addObject:[BITFeedbackMessageAttachment attachmentWithData:UIImageJPEGRepresentation(image, 0.7f) contentType:@"image/jpeg"]]; } else { BITHockeyLog(@"Unknown item type %@", item); } @@ -221,6 +224,8 @@ } [self updateBarButtonState]; + + } - (void)viewDidAppear:(BOOL)animated { @@ -236,6 +241,9 @@ // Invoke delayed to fix iOS 7 iPad landscape bug, where this view will be moved if not called delayed [self.textView performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.0]; } + + [self refreshAttachmentScrollview]; + } - (void)viewWillDisappear:(BOOL)animated { @@ -264,7 +272,7 @@ CGRect scrollViewFrame = self.attachmentScrollView.frame; - BOOL alreadySetup = CGRectGetWidth(scrollViewFrame) == scrollViewWidth; + BOOL alreadySetup = CGRectGetWidth(scrollViewFrame) > 0; if (!alreadySetup){ textViewFrame.size.width -= scrollViewWidth; @@ -468,6 +476,7 @@ self.selectedAttachmentIndex = NSNotFound; } + @end #endif /* HOCKEYSDK_FEATURE_FEEDBACK */