Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 46b6a59d6d
commit 1b99fd1df4

@ -236,6 +236,10 @@ NS_ASSUME_NONNULL_BEGIN
{ {
OWSAssert([self isAudio]); OWSAssert([self isAudio]);
// We want to treat "pre-voice messages flag" messages as voice messages if
// they have no file name.
//
// TODO: Remove this after the flag has been in production for a few months.
return (self.attachment.isVoiceMessage || self.attachment.filename.length < 1); return (self.attachment.isVoiceMessage || self.attachment.filename.length < 1);
} }

@ -129,14 +129,22 @@
- (UIColor *)blendWithColor:(UIColor *)otherColor alpha:(CGFloat)alpha - (UIColor *)blendWithColor:(UIColor *)otherColor alpha:(CGFloat)alpha
{ {
CGFloat r0, g0, b0, a0; CGFloat r0, g0, b0, a0;
[self getRed:&r0 green:&g0 blue:&b0 alpha:&a0]; #ifdef DEBUG
CGFloat r1, g1, b1, a1; BOOL result =
[otherColor getRed:&r1 green:&g1 blue:&b1 alpha:&a1]; #endif
[self getRed:&r0 green:&g0 blue:&b0 alpha:&a0];
return [UIColor colorWithRed:CGFloatLerp(r0, r1, alpha) OWSAssert(result)
green:CGFloatLerp(g0, g1, alpha)
blue:CGFloatLerp(b0, b1, alpha) CGFloat r1,
alpha:CGFloatLerp(a0, a1, alpha)]; g1, b1, a1;
#ifdef DEBUG
result =
#endif
[otherColor getRed:&r1 green:&g1 blue:&b1 alpha:&a1];
OWSAssert(result) return [UIColor colorWithRed:CGFloatLerp(r0, r1, alpha)
green:CGFloatLerp(g0, g1, alpha)
blue:CGFloatLerp(b0, b1, alpha)
alpha:CGFloatLerp(a0, a1, alpha)];
} }
@end @end

@ -3108,6 +3108,10 @@ typedef enum : NSUInteger {
DDLogInfo(@"startRecordingVoiceMemo"); DDLogInfo(@"startRecordingVoiceMemo");
// Cancel any ongoing audio playback.
[self.audioAttachmentPlayer stop];
self.audioAttachmentPlayer = nil;
NSString *temporaryDirectory = NSTemporaryDirectory(); NSString *temporaryDirectory = NSTemporaryDirectory();
NSString *filename = [NSString stringWithFormat:@"%lld.m4a", [NSDate ows_millisecondTimeStamp]]; NSString *filename = [NSString stringWithFormat:@"%lld.m4a", [NSDate ows_millisecondTimeStamp]];
NSString *filepath = [temporaryDirectory stringByAppendingPathComponent:filename]; NSString *filepath = [temporaryDirectory stringByAppendingPathComponent:filename];

@ -45,7 +45,7 @@ import UIKit
} }
} }
@available(*, unavailable, message:"use delegate: constructor instead.") @available(*, unavailable, message:"use init() constructor instead.")
required init?(coder aDecoder: NSCoder) { required init?(coder aDecoder: NSCoder) {
self.horizontalBarLayer = CAShapeLayer() self.horizontalBarLayer = CAShapeLayer()
self.progressLayer = CAShapeLayer() self.progressLayer = CAShapeLayer()

Loading…
Cancel
Save