mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Allow customizable attachments to feedback
- New `BITHockeyAttachment` class, which `BITCrashAttachment` is now a subclass of - Can also be used in `prepareWithItems:` for BITFeedbackComposeViewController - Allows to set a custom filename and content-type for attachments that can be used with crash reports and with feedback
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#import "BITHockeyHelper.h"
|
||||
|
||||
#import "BITImageAnnotationViewController.h"
|
||||
#import "BITHockeyAttachment.h"
|
||||
|
||||
|
||||
@interface BITFeedbackComposeViewController () <BITFeedbackUserDataDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIActionSheetDelegate, BITImageAnnotationDelegate> {
|
||||
@@ -114,6 +115,22 @@
|
||||
BITFeedbackMessageAttachment *attachment = [BITFeedbackMessageAttachment attachmentWithData:item contentType:@"application/octet-stream"];
|
||||
attachment.originalFilename = [NSString stringWithFormat:@"Attachment_%li.data", (unsigned long)[self.attachments count]];
|
||||
[self.attachments addObject:attachment];
|
||||
} else if ([item isKindOfClass:[BITHockeyAttachment class]]) {
|
||||
BITHockeyAttachment *sourceAttachment = (BITHockeyAttachment *)item;
|
||||
|
||||
if (!sourceAttachment.hockeyAttachmentData) {
|
||||
BITHockeyLog(@"BITHockeyAttachment instance doesn't contain any data.");
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *filename = [NSString stringWithFormat:@"Attachment_%li.data", (unsigned long)[self.attachments count]];
|
||||
if (sourceAttachment.filename) {
|
||||
filename = sourceAttachment.filename;
|
||||
}
|
||||
|
||||
BITFeedbackMessageAttachment *attachment = [BITFeedbackMessageAttachment attachmentWithData:sourceAttachment.hockeyAttachmentData contentType:sourceAttachment.contentType];
|
||||
attachment.originalFilename = filename;
|
||||
[self.attachments addObject:attachment];
|
||||
} else {
|
||||
BITHockeyLog(@"Unknown item type %@", item);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user