diff --git a/Signal/src/environment/PropertyListPreferences.h b/Signal/src/environment/PropertyListPreferences.h index b6f5f7d99..b5590634d 100644 --- a/Signal/src/environment/PropertyListPreferences.h +++ b/Signal/src/environment/PropertyListPreferences.h @@ -13,13 +13,6 @@ typedef NS_ENUM(NSUInteger, NotificationType) { NotificationNamePreview, }; -typedef NS_ENUM(NSUInteger, TSImageQuality) { - TSImageQualityUncropped = 1, - TSImageQualityHigh = 2, - TSImageQualityMedium = 3, - TSImageQualityLow = 4 -}; - // Used when migrating logging to NSUserDefaults. extern NSString *const PropertyListPreferencesSignalDatabaseCollection; extern NSString *const PropertyListPreferencesKeyEnableDebugLog; @@ -59,8 +52,6 @@ extern NSString *const PropertyListPreferencesKeyEnableDebugLog; - (BOOL)hasRegisteredVOIPPush; - (void)setHasRegisteredVOIPPush:(BOOL)enabled; -- (TSImageQuality)imageUploadQuality; - + (nullable NSString *)lastRanVersion; + (NSString *)setAndGetCurrentVersion; diff --git a/Signal/src/environment/PropertyListPreferences.m b/Signal/src/environment/PropertyListPreferences.m index 5caa7fc51..fe5689286 100644 --- a/Signal/src/environment/PropertyListPreferences.m +++ b/Signal/src/environment/PropertyListPreferences.m @@ -110,12 +110,6 @@ NSString *const PropertyListPreferencesKeyCallsHideIPAddress = @"CallsHideIPAddr } } -- (TSImageQuality)imageUploadQuality -{ - // always return average image quality - return TSImageQualityMedium; -} - - (void)setScreenSecurity:(BOOL)flag { [self setValueForKey:PropertyListPreferencesKeyScreenSecurity toValue:@(flag)]; diff --git a/Signal/src/view controllers/MessagesViewController.m b/Signal/src/view controllers/MessagesViewController.m index 6ef9dc290..1dc43f640 100644 --- a/Signal/src/view controllers/MessagesViewController.m +++ b/Signal/src/view controllers/MessagesViewController.m @@ -118,10 +118,6 @@ typedef enum : NSUInteger { - (BOOL)canPerformAction:(SEL)action withSender:(id)sender { if (action == @selector(paste:)) { - DDLogWarn(@"UIPasteboard.generalPasteboard(): %@.", - [UIPasteboard generalPasteboard].pasteboardTypes); - DDLogWarn(@"UIPasteboard.generalPasteboard(): %d.", - (int) [UIPasteboard generalPasteboard].numberOfItems); if ([self pasteBoardHasPossibleAttachment]) { return YES; } @@ -2479,9 +2475,6 @@ typedef enum : NSUInteger { - (BOOL)composerTextView:(JSQMessagesComposerTextView *)textView shouldPasteWithSender:(id)sender { - DDLogError(@"%@ sender: %@", - self.tag, - sender); return YES; } diff --git a/Signal/src/view controllers/SignalAttachment.swift b/Signal/src/view controllers/SignalAttachment.swift index b9dfe55dd..ae96f2d39 100644 --- a/Signal/src/view controllers/SignalAttachment.swift +++ b/Signal/src/view controllers/SignalAttachment.swift @@ -13,6 +13,13 @@ enum SignalAttachmentError: String { case invalidFileFormat } +enum TSImageQuality: Int { + case uncropped + case high + case medium + case low +} + // Represents a possible attachment to upload. // The attachment may be invalid. // @@ -260,6 +267,13 @@ class SignalAttachment: NSObject { } } + private class func defaultImageUploadQuality() -> TSImageQuality { + // always return average image quality + // + // TODO: Why are we using this value? Why not default to .uncropped? + return .medium + } + // If the proposed attachment already is a JPEG, and already conforms to the // file size and content size limits, don't recompress it. // @@ -272,8 +286,8 @@ class SignalAttachment: NSObject { return false } if dataUTI == kUTTypeJPEG as String { - let imageUploadQuality = Environment.preferences().imageUploadQuality() - let maxSize = maxSizeForImage(image: image, imageUploadQuality:imageUploadQuality) + let maxSize = maxSizeForImage(image: image, + imageUploadQuality:defaultImageUploadQuality()) if image.size.width <= maxSize && image.size.height <= maxSize && imageData.count <= kMaxFileSizeImage { @@ -305,7 +319,7 @@ class SignalAttachment: NSObject { private class func compressImageAsJPEG(image: UIImage!, attachment: SignalAttachment!) -> SignalAttachment! { assert(attachment.error == nil) - var imageUploadQuality = Environment.preferences().imageUploadQuality() + var imageUploadQuality = defaultImageUploadQuality() while true { let maxSize = maxSizeForImage(image: image, imageUploadQuality:imageUploadQuality)