fix cell updating and pin icon color
This commit is contained in:
parent
1cc2f17469
commit
7e5573c96f
|
@ -358,15 +358,17 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, NewConv
|
|||
delete.backgroundColor = Colors.destructive
|
||||
|
||||
let isPinned = thread.isPinned
|
||||
let pin = UITableViewRowAction(style: .normal, title: NSLocalizedString("PIN_BUTTON_TEXT", comment: "")) { _, _ in
|
||||
let pin = UITableViewRowAction(style: .normal, title: NSLocalizedString("PIN_BUTTON_TEXT", comment: "")) { [weak self] _, _ in
|
||||
thread.isPinned = true
|
||||
thread.save()
|
||||
self?.threadViewModelCache.removeValue(forKey: thread.uniqueId!)
|
||||
tableView.reloadRows(at: [ indexPath ], with: UITableView.RowAnimation.fade)
|
||||
}
|
||||
pin.backgroundColor = Colors.pathsBuilding
|
||||
let unpin = UITableViewRowAction(style: .normal, title: NSLocalizedString("UNPIN_BUTTON_TEXT", comment: "")) { _, _ in
|
||||
let unpin = UITableViewRowAction(style: .normal, title: NSLocalizedString("UNPIN_BUTTON_TEXT", comment: "")) { [weak self] _, _ in
|
||||
thread.isPinned = false
|
||||
thread.save()
|
||||
self?.threadViewModelCache.removeValue(forKey: thread.uniqueId!)
|
||||
tableView.reloadRows(at: [ indexPath ], with: UITableView.RowAnimation.fade)
|
||||
}
|
||||
unpin.backgroundColor = Colors.pathsBuilding
|
||||
|
|
|
@ -64,7 +64,7 @@ final class ConversationCell : UITableViewCell {
|
|||
let size = ConversationCell.unreadCountViewSize
|
||||
result.set(.width, to: size)
|
||||
result.set(.height, to: size)
|
||||
result.tintColor = Colors.text
|
||||
result.tintColor = Colors.pinIcon
|
||||
result.layer.masksToBounds = true
|
||||
return result
|
||||
}()
|
||||
|
@ -193,7 +193,7 @@ final class ConversationCell : UITableViewCell {
|
|||
private func update() {
|
||||
AssertIsOnMainThread()
|
||||
guard let thread = threadViewModel?.threadRecord else { return }
|
||||
backgroundColor = thread.isPinned ? Colors.cellPinned : Colors.cellBackground
|
||||
backgroundColor = threadViewModel.isPinned ? Colors.cellPinned : Colors.cellBackground
|
||||
let isBlocked: Bool
|
||||
if let thread = thread as? TSContactThread {
|
||||
isBlocked = SSKEnvironment.shared.blockingManager.isRecipientIdBlocked(thread.contactSessionID())
|
||||
|
|
|
@ -41,4 +41,5 @@ public final class Colors : NSObject {
|
|||
@objc public static var pnOptionBackground: UIColor { UIColor(named: "session_pn_option_background")! }
|
||||
@objc public static var pnOptionBorder: UIColor { UIColor(named: "session_pn_option_border")! }
|
||||
@objc public static var pathsBuilding: UIColor { UIColor(named: "session_paths_building")! }
|
||||
@objc public static var pinIcon: UIColor { UIColor(named: "session_pin_icon")! }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "96",
|
||||
"green" : "96",
|
||||
"red" : "96"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "179",
|
||||
"green" : "179",
|
||||
"red" : "179"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue