Various enhancements to the groups.
- new avatar and updated avatar functional - rounded corners in place, both in new/update group view and in inbox - removed the appearance of the ability to delete members from a group. - centering group menu in UIToolbar
This commit is contained in:
parent
f0ac231b7f
commit
797492fc13
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6254" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="tuk-0x-yCb">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="tuk-0x-yCb">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
|
||||
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
|
||||
|
@ -5589,6 +5589,9 @@ A0 09 9A FF A8 8A 09 99</string>
|
|||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||
<color key="textColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<variation key="heightClass=regular-widthClass=compact" misplaced="YES">
|
||||
<rect key="frame" x="10" y="274" width="94" height="20.5"/>
|
||||
</variation>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
|
|
|
@ -96,12 +96,12 @@ dispatch_queue_t attachmentsQueue() {
|
|||
}];
|
||||
outgoingMessage.body = nil;
|
||||
[outgoingMessage.attachments addObject:attachementId];
|
||||
//the state change is needed for the db to get a modification and it takes 200 milliseconds, why?
|
||||
[outgoingMessage setMessageState:TSOutgoingMessageStateAttemptingOut];
|
||||
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[outgoingMessage saveWithTransaction:transaction];
|
||||
}];
|
||||
|
||||
if(outgoingMessage.groupMetaMessage!=TSGroupMessageNew&&outgoingMessage.groupMetaMessage!=TSGroupMessageUpdate) {
|
||||
[outgoingMessage setMessageState:TSOutgoingMessageStateAttemptingOut];
|
||||
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
[outgoingMessage saveWithTransaction:transaction];
|
||||
}];
|
||||
}
|
||||
BOOL success = [self uploadDataWithProgress:result.body location:location attachmentID:attachementId];
|
||||
if (success) {
|
||||
[self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
||||
|
@ -109,7 +109,6 @@ dispatch_queue_t attachmentsQueue() {
|
|||
[result.pointer saveWithTransaction:transaction];
|
||||
NSLog(@"finished uploading");
|
||||
}];
|
||||
|
||||
[self sendMessage:outgoingMessage inThread:thread];
|
||||
} else{
|
||||
DDLogWarn(@"Failed to upload attachment");
|
||||
|
|
|
@ -289,6 +289,8 @@ dispatch_queue_t sendingQueue() {
|
|||
processAttachments = NO;
|
||||
}
|
||||
}
|
||||
[groupBuilder setMembersArray:gThread.groupModel.groupMemberIds];
|
||||
[groupBuilder setName:gThread.groupModel.groupName];
|
||||
[groupBuilder setType:PushMessageContentGroupContextTypeUpdate];
|
||||
break;
|
||||
}
|
||||
|
@ -297,10 +299,6 @@ dispatch_queue_t sendingQueue() {
|
|||
break;
|
||||
}
|
||||
[groupBuilder setId:gThread.groupModel.groupId];
|
||||
if(message.groupMetaMessage!=TSGroupMessageQuit) {
|
||||
[groupBuilder setMembersArray:gThread.groupModel.groupMemberIds];
|
||||
[groupBuilder setName:gThread.groupModel.groupName];
|
||||
}
|
||||
[builder setGroup:groupBuilder.build];
|
||||
}
|
||||
if(processAttachments) {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
[[*imageView layer] setMasksToBounds:YES];
|
||||
}
|
||||
|
||||
|
||||
+ (void)removeRoundedBorderToImageView:(UIImageView *__strong*)imageView {
|
||||
[[*imageView layer] setBorderWidth:0];
|
||||
[[*imageView layer] setCornerRadius:0];
|
||||
|
|
|
@ -50,6 +50,9 @@
|
|||
if([_nameLabel.text length]==0) {
|
||||
_nameLabel.text = @"New Group";
|
||||
}
|
||||
if(_contactPictureView.image!=nil) {
|
||||
[UIUtil applyRoundedBorderToImageView:&_contactPictureView];
|
||||
}
|
||||
}
|
||||
else {
|
||||
NSMutableString *initials = [NSMutableString string];
|
||||
|
|
|
@ -292,15 +292,45 @@ typedef enum : NSUInteger {
|
|||
|
||||
UIBarButtonItem *spaceMiddleWords = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
|
||||
|
||||
NSDictionary* buttonTextAttributes = @{NSFontAttributeName:[UIFont ows_regularFontWithSize:15.0f],
|
||||
NSForegroundColorAttributeName:[UIColor ows_materialBlueColor]};
|
||||
|
||||
|
||||
|
||||
|
||||
UIButton* groupUpdateButton = [[UIButton alloc] initWithFrame:CGRectMake(0,0,65,24)];
|
||||
NSMutableAttributedString *updateTitle = [[NSMutableAttributedString alloc] initWithString:@"Update"];
|
||||
[updateTitle setAttributes:buttonTextAttributes range:NSMakeRange(0, [updateTitle length])];
|
||||
[groupUpdateButton setAttributedTitle:updateTitle forState:UIControlStateNormal];
|
||||
[groupUpdateButton addTarget:self action:@selector(updateGroup) forControlEvents:UIControlEventTouchUpInside];
|
||||
[groupUpdateButton.titleLabel setTextAlignment:NSTextAlignmentCenter];
|
||||
|
||||
UIBarButtonItem *groupUpdateBarButton = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:self action:nil];
|
||||
groupUpdateBarButton.customView = groupUpdateButton;
|
||||
groupUpdateBarButton.customView.userInteractionEnabled = YES;
|
||||
|
||||
UIButton* groupLeaveButton = [[UIButton alloc] initWithFrame:CGRectMake(0,0,50,24)];
|
||||
NSMutableAttributedString *leaveTitle = [[NSMutableAttributedString alloc] initWithString:@"Leave"];
|
||||
[leaveTitle setAttributes:buttonTextAttributes range:NSMakeRange(0, [leaveTitle length])];
|
||||
[groupLeaveButton setAttributedTitle:leaveTitle forState:UIControlStateNormal];
|
||||
[groupLeaveButton addTarget:self action:@selector(leaveGroup) forControlEvents:UIControlEventTouchUpInside];
|
||||
[groupLeaveButton.titleLabel setTextAlignment:NSTextAlignmentCenter];
|
||||
UIBarButtonItem *groupLeaveBarButton = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:self action:nil];
|
||||
groupLeaveBarButton.customView = groupLeaveButton;
|
||||
groupLeaveBarButton.customView.userInteractionEnabled = YES;
|
||||
|
||||
UIButton* groupMembersButton = [[UIButton alloc] initWithFrame:CGRectMake(0,0,65,24)];
|
||||
NSMutableAttributedString *membersTitle = [[NSMutableAttributedString alloc] initWithString:@"Members"];
|
||||
[membersTitle setAttributes:buttonTextAttributes range:NSMakeRange(0, [membersTitle length])];
|
||||
[groupMembersButton setAttributedTitle:membersTitle forState:UIControlStateNormal];
|
||||
[groupMembersButton addTarget:self action:@selector(showGroupMembers) forControlEvents:UIControlEventTouchUpInside];
|
||||
[groupMembersButton.titleLabel setTextAlignment:NSTextAlignmentCenter];
|
||||
UIBarButtonItem *groupMembersBarButton = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:self action:nil];
|
||||
groupMembersBarButton.customView = groupMembersButton;
|
||||
groupMembersBarButton.customView.userInteractionEnabled = YES;
|
||||
|
||||
|
||||
|
||||
UIBarButtonItem *groupUpdateButton = [[UIBarButtonItem alloc] initWithTitle:@"Update" style:UIBarButtonItemStylePlain target:self action:@selector(updateGroup)];
|
||||
UIBarButtonItem *groupLeaveButton = [[UIBarButtonItem alloc] initWithTitle:@"Leave" style:UIBarButtonItemStylePlain target:self action:@selector(leaveGroup)];
|
||||
|
||||
UIBarButtonItem *showGroupMembersButton = [[UIBarButtonItem alloc] initWithTitle:@"Members" style:UIBarButtonItemStylePlain target:self action:@selector(showGroupMembers)];
|
||||
|
||||
self.navController.dropDownToolbar.items =@[spaceEdge, groupUpdateButton, spaceMiddleWords, groupLeaveButton, spaceMiddleWords, showGroupMembersButton, spaceEdge];
|
||||
self.navController.dropDownToolbar.items =@[spaceEdge, groupUpdateBarButton, spaceMiddleWords, groupLeaveBarButton, spaceMiddleWords, groupMembersBarButton, spaceEdge];
|
||||
|
||||
for(UIButton *button in self.navController.dropDownToolbar.items) {
|
||||
[button setTintColor:[UIColor ows_materialBlueColor]];
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
@property(nonatomic, strong) IBOutlet UITextField* nameGroupTextField;
|
||||
@property(nonatomic, strong) IBOutlet UIButton* groupImageButton;
|
||||
@property(nonatomic, strong) IBOutlet UIView* tapToDismissView;
|
||||
@property(nonatomic, strong) UIImage* groupImage;
|
||||
@property(nonatomic, strong) TSGroupModel* groupModel;
|
||||
|
||||
@end
|
||||
|
|
|
@ -53,8 +53,12 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
contacts = [contacts filter:^int(Contact* contact) {
|
||||
for(PhoneNumber* number in [contact parsedPhoneNumbers]) {
|
||||
if([[number toE164] isEqualToString:[SignalKeyingStorage.localNumber toE164]]) {
|
||||
// remove local number
|
||||
return NO;
|
||||
}
|
||||
else if(_thread!=nil && _thread.groupModel.groupMemberIds){
|
||||
return ![_thread.groupModel.groupMemberIds containsObject:[number toE164]];
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}];
|
||||
|
@ -73,24 +77,9 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
self.navigationItem.title = _thread.groupModel.groupName;
|
||||
self.nameGroupTextField.text = _thread.groupModel.groupName;
|
||||
if(_thread.groupModel.groupImage!=nil) {
|
||||
_groupImage = _thread.groupModel.groupImage;
|
||||
[self setupGroupImageButton:_thread.groupModel.groupImage];
|
||||
}
|
||||
// Select the contacts already selected:
|
||||
for (NSInteger r = 0; r < [_tableView numberOfRowsInSection:0]; r++) {
|
||||
// TODOGROUP this will not scale well
|
||||
NSMutableSet *usersInGroup = [NSMutableSet setWithArray:_thread.groupModel.groupMemberIds];
|
||||
NSMutableArray *contactPhoneNumbers = [[NSMutableArray alloc] init];
|
||||
for(PhoneNumber* number in [[contacts objectAtIndex:(NSUInteger)r] parsedPhoneNumbers]) {
|
||||
[contactPhoneNumbers addObject:[number toE164]];
|
||||
}
|
||||
[usersInGroup intersectSet:[NSSet setWithArray:contactPhoneNumbers]];
|
||||
if([usersInGroup count]>0) {
|
||||
[_tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:r inSection:0]
|
||||
animated:NO
|
||||
scrollPosition:UITableViewScrollPositionNone];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -136,7 +125,7 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
for (NSIndexPath* idx in _tableView.indexPathsForSelectedRows) {
|
||||
[mut addObjectsFromArray:[[contacts objectAtIndex:(NSUInteger)idx.row] textSecureIdentifiers]];
|
||||
}
|
||||
[mut addObject:[SignalKeyingStorage.localNumber toE164]]; // Also add the originator
|
||||
[mut addObjectsFromArray:_thread.groupModel.groupMemberIds];
|
||||
_groupModel = [[TSGroupModel alloc] initWithTitle:_nameGroupTextField.text memberIds:[NSMutableArray arrayWithArray:[[NSSet setWithArray:mut] allObjects]] image:_thread.groupModel.groupImage groupId:_thread.groupModel.groupId];
|
||||
|
||||
[self performSegueWithIdentifier:kUnwindToMessagesViewSegue sender:self];
|
||||
|
@ -145,17 +134,15 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
|
||||
-(TSGroupModel*)makeGroup {
|
||||
NSString* title = _nameGroupTextField.text;
|
||||
UIImage* img = _thread.groupModel.groupImage;
|
||||
NSMutableArray* mut = [[NSMutableArray alloc]init];
|
||||
|
||||
for (NSIndexPath* idx in _tableView.indexPathsForSelectedRows) {
|
||||
[mut addObjectsFromArray:[[contacts objectAtIndex:(NSUInteger)idx.row] textSecureIdentifiers]];
|
||||
}
|
||||
// Also add the originator
|
||||
[mut addObject:[SignalKeyingStorage.localNumber toE164]];
|
||||
NSData* groupId = [SecurityUtils generateRandomBytes:16];
|
||||
|
||||
return [[TSGroupModel alloc] initWithTitle:title memberIds:mut image:img groupId:groupId];
|
||||
return [[TSGroupModel alloc] initWithTitle:title memberIds:mut image:_groupImage groupId:groupId];
|
||||
}
|
||||
|
||||
-(IBAction)addGroupPhoto:(id)sender
|
||||
|
@ -233,6 +220,7 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
if (picture_camera) {
|
||||
UIImage *small = [picture_camera resizedImageToFitInSize:CGSizeMake(100.00,100.00) scaleIfSmaller:NO];
|
||||
_thread.groupModel.groupImage = small;
|
||||
_groupImage = small;
|
||||
[self setupGroupImageButton:small];
|
||||
|
||||
}
|
||||
|
@ -240,9 +228,11 @@ static NSString* const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue"
|
|||
}
|
||||
|
||||
-(void)setupGroupImageButton:(UIImage*)image {
|
||||
[self.groupImageButton setImage:image forState:UIControlStateNormal];
|
||||
_groupImageButton.imageView.layer.cornerRadius = 4.0f;
|
||||
_groupImageButton.imageView.clipsToBounds = YES;
|
||||
[_groupImageButton setImage:image forState:UIControlStateNormal];
|
||||
_groupImageButton.imageView.layer.cornerRadius = CGRectGetWidth([_groupImageButton.imageView frame])/2.0f;
|
||||
_groupImageButton.imageView.layer.masksToBounds = YES;
|
||||
_groupImageButton.imageView.layer.borderColor = [[UIColor lightGrayColor] CGColor];
|
||||
_groupImageButton.imageView.layer.borderWidth = 0.5f;
|
||||
}
|
||||
|
||||
#pragma mark - Table view data source
|
||||
|
|
|
@ -74,11 +74,11 @@
|
|||
|
||||
|
||||
if([membersWhoLeft count] > 0 ) {
|
||||
updatedGroupInfoString = [updatedGroupInfoString stringByAppendingString:[NSString stringWithFormat:@"%@ left the group. ",[[membersWhoLeft allObjects] componentsJoinedByString:@", "]]];
|
||||
updatedGroupInfoString = [updatedGroupInfoString stringByAppendingString:[NSString stringWithFormat:@" %@ left the group. ",[[membersWhoLeft allObjects] componentsJoinedByString:@", "]]];
|
||||
}
|
||||
|
||||
if([membersWhoJoined count] > 0 ) {
|
||||
updatedGroupInfoString = [updatedGroupInfoString stringByAppendingString:[NSString stringWithFormat:@"%@ joined the group. ",[[membersWhoJoined allObjects] componentsJoinedByString:@", "]]];
|
||||
updatedGroupInfoString = [updatedGroupInfoString stringByAppendingString:[NSString stringWithFormat:@" %@ joined the group. ",[[membersWhoJoined allObjects] componentsJoinedByString:@", "]]];
|
||||
}
|
||||
|
||||
return updatedGroupInfoString;
|
||||
|
|
Loading…
Reference in New Issue