@ -207,7 +207,7 @@ typedef enum : NSUInteger {
forState : UIControlStateNormal ] ;
forState : UIControlStateNormal ] ;
button . imageView . tintColor = [ UIColor ows_materialBlueColor ] ;
button . imageView . tintColor = [ UIColor ows_materialBlueColor ] ;
/ / We want to be permissive about the voice me mo gesture , so we :
/ / We want to be permissive about the voice me ssage gesture , so we :
/ /
/ /
/ / * Add the gesture recognizer to the button ' s superview instead of the button .
/ / * Add the gesture recognizer to the button ' s superview instead of the button .
/ / * Filter the touches that the gesture recognizer receives by serving as its
/ / * Filter the touches that the gesture recognizer receives by serving as its
@ -269,18 +269,18 @@ typedef enum : NSUInteger {
case UIGestureRecognizerStateCancelled :
case UIGestureRecognizerStateCancelled :
case UIGestureRecognizerStateFailed :
case UIGestureRecognizerStateFailed :
if ( self . isRecordingVoiceMemo ) {
if ( self . isRecordingVoiceMemo ) {
/ / Cancel voice me mo if necessary .
/ / Cancel voice me ssage if necessary .
self . isRecordingVoiceMemo = NO ;
self . isRecordingVoiceMemo = NO ;
[ self . delegate voiceMemoGestureDidCancel ] ;
[ self . delegate voiceMemoGestureDidCancel ] ;
}
}
break ;
break ;
case UIGestureRecognizerStateBegan :
case UIGestureRecognizerStateBegan :
if ( self . isRecordingVoiceMemo ) {
if ( self . isRecordingVoiceMemo ) {
/ / Cancel voice me mo if necessary .
/ / Cancel voice me ssage if necessary .
self . isRecordingVoiceMemo = NO ;
self . isRecordingVoiceMemo = NO ;
[ self . delegate voiceMemoGestureDidCancel ] ;
[ self . delegate voiceMemoGestureDidCancel ] ;
}
}
/ / Start voice me mo .
/ / Start voice me ssage .
[ self . textView resignFirstResponder ] ;
[ self . textView resignFirstResponder ] ;
self . isRecordingVoiceMemo = YES ;
self . isRecordingVoiceMemo = YES ;
self . voiceMemoGestureStartLocation = [ sender locationInView : self ] ;
self . voiceMemoGestureStartLocation = [ sender locationInView : self ] ;
@ -306,7 +306,7 @@ typedef enum : NSUInteger {
break ;
break ;
case UIGestureRecognizerStateEnded :
case UIGestureRecognizerStateEnded :
if ( self . isRecordingVoiceMemo ) {
if ( self . isRecordingVoiceMemo ) {
/ / End voice me mo .
/ / End voice me ssage .
self . isRecordingVoiceMemo = NO ;
self . isRecordingVoiceMemo = NO ;
[ self . delegate voiceMemoGestureDidEnd ] ;
[ self . delegate voiceMemoGestureDidEnd ] ;
}
}
@ -325,7 +325,7 @@ typedef enum : NSUInteger {
- ( BOOL ) gestureRecognizer : ( UIGestureRecognizer * ) gestureRecognizer shouldReceiveTouch : ( UITouch * ) touch
- ( BOOL ) gestureRecognizer : ( UIGestureRecognizer * ) gestureRecognizer shouldReceiveTouch : ( UITouch * ) touch
{
{
/ / We want to be permissive about the voice me mo gesture , so we accept
/ / We want to be permissive about the voice me ssage gesture , so we accept
/ / gesture that begin within N points of the
/ / gesture that begin within N points of the
CGFloat kVoiceMemoGestureTolerancePoints = 10 ;
CGFloat kVoiceMemoGestureTolerancePoints = 10 ;
CGPoint location = [ touch locationInView : self . voiceMemoButton ] ;
CGPoint location = [ touch locationInView : self . voiceMemoButton ] ;
@ -399,7 +399,8 @@ typedef enum : NSUInteger {
UILabel * cancelLabel = [ UILabel new ] ;
UILabel * cancelLabel = [ UILabel new ] ;
cancelLabel . textColor = [ UIColor ows_destructiveRedColor ] ;
cancelLabel . textColor = [ UIColor ows_destructiveRedColor ] ;
cancelLabel . font = [ UIFont ows_mediumFontWithSize : 14. f ] ;
cancelLabel . font = [ UIFont ows_mediumFontWithSize : 14. f ] ;
cancelLabel . text = NSLocalizedString ( @ "VOICE_MEMO_CANCEL_INSTRUCTIONS ", @ "Indicates how to cancel a voice memo . ") ;
cancelLabel . text
= NSLocalizedString ( @ "VOICE_MESSAGE_CANCEL_INSTRUCTIONS ", @ "Indicates how to cancel a voice message . ") ;
[ self . voiceMemoUI addSubview : cancelLabel ] ;
[ self . voiceMemoUI addSubview : cancelLabel ] ;
[ imageView autoVCenterInSuperview ] ;
[ imageView autoVCenterInSuperview ] ;
@ -484,7 +485,7 @@ typedef enum : NSUInteger {
{
{
OWSAssert ( [ NSThread isMainThread ] ) ;
OWSAssert ( [ NSThread isMainThread ] ) ;
/ / Fade out the voice me mo views as the cancel gesture
/ / Fade out the voice me ssage views as the cancel gesture
/ / proceeds as feedback .
/ / proceeds as feedback .
for ( UIView * subview in self . voiceMemoUI . subviews ) {
for ( UIView * subview in self . voiceMemoUI . subviews ) {
subview . layer . opacity = MAX ( 0. f , MIN ( 1. f , 1. f - ( float ) cancelAlpha ) ) ;
subview . layer . opacity = MAX ( 0. f , MIN ( 1. f , 1. f - ( float ) cancelAlpha ) ) ;
@ -3132,8 +3133,16 @@ typedef enum : NSUInteger {
const NSTimeInterval kMinimumRecordingTimeSeconds = 1. f ;
const NSTimeInterval kMinimumRecordingTimeSeconds = 1. f ;
if ( currentTime < kMinimumRecordingTimeSeconds ) {
if ( currentTime < kMinimumRecordingTimeSeconds ) {
DDLogInfo ( @ "Discarding voice me mo ; too short . ") ;
DDLogInfo ( @ "Discarding voice me ssage ; too short . ") ;
self . audioRecorder = nil ;
self . audioRecorder = nil ;
[ OWSAlerts
showAlertWithTitle :
NSLocalizedString ( @ "VOICE_MESSAGE_TOO_SHORT_ALERT_TITLE ",
@ "Title for the alert indicating the ' voice message' needs to be held to be held down to record . ")
message : NSLocalizedString ( @ "VOICE_MESSAGE_TOO_SHORT_ALERT_MESSAGE ",
@ "Message for the alert indicating the ' voice message' needs to be held to be held "
@ "down to record . ") ] ;
return ;
return ;
}
}
@ -3148,7 +3157,7 @@ typedef enum : NSUInteger {
self . audioRecorder = nil ;
self . audioRecorder = nil ;
NSString * filename = [ NSLocalizedString ( @ "VOICE_ME MO_FILE_NAME", @ "Filename for voice memo s. ")
NSString * filename = [ NSLocalizedString ( @ "VOICE_ME SSAGE_FILE_NAME", @ "Filename for voice message s. ")
stringByAppendingPathExtension : [ MIMETypeUtil fileExtensionForUTIType : ( NSString * ) kUTTypeMPEG4Audio ] ] ;
stringByAppendingPathExtension : [ MIMETypeUtil fileExtensionForUTIType : ( NSString * ) kUTTypeMPEG4Audio ] ] ;
SignalAttachment * attachment =
SignalAttachment * attachment =
@ -3524,7 +3533,7 @@ typedef enum : NSUInteger {
{
{
/ / Override .
/ / Override .
/ /
/ /
/ / We want to show the "voice me mo " button if the text input is empty
/ / We want to show the "voice me ssage " button if the text input is empty
/ / and the "send " button if it isn ' t .
/ / and the "send " button if it isn ' t .
[ ( ( OWSMessagesToolbarContentView * ) self . inputToolbar . contentView ) ensureEnabling ] ;
[ ( ( OWSMessagesToolbarContentView * ) self . inputToolbar . contentView ) ensureEnabling ] ;
}
}