diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 05e290b525..52032e7b3a 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -148,6 +148,7 @@ 34641E1B2088DA4100E2EDE5 /* ScreenLockViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34641E192088DA3F00E2EDE5 /* ScreenLockViewController.m */; }; 34641E1C2088DA4100E2EDE5 /* ScreenLockViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 34641E1A2088DA4000E2EDE5 /* ScreenLockViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 34641E1F2088DA6D00E2EDE5 /* SAEScreenLockViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34641E1E2088DA6D00E2EDE5 /* SAEScreenLockViewController.m */; }; + 34661FB820C1C0D60056EDD6 /* message_sent.aiff in Resources */ = {isa = PBXBuildFile; fileRef = 34661FB720C1C0D60056EDD6 /* message_sent.aiff */; }; 346B66311F4E29B200E5122F /* CropScaleImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 346B66301F4E29B200E5122F /* CropScaleImageViewController.swift */; }; 347850311FD7494A007B8332 /* dripicons-v2.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34330A5B1E787A9800DF2FB9 /* dripicons-v2.ttf */; }; 347850321FD7494A007B8332 /* ElegantIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34330A5D1E787BD800DF2FB9 /* ElegantIcons.ttf */; }; @@ -757,6 +758,7 @@ 34641E1A2088DA4000E2EDE5 /* ScreenLockViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScreenLockViewController.h; path = SignalMessaging/ViewControllers/ScreenLockViewController.h; sourceTree = SOURCE_ROOT; }; 34641E1D2088DA6C00E2EDE5 /* SAEScreenLockViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SAEScreenLockViewController.h; sourceTree = ""; }; 34641E1E2088DA6D00E2EDE5 /* SAEScreenLockViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SAEScreenLockViewController.m; sourceTree = ""; }; + 34661FB720C1C0D60056EDD6 /* message_sent.aiff */ = {isa = PBXFileReference; lastKnownFileType = audio.aiff; name = message_sent.aiff; path = Signal/AudioFiles/message_sent.aiff; sourceTree = SOURCE_ROOT; }; 346B66301F4E29B200E5122F /* CropScaleImageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CropScaleImageViewController.swift; sourceTree = ""; }; 347850561FD86544007B8332 /* SAEFailedViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SAEFailedViewController.swift; sourceTree = ""; }; 347850581FD9972E007B8332 /* SwiftSingletons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftSingletons.swift; sourceTree = ""; }; @@ -1279,6 +1281,7 @@ isa = PBXGroup; children = ( 45A2F004204473A3002E978A /* NewMessage.aifc */, + 34661FB720C1C0D60056EDD6 /* message_sent.aiff */, 34CF0783203E6B77005C4D61 /* busy_tone_ansi.caf */, 34CF0786203E6B78005C4D61 /* end_call_tone_cept.caf */, 34074FC5203E5435004596AE /* messageReceivedSounds */, @@ -2747,6 +2750,7 @@ 34CF0788203E6B78005C4D61 /* ringback_tone_ansi.caf in Resources */, 34C3C78F2040A4F70000134C /* sonarping.mp3 in Resources */, AD83FF431A73426500B5C81A /* audio_play_button@2x.png in Resources */, + 34661FB820C1C0D60056EDD6 /* message_sent.aiff in Resources */, 45CB2FA81CB7146C00E1B343 /* Launch Screen.storyboard in Resources */, 34B3F8781E8DF1700035BE1A /* ContactsPicker.xib in Resources */, B633C5C31A1D190B0059AC12 /* mute_off@2x.png in Resources */, diff --git a/Signal/AudioFiles/message_sent.aiff b/Signal/AudioFiles/message_sent.aiff new file mode 100644 index 0000000000..e46adff5ec Binary files /dev/null and b/Signal/AudioFiles/message_sent.aiff differ diff --git a/Signal/src/Models/AccountManager.swift b/Signal/src/Models/AccountManager.swift index fb46966d10..a6a17f06dd 100644 --- a/Signal/src/Models/AccountManager.swift +++ b/Signal/src/Models/AccountManager.swift @@ -52,9 +52,9 @@ public class AccountManager: NSObject { Logger.debug("\(self.TAG) registering with signal server") let registrationPromise: Promise = firstly { - self.registerForTextSecure(verificationCode: verificationCode, pin: pin) + return self.registerForTextSecure(verificationCode: verificationCode, pin: pin) }.then { - self.syncPushTokens() + return self.syncPushTokens() }.recover { (error) -> Promise in switch error { case PushRegistrationError.pushNotSupported(let description): diff --git a/Signal/src/Signal-Bridging-Header.h b/Signal/src/Signal-Bridging-Header.h index e8a428a910..df9d0ad239 100644 --- a/Signal/src/Signal-Bridging-Header.h +++ b/Signal/src/Signal-Bridging-Header.h @@ -41,12 +41,6 @@ #import "UIViewController+Permissions.h" #import "ViewControllerUtils.h" #import -#import -#import -#import -#import -#import -#import #import #import #import diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m index 85299986dd..98a9403af5 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSAudioMessageView.m @@ -5,10 +5,10 @@ #import "OWSAudioMessageView.h" #import "ConversationViewItem.h" #import "Signal-Swift.h" -#import "UIColor+JSQMessages.h" #import "UIColor+OWS.h" #import "ViewControllerUtils.h" #import +#import #import NS_ASSUME_NONNULL_BEGIN @@ -179,7 +179,7 @@ NS_ASSUME_NONNULL_BEGIN - (UIColor *)bubbleBackgroundColor { - return self.isIncoming ? [UIColor jsq_messageBubbleLightGrayColor] : [UIColor ows_materialBlueColor]; + return self.isIncoming ? [UIColor ows_messageBubbleLightGrayColor] : [UIColor ows_materialBlueColor]; } - (BOOL)isVoiceMessage diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m index 6402fbbf67..89af63251a 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactOffersCell.m @@ -4,8 +4,6 @@ #import "OWSContactOffersCell.h" #import "ConversationViewItem.h" -#import "NSBundle+JSQMessages.h" -#import #import #import #import @@ -139,7 +137,7 @@ NS_ASSUME_NONNULL_BEGIN OWSContactOffersInteraction *interaction = (OWSContactOffersInteraction *)self.viewItem.interaction; - // We're using a bit of a hack to get JSQ to layout this and the unread indicator as + // We're using a bit of a hack to get this and the unread indicator to layout as // "full width" cells. These cells will end up with an erroneous left margin that we // want to reverse. CGFloat contentWidth = self.width; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m index 6b23a2ec73..1a60642fa5 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSContactShareView.m @@ -5,12 +5,12 @@ #import "OWSContactShareView.h" #import "OWSContactAvatarBuilder.h" #import "Signal-Swift.h" -#import "UIColor+JSQMessages.h" #import "UIColor+OWS.h" #import "UIFont+OWS.h" #import "UIView+OWS.h" #import #import +#import #import NS_ASSUME_NONNULL_BEGIN @@ -145,7 +145,7 @@ NS_ASSUME_NONNULL_BEGIN - (UIColor *)bubbleBackgroundColor { - return self.isIncoming ? [UIColor jsq_messageBubbleLightGrayColor] : [UIColor ows_materialBlueColor]; + return self.isIncoming ? [UIColor ows_messageBubbleLightGrayColor] : [UIColor ows_materialBlueColor]; } + (UIFont *)nameFont diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m index 29c88ac4c5..8778028eea 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSGenericAttachmentView.m @@ -4,13 +4,13 @@ #import "OWSGenericAttachmentView.h" #import "OWSBezierPathView.h" -#import "UIColor+JSQMessages.h" #import "UIColor+OWS.h" #import "UIFont+OWS.h" #import "UIView+OWS.h" #import "ViewControllerUtils.h" #import #import +#import #import #import @@ -88,7 +88,7 @@ NS_ASSUME_NONNULL_BEGIN - (UIColor *)bubbleBackgroundColor { - return self.isIncoming ? [UIColor jsq_messageBubbleLightGrayColor] : [UIColor ows_materialBlueColor]; + return self.isIncoming ? [UIColor ows_messageBubbleLightGrayColor] : [UIColor ows_materialBlueColor]; } - (UIColor *)textColor diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m index 2a33bac771..587598c350 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSMessageBubbleView.m @@ -768,11 +768,11 @@ NS_ASSUME_NONNULL_BEGIN switch (self.attachmentPointer.state) { case TSAttachmentPointerStateEnqueued: customView.backgroundColor - = (self.isIncoming ? [UIColor jsq_messageBubbleLightGrayColor] : [UIColor ows_fadedBlueColor]); + = (self.isIncoming ? [UIColor ows_messageBubbleLightGrayColor] : [UIColor ows_fadedBlueColor]); break; case TSAttachmentPointerStateDownloading: customView.backgroundColor - = (self.isIncoming ? [UIColor jsq_messageBubbleLightGrayColor] : [UIColor ows_fadedBlueColor]); + = (self.isIncoming ? [UIColor ows_messageBubbleLightGrayColor] : [UIColor ows_fadedBlueColor]); break; case TSAttachmentPointerStateFailed: customView.backgroundColor = [UIColor grayColor]; diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m index eb8ad7526c..2a3e4e9f03 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSSystemMessageCell.m @@ -4,11 +4,9 @@ #import "OWSSystemMessageCell.h" #import "ConversationViewItem.h" -#import "NSBundle+JSQMessages.h" #import "UIColor+OWS.h" #import "UIFont+OWS.h" #import "UIView+OWS.h" -#import #import #import #import diff --git a/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m b/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m index ffa23218c6..7801476978 100644 --- a/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m +++ b/Signal/src/ViewControllers/ConversationView/Cells/OWSUnreadIndicatorCell.m @@ -4,8 +4,6 @@ #import "OWSUnreadIndicatorCell.h" #import "ConversationViewItem.h" -#import "NSBundle+JSQMessages.h" -#import #import #import #import @@ -133,7 +131,8 @@ NS_ASSUME_NONNULL_BEGIN @"Messages that indicates that there are more unseen messages including safety number changes that " @"be revealed by tapping the 'load earlier messages' button. Embeds {{the name of the 'load earlier " @"messages' button}}.")); - NSString *loadMoreButtonName = [NSBundle jsq_localizedStringForKey:@"load_earlier_messages"]; + NSString *loadMoreButtonName = NSLocalizedString( + @"load_earlier_messages", @"Label for button that loads more messages in conversation view."); return [NSString stringWithFormat:subtitleFormat, loadMoreButtonName]; } diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 982756545d..ac1b53cc45 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -45,14 +45,6 @@ #import #import #import -#import -#import -#import -#import -#import -#import -#import -#import #import #import #import @@ -1479,8 +1471,6 @@ typedef enum : NSUInteger { [((TSContactThread *)self.thread).contactIdentifier isEqualToString:[TSAccountManager localNumber]]); } -#pragma mark - JSQMessagesViewController method overrides - #pragma mark - Dynamic Text /** @@ -2702,7 +2692,8 @@ typedef enum : NSUInteger { self.inputToolbar.quotedReply = nil; if ([Environment.preferences soundInForeground]) { - [JSQSystemSoundPlayer jsq_playMessageSentSound]; + SystemSoundID soundId = [OWSSounds systemSoundIDForSound:OWSSound_MessageSent quiet:YES]; + AudioServicesPlaySystemSound(soundId); } } diff --git a/Signal/src/ViewControllers/MediaTileViewController.swift b/Signal/src/ViewControllers/MediaTileViewController.swift index f6a5ecf029..2f5d03f676 100644 --- a/Signal/src/ViewControllers/MediaTileViewController.swift +++ b/Signal/src/ViewControllers/MediaTileViewController.swift @@ -522,7 +522,7 @@ public class MediaTileViewController: UICollectionViewController, MediaGalleryDa return } - let items: [MediaGalleryItem] = indexPaths.flatMap { return self.galleryItem(at: $0) } + let items: [MediaGalleryItem] = indexPaths.compactMap { return self.galleryItem(at: $0) } guard let mediaGalleryDataSource = self.mediaGalleryDataSource else { owsFail("\(logTag) in \(#function) mediaGalleryDataSource was unexpectedly nil") diff --git a/Signal/src/ViewControllers/SafetyNumberConfirmationAlert.swift b/Signal/src/ViewControllers/SafetyNumberConfirmationAlert.swift index 8964ddf246..cd514edd12 100644 --- a/Signal/src/ViewControllers/SafetyNumberConfirmationAlert.swift +++ b/Signal/src/ViewControllers/SafetyNumberConfirmationAlert.swift @@ -112,7 +112,7 @@ public class SafetyNumberConfirmationAlert: NSObject { } private func untrustedIdentityForSending(recipientIds: [String]) -> OWSRecipientIdentity? { - return recipientIds.flatMap { + return recipientIds.compactMap { OWSIdentityManager.shared().untrustedIdentityForSending(toRecipientId: $0) }.first } diff --git a/Signal/src/environment/ExperienceUpgrades/ExperienceUpgradeFinder.swift b/Signal/src/environment/ExperienceUpgrades/ExperienceUpgradeFinder.swift index d6e8fcbb99..cf132252f4 100644 --- a/Signal/src/environment/ExperienceUpgrades/ExperienceUpgradeFinder.swift +++ b/Signal/src/environment/ExperienceUpgrades/ExperienceUpgradeFinder.swift @@ -74,7 +74,7 @@ enum ExperienceUpgradeId: String { // introducingProfiles, // introducingReadReceipts, configurableNotificationAudio - ].flatMap { $0 } + ].compactMap { $0 } } // MARK: - Instance Methods diff --git a/Signal/src/network/GiphyAPI.swift b/Signal/src/network/GiphyAPI.swift index 97f68382a5..38f8ab394d 100644 --- a/Signal/src/network/GiphyAPI.swift +++ b/Signal/src/network/GiphyAPI.swift @@ -368,7 +368,7 @@ extension GiphyError: LocalizedError { Logger.error("\(TAG) Invalid response data.") return nil } - return imageDicts.flatMap { imageDict in + return imageDicts.compactMap { imageDict in return parseGiphyImage(imageDict: imageDict) } } diff --git a/Signal/test/SignalTests-Bridging-Header.h b/Signal/test/SignalTests-Bridging-Header.h index 2fbb2d90d5..05752f2d58 100644 --- a/Signal/test/SignalTests-Bridging-Header.h +++ b/Signal/test/SignalTests-Bridging-Header.h @@ -1,7 +1,5 @@ // -// Copyright (c) 2017 Open Whisper Systems. All rights reserved. +// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // #import "Signal-Bridging-Header.h" -#import -#import diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index c70c31e107..bae7012edc 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -1094,6 +1094,9 @@ /* table cell label in conversation settings */ "LIST_GROUP_MEMBERS_ACTION" = "Group Members"; +/* Label for button that loads more messages in conversation view. */ +"load_earlier_messages" = "Load Earlier Messages"; + /* No comment provided by engineer. */ "LOGGING_SECTION" = "Logging"; diff --git a/SignalMessaging/categories/UIColor+OWS.h b/SignalMessaging/categories/UIColor+OWS.h index 7e3038a9b5..6505070207 100644 --- a/SignalMessaging/categories/UIColor+OWS.h +++ b/SignalMessaging/categories/UIColor+OWS.h @@ -25,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN @property (class, readonly, nonatomic) UIColor *ows_errorMessageBorderColor; @property (class, readonly, nonatomic) UIColor *ows_infoMessageBorderColor; @property (class, readonly, nonatomic) UIColor *ows_toolbarBackgroundColor; +@property (class, readonly, nonatomic) UIColor *ows_messageBubbleLightGrayColor; + (UIColor *)backgroundColorForContact:(NSString *)contactIdentifier; + (UIColor *)colorWithRGBHex:(unsigned long)value; diff --git a/SignalMessaging/categories/UIColor+OWS.m b/SignalMessaging/categories/UIColor+OWS.m index 12dbe90871..c9293d968d 100644 --- a/SignalMessaging/categories/UIColor+OWS.m +++ b/SignalMessaging/categories/UIColor+OWS.m @@ -111,6 +111,11 @@ NS_ASSUME_NONNULL_BEGIN return sharedColor; } ++ (UIColor *)ows_messageBubbleLightGrayColor +{ + return [UIColor colorWithHue:240.0f / 360.0f saturation:0.02f brightness:0.92f alpha:1.0f]; +} + + (UIColor *)backgroundColorForContact:(NSString *)contactIdentifier { NSArray *colors = @[ diff --git a/SignalMessaging/environment/OWSAudioSession.swift b/SignalMessaging/environment/OWSAudioSession.swift index c331587daa..1822e41708 100644 --- a/SignalMessaging/environment/OWSAudioSession.swift +++ b/SignalMessaging/environment/OWSAudioSession.swift @@ -128,7 +128,7 @@ public class OWSAudioSession: NSObject { defer { objc_sync_exit(self) } // Cull any stale activities - currentActivities = currentActivities.flatMap { oldActivity in + currentActivities = currentActivities.compactMap { oldActivity in guard oldActivity.value != nil else { // Normally we should be explicitly stopping an audio activity, but this allows // for recovery if the owner of the AudioAcivity was GC'd without ending it's diff --git a/SignalMessaging/environment/OWSSounds.h b/SignalMessaging/environment/OWSSounds.h index f2f311dd7e..746470f21c 100644 --- a/SignalMessaging/environment/OWSSounds.h +++ b/SignalMessaging/environment/OWSSounds.h @@ -34,6 +34,7 @@ typedef NS_ENUM(NSUInteger, OWSSound) { OWSSound_CallFailure, // Other + OWSSound_MessageSent, OWSSound_None, OWSSound_DefaultiOSIncomingRingtone = OWSSound_Opening, }; diff --git a/SignalMessaging/environment/OWSSounds.m b/SignalMessaging/environment/OWSSounds.m index 9e29a8653a..4d9465a2ae 100644 --- a/SignalMessaging/environment/OWSSounds.m +++ b/SignalMessaging/environment/OWSSounds.m @@ -96,7 +96,7 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob _dbConnection = primaryStorage.newDatabaseConnection; // Don't store too many sounds in memory. Most users will only use 1 or 2 sounds anyway. - _cachedSystemSounds = [[AnyLRUCache alloc] initWithMaxSize:3]; + _cachedSystemSounds = [[AnyLRUCache alloc] initWithMaxSize:4]; OWSSingletonAssert(); @@ -172,6 +172,8 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob return @"Call Busy"; case OWSSound_CallFailure: return @"Call Failure"; + case OWSSound_MessageSent: + return @"Message Sent"; // Other case OWSSound_None: @@ -234,6 +236,8 @@ NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlob return @"busy_tone_ansi.caf"; case OWSSound_CallFailure: return @"end_call_tone_cept.caf"; + case OWSSound_MessageSent: + return @"message_sent.aiff"; // Other case OWSSound_None: diff --git a/SignalMessaging/utils/OWSMessagesBubbleImageFactory.swift b/SignalMessaging/utils/OWSMessagesBubbleImageFactory.swift index ef923b9bd6..12f743c7a2 100644 --- a/SignalMessaging/utils/OWSMessagesBubbleImageFactory.swift +++ b/SignalMessaging/utils/OWSMessagesBubbleImageFactory.swift @@ -3,7 +3,6 @@ // import Foundation -import JSQMessagesViewController import SignalServiceKit @objc @@ -12,8 +11,6 @@ public class OWSMessagesBubbleImageFactory: NSObject { @objc public static let shared = OWSMessagesBubbleImageFactory() - private let jsqFactory = JSQMessagesBubbleImageFactory()! - // TODO: UIView is a little bit expensive to instantiate. // Can we cache this value? private lazy var isRTL: Bool = { @@ -21,50 +18,7 @@ public class OWSMessagesBubbleImageFactory: NSObject { }() @objc - public lazy var incoming: JSQMessagesBubbleImage = { - let color = OWSMessagesBubbleImageFactory.bubbleColorIncoming - return self.incoming(color: color) - }() - - @objc - public lazy var outgoing: JSQMessagesBubbleImage = { - let color = OWSMessagesBubbleImageFactory.bubbleColorOutgoingSent - return self.outgoing(color: color) - }() - - @objc - public lazy var currentlyOutgoing: JSQMessagesBubbleImage = { - let color = OWSMessagesBubbleImageFactory.bubbleColorOutgoingSending - return self.outgoing(color: color) - }() - - @objc - public lazy var outgoingFailed: JSQMessagesBubbleImage = { - let color = OWSMessagesBubbleImageFactory.bubbleColorOutgoingUnsent - return self.outgoing(color: color) - }() - - @objc - public func bubble(message: TSMessage) -> JSQMessagesBubbleImage { - if message is TSIncomingMessage { - return self.incoming - } else if let outgoingMessage = message as? TSOutgoingMessage { - switch outgoingMessage.messageState { - case .failed: - return outgoingFailed - case .sending: - return currentlyOutgoing - default: - return outgoing - } - } else { - owsFail("Unexpected message type: \(message)") - return outgoing - } - } - - @objc - public static let bubbleColorIncoming = UIColor.jsq_messageBubbleLightGray()! + public static let bubbleColorIncoming = UIColor.ows_messageBubbleLightGray @objc public static let bubbleColorOutgoingUnsent = UIColor.gray @@ -93,20 +47,4 @@ public class OWSMessagesBubbleImageFactory: NSObject { return UIColor.ows_materialBlue } } - - private func outgoing(color: UIColor) -> JSQMessagesBubbleImage { - if isRTL { - return jsqFactory.incomingMessagesBubbleImage(with: color) - } else { - return jsqFactory.outgoingMessagesBubbleImage(with: color) - } - } - - private func incoming(color: UIColor) -> JSQMessagesBubbleImage { - if isRTL { - return jsqFactory.outgoingMessagesBubbleImage(with: color) - } else { - return jsqFactory.incomingMessagesBubbleImage(with: color) - } - } }