Skip to content
Snippets Groups Projects
Commit 66406431 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

conversations UI: fixes

- display time
- generated messages
- record file

Change-Id: I3bbbfd3143b3e3d8f645ce883c53f440772df358
parent 64533104
Branches
No related tags found
No related merge requests found
...@@ -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 {
......
...@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment