Respond to CR.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-05-12 09:22:56 -04:00
parent 46b6a59d6d
commit 1b99fd1df4
4 changed files with 24 additions and 8 deletions

View File

@ -236,6 +236,10 @@ NS_ASSUME_NONNULL_BEGIN
{
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);
}

View File

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

View File

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

View File

@ -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) {
self.horizontalBarLayer = CAShapeLayer()
self.progressLayer = CAShapeLayer()