@@ -123,9 +123,9 @@ - (void)updateTitle {
123123 }
124124
125125 if (assignedEntry.ciphercount == 0 ) {
126- self.navigationItem .title = [NSString stringWithFormat: @" %@ %d " , displayName, assignedEntry.messagecount ];
126+ self.navigationItem .title = [NSString stringWithFormat: @" %@ %lu " , displayName, ( unsigned long )[ self .messages count ] ];
127127 } else {
128- self.navigationItem .title = [NSString stringWithFormat: @" %@ %d (%d )" , displayName, assignedEntry.messagecount , assignedEntry.ciphercount];
128+ self.navigationItem .title = [NSString stringWithFormat: @" %@ %lu (%d )" , displayName, ( unsigned long )[ self .messages count ] , assignedEntry.ciphercount];
129129 }
130130}
131131
@@ -218,10 +218,8 @@ - (void)reloadTable {
218218
219219 assignedEntry.messagecount = (int )self.messages .count ;
220220
221- [self updateTitle ];
222-
221+ [self updateTitle ];
223222 [self .tableView reloadData ];
224-
225223 [self scrollToBottom ];
226224}
227225
@@ -390,6 +388,12 @@ - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEd
390388 [[[[iToast makeText: NSLocalizedString(@" error_UnableToUpdateMessageInDB" , @" Unable to update the message database." )]
391389 setGravity: iToastGravityCenter] setDuration: iToastDurationNormal] show ];
392390 }
391+
392+ // when no message left, go back to thread view
393+ if ([self .messages count ]==0 )
394+ [self .navigationController popViewControllerAnimated: YES ];
395+ else
396+ [self updateTitle ];
393397 }
394398}
395399
@@ -1060,7 +1064,6 @@ - (void)messageReceived {
10601064}
10611065
10621066#pragma mark - MessageSenderDelegate methods
1063-
10641067- (void )updatedOutgoingStatusForMessage : (MsgEntry *)message {
10651068 int i = (int )self.messages .count - 1 ;
10661069 BOOL found = NO ;
@@ -1079,9 +1082,10 @@ - (void)updatedOutgoingStatusForMessage:(MsgEntry *)message {
10791082
10801083 if (!found) {
10811084 [self .messages addObject: message];
1082-
10831085 [self reloadTable ];
1084- }
1086+ }else {
1087+ [self updateTitle ];
1088+ }
10851089}
10861090
10871091#pragma mark - AudioRecordDelegate methods
0 commit comments