diff --git a/NextcloudTalk/AvatarButton.swift b/NextcloudTalk/AvatarButton.swift index ca2e88422..70e7fa8a6 100644 --- a/NextcloudTalk/AvatarButton.swift +++ b/NextcloudTalk/AvatarButton.swift @@ -51,10 +51,10 @@ import SDWebImage // MARK: - Conversation avatars - public func setAvatar(for room: NCRoom, with style: UIUserInterfaceStyle) { + public func setAvatar(for room: NCRoom) { self.cancelCurrentRequest() - self.currentRequest = AvatarManager.shared.getAvatar(for: room, with: style) { image in + self.currentRequest = AvatarManager.shared.getAvatar(for: room, with: self.traitCollection.userInterfaceStyle) { image in guard let image = image else { return } @@ -63,8 +63,8 @@ import SDWebImage } } - public func setGroupAvatar(with style: UIUserInterfaceStyle) { - if let image = AvatarManager.shared.getGroupAvatar(with: style) { + public func setGroupAvatar() { + if let image = AvatarManager.shared.getGroupAvatar(with: self.traitCollection.userInterfaceStyle) { self.setImage(image, for: .normal) } } diff --git a/NextcloudTalk/AvatarImageView.swift b/NextcloudTalk/AvatarImageView.swift index abb471111..2115355c6 100644 --- a/NextcloudTalk/AvatarImageView.swift +++ b/NextcloudTalk/AvatarImageView.swift @@ -48,10 +48,10 @@ import SDWebImage // MARK: - Conversation avatars - public func setAvatar(for room: NCRoom, with style: UIUserInterfaceStyle) { + public func setAvatar(for room: NCRoom) { self.cancelCurrentRequest() - self.currentRequest = AvatarManager.shared.getAvatar(for: room, with: style) { image in + self.currentRequest = AvatarManager.shared.getAvatar(for: room, with: self.traitCollection.userInterfaceStyle) { image in guard let image = image else { return } @@ -61,14 +61,14 @@ import SDWebImage } } - public func setGroupAvatar(with style: UIUserInterfaceStyle) { - if let image = AvatarManager.shared.getGroupAvatar(with: style) { + public func setGroupAvatar() { + if let image = AvatarManager.shared.getGroupAvatar(with: self.traitCollection.userInterfaceStyle) { self.image = image } } - public func setMailAvatar(with style: UIUserInterfaceStyle) { - if let image = AvatarManager.shared.getMailAvatar(with: style) { + public func setMailAvatar() { + if let image = AvatarManager.shared.getMailAvatar(with: self.traitCollection.userInterfaceStyle) { self.image = image } } diff --git a/NextcloudTalk/NCChatTitleView.m b/NextcloudTalk/NCChatTitleView.m index 7585aa58b..222277e46 100644 --- a/NextcloudTalk/NCChatTitleView.m +++ b/NextcloudTalk/NCChatTitleView.m @@ -101,7 +101,7 @@ - (void)layoutSubviews - (void)updateForRoom:(NCRoom *)room { // Set room image - [self.avatarimage setAvatarFor:room with:self.traitCollection.userInterfaceStyle]; + [self.avatarimage setAvatarFor:room]; NSString *subtitle = nil; diff --git a/NextcloudTalk/OpenConversationsTableViewController.swift b/NextcloudTalk/OpenConversationsTableViewController.swift index 40a4baf97..9a1c55aa2 100644 --- a/NextcloudTalk/OpenConversationsTableViewController.swift +++ b/NextcloudTalk/OpenConversationsTableViewController.swift @@ -170,9 +170,9 @@ class OpenConversationsTableViewController: UITableViewController, UISearchResul cell.labelTitle.text = openConversation.displayName // Set group avatar as default avatar - cell.contactImage.setGroupAvatar(with: self.traitCollection.userInterfaceStyle) + cell.contactImage.setGroupAvatar() // Try to get room avatar even though at the moment (Talk 17) it is not exposed - cell.contactImage.setAvatar(for: openConversation, with: self.traitCollection.userInterfaceStyle) + cell.contactImage.setAvatar(for: openConversation) return cell } diff --git a/NextcloudTalk/ReferenceTalkView.swift b/NextcloudTalk/ReferenceTalkView.swift index 4afcbef95..214385ff9 100644 --- a/NextcloudTalk/ReferenceTalkView.swift +++ b/NextcloudTalk/ReferenceTalkView.swift @@ -93,7 +93,7 @@ import SwiftyAttributes let room = NCDatabaseManager.sharedInstance().room(withToken: roomToken, forAccountId: activeAccount.accountId) if let room = room { - self.referenceTypeIcon.setAvatar(for: room, with: self.traitCollection.userInterfaceStyle) + self.referenceTypeIcon.setAvatar(for: room) self.referenceTypeIcon.layer.cornerRadius = self.referenceTypeIcon.frame.height / 2 } else { self.referenceTypeIcon.layer.cornerRadius = 0 diff --git a/NextcloudTalk/RoomAvatarInfoTableViewController.swift b/NextcloudTalk/RoomAvatarInfoTableViewController.swift index 27705b3f8..c4f0ceb8c 100644 --- a/NextcloudTalk/RoomAvatarInfoTableViewController.swift +++ b/NextcloudTalk/RoomAvatarInfoTableViewController.swift @@ -97,7 +97,7 @@ enum RoomAvatarInfoSection: Int { } func updateHeaderView() { - self.headerView.avatarImageView.setAvatar(for: self.room, with: self.traitCollection.userInterfaceStyle) + self.headerView.avatarImageView.setAvatar(for: self.room) self.headerView.editView.isHidden = !NCDatabaseManager.sharedInstance().serverHasTalkCapability(kCapabilityConversationAvatars, forAccountId: self.room.accountId) self.headerView.trashButton.isHidden = !self.room.isCustomAvatar diff --git a/NextcloudTalk/RoomCreationTableViewController.swift b/NextcloudTalk/RoomCreationTableViewController.swift index c0f906025..d1eb1f389 100644 --- a/NextcloudTalk/RoomCreationTableViewController.swift +++ b/NextcloudTalk/RoomCreationTableViewController.swift @@ -139,7 +139,7 @@ enum RoomVisibilityOption: Int { } else if self.selectedEmojiImage != nil { self.headerView.avatarImageView.image = self.selectedEmojiImage } else { - self.headerView.avatarImageView.setGroupAvatar(with: self.traitCollection.userInterfaceStyle) + self.headerView.avatarImageView.setGroupAvatar() } self.headerView.trashButton.isHidden = self.selectedAvatarImage == nil && self.selectedEmojiImage == nil diff --git a/NextcloudTalk/RoomInfoTableViewController.m b/NextcloudTalk/RoomInfoTableViewController.m index d8ca13a7a..18b784b74 100644 --- a/NextcloudTalk/RoomInfoTableViewController.m +++ b/NextcloudTalk/RoomInfoTableViewController.m @@ -1694,7 +1694,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell.roomNameTextField.text = _room.displayName; } - [cell.roomImage setAvatarFor:_room with:self.traitCollection.userInterfaceStyle]; + [cell.roomImage setAvatarFor:_room]; if (_room.hasCall) { [cell.favoriteImage setTintColor:[UIColor systemRedColor]]; diff --git a/NextcloudTalk/RoomSearchTableViewController.m b/NextcloudTalk/RoomSearchTableViewController.m index d210492aa..788534c2b 100644 --- a/NextcloudTalk/RoomSearchTableViewController.m +++ b/NextcloudTalk/RoomSearchTableViewController.m @@ -345,7 +345,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N [cell setUnreadMessages:room.unreadMessages mentioned:mentioned groupMentioned:NO]; } - [cell.roomImage setAvatarFor:room with:self.traitCollection.userInterfaceStyle]; + [cell.roomImage setAvatarFor:room]; // Set favorite or call image if (room.hasCall) { diff --git a/NextcloudTalk/RoomsTableViewController.m b/NextcloudTalk/RoomsTableViewController.m index c1af77277..2e8edb281 100644 --- a/NextcloudTalk/RoomsTableViewController.m +++ b/NextcloudTalk/RoomsTableViewController.m @@ -1499,7 +1499,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell.subtitleLabel.text = pendingInvitationsString; cell.dateLabel.text = @""; - [cell.roomImage setMailAvatarWith:self.traitCollection.userInterfaceStyle]; + [cell.roomImage setMailAvatar]; return cell; } @@ -1529,7 +1529,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N [cell setUnreadMessages:room.unreadMessages mentioned:mentioned groupMentioned:NO]; } - [cell.roomImage setAvatarFor:room with:self.traitCollection.userInterfaceStyle]; + [cell.roomImage setAvatarFor:room]; // Set favorite or call image if (room.hasCall) { diff --git a/ShareExtension/ShareViewController.m b/ShareExtension/ShareViewController.m index 562d837f5..e2b86d437 100644 --- a/ShareExtension/ShareViewController.m +++ b/ShareExtension/ShareViewController.m @@ -567,7 +567,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell.titleLabel.text = room.displayName; - [cell.avatarImageView setAvatarFor:room with:self.traitCollection.userInterfaceStyle]; + [cell.avatarImageView setAvatarFor:room]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;