Archiving and correctly sorting empty threads.

pull/1/head
Christine Corbett 10 years ago committed by Frederic Jacobs
parent aca02221be
commit 553a38288e

@ -64,6 +64,7 @@ typedef NS_ENUM(NSInteger, TSLastActionType) {
@property (getter=isBlocked) BOOL blocked;
@property (nonatomic) NSString* latestMessageId;
@property NSDate *archivalDate;
@property (nonatomic) NSDate *creationDate;
- (NSDate*)lastMessageDate;

@ -30,6 +30,7 @@
if (self) {
_blocked = NO;
_latestMessageId = nil;
_creationDate = [NSDate date];
}
return self;
@ -51,9 +52,13 @@
if (date) {
return date;
}
else {
return [NSDate date];
}
}
else {
return _creationDate;
}
return [NSDate date];
}
- (UIImage*)image{

@ -67,10 +67,15 @@ NSString *TSUnreadDatabaseViewExtensionName = @"TSUnreadDatabaseViewExtensionNa
YapDatabaseViewGrouping *viewGrouping = [YapDatabaseViewGrouping withObjectBlock:^NSString *(NSString *collection, NSString *key, id object) {
if ([object isKindOfClass:[TSThread class]]){
TSThread *thread = (TSThread*)object;
if (thread.archivalDate) {
if (thread.archivalDate&&[thread.latestMessageId length]>0) {
return ([self threadShouldBeInInbox:thread])?TSInboxGroup:TSArchiveGroup;
}
return TSInboxGroup;
else if(thread.archivalDate) {
return TSArchiveGroup;
}
else {
return TSInboxGroup;
}
}
return nil;
}];

@ -226,7 +226,7 @@ static NSString* const kShowSignupFlowSegue = @"showSignupFlow";
MessagesViewController * vc = [segue destinationViewController];
NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow];
TSThread *thread = [self threadForIndexPath:selectedIndexPath];
[self selectedInbox:self];
if (self.contactIdentifierFromCompose){
[vc setupWithTSIdentifier:self.contactIdentifierFromCompose];
self.contactIdentifierFromCompose = nil;
@ -238,6 +238,7 @@ static NSString* const kShowSignupFlowSegue = @"showSignupFlow";
else if (thread) {
[vc setupWithThread:thread];
}
}
else if ([segue.identifier isEqualToString:kCallSegue]) {
InCallViewController* vc = [segue destinationViewController];

Loading…
Cancel
Save