Merge branch 'charlesmchen/trimGroupName'

pull/1/head
Matthew Chen 9 years ago
commit 4814e64c40

@ -467,12 +467,12 @@ NS_ASSUME_NONNULL_BEGIN
- (TSGroupModel *)makeGroup - (TSGroupModel *)makeGroup
{ {
NSString *title = self.groupNameTextField.text; NSString *groupName =
[self.groupNameTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSMutableArray<NSString *> *recipientIds = [self.memberRecipientIds.allObjects mutableCopy]; NSMutableArray<NSString *> *recipientIds = [self.memberRecipientIds.allObjects mutableCopy];
[recipientIds addObject:[self.contactsViewHelper localNumber]]; [recipientIds addObject:[self.contactsViewHelper localNumber]];
NSData *groupId = [SecurityUtils generateRandomBytes:16]; NSData *groupId = [SecurityUtils generateRandomBytes:16];
return [[TSGroupModel alloc] initWithTitle:groupName memberIds:recipientIds image:self.groupAvatar groupId:groupId];
return [[TSGroupModel alloc] initWithTitle:title memberIds:recipientIds image:self.groupAvatar groupId:groupId];
} }
#pragma mark - Group Avatar #pragma mark - Group Avatar

@ -170,6 +170,9 @@ NS_ASSUME_NONNULL_BEGIN
- (UIView *)firstSectionHeader - (UIView *)firstSectionHeader
{ {
OWSAssert(self.thread);
OWSAssert(self.thread.groupModel);
UIView *firstSectionHeader = [UIView new]; UIView *firstSectionHeader = [UIView new];
firstSectionHeader.backgroundColor = [UIColor whiteColor]; firstSectionHeader.backgroundColor = [UIColor whiteColor];
UIView *threadInfoView = [UIView new]; UIView *threadInfoView = [UIView new];
@ -189,16 +192,13 @@ NS_ASSUME_NONNULL_BEGIN
[avatarView autoPinEdgeToSuperviewEdge:ALEdgeLeft]; [avatarView autoPinEdgeToSuperviewEdge:ALEdgeLeft];
[avatarView autoSetDimension:ALDimensionWidth toSize:kAvatarSize]; [avatarView autoSetDimension:ALDimensionWidth toSize:kAvatarSize];
[avatarView autoSetDimension:ALDimensionHeight toSize:kAvatarSize]; [avatarView autoSetDimension:ALDimensionHeight toSize:kAvatarSize];
if (self.thread.groupModel) {
_groupAvatar = self.thread.groupModel.groupImage; _groupAvatar = self.thread.groupModel.groupImage;
}
[self updateAvatarView]; [self updateAvatarView];
UITextField *groupNameTextField = [UITextField new]; UITextField *groupNameTextField = [UITextField new];
_groupNameTextField = groupNameTextField; _groupNameTextField = groupNameTextField;
if (self.thread) { self.groupNameTextField.text =
self.groupNameTextField.text = self.thread.groupModel.groupName; [self.thread.groupModel.groupName stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
}
groupNameTextField.textColor = [UIColor blackColor]; groupNameTextField.textColor = [UIColor blackColor];
groupNameTextField.font = [UIFont ows_dynamicTypeTitle2Font]; groupNameTextField.font = [UIFont ows_dynamicTypeTitle2Font];
groupNameTextField.placeholder groupNameTextField.placeholder
@ -373,7 +373,9 @@ NS_ASSUME_NONNULL_BEGIN
{ {
OWSAssert(self.conversationSettingsViewDelegate); OWSAssert(self.conversationSettingsViewDelegate);
TSGroupModel *groupModel = [[TSGroupModel alloc] initWithTitle:self.groupNameTextField.text NSString *groupName =
[self.groupNameTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
TSGroupModel *groupModel = [[TSGroupModel alloc] initWithTitle:groupName
memberIds:[self.memberRecipientIds.allObjects mutableCopy] memberIds:[self.memberRecipientIds.allObjects mutableCopy]
image:self.groupAvatar image:self.groupAvatar
groupId:self.thread.groupModel.groupId]; groupId:self.thread.groupModel.groupId];

Loading…
Cancel
Save