Respond to CR.

This commit is contained in:
Matthew Chen 2018-10-31 12:19:07 -04:00
parent a98c82645c
commit 3d0e7386a4
3 changed files with 15 additions and 22 deletions

2
Pods

@ -1 +1 @@
Subproject commit 5821eb8e9fd9f76fbdbedd3402892c185e65c48e
Subproject commit 809897a812bb4b4895e7754e6029c2da2d18ff8b

View File

@ -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

View File

@ -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()
}
}