ContactGroupCell.m 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2015-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import "ContactGroupCell.h"
  21. #import "AvatarMaker.h"
  22. #import "BundleUtil.h"
  23. @implementation ContactGroupCell
  24. - (void)awakeFromNib {
  25. [super awakeFromNib];
  26. _nameLabel.font = [UIFont boldSystemFontOfSize: _nameLabel.font.pointSize];
  27. if (@available(iOS 11.0, *)) {
  28. _avatarImage.accessibilityIgnoresInvertColors = true;
  29. }
  30. }
  31. - (void)setGroup:(GroupProxy *)group {
  32. _group = group;
  33. NSString *groupName = group.conversation.displayName;
  34. [_nameLabel setText: groupName];
  35. NSString *creator = [_group creatorString];
  36. NSString *memberCount = [_group membersSummaryString];
  37. [_creatorNameLabel setText:creator];
  38. [_countMembersLabel setText:memberCount];
  39. _avatarImage.image = [BundleUtil imageNamed:@"Unknown"];
  40. [[AvatarMaker sharedAvatarMaker] avatarForConversation:group.conversation size:40.0f masked:YES onCompletion:^(UIImage *avatarImage) {
  41. dispatch_async(dispatch_get_main_queue(), ^{
  42. _avatarImage.image = avatarImage;
  43. });
  44. }];
  45. }
  46. @end