From 3d0e7386a4d9688b9d50fe71630c25881900bb34 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 31 Oct 2018 12:19:07 -0400 Subject: [PATCH] Respond to CR. --- Pods | 2 +- .../ConversationViewController.m | 10 ++++---- .../src/Util/TypingIndicators.swift | 25 +++++++------------ 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/Pods b/Pods index 5821eb8e9..809897a81 160000 --- a/Pods +++ b/Pods @@ -1 +1 @@ -Subproject commit 5821eb8e9fd9f76fbdbedd3402892c185e65c48e +Subproject commit 809897a812bb4b4895e7754e6029c2da2d18ff8b diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 8b638444b..b2f1c526d 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -3773,7 +3773,7 @@ typedef enum : NSUInteger { [self stopRecording]; self.audioRecorder = nil; self.voiceMessageUUID = nil; - [self.typingIndicators didStopTypeOutgoingInputInThread:self.thread]; + [self.typingIndicators didStopTypingOutgoingInputInThread:self.thread]; } - (void)setAudioRecorder:(nullable AVAudioRecorder *)audioRecorder @@ -3883,7 +3883,7 @@ typedef enum : NSUInteger { [self dismissKeyBoard]; [self presentViewController:actionSheetController animated:true completion:nil]; - [self.typingIndicators didStartTypeOutgoingInputInThread:self.thread]; + [self.typingIndicators didStartTypingOutgoingInputInThread:self.thread]; } - (nullable NSIndexPath *)lastVisibleIndexPath @@ -4138,9 +4138,9 @@ typedef enum : NSUInteger { - (void)textViewDidChange:(UITextView *)textView { if (textView.text.length > 0) { - [self.typingIndicators didStartTypeOutgoingInputInThread:self.thread]; + [self.typingIndicators didStartTypingOutgoingInputInThread:self.thread]; } else { - [self.typingIndicators didStopTypeOutgoingInputInThread:self.thread]; + [self.typingIndicators didStopTypingOutgoingInputInThread:self.thread]; } } @@ -4560,7 +4560,7 @@ typedef enum : NSUInteger { [self.inputToolbar showVoiceMemoUI]; AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); [self requestRecordingVoiceMemo]; - [self.typingIndicators didStartTypeOutgoingInputInThread:self.thread]; + [self.typingIndicators didStartTypingOutgoingInputInThread:self.thread]; } - (void)voiceMemoGestureDidEnd diff --git a/SignalServiceKit/src/Util/TypingIndicators.swift b/SignalServiceKit/src/Util/TypingIndicators.swift index a6cf5c2fc..6a077adc9 100644 --- a/SignalServiceKit/src/Util/TypingIndicators.swift +++ b/SignalServiceKit/src/Util/TypingIndicators.swift @@ -6,13 +6,11 @@ import Foundation @objc(OWSTypingIndicators) public protocol TypingIndicators: class { - // TODO: Use this method. @objc - func didStartTypeOutgoingInput(inThread thread: TSThread) + func didStartTypingOutgoingInput(inThread thread: TSThread) - // TODO: Use this method. @objc - func didStopTypeOutgoingInput(inThread thread: TSThread) + func didStopTypingOutgoingInput(inThread thread: TSThread) @objc func didSendOutgoingMessage(inThread thread: TSThread) @@ -38,23 +36,23 @@ public class TypingIndicatorsImpl: NSObject, TypingIndicators { @objc public static let typingIndicatorStateDidChange = Notification.Name("typingIndicatorStateDidChange") @objc - public func didStartTypeOutgoingInput(inThread thread: TSThread) { + public func didStartTypingOutgoingInput(inThread thread: TSThread) { AssertIsOnMainThread() guard let outgoingIndicators = ensureOutgoingIndicators(forThread: thread) else { owsFailDebug("Could not locate outgoing indicators state") return } - outgoingIndicators.didStartTypeOutgoingInput() + outgoingIndicators.didStartTypingOutgoingInput() } @objc - public func didStopTypeOutgoingInput(inThread thread: TSThread) { + public func didStopTypingOutgoingInput(inThread thread: TSThread) { AssertIsOnMainThread() guard let outgoingIndicators = ensureOutgoingIndicators(forThread: thread) else { owsFailDebug("Could not locate outgoing indicators state") return } - outgoingIndicators.didStopTypeOutgoingInput() + outgoingIndicators.didStopTypingOutgoingInput() } @objc @@ -145,7 +143,7 @@ public class TypingIndicatorsImpl: NSObject, TypingIndicators { // MARK: - - func didStartTypeOutgoingInput() { + func didStartTypingOutgoingInput() { AssertIsOnMainThread() if sendRefreshTimer == nil { @@ -177,7 +175,7 @@ public class TypingIndicatorsImpl: NSObject, TypingIndicators { repeats: false) } - func didStopTypeOutgoingInput() { + func didStopTypingOutgoingInput() { AssertIsOnMainThread() // Send ACTION=STOPPED message. @@ -241,12 +239,7 @@ public class TypingIndicatorsImpl: NSObject, TypingIndicators { Logger.verbose("\(TypingIndicatorMessage.string(forTypingIndicatorAction: action))") let message = TypingIndicatorMessage(thread: thread, action: action) - messageSender.sendPromise(message: message) - .done { - Logger.info("Outgoing typing indicator message send succeeded.") - }.catch { error in - Logger.error("Outgoing typing indicator message send failed: \(error).") - }.retainUntilComplete() + messageSender.sendPromise(message: message).retainUntilComplete() } }