зеркало из https://github.com/nextcloud/talk-ios.git
Add new AvatarView.
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Родитель
29c556d993
Коммит
66a1a6e0b9
|
@ -575,6 +575,8 @@
|
|||
2CD5F3242142781A006B71BF /* NCExternalSignalingController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CD5F3232142781A006B71BF /* NCExternalSignalingController.m */; };
|
||||
2CD80F482A4304AD00919057 /* OpenConversationsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CD80F472A4304AD00919057 /* OpenConversationsTableViewController.swift */; };
|
||||
2CEDA88C26F492610044552B /* NSMutableAttributedString+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CEDA88B26F492610044552B /* NSMutableAttributedString+Extensions.swift */; };
|
||||
2CF338E12CED388B0029CACC /* AvatarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF338E02CED388B0029CACC /* AvatarView.swift */; };
|
||||
2CF338E22CED388B0029CACC /* AvatarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF338E02CED388B0029CACC /* AvatarView.swift */; };
|
||||
2CF8AD3F2A0010FB00A4D3E6 /* MessageTranslationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF8AD3D2A0010FB00A4D3E6 /* MessageTranslationViewController.swift */; };
|
||||
2CF8AD402A0010FB00A4D3E6 /* MessageTranslationViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2CF8AD3E2A0010FB00A4D3E6 /* MessageTranslationViewController.xib */; };
|
||||
3FCA62550CD1442D28E8A7C6 /* libPods-NotificationServiceExtension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9B81BB7A4920C391CC2CACFD /* libPods-NotificationServiceExtension.a */; };
|
||||
|
@ -1143,6 +1145,7 @@
|
|||
2CEA990828B8B5780029216A /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = de; path = de.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
|
||||
2CEDA87E26EF91460044552B /* NextcloudTalk-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NextcloudTalk-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
2CEDA88B26F492610044552B /* NSMutableAttributedString+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSMutableAttributedString+Extensions.swift"; sourceTree = "<group>"; };
|
||||
2CF338E02CED388B0029CACC /* AvatarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarView.swift; sourceTree = "<group>"; };
|
||||
2CF8AD3D2A0010FB00A4D3E6 /* MessageTranslationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageTranslationViewController.swift; sourceTree = "<group>"; };
|
||||
2CF8AD3E2A0010FB00A4D3E6 /* MessageTranslationViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MessageTranslationViewController.xib; sourceTree = "<group>"; };
|
||||
342600BABD1AD1FCA48B5E59 /* Pods-NextcloudTalkTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NextcloudTalkTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-NextcloudTalkTests/Pods-NextcloudTalkTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
|
@ -1681,6 +1684,7 @@
|
|||
1F1C0D8629AFB88800D17C6D /* VLCKitVideoViewController.xib */,
|
||||
1F90DA0329E9A28E00E81E3D /* AvatarManager.swift */,
|
||||
1FDCC3D329EBF6E700DEB39B /* AvatarImageView.swift */,
|
||||
2CF338E02CED388B0029CACC /* AvatarView.swift */,
|
||||
1FDCC3EF29ECB4CE00DEB39B /* AvatarButton.swift */,
|
||||
1F3C41A229EDF05700F58435 /* AvatarEditView.swift */,
|
||||
1F3C41A429EDF0B800F58435 /* AvatarEditView.xib */,
|
||||
|
@ -3076,6 +3080,7 @@
|
|||
2CB6ACBC26385A3800D3D641 /* ShareLocationViewController.m in Sources */,
|
||||
2C04249B2CA33681004772F6 /* AudioPlayerView.swift in Sources */,
|
||||
1F1B0F462BE047CE003FD766 /* InteractionControlling.swift in Sources */,
|
||||
2CF338E12CED388B0029CACC /* AvatarView.swift in Sources */,
|
||||
1FDCC3D429EBF6E700DEB39B /* AvatarImageView.swift in Sources */,
|
||||
1FB78E262B6AE5A600B0D69D /* FederationInvitation.swift in Sources */,
|
||||
1FDFC94D2BA50B9100670DF4 /* UIFontExtension.swift in Sources */,
|
||||
|
@ -3112,6 +3117,7 @@
|
|||
2C62AFFD24C1BDA5007E460A /* NCMessageParameter.m in Sources */,
|
||||
1F35F8EC2AEEBC1400044BDA /* UIScrollView+SLKAdditions.m in Sources */,
|
||||
1FF136172BFB74CF006A6101 /* NCChatMessage.swift in Sources */,
|
||||
2CF338E22CED388B0029CACC /* AvatarView.swift in Sources */,
|
||||
1FF4DA8A2C0262BB00C1B952 /* NCBaseSessionManager.swift in Sources */,
|
||||
2C62B00C24C1BDC1007E460A /* NCNotification.m in Sources */,
|
||||
1F8AAC3E2C519689004DA20A /* StunServer.swift in Sources */,
|
||||
|
|
|
@ -0,0 +1,198 @@
|
|||
//
|
||||
// SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import SDWebImage
|
||||
|
||||
@objcMembers class AvatarView: UIView {
|
||||
|
||||
private let userStatusSizePercentage = 0.38
|
||||
|
||||
public let avatarImageView = AvatarImageView(frame: .zero)
|
||||
public let favoriteImageView = UIImageView()
|
||||
private let userStatusImageView = UIImageView()
|
||||
private let userStatusLabel = UILabel()
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
self.commonInit()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
self.commonInit()
|
||||
}
|
||||
|
||||
private func commonInit() {
|
||||
self.addSubview(avatarImageView)
|
||||
self.addSubview(favoriteImageView)
|
||||
self.addSubview(userStatusImageView)
|
||||
self.addSubview(userStatusLabel)
|
||||
|
||||
avatarImageView.contentMode = .scaleAspectFit
|
||||
favoriteImageView.contentMode = .scaleAspectFill
|
||||
userStatusImageView.contentMode = .center
|
||||
userStatusLabel.textAlignment = .center
|
||||
|
||||
userStatusImageView.isHidden = true
|
||||
userStatusLabel.isHidden = true
|
||||
|
||||
avatarImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
favoriteImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
userStatusImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
userStatusLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
NSLayoutConstraint.activate([
|
||||
avatarImageView.topAnchor.constraint(equalTo: topAnchor, constant: 0),
|
||||
avatarImageView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 0),
|
||||
avatarImageView.leftAnchor.constraint(equalTo: leftAnchor, constant: 0),
|
||||
avatarImageView.rightAnchor.constraint(equalTo: rightAnchor, constant: 0),
|
||||
|
||||
favoriteImageView.widthAnchor.constraint(equalTo: widthAnchor, multiplier: userStatusSizePercentage),
|
||||
favoriteImageView.heightAnchor.constraint(equalTo: heightAnchor, multiplier: userStatusSizePercentage),
|
||||
favoriteImageView.rightAnchor.constraint(equalTo: rightAnchor, constant: 2),
|
||||
favoriteImageView.topAnchor.constraint(equalTo: topAnchor, constant: -4),
|
||||
|
||||
userStatusImageView.widthAnchor.constraint(equalTo: widthAnchor, multiplier: userStatusSizePercentage),
|
||||
userStatusImageView.heightAnchor.constraint(equalTo: heightAnchor, multiplier: userStatusSizePercentage),
|
||||
userStatusImageView.rightAnchor.constraint(equalTo: rightAnchor, constant: 2),
|
||||
userStatusImageView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 2),
|
||||
|
||||
userStatusLabel.widthAnchor.constraint(equalTo: widthAnchor, multiplier: userStatusSizePercentage),
|
||||
userStatusLabel.heightAnchor.constraint(equalTo: heightAnchor, multiplier: userStatusSizePercentage),
|
||||
userStatusLabel.rightAnchor.constraint(equalTo: rightAnchor, constant: 2),
|
||||
userStatusLabel.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 2)
|
||||
])
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
avatarImageView.layer.cornerRadius = avatarImageView.frame.height / 2
|
||||
avatarImageView.clipsToBounds = true
|
||||
|
||||
userStatusImageView.layer.cornerRadius = userStatusImageView.frame.height / 2
|
||||
userStatusImageView.clipsToBounds = true
|
||||
}
|
||||
|
||||
public func prepareForReuse() {
|
||||
// Fix problem of rendering downloaded image in a reused cell
|
||||
avatarImageView.cancelCurrentRequest()
|
||||
avatarImageView.image = nil
|
||||
|
||||
favoriteImageView.image = nil
|
||||
|
||||
userStatusImageView.image = nil
|
||||
userStatusImageView.backgroundColor = .clear
|
||||
|
||||
userStatusLabel.text = nil
|
||||
}
|
||||
|
||||
// MARK: - Conversation avatars
|
||||
|
||||
public func setAvatar(for room: NCRoom) {
|
||||
self.avatarImageView.setAvatar(for: room)
|
||||
}
|
||||
|
||||
public func setGroupAvatar() {
|
||||
self.avatarImageView.setGroupAvatar()
|
||||
}
|
||||
|
||||
public func setMailAvatar() {
|
||||
self.avatarImageView.setMailAvatar()
|
||||
}
|
||||
|
||||
// MARK: - User avatars
|
||||
|
||||
public func setActorAvatar(forMessage message: NCChatMessage) {
|
||||
self.avatarImageView.setActorAvatar(forMessage: message)
|
||||
}
|
||||
|
||||
public func setActorAvatar(forId actorId: String?, withType actorType: String?, withDisplayName actorDisplayName: String?, withRoomToken roomToken: String?, using account: TalkAccount) {
|
||||
self.avatarImageView.setActorAvatar(forId: actorId, withType: actorType, withDisplayName: actorDisplayName, withRoomToken: roomToken, using: account)
|
||||
}
|
||||
|
||||
// MARK: - User status
|
||||
|
||||
public func setStatus(for room: NCRoom, with backgroundColor: UIColor) {
|
||||
if room.type == .oneToOne, let roomStatus = room.status {
|
||||
if roomStatus != "dnd", let roomStatusIcon = room.statusIcon {
|
||||
setUserStatusIcon(roomStatusIcon, with: backgroundColor)
|
||||
} else {
|
||||
setUserStatus(roomStatus, with: backgroundColor)
|
||||
}
|
||||
} else if room.isPublic {
|
||||
if let statusImage = statusImageWith(name: "link", color: .label, padding: 4) {
|
||||
setUserStatusImage(statusImage, with: backgroundColor)
|
||||
}
|
||||
} else if room.isFederated {
|
||||
if let statusImage = statusImageWith(name: "globe", color: .label, padding: 3) {
|
||||
setUserStatusImage(statusImage, with: backgroundColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func setUserStatus(_ userStatus: String, with backgroundColor: UIColor) {
|
||||
if userStatus == "online" {
|
||||
if let statusImage = statusImageWith(name: "circle.fill", color: .systemGreen, padding: 2) {
|
||||
setUserStatusImage(statusImage, with: backgroundColor)
|
||||
}
|
||||
} else if userStatus == "away" {
|
||||
if let statusImage = statusImageWith(name: "moon.fill", color: .systemYellow, padding: 2) {
|
||||
setUserStatusImage(statusImage, with: backgroundColor)
|
||||
}
|
||||
} else if userStatus == "dnd" {
|
||||
var dndImageName = "minus.circle.fill"
|
||||
if #available(iOS 16.1, *) {
|
||||
dndImageName = "wrongwaysign.fill"
|
||||
}
|
||||
if let statusImage = statusImageWith(name: dndImageName, color: .systemRed, secondaryColor: .white, padding: 2) {
|
||||
setUserStatusImage(statusImage, with: backgroundColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func setUserStatusImage(_ userStatusImage: UIImage, with backgroundColor: UIColor) {
|
||||
userStatusImageView.backgroundColor = backgroundColor
|
||||
userStatusImageView.image = userStatusImage
|
||||
|
||||
userStatusImageView.isHidden = false
|
||||
userStatusLabel.isHidden = true
|
||||
}
|
||||
|
||||
private func setUserStatusIcon(_ userStatusIcon: String, with backgroundColor: UIColor) {
|
||||
userStatusLabel.text = userStatusIcon
|
||||
userStatusLabel.font = .systemFont(ofSize: userStatusLabel.frame.height - 6)
|
||||
|
||||
userStatusImageView.isHidden = true
|
||||
userStatusLabel.isHidden = false
|
||||
}
|
||||
|
||||
private func statusImageWith(name: String, color: UIColor, secondaryColor: UIColor? = nil, padding: CGFloat) -> UIImage? {
|
||||
let userStatusSize = self.frame.size.height * userStatusSizePercentage - padding * 2
|
||||
let sizeConfiguration = UIImage.SymbolConfiguration(pointSize: userStatusSize)
|
||||
|
||||
// Multicolor image
|
||||
if let secondaryColor {
|
||||
let colorConfiguration = UIImage.SymbolConfiguration(paletteColors: [secondaryColor, color])
|
||||
let combinedSymbolConfiguration = colorConfiguration.applying(sizeConfiguration)
|
||||
if let statusImage = UIImage(systemName: name)?
|
||||
.applyingSymbolConfiguration(combinedSymbolConfiguration) {
|
||||
return statusImage
|
||||
}
|
||||
}
|
||||
|
||||
// Single color image
|
||||
if let statusImage = UIImage(systemName: name)?
|
||||
.withTintColor(color, renderingMode: .alwaysOriginal)
|
||||
.applyingSymbolConfiguration(sizeConfiguration) {
|
||||
return statusImage
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
|
@ -126,9 +126,9 @@ extern NSString * const NCRoomObjectTypeRoom;
|
|||
@property (nonatomic, copy) NSString *pendingMessage;
|
||||
@property (nonatomic, assign) BOOL canLeaveConversation;
|
||||
@property (nonatomic, assign) BOOL canDeleteConversation;
|
||||
@property (nonatomic, copy) NSString *status;
|
||||
@property (nonatomic, copy) NSString *statusIcon;
|
||||
@property (nonatomic, copy) NSString *statusMessage;
|
||||
@property (nonatomic, copy, nullable) NSString *status;
|
||||
@property (nonatomic, copy, nullable) NSString *statusIcon;
|
||||
@property (nonatomic, copy, nullable) NSString *statusMessage;
|
||||
@property (nonatomic, assign) NSInteger participantFlags;
|
||||
@property (nonatomic, assign) NCPermission permissions;
|
||||
@property (nonatomic, assign) NSInteger attendeePermissions;
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#import "NCAppBranding.h"
|
||||
#import "NCDatabaseManager.h"
|
||||
#import "NCRoom.h"
|
||||
#import "NCUserStatus.h"
|
||||
#import "TalkAccount.h"
|
||||
#import "NotificationCenterNotifications.h"
|
||||
|
||||
|
|
|
@ -192,11 +192,11 @@ typedef enum RoomSearchSection {
|
|||
NSString *actorId = [messageEntry.attributes objectForKey:@"actorId"];
|
||||
NSString *actorType = [messageEntry.attributes objectForKey:@"actorType"];
|
||||
if (thumbnailURL && thumbnailURL.absoluteString.length > 0) {
|
||||
[cell.roomImage setImageWithURL:thumbnailURL placeholderImage:nil];
|
||||
cell.roomImage.contentMode = UIViewContentModeScaleToFill;
|
||||
[cell.avatarView.avatarImageView setImageWithURL:thumbnailURL placeholderImage:nil];
|
||||
cell.avatarView.avatarImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
} else {
|
||||
TalkAccount *activeAccount = [[NCDatabaseManager sharedInstance] activeAccount];
|
||||
[cell.roomImage setActorAvatarForId:actorId withType:actorType withDisplayName:@"" withRoomToken:nil using:activeAccount];
|
||||
[cell.avatarView setActorAvatarForId:actorId withType:actorType withDisplayName:@"" withRoomToken:nil using:activeAccount];
|
||||
}
|
||||
|
||||
// Clear possible content not removed by cell reuse
|
||||
|
@ -238,7 +238,7 @@ typedef enum RoomSearchSection {
|
|||
cell.titleLabel.text = user.name;
|
||||
cell.titleOnly = YES;
|
||||
TalkAccount *activeAccount = [[NCDatabaseManager sharedInstance] activeAccount];
|
||||
[cell.roomImage setActorAvatarForId:user.userId withType:user.source withDisplayName:user.name withRoomToken:nil using:activeAccount];
|
||||
[cell.avatarView setActorAvatarForId:user.userId withType:user.source withDisplayName:user.name withRoomToken:nil using:activeAccount];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
@ -326,15 +326,15 @@ typedef enum RoomSearchSection {
|
|||
[cell setUnreadWithMessages:room.unreadMessages mentioned:mentioned groupMentioned:NO];
|
||||
}
|
||||
|
||||
[cell.roomImage setAvatarFor:room];
|
||||
[cell.avatarView setAvatarFor:room];
|
||||
|
||||
// Set favorite or call image
|
||||
if (room.hasCall) {
|
||||
[cell.favoriteImage setTintColor:[UIColor systemRedColor]];
|
||||
[cell.favoriteImage setImage:[UIImage systemImageNamed:@"video.fill"]];
|
||||
[cell.avatarView.favoriteImageView setTintColor:[UIColor systemRedColor]];
|
||||
[cell.avatarView.favoriteImageView setImage:[UIImage systemImageNamed:@"video.fill"]];
|
||||
} else if (room.isFavorite) {
|
||||
[cell.favoriteImage setTintColor:[UIColor systemYellowColor]];
|
||||
[cell.favoriteImage setImage:[UIImage systemImageNamed:@"star.fill"]];
|
||||
[cell.avatarView.favoriteImageView setTintColor:[UIColor systemYellowColor]];
|
||||
[cell.avatarView.favoriteImageView setImage:[UIImage systemImageNamed:@"star.fill"]];
|
||||
}
|
||||
|
||||
return cell;
|
||||
|
|
|
@ -7,14 +7,11 @@ import Foundation
|
|||
|
||||
@objcMembers public class RoomTableViewCell: UITableViewCell {
|
||||
|
||||
@IBOutlet weak var roomImage: AvatarImageView!
|
||||
@IBOutlet weak var avatarView: AvatarView!
|
||||
@IBOutlet weak var titleLabel: UILabel!
|
||||
@IBOutlet weak var subtitleLabel: UILabel!
|
||||
@IBOutlet weak var unreadMessagesView: BadgeView!
|
||||
@IBOutlet weak var dateLabel: UILabel!
|
||||
@IBOutlet weak var favoriteImage: UIImageView!
|
||||
@IBOutlet weak var userStatusImageView: UIImageView!
|
||||
@IBOutlet weak var userStatusLabel: UILabel!
|
||||
@IBOutlet weak var titleLabelTopConstraint: NSLayoutConstraint!
|
||||
|
||||
public static var identifier = "RoomCellIdentifier"
|
||||
|
@ -33,12 +30,6 @@ import Foundation
|
|||
public override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
self.roomImage.layer.cornerRadius = 24.0
|
||||
self.roomImage.layer.masksToBounds = true
|
||||
self.roomImage.backgroundColor = NCAppBranding.placeholderColor()
|
||||
|
||||
self.favoriteImage.contentMode = .center
|
||||
|
||||
if UIView.userInterfaceLayoutDirection(for: self.dateLabel.semanticContentAttribute) == .rightToLeft {
|
||||
self.dateLabel.textAlignment = .left
|
||||
} else {
|
||||
|
@ -49,20 +40,11 @@ import Foundation
|
|||
public override func prepareForReuse() {
|
||||
super.prepareForReuse()
|
||||
|
||||
// Fix problem of rendering downloaded image in a reused cell
|
||||
self.roomImage.cancelCurrentRequest()
|
||||
self.avatarView.prepareForReuse()
|
||||
|
||||
self.roomImage.image = nil
|
||||
self.favoriteImage.image = nil
|
||||
self.favoriteImage.tintColor = .clear
|
||||
self.subtitleLabel.text = ""
|
||||
self.dateLabel.text = ""
|
||||
|
||||
self.userStatusImageView.image = nil
|
||||
self.userStatusImageView.backgroundColor = .clear
|
||||
|
||||
self.userStatusLabel.isHidden = true
|
||||
|
||||
self.unreadMessagesView.setBadgeNumber(0)
|
||||
|
||||
self.titleLabelTopConstraint.constant = titleOriginY
|
||||
|
@ -102,35 +84,4 @@ import Foundation
|
|||
self.dateLabel.font = UIFont.preferredFont(forTextStyle: .footnote)
|
||||
}
|
||||
}
|
||||
|
||||
public func setUserStatusIcon(_ userStatusIcon: String) {
|
||||
self.userStatusLabel.text = userStatusIcon
|
||||
self.userStatusLabel.isHidden = false
|
||||
}
|
||||
|
||||
public func setUserStatusIconWithImage(_ image: UIImage) {
|
||||
self.userStatusImageView.image = image
|
||||
self.userStatusImageView.contentMode = .center
|
||||
self.userStatusImageView.layer.cornerRadius = 10
|
||||
self.userStatusImageView.clipsToBounds = true
|
||||
|
||||
// When a background color is set directly to the cell it seems that there is no background configuration.
|
||||
self.userStatusImageView.backgroundColor = self.backgroundConfiguration?.backgroundColor ?? self.backgroundColor
|
||||
}
|
||||
|
||||
public func setUserStatus(_ userStatus: String) {
|
||||
var statusImage: UIImage?
|
||||
|
||||
if userStatus == "online" {
|
||||
statusImage = UIImage(named: "user-status-online")
|
||||
} else if userStatus == "away" {
|
||||
statusImage = UIImage(named: "user-status-away")
|
||||
} else if userStatus == "dnd" {
|
||||
statusImage = UIImage(named: "user-status-dnd")
|
||||
}
|
||||
|
||||
if let statusImage {
|
||||
self.setUserStatusIconWithImage(statusImage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,14 +18,14 @@
|
|||
<rect key="frame" x="0.0" y="0.0" width="375" height="72"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="j70-Qd-IKC" customClass="AvatarImageView" customModule="NextcloudTalk" customModuleProvider="target">
|
||||
<rect key="frame" x="12" y="12" width="48" height="48"/>
|
||||
<color key="backgroundColor" red="0.83529411764705885" green="0.83529411764705885" blue="0.83529411764705885" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xcw-pC-kPV" customClass="AvatarView" customModule="NextcloudTalk" customModuleProvider="target">
|
||||
<rect key="frame" x="16" y="12" width="48" height="48"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="48" id="1E2-6J-hdU"/>
|
||||
<constraint firstAttribute="width" constant="48" id="OiT-EW-fDv"/>
|
||||
<constraint firstAttribute="height" constant="48" id="BFT-jl-6Wp"/>
|
||||
<constraint firstAttribute="width" constant="48" id="jyi-6z-FTf"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="750" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4oj-Ge-nSq">
|
||||
<rect key="frame" x="72" y="12" width="225" height="20.5"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/>
|
||||
|
@ -41,73 +41,37 @@
|
|||
<view contentMode="scaleToFill" horizontalHuggingPriority="750" horizontalCompressionResistancePriority="1000" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xb6-vq-E0C" customClass="BadgeView" customModule="NextcloudTalk" customModuleProvider="target">
|
||||
<rect key="frame" x="132" y="36.5" width="227" height="23.5"/>
|
||||
</view>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="eUE-Vb-afX">
|
||||
<rect key="frame" x="45" y="4" width="20" height="20"/>
|
||||
<color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20" id="IZw-CA-ND6"/>
|
||||
<constraint firstAttribute="width" constant="20" id="jb4-sv-7MN"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="Yesterday" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DEV-Kr-Vlw">
|
||||
<rect key="frame" x="299" y="10" width="60" height="16"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
|
||||
<color key="textColor" systemColor="secondaryLabelColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="mxr-4b-6AO">
|
||||
<rect key="frame" x="44" y="44" width="20" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20" id="Nis-iR-sXa"/>
|
||||
<constraint firstAttribute="width" constant="20" id="iwo-ml-eCL"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IAW-Df-Q2p">
|
||||
<rect key="frame" x="44" y="44" width="20" height="20"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20" id="9H9-OY-FwF"/>
|
||||
<constraint firstAttribute="width" constant="20" id="E1R-qY-JVY"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="hTO-u0-vdH"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Xb6-vq-E0C" firstAttribute="leading" secondItem="Tc2-b5-oRl" secondAttribute="trailing" constant="4" id="2GI-x9-HFH"/>
|
||||
<constraint firstItem="DEV-Kr-Vlw" firstAttribute="leading" secondItem="4oj-Ge-nSq" secondAttribute="trailing" constant="2" id="33H-xh-7ow"/>
|
||||
<constraint firstItem="DEV-Kr-Vlw" firstAttribute="top" secondItem="hTO-u0-vdH" secondAttribute="top" constant="10" id="7oV-CM-9Gt"/>
|
||||
<constraint firstItem="mxr-4b-6AO" firstAttribute="top" secondItem="hTO-u0-vdH" secondAttribute="top" constant="44" id="Dmf-d3-Tcd"/>
|
||||
<constraint firstItem="DEV-Kr-Vlw" firstAttribute="trailing" secondItem="hTO-u0-vdH" secondAttribute="trailing" constant="-16" id="FrT-LG-M0H"/>
|
||||
<constraint firstItem="eUE-Vb-afX" firstAttribute="leading" secondItem="hTO-u0-vdH" secondAttribute="leading" constant="45" id="H1a-CQ-Rs2"/>
|
||||
<constraint firstItem="Tc2-b5-oRl" firstAttribute="top" secondItem="4oj-Ge-nSq" secondAttribute="bottom" constant="4" id="J8O-Vc-Fdv"/>
|
||||
<constraint firstItem="IAW-Df-Q2p" firstAttribute="top" secondItem="hTO-u0-vdH" secondAttribute="top" constant="44" id="UTs-bM-4rK"/>
|
||||
<constraint firstItem="j70-Qd-IKC" firstAttribute="leading" secondItem="hTO-u0-vdH" secondAttribute="leading" constant="12" id="VLJ-ka-a3c"/>
|
||||
<constraint firstItem="mxr-4b-6AO" firstAttribute="leading" secondItem="hTO-u0-vdH" secondAttribute="leading" constant="44" id="Vn7-Zn-ft5"/>
|
||||
<constraint firstItem="Xb6-vq-E0C" firstAttribute="centerY" secondItem="Tc2-b5-oRl" secondAttribute="centerY" id="X1F-a1-FRV"/>
|
||||
<constraint firstItem="IAW-Df-Q2p" firstAttribute="leading" secondItem="hTO-u0-vdH" secondAttribute="leading" constant="44" id="YhT-4g-4nL"/>
|
||||
<constraint firstItem="j70-Qd-IKC" firstAttribute="bottom" relation="lessThanOrEqual" secondItem="hTO-u0-vdH" secondAttribute="bottom" constant="-12" id="fSK-5G-Gcg"/>
|
||||
<constraint firstItem="Xb6-vq-E0C" firstAttribute="trailing" secondItem="hTO-u0-vdH" secondAttribute="trailing" constant="-16" id="iFT-1s-vDX"/>
|
||||
<constraint firstItem="Tc2-b5-oRl" firstAttribute="bottom" secondItem="hTO-u0-vdH" secondAttribute="bottom" constant="-12" id="j15-Xe-J8f"/>
|
||||
<constraint firstItem="4oj-Ge-nSq" firstAttribute="leading" secondItem="hTO-u0-vdH" secondAttribute="leading" constant="72" id="k3r-2g-iB6"/>
|
||||
<constraint firstItem="xcw-pC-kPV" firstAttribute="leading" secondItem="hTO-u0-vdH" secondAttribute="leading" constant="16" id="mPn-Ei-3FV"/>
|
||||
<constraint firstItem="4oj-Ge-nSq" firstAttribute="top" secondItem="hTO-u0-vdH" secondAttribute="top" constant="12" id="mha-g7-USc"/>
|
||||
<constraint firstItem="j70-Qd-IKC" firstAttribute="top" secondItem="hTO-u0-vdH" secondAttribute="top" constant="12" id="s9G-jv-sKe"/>
|
||||
<constraint firstItem="eUE-Vb-afX" firstAttribute="top" secondItem="hTO-u0-vdH" secondAttribute="top" constant="4" id="vz2-fe-RvW"/>
|
||||
<constraint firstItem="xcw-pC-kPV" firstAttribute="centerY" secondItem="eba-Du-dTo" secondAttribute="centerY" id="qbT-jS-yhG"/>
|
||||
<constraint firstItem="Tc2-b5-oRl" firstAttribute="leading" secondItem="hTO-u0-vdH" secondAttribute="leading" constant="72" id="xj3-Nb-jdA"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="avatarView" destination="xcw-pC-kPV" id="KB2-ZV-7o9"/>
|
||||
<outlet property="dateLabel" destination="DEV-Kr-Vlw" id="2t1-ib-Gfb"/>
|
||||
<outlet property="favoriteImage" destination="eUE-Vb-afX" id="SZW-c9-bdM"/>
|
||||
<outlet property="roomImage" destination="j70-Qd-IKC" id="YvW-c3-hxL"/>
|
||||
<outlet property="subtitleLabel" destination="Tc2-b5-oRl" id="1mD-EQ-Jhs"/>
|
||||
<outlet property="titleLabel" destination="4oj-Ge-nSq" id="SPq-KL-y2z"/>
|
||||
<outlet property="titleLabelTopConstraint" destination="mha-g7-USc" id="0fY-Qe-pU5"/>
|
||||
<outlet property="unreadMessagesView" destination="Xb6-vq-E0C" id="wXP-Vy-8sF"/>
|
||||
<outlet property="userStatusImageView" destination="mxr-4b-6AO" id="MJo-C9-yUh"/>
|
||||
<outlet property="userStatusLabel" destination="IAW-Df-Q2p" id="z9s-DV-2UV"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-71.200000000000003" y="-44.977511244377816"/>
|
||||
</tableViewCell>
|
||||
|
@ -116,5 +80,8 @@
|
|||
<systemColor name="secondaryLabelColor">
|
||||
<color red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</systemColor>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
|
@ -1456,15 +1456,15 @@ typedef enum RoomsSections {
|
|||
[cell setUnreadWithMessages:room.unreadMessages mentioned:mentioned groupMentioned:NO];
|
||||
}
|
||||
|
||||
[cell.roomImage setAvatarFor:room];
|
||||
[cell.avatarView setAvatarFor:room];
|
||||
|
||||
// Set favorite or call image
|
||||
if (room.hasCall) {
|
||||
[cell.favoriteImage setTintColor:[UIColor systemRedColor]];
|
||||
[cell.favoriteImage setImage:[UIImage systemImageNamed:@"video.fill"]];
|
||||
[cell.avatarView.favoriteImageView setTintColor:[UIColor systemRedColor]];
|
||||
[cell.avatarView.favoriteImageView setImage:[UIImage systemImageNamed:@"video.fill"]];
|
||||
} else if (room.isFavorite) {
|
||||
[cell.favoriteImage setTintColor:[UIColor systemYellowColor]];
|
||||
[cell.favoriteImage setImage:[UIImage systemImageNamed:@"star.fill"]];
|
||||
[cell.avatarView.favoriteImageView setTintColor:[UIColor systemYellowColor]];
|
||||
[cell.avatarView.favoriteImageView setImage:[UIImage systemImageNamed:@"star.fill"]];
|
||||
}
|
||||
|
||||
cell.roomToken = room.token;
|
||||
|
@ -1481,26 +1481,8 @@ typedef enum RoomsSections {
|
|||
RoomTableViewCell *cell = (RoomTableViewCell *)rcell;
|
||||
NCRoom *room = [_rooms objectAtIndex:indexPath.row];
|
||||
|
||||
//Show User Status
|
||||
if (room.type == kNCRoomTypeOneToOne && [room.status length] != 0) {
|
||||
if (![room.status isEqualToString:@"dnd"] && [room.statusIcon length] != 0) {
|
||||
[cell setUserStatusIcon:room.statusIcon];
|
||||
} else {
|
||||
[cell setUserStatus:room.status];
|
||||
}
|
||||
} else if (room.isPublic) {
|
||||
UIImageSymbolConfiguration *conf = [UIImageSymbolConfiguration configurationWithPointSize:12];
|
||||
UIImage *publicRoomImage = [UIImage systemImageNamed:@"link"];
|
||||
publicRoomImage = [publicRoomImage imageWithTintColor:[UIColor labelColor] renderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
publicRoomImage = [publicRoomImage imageByApplyingSymbolConfiguration:conf];
|
||||
[cell setUserStatusIconWithImage:publicRoomImage];
|
||||
} else if (room.isFederated) {
|
||||
UIImageSymbolConfiguration *conf = [UIImageSymbolConfiguration configurationWithPointSize:14];
|
||||
UIImage *publicRoomImage = [UIImage systemImageNamed:@"globe"];
|
||||
publicRoomImage = [publicRoomImage imageWithTintColor:[UIColor labelColor] renderingMode:UIImageRenderingModeAlwaysOriginal];
|
||||
publicRoomImage = [publicRoomImage imageByApplyingSymbolConfiguration:conf];
|
||||
[cell setUserStatusIconWithImage:publicRoomImage];
|
||||
}
|
||||
UIColor *backgroundColor = cell.backgroundConfiguration.backgroundColor ? cell.backgroundConfiguration.backgroundColor : cell.backgroundColor;
|
||||
[cell.avatarView setStatusFor:room with:backgroundColor];
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
|
|
Загрузка…
Ссылка в новой задаче