Groups: self-management of membership of groups

- Add Groups tab

vector-im/riot-meta#114
This commit is contained in:
Giom Foret
2017-12-12 16:03:26 +01:00
parent 6625beb49a
commit 9a25515d14
31 changed files with 2267 additions and 29 deletions
+87
View File
@@ -0,0 +1,87 @@
/*
Copyright 2017 Vector Creations Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import "GroupTableViewCell.h"
#import "RiotDesignValues.h"
#import "MXGroup+Riot.h"
@implementation GroupTableViewCell
#pragma mark - Class methods
- (void)awakeFromNib
{
[super awakeFromNib];
// Initialize unread count badge
[_missedNotifAndUnreadBadgeBgView.layer setCornerRadius:10];
_missedNotifAndUnreadBadgeBgViewWidthConstraint.constant = 0;
if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)])
{
self.groupName.font = [UIFont systemFontOfSize:17 weight:UIFontWeightMedium];
}
else
{
self.groupName.font = [UIFont systemFontOfSize:17];
}
}
- (void)customizeTableViewCellRendering
{
[super customizeTableViewCellRendering];
self.groupName.textColor = kRiotPrimaryTextColor;
self.groupDescription.textColor = kRiotSecondaryTextColor;
self.memberCount.textColor = kRiotSecondaryTextColor;
self.missedNotifAndUnreadBadgeLabel.textColor = kRiotPrimaryBgColor;
self.groupAvatar.defaultBackgroundColor = [UIColor clearColor];
}
- (void)layoutSubviews
{
[super layoutSubviews];
// Round image view
[_groupAvatar.layer setCornerRadius:_groupAvatar.frame.size.width / 2];
_groupAvatar.clipsToBounds = YES;
}
- (void)render:(MXKCellData *)cellData
{
[super render:cellData];
// Hide by default missed notifications and unread widgets
self.missedNotifAndUnreadBadgeBgView.hidden = YES;
self.missedNotifAndUnreadBadgeBgViewWidthConstraint.constant = 0;
if (groupCellData)
{
[groupCellData.group setGroupAvatarImageIn:self.groupAvatar matrixSession:groupCellData.groupsDataSource.mxSession];
}
}
+ (CGFloat)heightForCellData:(MXKCellData *)cellData withMaximumWidth:(CGFloat)maxWidth
{
// The height is fixed
// @TODO change this to support dynamic fonts
return 74;
}
@end