Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Stuart Breckenridge 2019-06-19 23:26:11 +08:00
commit 449dde54c5
21 changed files with 89 additions and 145 deletions

View File

@ -36,26 +36,21 @@ struct AppAssets {
return RSImage(named: "faviconTemplateImage")! return RSImage(named: "faviconTemplateImage")!
}() }()
static var feedColor: UIColor = {
return UIColor(named: "feedColor")!
}()
static var feedImage: RSImage = { static var feedImage: RSImage = {
let image = RSImage(named: "feedImage")! return RSImage(named: "feedImage")!
return image.maskWithColor(color: AppAssets.feedColor.cgColor)!
}() }()
static var masterFolderColor: UIColor = { static var masterFolderColor: UIColor = {
return UIColor(named: "masterFolderColor")! return UIColor(named: "masterFolderColor")!
}() }()
static var masterFolderImage: RSImage = { static var masterFolderImage: RSImage = {
let image = RSImage(named: "folderImage")! let image = RSImage(named: "folderImage")!
return image.maskWithColor(color: AppAssets.masterFolderColor.cgColor)! return image.maskWithColor(color: AppAssets.masterFolderColor.cgColor)!
}() }()
static var selectionBackgroundColor: UIColor = { static var netNewsWireBlueColor: UIColor = {
return UIColor(named: "selectionBackgroundColor")! return UIColor(named: "netNewsWireBlueColor")!
}() }()
static var smartFeedColor: UIColor = { static var smartFeedColor: UIColor = {
@ -84,14 +79,6 @@ struct AppAssets {
return image.maskWithColor(color: AppAssets.starColor.cgColor)! return image.maskWithColor(color: AppAssets.starColor.cgColor)!
}() }()
static var timelineTextPrimaryColor: UIColor = {
return UIColor(named: "timelineTextPrimaryColor")!
}()
static var timelineTextSecondaryColor: UIColor = {
return UIColor(named: "timelineTextSecondaryColor")!
}()
static var timelineUnreadCircleColor: UIColor = { static var timelineUnreadCircleColor: UIColor = {
return UIColor(named: "timelineUnreadCircleColor")! return UIColor(named: "timelineUnreadCircleColor")!
}() }()

View File

@ -71,6 +71,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem
splitViewController.delegate = self splitViewController.delegate = self
window!.tintColor = AppAssets.netNewsWireBlueColor
AppDefaults.registerDefaults() AppDefaults.registerDefaults()
let isFirstRun = AppDefaults.isFirstRun let isFirstRun = AppDefaults.isFirstRun
if isFirstRun { if isFirstRun {

View File

@ -144,7 +144,7 @@ private extension MasterFeedTableViewCell {
func theme() { func theme() {
let bgView = UIView() let bgView = UIView()
bgView.backgroundColor = AppAssets.selectionBackgroundColor bgView.backgroundColor = AppAssets.netNewsWireBlueColor
selectedBackgroundView = bgView selectedBackgroundView = bgView
} }

View File

@ -28,7 +28,7 @@ extension MasterTimelineCellLayout {
var r = CGRect.zero var r = CGRect.zero
r.size = CGSize(width: MasterTimelineDefaultCellLayout.unreadCircleDimension, height: MasterTimelineDefaultCellLayout.unreadCircleDimension) r.size = CGSize(width: MasterTimelineDefaultCellLayout.unreadCircleDimension, height: MasterTimelineDefaultCellLayout.unreadCircleDimension)
r.origin.x = point.x r.origin.x = point.x
r.origin.y = point.y + 4 r.origin.y = point.y + 5
return r return r
} }
@ -38,7 +38,7 @@ extension MasterTimelineCellLayout {
r.size.width = MasterTimelineDefaultCellLayout.starDimension r.size.width = MasterTimelineDefaultCellLayout.starDimension
r.size.height = MasterTimelineDefaultCellLayout.starDimension r.size.height = MasterTimelineDefaultCellLayout.starDimension
r.origin.x = floor(point.x - ((MasterTimelineDefaultCellLayout.starDimension - MasterTimelineDefaultCellLayout.unreadCircleDimension) / 2.0)) r.origin.x = floor(point.x - ((MasterTimelineDefaultCellLayout.starDimension - MasterTimelineDefaultCellLayout.unreadCircleDimension) / 2.0))
r.origin.y = point.y + 2 r.origin.y = point.y + 3
return r return r
} }

View File

@ -23,25 +23,21 @@ struct MasterTimelineDefaultCellLayout: MasterTimelineCellLayout {
static let avatarMarginRight = CGFloat(integerLiteral: 8) static let avatarMarginRight = CGFloat(integerLiteral: 8)
static let avatarCornerRadius = CGFloat(integerLiteral: 4) static let avatarCornerRadius = CGFloat(integerLiteral: 4)
static let titleColor = AppAssets.timelineTextPrimaryColor
static var titleFont: UIFont { static var titleFont: UIFont {
return UIFont.preferredFont(forTextStyle: .headline) return UIFont.preferredFont(forTextStyle: .headline)
} }
static let titleBottomMargin = CGFloat(integerLiteral: 1) static let titleBottomMargin = CGFloat(integerLiteral: 1)
static let feedColor = AppAssets.timelineTextSecondaryColor
static var feedNameFont: UIFont { static var feedNameFont: UIFont {
return UIFont.preferredFont(forTextStyle: .footnote) return UIFont.preferredFont(forTextStyle: .footnote)
} }
static let feedRightMargin = CGFloat(integerLiteral: 8) static let feedRightMargin = CGFloat(integerLiteral: 8)
static let dateColor = AppAssets.timelineTextSecondaryColor
static var dateFont: UIFont { static var dateFont: UIFont {
return UIFont.preferredFont(forTextStyle: .footnote) return UIFont.preferredFont(forTextStyle: .footnote)
} }
static let dateMarginBottom = CGFloat(integerLiteral: 1) static let dateMarginBottom = CGFloat(integerLiteral: 1)
static let summaryColor = AppAssets.timelineTextPrimaryColor
static var summaryFont: UIFont { static var summaryFont: UIFont {
return UIFont.preferredFont(forTextStyle: .body) return UIFont.preferredFont(forTextStyle: .body)
} }

View File

@ -123,7 +123,7 @@ private extension MasterTimelineTableViewCell {
func theme() { func theme() {
let bgView = UIView() let bgView = UIView()
bgView.backgroundColor = AppAssets.selectionBackgroundColor bgView.backgroundColor = AppAssets.netNewsWireBlueColor
selectedBackgroundView = bgView selectedBackgroundView = bgView
} }
@ -141,19 +141,19 @@ private extension MasterTimelineTableViewCell {
func updateTitleView() { func updateTitleView() {
titleView.font = MasterTimelineDefaultCellLayout.titleFont titleView.font = MasterTimelineDefaultCellLayout.titleFont
titleView.textColor = MasterTimelineDefaultCellLayout.titleColor titleView.textColor = .label
updateTextFieldText(titleView, cellData?.title) updateTextFieldText(titleView, cellData?.title)
} }
func updateSummaryView() { func updateSummaryView() {
summaryView.font = MasterTimelineDefaultCellLayout.summaryFont summaryView.font = MasterTimelineDefaultCellLayout.summaryFont
summaryView.textColor = MasterTimelineDefaultCellLayout.summaryColor summaryView.textColor = .label
updateTextFieldText(summaryView, cellData?.summary) updateTextFieldText(summaryView, cellData?.summary)
} }
func updateDateView() { func updateDateView() {
dateView.font = MasterTimelineDefaultCellLayout.dateFont dateView.font = MasterTimelineDefaultCellLayout.dateFont
dateView.textColor = MasterTimelineDefaultCellLayout.dateColor dateView.textColor = .secondaryLabel
updateTextFieldText(dateView, cellData.dateString) updateTextFieldText(dateView, cellData.dateString)
} }
@ -170,7 +170,7 @@ private extension MasterTimelineTableViewCell {
if cellData.showFeedName { if cellData.showFeedName {
showView(feedNameView) showView(feedNameView)
feedNameView.font = MasterTimelineDefaultCellLayout.feedNameFont feedNameView.font = MasterTimelineDefaultCellLayout.feedNameFont
feedNameView.textColor = MasterTimelineDefaultCellLayout.feedColor feedNameView.textColor = .secondaryLabel
updateTextFieldText(feedNameView, cellData.feedName) updateTextFieldText(feedNameView, cellData.feedName)
} else { } else {
hideView(feedNameView) hideView(feedNameView)

View File

@ -139,7 +139,7 @@ class MasterTimelineViewController: ProgressTableViewController, UndoableCommand
} }
readAction.image = AppAssets.circleClosedImage readAction.image = AppAssets.circleClosedImage
readAction.backgroundColor = AppAssets.timelineUnreadCircleColor readAction.backgroundColor = AppAssets.netNewsWireBlueColor
// Set up the star action // Set up the star action
let starTitle = article.status.starred ? let starTitle = article.status.starred ?

View File

@ -1,20 +0,0 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "universal",
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "20",
"alpha" : "1.000",
"blue" : "243",
"green" : "140"
}
}
}
]
}

View File

@ -0,0 +1,38 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "universal",
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0x08",
"alpha" : "1.000",
"blue" : "0xEE",
"green" : "0x6A"
}
}
},
{
"idiom" : "universal",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0x44",
"alpha" : "1.000",
"blue" : "0xE2",
"green" : "0x90"
}
}
}
]
}

