Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent bdc729ad29
commit 58e273b1a3

@ -1914,6 +1914,10 @@ typedef enum : NSUInteger {
dataUTI:(NSString *) kUTTypeJPEG];
if (!attachment ||
[attachment hasError]) {
DDLogWarn(@"%@ %s Invalid attachment: %@.",
self.tag,
__PRETTY_FUNCTION__,
attachment ? [attachment errorMessage] : @"Missing data");
failedToPickAttachment(nil);
} else {
[self sendMessageAttachment:attachment];
@ -1952,7 +1956,10 @@ typedef enum : NSUInteger {
dataUTI:dataUTI];
if (!attachment ||
[attachment hasError]) {
// TODO: Should we create an NSError?
DDLogWarn(@"%@ %s Invalid attachment: %@.",
self.tag,
__PRETTY_FUNCTION__,
attachment ? [attachment errorMessage] : @"Missing data");
failedToPickAttachment(nil);
} else {
[self dismissViewControllerAnimated:YES
@ -2036,6 +2043,10 @@ typedef enum : NSUInteger {
dataUTI:(NSString *) kUTTypeMPEG4];
if (!attachment ||
[attachment hasError]) {
DDLogWarn(@"%@ %s Invalid attachment: %@.",
self.tag,
__PRETTY_FUNCTION__,
attachment ? [attachment errorMessage] : @"Missing data");
// TODO: How should we handle errors here?
} else {
[self sendMessageAttachment:attachment];
@ -2247,6 +2258,10 @@ typedef enum : NSUInteger {
dataUTI:(NSString *) kUTTypeMPEG4Audio];
if (!attachment ||
[attachment hasError]) {
DDLogWarn(@"%@ %s Invalid attachment: %@.",
self.tag,
__PRETTY_FUNCTION__,
attachment ? [attachment errorMessage] : @"Missing data");
// TODO: How should we handle errors here?
} else {
[self sendMessageAttachment:attachment];
@ -2483,6 +2498,10 @@ typedef enum : NSUInteger {
if (attachment == nil ||
[attachment hasError]) {
DDLogWarn(@"%@ %s Invalid attachment: %@.",
self.tag,
__PRETTY_FUNCTION__,
attachment ? [attachment errorMessage] : @"Missing data");
// TODO: Add UI.
} else {
__weak MessagesViewController *weakSelf = self;

@ -91,6 +91,15 @@ class SignalAttachment: NSObject {
return error != nil
}
var errorMessage: String? {
guard let error = error else {
// This method should only be called if there is an error.
assert(false)
return nil
}
return "\(error)"
}
// Returns the MIME type for this attachment or nil if no MIME type
// can be identified.
var mimeType: String? {

Loading…
Cancel
Save