mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-02 20:16:54 +01:00
Add vibrant button style
This commit is contained in:
parent
00310b7bd7
commit
7bda205af8
@ -25,6 +25,7 @@
|
||||
512E09352268B25900BDCFDD /* UISplitViewController-Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 512E092B2268B25500BDCFDD /* UISplitViewController-Extensions.swift */; };
|
||||
512E094D2268B8AB00BDCFDD /* DeleteCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84B99C9C1FAE83C600ECDEDB /* DeleteCommand.swift */; };
|
||||
51322855232EED360033D4ED /* VibrantSelectAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51322854232EED360033D4ED /* VibrantSelectAction.swift */; };
|
||||
51322859232FDDB80033D4ED /* VibrantButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51322858232FDDB80033D4ED /* VibrantButtonStyle.swift */; };
|
||||
513C5CE9232571C2003D4054 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 513C5CE8232571C2003D4054 /* ShareViewController.swift */; };
|
||||
513C5CEC232571C2003D4054 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 513C5CEA232571C2003D4054 /* MainInterface.storyboard */; };
|
||||
513C5CF0232571C2003D4054 /* NetNewsWire iOS Share Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 513C5CE6232571C2003D4054 /* NetNewsWire iOS Share Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
@ -764,6 +765,7 @@
|
||||
512E08F722688F7C00BDCFDD /* MasterFeedTableViewSectionHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterFeedTableViewSectionHeader.swift; sourceTree = "<group>"; };
|
||||
512E092B2268B25500BDCFDD /* UISplitViewController-Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UISplitViewController-Extensions.swift"; sourceTree = "<group>"; };
|
||||
51322854232EED360033D4ED /* VibrantSelectAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VibrantSelectAction.swift; sourceTree = "<group>"; };
|
||||
51322858232FDDB80033D4ED /* VibrantButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VibrantButtonStyle.swift; sourceTree = "<group>"; };
|
||||
513C5CE6232571C2003D4054 /* NetNewsWire iOS Share Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "NetNewsWire iOS Share Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
513C5CE8232571C2003D4054 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; };
|
||||
513C5CEB232571C2003D4054 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
|
||||
@ -1252,6 +1254,7 @@
|
||||
children = (
|
||||
DF999FF622B5AEFA0064B687 /* SafariView.swift */,
|
||||
51322854232EED360033D4ED /* VibrantSelectAction.swift */,
|
||||
51322858232FDDB80033D4ED /* VibrantButtonStyle.swift */,
|
||||
);
|
||||
path = "SwiftUI Extensions";
|
||||
sourceTree = "<group>";
|
||||
@ -2652,6 +2655,7 @@
|
||||
51C452772265091600C03939 /* MultilineUILabelSizer.swift in Sources */,
|
||||
51C452A522650A2D00C03939 /* SmallIconProvider.swift in Sources */,
|
||||
51D5948722668EFA00DFC836 /* MarkStatusCommand.swift in Sources */,
|
||||
51322859232FDDB80033D4ED /* VibrantButtonStyle.swift in Sources */,
|
||||
514B7C8323205EFB00BAC947 /* RootSplitViewController.swift in Sources */,
|
||||
5152E0F923248F6200E5C7AD /* SettingsLocalAccountView.swift in Sources */,
|
||||
FF3ABF162325AF5D0074C542 /* ArticleSorter.swift in Sources */,
|
||||
|
@ -36,6 +36,7 @@ struct SettingsView : View {
|
||||
buildDatabaseSection()
|
||||
buildAboutSection()
|
||||
}
|
||||
.buttonStyle(VibrantButtonStyle())
|
||||
.navigationBarTitle(Text("Settings"), displayMode: .inline)
|
||||
.navigationBarItems(leading: Button(action: { self.viewController?.dismiss(animated: true) }) { Text("Done") } )
|
||||
}
|
||||
@ -43,14 +44,20 @@ struct SettingsView : View {
|
||||
|
||||
func buildAccountsSection() -> some View {
|
||||
Section(header: Text("ACCOUNTS").padding(.top, 22.0)) {
|
||||
ForEach(viewModel.accounts) { account in
|
||||
NavigationLink(destination: SettingsDetailAccountView(viewModel: SettingsDetailAccountView.ViewModel(account))) {
|
||||
Text(verbatim: account.nameForDisplay)
|
||||
ForEach(0..<viewModel.accounts.count) { index in
|
||||
NavigationLink(destination: SettingsDetailAccountView(viewModel: SettingsDetailAccountView.ViewModel(self.viewModel.accounts[index])), tag: index, selection: self.$accountAction) {
|
||||
Text(verbatim: self.viewModel.accounts[index].nameForDisplay)
|
||||
}
|
||||
.modifier(VibrantSelectAction(action: {
|
||||
self.accountAction = index
|
||||
}))
|
||||
}
|
||||
NavigationLink(destination: SettingsAddAccountView()) {
|
||||
NavigationLink(destination: SettingsAddAccountView(), tag: 1000, selection: $accountAction) {
|
||||
Text("Add Account")
|
||||
}
|
||||
.modifier(VibrantSelectAction(action: {
|
||||
self.accountAction = 1000
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +84,6 @@ struct SettingsView : View {
|
||||
}
|
||||
}
|
||||
|
||||
VStack {
|
||||
Button("Import Subscriptions...") {
|
||||
if AccountManager.shared.activeAccounts.count == 1 {
|
||||
self.opmlAccount = AccountManager.shared.activeAccounts.first
|
||||
@ -85,14 +91,12 @@ struct SettingsView : View {
|
||||
} else {
|
||||
self.isOPMLImportPresented = true
|
||||
}
|
||||
}
|
||||
}.actionSheet(isPresented: $isOPMLImportPresented) {
|
||||
buildSubscriptionsImportAccounts()
|
||||
}.sheet(isPresented: $isOPMLImportDocPickerPresented) {
|
||||
SettingsSubscriptionsImportDocumentPickerView(account: self.opmlAccount!)
|
||||
}.foregroundColor(.primary)
|
||||
}
|
||||
|
||||
VStack {
|
||||
Button("Export Subscriptions...") {
|
||||
if AccountManager.shared.accounts.count == 1 {
|
||||
self.opmlAccount = AccountManager.shared.accounts.first
|
||||
@ -100,12 +104,11 @@ struct SettingsView : View {
|
||||
} else {
|
||||
self.isOPMLExportPresented = true
|
||||
}
|
||||
}
|
||||
}.actionSheet(isPresented: $isOPMLExportPresented) {
|
||||
buildSubscriptionsExportAccounts()
|
||||
}.sheet(isPresented: $isOPMLExportDocPickerPresented) {
|
||||
SettingsSubscriptionsExportDocumentPickerView(account: self.opmlAccount!)
|
||||
}.foregroundColor(.primary)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,35 +121,35 @@ struct SettingsView : View {
|
||||
self.website = "https://ranchero.com/netnewswire/"
|
||||
}) {
|
||||
Text("Website")
|
||||
}.foregroundColor(.primary)
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
self.isWebsitePresented.toggle()
|
||||
self.website = "https://github.com/brentsimmons/NetNewsWire"
|
||||
}) {
|
||||
Text("Github Repository")
|
||||
}.foregroundColor(.primary)
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
self.isWebsitePresented.toggle()
|
||||
self.website = "https://github.com/brentsimmons/NetNewsWire/issues"
|
||||
}) {
|
||||
Text("Bug Tracker")
|
||||
}.foregroundColor(.primary)
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
self.isWebsitePresented.toggle()
|
||||
self.website = "https://github.com/brentsimmons/NetNewsWire/tree/master/Technotes"
|
||||
}) {
|
||||
Text("Technotes")
|
||||
}.foregroundColor(.primary)
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
self.isWebsitePresented.toggle()
|
||||
self.website = "https://github.com/brentsimmons/NetNewsWire/blob/master/Technotes/HowToSupportNetNewsWire.markdown"
|
||||
}) {
|
||||
Text("How To Support NetNewsWire")
|
||||
}.foregroundColor(.primary)
|
||||
}
|
||||
|
||||
if !AccountManager.shared.anyAccountHasFeedWithURL("https://nnw.ranchero.com/feed.json") {
|
||||
Button(action: {
|
||||
@ -156,7 +159,7 @@ struct SettingsView : View {
|
||||
}
|
||||
}) {
|
||||
Text("Add NetNewsWire News Feed")
|
||||
}.foregroundColor(.primary)
|
||||
}
|
||||
}
|
||||
|
||||
}.sheet(isPresented: $isWebsitePresented) {
|
||||
|
23
iOS/SwiftUI Extensions/VibrantButtonStyle.swift
Normal file
23
iOS/SwiftUI Extensions/VibrantButtonStyle.swift
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// VibrantButtonStyle.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Maurice Parker on 9/16/19.
|
||||
// Copyright © 2019 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct VibrantButtonStyle: ButtonStyle {
|
||||
|
||||
func makeBody(configuration: Configuration) -> some View {
|
||||
GeometryReader { geometry in
|
||||
configuration.label
|
||||
.frame(width: geometry.size.width, height: geometry.size.height, alignment: .leading)
|
||||
}
|
||||
.foregroundColor(configuration.isPressed ? Color(AppAssets.tableViewCellHighlightedTextColor) : .primary)
|
||||
.listRowBackground(configuration.isPressed ? Color(AppAssets.tableViewCellSelectionColor) : Color(.secondarySystemGroupedBackground))
|
||||
.background(configuration.isPressed ? Color(AppAssets.tableViewCellSelectionColor) : Color(.secondarySystemGroupedBackground))
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user