View File

@ -1,20 +0,0 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "universal",
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "111",
"alpha" : "1.000",
"blue" : "250",
"green" : "175"
}
}
}
]
}

View File

@ -1,20 +0,0 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "universal",
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0x22",
"alpha" : "1.000",
"blue" : "0x22",
"green" : "0x22"
}
}
}
]
}

View File

@ -1,20 +0,0 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "universal",
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0x80",
"alpha" : "1.000",
"blue" : "0x80",
"green" : "0x80"
}
}
}
]
}

View File

@ -11,7 +11,7 @@ import Account
struct SettingsAddAccountView : View { struct SettingsAddAccountView : View {
var body: some View { var body: some View {
List { Form {
PresentationButton(destination: SettingsLocalAccountView(name: "")) { PresentationButton(destination: SettingsLocalAccountView(name: "")) {
SettingsAccountLabelView(accountImage: "accountLocal", accountLabel: Account.defaultLocalAccountName) SettingsAccountLabelView(accountImage: "accountLocal", accountLabel: Account.defaultLocalAccountName)
} }
@ -21,7 +21,6 @@ struct SettingsAddAccountView : View {
} }
.padding(4) .padding(4)
} }
.listStyle(.grouped)
.navigationBarTitle(Text("Add Account"), displayMode: .inline) .navigationBarTitle(Text("Add Account"), displayMode: .inline)
} }
} }

