Skip to content
This repository has been archived by the owner. It is now read-only.

News: breaking news label color update - fixes #468 #470

Merged
merged 1 commit into from Sep 3, 2019
Merged
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -508,6 +508,7 @@ extension UIColor {
static let cliqzGreenLightFunctional = UIColor(colorString: "9ECC42")
static let cliqzGreenDarkFunctional = UIColor(colorString: "67A73A")
static let cliqzPinkFunctional = UIColor(colorString: "FF7E74")
static let cliqzRedFunctional = UIColor(colorString: "FF403D")
static let cliqzGrayFunctional = UIColor(colorString: "97A4AE")

//Other
@@ -27,14 +27,32 @@ class NewsCellViewModel {
url = ""
}
let fullTitle = NSMutableAttributedString()
let customAttributes = NewsCellViewModel.getCustomLabelAttributes()

if news.isBreaking ?? false,
let t = news.breakingLabel {
fullTitle.append(NSAttributedString(string: t.uppercased() + ": ", attributes: customAttributes))
} else if let locallbl = news.localLabel {
fullTitle.append(NSAttributedString(string: locallbl.uppercased() + ": ", attributes: customAttributes))
}
if
news.isBreaking ?? false,
let t = news.breakingLabel
{
fullTitle.append(
NSAttributedString(
string: t.uppercased() + ": ",
attributes: [
NSAttributedStringKey.foregroundColor: UIColor.cliqzRedFunctional,
NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: 16),
]
)
)
} else if let locallbl = news.localLabel {
fullTitle.append(
NSAttributedString(
string: locallbl.uppercased() + ": ",
attributes: [
NSAttributedStringKey.foregroundColor: UIColor.cliqzBluePrimary,
NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: 16),
]
)
)
}

if let shortTitle = news.shortTitle {
fullTitle.append(NSAttributedString(string: shortTitle))
} else if let t = news.title {
@@ -44,14 +62,6 @@ class NewsCellViewModel {
logo = Variable(nil)
logoInfo = Variable(nil)
}

private class func getCustomLabelAttributes() -> [NSAttributedStringKey : Any] {

let customAttributes = [NSAttributedStringKey.foregroundColor: UIColor.cliqzBluePrimary,
NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: 16)]

return customAttributes
}
}

class NewsViewCell: ClickableUITableViewCell {
ProTip! Use n and p to navigate between commits in a pull request.