Commit b2a14a06 by Demid Merzlyakov

Read / unread NWSAlertCell background color.

parent 564a6669
...@@ -20,6 +20,7 @@ public struct NWSAlert: Codable, Equatable, Hashable { ...@@ -20,6 +20,7 @@ public struct NWSAlert: Codable, Equatable, Hashable {
/// This property is set by NWSAlertManager after decoding the response. /// This property is set by NWSAlertManager after decoding the response.
public var city: String = "" public var city: String = ""
public var timeZone: TimeZone! public var timeZone: TimeZone!
public var read: Bool = false
public var extendedInfo: NWSAlertExtendedInfo? public var extendedInfo: NWSAlertExtendedInfo?
...@@ -45,7 +46,7 @@ public struct NWSAlert: Codable, Equatable, Hashable { ...@@ -45,7 +46,7 @@ public struct NWSAlert: Codable, Equatable, Hashable {
lhs.severityLevel == rhs.severityLevel && lhs.severityLevel == rhs.severityLevel &&
lhs.description == rhs.description && lhs.description == rhs.description &&
lhs.expires == rhs.expires lhs.expires == rhs.expires
// do not compare weatherMessage & city // only compare attributes that come from JSON.
} }
public func hash(into hasher: inout Hasher) { 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 @@ ...@@ -20,12 +20,12 @@
} }
], ],
"color" : { "color" : {
"color-space" : "display-p3", "color-space" : "srgb",
"components" : { "components" : {
"alpha" : "1.000", "alpha" : "1.000",
"blue" : "0.400", "blue" : "255",
"green" : "0.312", "green" : "255",
"red" : "0.280" "red" : "255"
} }
}, },
"idiom" : "universal" "idiom" : "universal"
......
...@@ -22,6 +22,8 @@ class NWSAlertCell: UITableViewCell { ...@@ -22,6 +22,8 @@ class NWSAlertCell: UITableViewCell {
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none self.selectionStyle = .none
self.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
self.contentView.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
prepareHeader() prepareHeader()
prepareAlertTextLabel() prepareAlertTextLabel()
prepareFooter() prepareFooter()
...@@ -58,6 +60,10 @@ class NWSAlertCell: UITableViewCell { ...@@ -58,6 +60,10 @@ class NWSAlertCell: UITableViewCell {
public func configure(with alert: NWSAlert) { public func configure(with alert: NWSAlert) {
self.alert = alert 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 { if alert.expired {
headerActiveExpiredLabel.text = "notifications.nwsCell.expired".localized() headerActiveExpiredLabel.text = "notifications.nwsCell.expired".localized()
headerActiveExpiredLabel.backgroundColor = UIColor(named: "nws_cell_expired") 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