View File

@ -17,7 +17,7 @@ struct SettingsDetailAccountView : View {
@State private var showFeedbinCredentials = false @State private var showFeedbinCredentials = false
var body: some View { var body: some View {
List { Form {
Section { Section {
HStack { HStack {
Text("Name") Text("Name")
@ -63,7 +63,6 @@ struct SettingsDetailAccountView : View {
} }
} }
} }
.listStyle(.grouped)
.navigationBarTitle(Text(verbatim: viewModel.nameForDisplay), displayMode: .inline) .navigationBarTitle(Text(verbatim: viewModel.nameForDisplay), displayMode: .inline)
} }

View File

@ -19,7 +19,7 @@ struct SettingsFeedbinAccountView : View {
var body: some View { var body: some View {
NavigationView { NavigationView {
List { Form {
Section(header: Section(header:
SettingsAccountLabelView(accountImage: "accountFeedbin", accountLabel: "Feedbin").padding() SettingsAccountLabelView(accountImage: "accountFeedbin", accountLabel: "Feedbin").padding()
) { ) {
@ -57,7 +57,6 @@ struct SettingsFeedbinAccountView : View {
} }
} }
.disabled(busy) .disabled(busy)
.listStyle(.grouped)
.navigationBarTitle(Text(""), displayMode: .inline) .navigationBarTitle(Text(""), displayMode: .inline)
.navigationBarItems(leading: .navigationBarItems(leading:
Button(action: { self.dismiss() }) { Text("Cancel") } Button(action: { self.dismiss() }) { Text("Cancel") }

View File

@ -15,7 +15,7 @@ struct SettingsLocalAccountView : View {
var body: some View { var body: some View {
NavigationView { NavigationView {
List { Form {
Section(header: Section(header:
SettingsAccountLabelView(accountImage: "accountLocal", accountLabel: Account.defaultLocalAccountName).padding() SettingsAccountLabelView(accountImage: "accountLocal", accountLabel: Account.defaultLocalAccountName).padding()
) { ) {
@ -35,7 +35,6 @@ struct SettingsLocalAccountView : View {
} }
} }
} }
.listStyle(.grouped)
.navigationBarTitle(Text(""), displayMode: .inline) .navigationBarTitle(Text(""), displayMode: .inline)
.navigationBarItems(leading: Button(action: { self.dismiss() }) { Text("Cancel") } ) .navigationBarItems(leading: Button(action: { self.dismiss() }) { Text("Cancel") } )
} }

View File

@ -19,7 +19,7 @@ struct SettingsView : View {
var body: some View { var body: some View {
NavigationView { NavigationView {
List { Form {
Section(header: Text("ACCOUNTS")) { Section(header: Text("ACCOUNTS")) {
ForEach(viewModel.accounts.identified(by: \.self)) { account in ForEach(viewModel.accounts.identified(by: \.self)) { account in
@ -32,27 +32,6 @@ struct SettingsView : View {
} }
} }
Section(header: Text("ABOUT")) {
Text("About NetNewsWire")
PresentationButton(destination: SafariView(url: URL(string: "https://ranchero.com/netnewswire/")!)) {
Text("Website")
}
PresentationButton(destination: SafariView(url: URL(string: "https://github.com/brentsimmons/NetNewsWire")!)) {
Text("Github Repository")
}
PresentationButton(destination: SafariView(url: URL(string: "https://github.com/brentsimmons/NetNewsWire/issues")!)) {
Text("Bug Tracker")
}
PresentationButton(destination: SafariView(url: URL(string: "https://github.com/brentsimmons/NetNewsWire/tree/master/Technotes")!)) {
Text("Technotes")
}
PresentationButton(destination: SafariView(url: URL(string: "https://github.com/brentsimmons/NetNewsWire/blob/master/Technotes/HowToSupportNetNewsWire.markdown")!)) {
Text("How to Support NetNewsWire")
}
Text("Add NetNewsWire News Feed")
}
.foregroundColor(.primary)
Section(header: Text("TIMELINE")) { Section(header: Text("TIMELINE")) {
Toggle(isOn: $viewModel.sortOldestToNewest) { Toggle(isOn: $viewModel.sortOldestToNewest) {
Text("Sort Oldest to Newest") Text("Sort Oldest to Newest")
@ -85,8 +64,28 @@ struct SettingsView : View {
} }
.foregroundColor(.primary) .foregroundColor(.primary)
Section(header: Text("ABOUT"), footer: buildFooter) {
Text("About NetNewsWire")
PresentationButton(destination: SafariView(url: URL(string: "https://ranchero.com/netnewswire/")!)) {
Text("Website")
}
PresentationButton(destination: SafariView(url: URL(string: "https://github.com/brentsimmons/NetNewsWire")!)) {
Text("Github Repository")
}
PresentationButton(destination: SafariView(url: URL(string: "https://github.com/brentsimmons/NetNewsWire/issues")!)) {
Text("Bug Tracker")
}
PresentationButton(destination: SafariView(url: URL(string: "https://github.com/brentsimmons/NetNewsWire/tree/master/Technotes")!)) {
Text("Technotes")
}
PresentationButton(destination: SafariView(url: URL(string: "https://github.com/brentsimmons/NetNewsWire/blob/master/Technotes/HowToSupportNetNewsWire.markdown")!)) {
Text("How to Support NetNewsWire")
}
Text("Add NetNewsWire News Feed")
}
.foregroundColor(.primary)
} }
.listStyle(.grouped)
.navigationBarTitle(Text("Settings"), displayMode: .inline) .navigationBarTitle(Text("Settings"), displayMode: .inline)
} }
@ -118,6 +117,12 @@ struct SettingsView : View {
return ActionSheet(title: Text("Export Subscriptions..."), message: Text("Select the account to export out of."), buttons: buttons) return ActionSheet(title: Text("Export Subscriptions..."), message: Text("Select the account to export out of."), buttons: buttons)
} }
var buildFooter: some View {
return Text(verbatim: "\(Bundle.main.appName) v \(Bundle.main.versionNumber) (Build \(Bundle.main.buildNumber))")
.font(.footnote)
.foregroundColor(.secondary)
}
// MARK: ViewModel // MARK: ViewModel
class ViewModel: BindableObject { class ViewModel: BindableObject {

View File

@ -59,7 +59,7 @@ extension DetailAccountViewController {
} }
let bgView = UIView() let bgView = UIView()
bgView.backgroundColor = AppAssets.selectionBackgroundColor bgView.backgroundColor = AppAssets.netNewsWireBlueColor
cell.selectedBackgroundView = bgView cell.selectedBackgroundView = bgView
return cell return cell
} }

View File

@ -25,7 +25,7 @@ class RefreshIntervalViewController: UITableViewController {
cell.textLabel?.adjustsFontForContentSizeCategory = true cell.textLabel?.adjustsFontForContentSizeCategory = true
let bgView = UIView() let bgView = UIView()
bgView.backgroundColor = AppAssets.selectionBackgroundColor bgView.backgroundColor = AppAssets.netNewsWireBlueColor
cell.selectedBackgroundView = bgView cell.selectedBackgroundView = bgView
let userRefreshInterval = AppDefaults.refreshInterval let userRefreshInterval = AppDefaults.refreshInterval

View File

@ -93,7 +93,7 @@ class SettingsViewController: UITableViewController {
} }
let bgView = UIView() let bgView = UIView()
bgView.backgroundColor = AppAssets.selectionBackgroundColor bgView.backgroundColor = AppAssets.netNewsWireBlueColor
cell.selectedBackgroundView = bgView cell.selectedBackgroundView = bgView
return cell return cell

View File

@ -25,7 +25,7 @@ class TimelineNumberOfLinesViewController: UITableViewController {
cell.textLabel?.adjustsFontForContentSizeCategory = true cell.textLabel?.adjustsFontForContentSizeCategory = true
let bgView = UIView() let bgView = UIView()
bgView.backgroundColor = AppAssets.selectionBackgroundColor bgView.backgroundColor = AppAssets.netNewsWireBlueColor
cell.selectedBackgroundView = bgView cell.selectedBackgroundView = bgView
cell.textLabel?.text = "\(2 + indexPath.row)" + NSLocalizedString(" lines", comment: "Lines") cell.textLabel?.text = "\(2 + indexPath.row)" + NSLocalizedString(" lines", comment: "Lines")