Skip to content

Commit

Permalink
Add height constraints to status view elements
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Müller <[email protected]>
  • Loading branch information
SystemKeeper committed Mar 18, 2024
1 parent 5d15c20 commit cd4264e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
1 change: 1 addition & 0 deletions NextcloudTalk/BaseChatTableViewCell+File.swift
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ extension BaseChatTableViewCell {
}

fileActivityIndicator.startAnimating()
fileActivityIndicator.heightAnchor.constraint(equalToConstant: 20).isActive = true
self.statusView.addArrangedSubview(fileActivityIndicator)
}

Expand Down
31 changes: 20 additions & 11 deletions NextcloudTalk/BaseChatTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,31 +298,40 @@ class BaseChatTableViewCell: UITableViewCell, ReactionsViewDelegate {

if deliveryState == ChatMessageDeliveryStateSending || deliveryState == ChatMessageDeliveryStateDeleting {
let activityIndicator = MDCActivityIndicator(frame: .init(x: 0, y: 0, width: 20, height: 20))

activityIndicator.radius = 7.0
activityIndicator.cycleColors = [.lightGray]
activityIndicator.cycleColors = [.systemGray2]
activityIndicator.startAnimating()
activityIndicator.heightAnchor.constraint(equalToConstant: 20).isActive = true

self.statusView.addArrangedSubview(activityIndicator)

} else if deliveryState == ChatMessageDeliveryStateFailed {
let errorView = UIImageView(frame: .init(x: 0, y: 0, width: 20, height: 20))
let errorImage = UIImage(systemName: "exclamationmark.circle")?.withTintColor(.red).withRenderingMode(.alwaysOriginal)

errorView.image = errorImage
errorView.heightAnchor.constraint(equalToConstant: 20).isActive = true

self.statusView.addArrangedSubview(errorView)
} else if deliveryState == ChatMessageDeliveryStateSent {

} else if deliveryState == ChatMessageDeliveryStateSent || deliveryState == ChatMessageDeliveryStateRead {
var checkImageName = "check"

if deliveryState == ChatMessageDeliveryStateRead {
checkImageName = "check-all"
}

let checkImage = UIImage(named: checkImageName)?.withRenderingMode(.alwaysTemplate)
let checkView = UIImageView(frame: .init(x: 0, y: 0, width: 20, height: 20))
let checkImage = UIImage(named: "check")?.withRenderingMode(.alwaysTemplate)

checkView.image = checkImage
checkView.contentMode = .scaleAspectFit
checkView.tintColor = .systemGray2
checkView.accessibilityIdentifier = "MessageSent"
checkView.heightAnchor.constraint(equalToConstant: 20).isActive = true

self.statusView.addArrangedSubview(checkView)
} else if deliveryState == ChatMessageDeliveryStateRead {
let checkAllView = UIImageView(frame: .init(x: 0, y: 0, width: 20, height: 20))
let checkAllImage = UIImage(named: "check-all")?.withRenderingMode(.alwaysTemplate)
checkAllView.image = checkAllImage
checkAllView.contentMode = .scaleAspectFit
checkAllView.tintColor = .systemGray2
checkAllView.accessibilityIdentifier = "MessageSent"
self.statusView.addArrangedSubview(checkAllView)
}
}

Expand Down
2 changes: 1 addition & 1 deletion NextcloudTalk/BaseChatTableViewCell.xib
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<view opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="X2q-XX-H1j" userLabel="ContentPart">
<rect key="frame" x="0.0" y="100" width="422" height="257"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillProportionally" translatesAutoresizingMaskIntoConstraints="NO" id="TkE-V6-ePd" userLabel="StatusView">
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillProportionally" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="TkE-V6-ePd" userLabel="StatusView">
<rect key="frame" x="15" y="5" width="20" height="20"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="F90-3N-Ecf" userLabel="PlaceholderForInterfaceBuilder">
Expand Down

0 comments on commit cd4264e

Please sign in to comment.