...
 
Commits (2)
...@@ -312,7 +312,7 @@ typedef NS_ENUM(NSInteger, MessageSequencing) { ...@@ -312,7 +312,7 @@ typedef NS_ENUM(NSInteger, MessageSequencing) {
NSTextField* timeField = [result viewWithTag:GENERIC_INT_TIME_TAG]; NSTextField* timeField = [result viewWithTag:GENERIC_INT_TIME_TAG];
// TODO: Fix symbol in LRC // TODO: Fix symbol in LRC
NSString* fixedString = [text stringByReplacingOccurrencesOfString:@"🕽" withString:@"📞"]; NSString* fixedString = [[text stringByReplacingOccurrencesOfString:@"🕽" withString:@""] stringByReplacingOccurrencesOfString:@"📞" withString:@""];
[textField setStringValue:fixedString]; [textField setStringValue:fixedString];
[timeField setStringValue:time]; [timeField setStringValue:time];
...@@ -786,21 +786,17 @@ typedef NS_ENUM(NSInteger, MessageSequencing) { ...@@ -786,21 +786,17 @@ typedef NS_ENUM(NSInteger, MessageSequencing) {
if ([[NSCalendar currentCalendar] compareDate:today if ([[NSCalendar currentCalendar] compareDate:today
toDate:msgTime toDate:msgTime
toUnitGranularity:NSCalendarUnitYear]!= NSOrderedSame) { toUnitGranularity:NSCalendarUnitYear]!= NSOrderedSame) {
return [NSDateFormatter localizedStringFromDate:msgTime dateStyle:NSDateFormatterMediumStyle timeStyle:NSDateFormatterMediumStyle]; return [NSDateFormatter localizedStringFromDate:msgTime dateStyle:NSDateFormatterLongStyle timeStyle:NSDateFormatterMediumStyle];
} }
if ([[NSCalendar currentCalendar] compareDate:today if ([[NSCalendar currentCalendar] compareDate:today
toDate:msgTime toDate:msgTime
toUnitGranularity:NSCalendarUnitDay]!= NSOrderedSame || toUnitGranularity:NSCalendarUnitDay]!= NSOrderedSame ||
[[NSCalendar currentCalendar] compareDate:today [[NSCalendar currentCalendar] compareDate:today
toDate:msgTime toDate:msgTime
toUnitGranularity:NSCalendarUnitMonth]!= NSOrderedSame) { toUnitGranularity:NSCalendarUnitMonth]!= NSOrderedSame) {
[dateFormatter setDateFormat:@"MMM dd, HH:mm"]; return [NSDateFormatter localizedStringFromDate:msgTime dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle];
return [dateFormatter stringFromDate:msgTime]; }
} return [NSDateFormatter localizedStringFromDate:msgTime dateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterShortStyle];
[dateFormatter setDateFormat:@"HH:mm"];
return [dateFormatter stringFromDate:msgTime];
} }
- (void) updateSendMessageHeight { - (void) updateSendMessageHeight {
......
...@@ -119,7 +119,7 @@ previewView, timeLabel, recordOnOffButton, sendButton, fileImage, infoLabel, tim ...@@ -119,7 +119,7 @@ previewView, timeLabel, recordOnOffButton, sendButton, fileImage, infoLabel, tim
[view renderWithPixelBuffer: buffer [view renderWithPixelBuffer: buffer
size: frameSize size: frameSize
rotation: 0 rotation: 0
fillFrame: false]; fillFrame: true];
} }
} }
...@@ -211,11 +211,6 @@ previewView, timeLabel, recordOnOffButton, sendButton, fileImage, infoLabel, tim ...@@ -211,11 +211,6 @@ previewView, timeLabel, recordOnOffButton, sendButton, fileImage, infoLabel, tim
[durationTimer invalidate]; [durationTimer invalidate];
durationTimer = nil; durationTimer = nil;
[self setRecordedState]; [self setRecordedState];
if(isAudio) {
return;
}
std::string uri = [[@"file:///" stringByAppendingString: fileName] UTF8String];
avModel->setInputFile(uri);
} }
-(void) startRecord { -(void) startRecord {
......
...@@ -523,19 +523,26 @@ NSInteger const REQUEST_SEG = 1; ...@@ -523,19 +523,26 @@ NSInteger const REQUEST_SEG = 1;
[interactionSnippet setStringValue:lastInteractionSnippetFixedString]; [interactionSnippet setStringValue:lastInteractionSnippetFixedString];
// last interaction date/time // last interaction date/time
std::time_t lastInteractionTimestamp = conversation.interactions[lastUid].timestamp; NSString *timeString = @"";
std::time_t now = std::time(nullptr); NSDate* msgTime = [NSDate dateWithTimeIntervalSince1970:conversation.interactions[lastUid].timestamp];
char interactionDay[64]; NSDate *today = [NSDate date];
char nowDay[64]; NSDateFormatter *dateFormatter=[[NSDateFormatter alloc] init];
std::strftime(interactionDay, sizeof(interactionDay), "%D", std::localtime(&lastInteractionTimestamp)); [dateFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:[[NSLocale currentLocale] localeIdentifier]]];
std::strftime(nowDay, sizeof(nowDay), "%D", std::localtime(&now)); if ([[NSCalendar currentCalendar] compareDate:today
if (std::string(interactionDay) == std::string(nowDay)) { toDate:msgTime
char interactionTime[64]; toUnitGranularity:NSCalendarUnitYear]!= NSOrderedSame) {
std::strftime(interactionTime, sizeof(interactionTime), "%R", std::localtime(&lastInteractionTimestamp)); timeString = [NSDateFormatter localizedStringFromDate:msgTime dateStyle:NSDateFormatterMediumStyle timeStyle:NSDateFormatterNoStyle];
[lastInteractionDate setStringValue:[NSString stringWithUTF8String:interactionTime]]; } else if ([[NSCalendar currentCalendar] compareDate:today
toDate:msgTime
toUnitGranularity:NSCalendarUnitDay]!= NSOrderedSame ||
[[NSCalendar currentCalendar] compareDate:today
toDate:msgTime
toUnitGranularity:NSCalendarUnitMonth]!= NSOrderedSame) {
timeString = [NSDateFormatter localizedStringFromDate:msgTime dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterNoStyle];
} else { } else {
[lastInteractionDate setStringValue:[NSString stringWithUTF8String:interactionDay]]; timeString = [NSDateFormatter localizedStringFromDate:msgTime dateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterShortStyle];
} }
[lastInteractionDate setStringValue:timeString];
} }
return result; return result;
......
...@@ -227,14 +227,14 @@ std::string currentVideoDevice; ...@@ -227,14 +227,14 @@ std::string currentVideoDevice;
[view renderWithPixelBuffer:(CVPixelBufferRef)frame->data[3] [view renderWithPixelBuffer:(CVPixelBufferRef)frame->data[3]
size: frameSize size: frameSize
rotation: rotation rotation: rotation
fillFrame: false]; fillFrame: true];
return; return;
} }
else if (CVPixelBufferRef pixBuffer = [self getBufferForPreviewFromFrame:frame]) { else if (CVPixelBufferRef pixBuffer = [self getBufferForPreviewFromFrame:frame]) {
[view renderWithPixelBuffer: pixBuffer [view renderWithPixelBuffer: pixBuffer
size: frameSize size: frameSize
rotation: rotation rotation: rotation
fillFrame: false]; fillFrame: true];
} }
} }
} }
......
...@@ -179,23 +179,10 @@ bool frameDisplayed = false; ...@@ -179,23 +179,10 @@ bool frameDisplayed = false;
float frameRatio = ((float)size.width)/((float)size.height); float frameRatio = ((float)size.width)/((float)size.height);
simd::float4x4 projectionMatrix; simd::float4x4 projectionMatrix;
float ratio = viewRatio * (1/frameRatio); float ratio = viewRatio * (1/frameRatio);
if((viewRatio >= 1 && frameRatio >= 1) || if (ratio < 1.0 && !fill || fill && ratio > 1.0)
(viewRatio < 1 && frameRatio < 1) || projectionMatrix = [self getScalingMatrix: ratio axis: 'y'];
(ratio > 0.5 && ratio < 1.5) ) { else
if (ratio <= 1.0 && ratio >= 0.5) projectionMatrix = [self getScalingMatrix: 1/ratio axis: 'x'];
projectionMatrix = [self getScalingMatrix: 1/ratio axis: 'x'];
else if (ratio < 0.5)
projectionMatrix = [self getScalingMatrix: ratio axis: 'y'];
else if (ratio > 1 && ratio < 2)
projectionMatrix = [self getScalingMatrix: ratio axis: 'y'];
else
projectionMatrix = [self getScalingMatrix: 1/ratio axis: 'x'];
} else {
if (ratio < 1.0 && !fill || fill && ratio > 1.0)
projectionMatrix = [self getScalingMatrix: ratio axis: 'y'];
else
projectionMatrix = [self getScalingMatrix: 1/ratio axis: 'x'];
}
float radians = (-rotation * M_PI) / 180; float radians = (-rotation * M_PI) / 180;
simd::float4x4 rotationMatrix = [self getRotationMatrix:radians]; simd::float4x4 rotationMatrix = [self getRotationMatrix:radians];
Uniforms bytes = Uniforms{projectionMatrix: projectionMatrix, rotationMatrix: rotationMatrix}; Uniforms bytes = Uniforms{projectionMatrix: projectionMatrix, rotationMatrix: rotationMatrix};
......