Commit b2a14a06 by Demid Merzlyakov

Read / unread NWSAlertCell background color.

parent 564a6669
......@@ -20,6 +20,7 @@ public struct NWSAlert: Codable, Equatable, Hashable {
/// This property is set by NWSAlertManager after decoding the response.
public var city: String = ""
public var timeZone: TimeZone!
public var read: Bool = false
public var extendedInfo: NWSAlertExtendedInfo?
......@@ -45,7 +46,7 @@ public struct NWSAlert: Codable, Equatable, Hashable {
lhs.severityLevel == rhs.severityLevel &&
lhs.description == rhs.description &&
lhs.expires == rhs.expires
// do not compare weatherMessage & city
// only compare attributes that come from JSON.
}
public func hash(into hasher: inout Hasher) {
......
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.967",
"green" : "0.933",
"red" : "0.927"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.103",
"green" : "0.090",
"red" : "0.091"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.170",
"green" : "0.149",
"red" : "0.150"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -20,12 +20,12 @@
}
],
"color" : {
"color-space" : "display-p3",
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.400",
"green" : "0.312",
"red" : "0.280"
"blue" : "255",
"green" : "255",
"red" : "255"
}
},
"idiom" : "universal"
......
......@@ -22,6 +22,8 @@ class NWSAlertCell: UITableViewCell {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
self.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
self.contentView.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
prepareHeader()
prepareAlertTextLabel()
prepareFooter()
......@@ -58,6 +60,10 @@ class NWSAlertCell: UITableViewCell {
public func configure(with alert: NWSAlert) {
self.alert = alert
let backgroundColorName = alert.read ? "notifications_background_read" : "notifications_background_unread"
self.backgroundColor = UIColor(named: backgroundColorName)
self.contentView.backgroundColor = UIColor(named: backgroundColorName)
if alert.expired {
headerActiveExpiredLabel.text = "notifications.nwsCell.expired".localized()
headerActiveExpiredLabel.backgroundColor = UIColor(named: "nws_cell_expired")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment