diff --git a/Session/Home/HomeVC.swift b/Session/Home/HomeVC.swift index bd1c04564..b2d643011 100644 --- a/Session/Home/HomeVC.swift +++ b/Session/Home/HomeVC.swift @@ -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 diff --git a/Session/Shared/ConversationCell.swift b/Session/Shared/ConversationCell.swift index 2eaf22d3a..2a7edf38a 100644 --- a/Session/Shared/ConversationCell.swift +++ b/Session/Shared/ConversationCell.swift @@ -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()) diff --git a/SessionUIKit/Style Guide/Colors.swift b/SessionUIKit/Style Guide/Colors.swift index 06f4e3095..1a150ebc9 100644 --- a/SessionUIKit/Style Guide/Colors.swift +++ b/SessionUIKit/Style Guide/Colors.swift @@ -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")! } } diff --git a/SessionUIKit/Style Guide/Colors.xcassets/session_pin_icon.colorset/Contents.json b/SessionUIKit/Style Guide/Colors.xcassets/session_pin_icon.colorset/Contents.json new file mode 100644 index 000000000..dea6b5f39 --- /dev/null +++ b/SessionUIKit/Style Guide/Colors.xcassets/session_pin_icon.colorset/Contents.json @@ -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 + } +}