Groups: Name of leaving user + outgoing message layout.

This commit is contained in:
Frederic Jacobs 2014-12-29 11:20:20 +01:00
parent e58f9bf966
commit a93b111458
4 changed files with 11 additions and 4 deletions

View file

@ -87,5 +87,4 @@ andCurrentRegionCodeForPhoneNumbers:(NSString*)currentRegionCodeForPhoneNumbers
+ (void)messageIdentifier:(NSString*)identifier;
+ (void)groupModel:(GroupModel*)model;
@end

View file

@ -35,6 +35,7 @@
#import "Environment.h"
#import "PreferencesUtil.h"
#import "ContactsManager.h"
#import <CocoaLumberjack/DDLog.h>
@ -255,10 +256,17 @@
[[[TSInfoMessage alloc] initWithTimestamp:timeStamp inThread:gThread messageType:TSInfoMessageTypeGroupUpdate customMessage:updateGroupInfo] saveWithTransaction:transaction];
}
else if(content.group.type==PushMessageContentGroupContextTypeQuit) {
NSString* updateGroupInfo = [NSString stringWithFormat:@"%@ has left group",message.source];
NSString *nameString = [[Environment.getCurrent contactsManager] nameStringForPhoneIdentifier:message.source];
if (!nameString) {
nameString = message.source;
}
NSString* updateGroupInfo = [NSString stringWithFormat:@"%@ has left group",nameString];
NSMutableArray *newGroupMembers = [NSMutableArray arrayWithArray:gThread.groupModel.groupMemberIds];
[newGroupMembers removeObject:message.source];
gThread.groupModel.groupMemberIds = newGroupMembers;
[gThread saveWithTransaction:transaction];
[[[TSInfoMessage alloc] initWithTimestamp:timeStamp inThread:gThread messageType:TSInfoMessageTypeGroupUpdate customMessage:updateGroupInfo] saveWithTransaction:transaction];
}

View file

@ -110,7 +110,6 @@ typedef enum : NSUInteger {
- (void)setupWithThread:(TSThread *)thread{
self.thread = thread;
isGroupConversation = [self.thread isKindOfClass:[TSGroupThread class]];
}
- (void)viewDidLoad {
@ -1027,7 +1026,6 @@ typedef enum : NSUInteger {
}
- (IBAction)unwindGroupUpdated:(UIStoryboardSegue *)segue{
[self.inputToolbar.contentView.textView resignFirstResponder];
NewGroupViewController *ngc = [segue sourceViewController];

View file

@ -79,9 +79,11 @@
TSIncomingMessage *message = (TSIncomingMessage*)interaction;
adapter.senderId = message.authorId;
adapter.senderDisplayName = message.authorId;
adapter.messageType = TSIncomingMessageAdapter;
} else {
adapter.senderId = ME_MESSAGE_IDENTIFIER;
adapter.senderDisplayName = @"Me";
adapter.messageType = TSOutgoingMessageAdapter;
}
}