+ prepareWithItems accepts UIImages now.

This commit is contained in:
moritz haarmann 2014-02-24 11:37:18 +01:00
parent 6cfc0ac2d2
commit 21e5ca3b9d
2 changed files with 11 additions and 1 deletions

View File

@ -70,6 +70,7 @@
The follwoing data object classes are currently supported: The follwoing data object classes are currently supported:
- NSString - NSString
- NSURL - NSURL
- UIImage
These are automatically concatenated to one text string. These are automatically concatenated to one text string.

View File

@ -95,6 +95,9 @@
self.text = [(self.text ? self.text : @"") stringByAppendingFormat:@"%@%@", (self.text ? @" " : @""), item]; self.text = [(self.text ? self.text : @"") stringByAppendingFormat:@"%@%@", (self.text ? @" " : @""), item];
} else if ([item isKindOfClass:[NSURL class]]) { } else if ([item isKindOfClass:[NSURL class]]) {
self.text = [(self.text ? self.text : @"") stringByAppendingFormat:@"%@%@", (self.text ? @" " : @""), [(NSURL *)item absoluteString]]; 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 { } else {
BITHockeyLog(@"Unknown item type %@", item); BITHockeyLog(@"Unknown item type %@", item);
} }
@ -221,6 +224,8 @@
} }
[self updateBarButtonState]; [self updateBarButtonState];
} }
- (void)viewDidAppear:(BOOL)animated { - (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 // 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.textView performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.0];
} }
[self refreshAttachmentScrollview];
} }
- (void)viewWillDisappear:(BOOL)animated { - (void)viewWillDisappear:(BOOL)animated {
@ -264,7 +272,7 @@
CGRect scrollViewFrame = self.attachmentScrollView.frame; CGRect scrollViewFrame = self.attachmentScrollView.frame;
BOOL alreadySetup = CGRectGetWidth(scrollViewFrame) == scrollViewWidth; BOOL alreadySetup = CGRectGetWidth(scrollViewFrame) > 0;
if (!alreadySetup){ if (!alreadySetup){
textViewFrame.size.width -= scrollViewWidth; textViewFrame.size.width -= scrollViewWidth;
@ -468,6 +476,7 @@
self.selectedAttachmentIndex = NSNotFound; self.selectedAttachmentIndex = NSNotFound;
} }
@end @end
#endif /* HOCKEYSDK_FEATURE_FEEDBACK */ #endif /* HOCKEYSDK_FEATURE_FEEDBACK */