mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
More settings work
This commit is contained in:
@@ -857,6 +857,7 @@
|
||||
DF59F072292085B800ACD33D /* ColorPaletteSelectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF59F071292085B800ACD33D /* ColorPaletteSelectorView.swift */; };
|
||||
DF59F0742920DB5100ACD33D /* AccountsManagementView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF59F0732920DB5100ACD33D /* AccountsManagementView.swift */; };
|
||||
DF5AD10128D6922200CA3BF7 /* SmartFeedSummaryWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1768144D2564BCE000D98635 /* SmartFeedSummaryWidget.swift */; };
|
||||
DF766FED29377FD9006FBBE2 /* ExtensionsManagementView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF766FEC29377FD9006FBBE2 /* ExtensionsManagementView.swift */; };
|
||||
DF790D6228E990A900455FC7 /* AboutData.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF790D6128E990A900455FC7 /* AboutData.swift */; };
|
||||
DFC14F0F28EA55BD00F6EE86 /* AboutWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFC14F0E28EA55BD00F6EE86 /* AboutWindowController.swift */; };
|
||||
DFC14F1228EA5DC500F6EE86 /* AboutData.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF790D6128E990A900455FC7 /* AboutData.swift */; };
|
||||
@@ -1612,6 +1613,7 @@
|
||||
DF394EFF29357A180081EB6E /* NewArticleNotificationsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewArticleNotificationsView.swift; sourceTree = "<group>"; };
|
||||
DF59F071292085B800ACD33D /* ColorPaletteSelectorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPaletteSelectorView.swift; sourceTree = "<group>"; };
|
||||
DF59F0732920DB5100ACD33D /* AccountsManagementView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountsManagementView.swift; sourceTree = "<group>"; };
|
||||
DF766FEC29377FD9006FBBE2 /* ExtensionsManagementView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionsManagementView.swift; sourceTree = "<group>"; };
|
||||
DF790D6128E990A900455FC7 /* AboutData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutData.swift; sourceTree = "<group>"; };
|
||||
DFC14F0E28EA55BD00F6EE86 /* AboutWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutWindowController.swift; sourceTree = "<group>"; };
|
||||
DFC14F1428EB177000F6EE86 /* AboutNetNewsWireView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutNetNewsWireView.swift; sourceTree = "<group>"; };
|
||||
@@ -2014,7 +2016,7 @@
|
||||
5183CCEB227117C70010922C /* Settings */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DFFC4E7328E95C01006B82AF /* AboutView.swift */,
|
||||
DFD406F8291FB5D500C02962 /* Views */,
|
||||
51A16992235E10D600EB091F /* AddAccountViewController.swift */,
|
||||
519ED455244828C3007F8E94 /* AddExtensionPointViewController.swift */,
|
||||
5137C2E926F63AE6009EFEDB /* ArticleThemeImporter.swift */,
|
||||
@@ -2022,10 +2024,6 @@
|
||||
516244E2241E19F000B61C47 /* ColorPaletteTableViewController.swift */,
|
||||
519ED47924482AEB007F8E94 /* EnableExtensionPointViewController.swift */,
|
||||
51A16990235E10D600EB091F /* Settings.storyboard */,
|
||||
DFD406F8291FB5D500C02962 /* Settings View */,
|
||||
DFD406FD291FDBD900C02962 /* Appearance Views */,
|
||||
DF59F0752920E42000ACD33D /* Account Management Views */,
|
||||
DF3630E92936038400326FB8 /* New Article Notifications Views */,
|
||||
516A09382360A2AE00EAE89B /* SettingsComboTableViewCell.swift */,
|
||||
516A091D23609A3600EAE89B /* SettingsComboTableViewCell.xib */,
|
||||
516A093A2360A4A000EAE89B /* SettingsTableViewCell.xib */,
|
||||
@@ -2900,20 +2898,40 @@
|
||||
path = Scriptability;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DF3630E92936038400326FB8 /* New Article Notifications Views */ = {
|
||||
DF3630E92936038400326FB8 /* New Article Notifications */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DF394EFF29357A180081EB6E /* NewArticleNotificationsView.swift */,
|
||||
);
|
||||
path = "New Article Notifications Views";
|
||||
path = "New Article Notifications";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DF59F0752920E42000ACD33D /* Account Management Views */ = {
|
||||
DF59F0752920E42000ACD33D /* Account and Extensions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DF59F0732920DB5100ACD33D /* AccountsManagementView.swift */,
|
||||
DF766FEC29377FD9006FBBE2 /* ExtensionsManagementView.swift */,
|
||||
);
|
||||
path = "Account Management Views";
|
||||
path = "Account and Extensions";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DF766FEA2936337A006FBBE2 /* Help */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DFFC4E7328E95C01006B82AF /* AboutView.swift */,
|
||||
DFD406FB291FB63B00C02962 /* SettingsHelpSheets.swift */,
|
||||
);
|
||||
path = Help;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DF766FEB2936344D006FBBE2 /* General */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DFD406F4291F79C900C02962 /* SettingsView.swift */,
|
||||
DF3630EE293618A900326FB8 /* SettingsViewModel.swift */,
|
||||
DFD406F9291FB5E400C02962 /* SettingsRows.swift */,
|
||||
);
|
||||
path = General;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DFC14F0928EA51AB00F6EE86 /* About */ = {
|
||||
@@ -2926,24 +2944,25 @@
|
||||
path = About;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DFD406F8291FB5D500C02962 /* Settings View */ = {
|
||||
DFD406F8291FB5D500C02962 /* Views */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DFD406F4291F79C900C02962 /* SettingsView.swift */,
|
||||
DF3630EE293618A900326FB8 /* SettingsViewModel.swift */,
|
||||
DFD406F9291FB5E400C02962 /* SettingsRows.swift */,
|
||||
DFD406FB291FB63B00C02962 /* SettingsHelpSheets.swift */,
|
||||
DF766FEB2936344D006FBBE2 /* General */,
|
||||
DFD406FD291FDBD900C02962 /* Appearance */,
|
||||
DF59F0752920E42000ACD33D /* Account and Extensions */,
|
||||
DF3630E92936038400326FB8 /* New Article Notifications */,
|
||||
DF766FEA2936337A006FBBE2 /* Help */,
|
||||
);
|
||||
path = "Settings View";
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
DFD406FD291FDBD900C02962 /* Appearance Views */ = {
|
||||
DFD406FD291FDBD900C02962 /* Appearance */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
DFD406FE291FDC0C00C02962 /* DisplayAndBehaviorsView.swift */,
|
||||
DF59F071292085B800ACD33D /* ColorPaletteSelectorView.swift */,
|
||||
);
|
||||
path = "Appearance Views";
|
||||
path = Appearance;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
@@ -4217,6 +4236,7 @@
|
||||
512AF9C2236ED52C0066F8BE /* ImageHeaderView.swift in Sources */,
|
||||
512392C124E33A3C00F11704 /* RedditSelectTypeTableViewController.swift in Sources */,
|
||||
515A5181243E90260089E588 /* ExtensionPointIdentifer.swift in Sources */,
|
||||
DF766FED29377FD9006FBBE2 /* ExtensionsManagementView.swift in Sources */,
|
||||
51C45290226509C100C03939 /* PseudoFeed.swift in Sources */,
|
||||
512392C624E3451400F11704 /* TwitterSelectAccountTableViewController.swift in Sources */,
|
||||
51C452A922650DC600C03939 /* ArticleRenderer.swift in Sources */,
|
||||
|
||||
@@ -38,7 +38,7 @@ final class ExtensionPointManager: FeedProviderManagerDelegate {
|
||||
let activeExtensionPointTypes = activeExtensionPoints.keys.compactMap({ ObjectIdentifier($0.extensionPointType) })
|
||||
var available = [ExtensionPoint.Type]()
|
||||
for possibleExtensionPointType in possibleExtensionPointTypes {
|
||||
if !(AppDefaults.shared.isDeveloperBuild && possibleExtensionPointType.isDeveloperBuildRestricted) {
|
||||
if (AppDefaults.shared.isDeveloperBuild && possibleExtensionPointType.isDeveloperBuildRestricted) {
|
||||
if possibleExtensionPointType.isSinglton {
|
||||
if !activeExtensionPointTypes.contains(ObjectIdentifier(possibleExtensionPointType)) {
|
||||
available.append(possibleExtensionPointType)
|
||||
|
||||
@@ -9,6 +9,26 @@
|
||||
import UIKit
|
||||
import SafariServices
|
||||
import Account
|
||||
import SwiftUI
|
||||
|
||||
struct AccountInspectorWrapper: UIViewControllerRepresentable {
|
||||
|
||||
var account: Account
|
||||
|
||||
func makeUIViewController(context: Context) -> AccountInspectorViewController {
|
||||
let controller = UIStoryboard.inspector.instantiateViewController(withIdentifier: "AccountInspectorViewController") as! AccountInspectorViewController
|
||||
controller.account = account
|
||||
return controller
|
||||
}
|
||||
|
||||
func updateUIViewController(_ uiViewController: AccountInspectorViewController, context: Context) {
|
||||
//
|
||||
}
|
||||
|
||||
typealias UIViewControllerType = AccountInspectorViewController
|
||||
|
||||
}
|
||||
|
||||
|
||||
class AccountInspectorViewController: UITableViewController {
|
||||
|
||||
|
||||
@@ -7,6 +7,27 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
|
||||
struct ExtensionPointInspectorWrapper: UIViewControllerRepresentable {
|
||||
|
||||
var extensionPoint: ExtensionPoint?
|
||||
|
||||
func makeUIViewController(context: Context) -> ExtensionPointInspectorViewController {
|
||||
let controller = UIStoryboard.inspector.instantiateViewController(withIdentifier: "ExtensionPointInspectorViewController") as! ExtensionPointInspectorViewController
|
||||
controller.extensionPoint = extensionPoint
|
||||
return controller
|
||||
}
|
||||
|
||||
func updateUIViewController(_ uiViewController: ExtensionPointInspectorViewController, context: Context) {
|
||||
//
|
||||
}
|
||||
|
||||
typealias UIViewControllerType = ExtensionPointInspectorViewController
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
class ExtensionPointInspectorViewController: UITableViewController {
|
||||
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
//
|
||||
// AccountsManagementView.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Stuart Breckenridge on 13/11/2022.
|
||||
// Copyright © 2022 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Account
|
||||
import Combine
|
||||
|
||||
struct AccountsManagementView: View {
|
||||
|
||||
@State private var showAddAccountSheet: Bool = false
|
||||
var cancellables = Set<AnyCancellable>()
|
||||
@State private var sortedAccounts = [Account]()
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
ForEach(sortedAccounts, id: \.self) { account in
|
||||
Section(header: Text("")) {
|
||||
accountRow(account)
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle(Text("Accounts"))
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.tint(Color(uiColor: AppAssets.primaryAccentColor))
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button {
|
||||
//
|
||||
} label: {
|
||||
Image(systemName: "plus")
|
||||
}
|
||||
}
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .AccountStateDidChange)) { _ in
|
||||
sortedAccounts = AccountManager.shared.sortedAccounts
|
||||
}
|
||||
.onAppear {
|
||||
sortedAccounts = AccountManager.shared.sortedAccounts
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var addAccountButton: some View {
|
||||
HStack {
|
||||
Spacer()
|
||||
Text("Add Account")
|
||||
.padding(8)
|
||||
.overlay(NavigationLink { AddAccountViewControllerRepresentable() } label: { EmptyView() }.opacity(0.0))
|
||||
.background(Color(uiColor: AppAssets.primaryAccentColor))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 6))
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
|
||||
func accountFooterText(_ account: Account) -> some View {
|
||||
if account.type == .cloudKit {
|
||||
return Text("iCloud Syncing Limitations & Solutions")
|
||||
} else {
|
||||
return Text("")
|
||||
}
|
||||
}
|
||||
|
||||
func accountRow(_ account: Account) -> some View {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Image(uiImage: account.smallIcon!.image)
|
||||
.resizable()
|
||||
.frame(width: 25, height: 25)
|
||||
TextField(text: Binding(get: { account.nameForDisplay }, set: { account.name = $0 })) {
|
||||
Text(account.nameForDisplay)
|
||||
}.foregroundColor(.secondary)
|
||||
Spacer()
|
||||
Toggle(isOn: Binding<Bool>(
|
||||
get: { account.isActive },
|
||||
set: { account.isActive = $0 }
|
||||
)) {
|
||||
Text("")
|
||||
}
|
||||
}
|
||||
if account.type != .onMyMac {
|
||||
Divider()
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
HStack {
|
||||
Spacer()
|
||||
Button {
|
||||
// Remove account
|
||||
} label: {
|
||||
Text("Remove Account")
|
||||
.foregroundColor(.red)
|
||||
.bold()
|
||||
}
|
||||
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var inactiveFooterText: some View {
|
||||
if AccountManager.shared.sortedAccounts.filter({ $0.isActive == false }).count == 0 {
|
||||
return Text("There are no inactive accounts.")
|
||||
} else {
|
||||
return Text("")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct AddAccountView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
AccountsManagementView()
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,25 @@ import AuthenticationServices
|
||||
import Account
|
||||
import OAuthSwift
|
||||
import Secrets
|
||||
import SwiftUI
|
||||
|
||||
struct EnableExtensionPointViewWrapper: UIViewControllerRepresentable {
|
||||
|
||||
var extensionPoint: ExtensionPoint.Type?
|
||||
|
||||
func makeUIViewController(context: Context) -> EnableExtensionPointViewController {
|
||||
let controller = UIStoryboard.settings.instantiateViewController(withIdentifier: "EnableExtensionPointViewController") as! EnableExtensionPointViewController
|
||||
controller.extensionPointType = extensionPoint
|
||||
return controller
|
||||
}
|
||||
|
||||
func updateUIViewController(_ uiViewController: EnableExtensionPointViewController, context: Context) {
|
||||
|
||||
}
|
||||
|
||||
typealias UIViewControllerType = EnableExtensionPointViewController
|
||||
|
||||
}
|
||||
|
||||
class EnableExtensionPointViewController: UITableViewController {
|
||||
|
||||
|
||||
@@ -385,10 +385,10 @@
|
||||
<tableViewSection headerTitle="Appearance" id="TkH-4v-yhk">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" id="EvG-yE-gDF" customClass="VibrantBasicTableViewCell" customModule="NetNewsWire" customModuleProvider="target">
|
||||
<rect key="frame" x="20" y="981.5" width="374" height="43.5"/>
|
||||
<rect key="frame" x="20" y="1002" width="374" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="EvG-yE-gDF" id="wBN-zJ-6pN">
|
||||
<rect key="frame" x="0.0" y="0.0" width="343.5" height="43.5"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="355.5" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Color Palette" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2Fp-li-dGP">
|
||||
@@ -1185,7 +1185,7 @@
|
||||
<!--Extension-->
|
||||
<scene sceneID="sHq-4g-bAA">
|
||||
<objects>
|
||||
<tableViewController id="8Eu-UD-eCa" customClass="EnableExtensionPointViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableViewController storyboardIdentifier="EnableExtensionPointViewController" id="8Eu-UD-eCa" customClass="EnableExtensionPointViewController" customModule="NetNewsWire" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="insetGrouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="hqD-G5-jzC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
//
|
||||
// AccountsManagementView.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Stuart Breckenridge on 13/11/2022.
|
||||
// Copyright © 2022 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Account
|
||||
import Combine
|
||||
|
||||
struct AddAccountWrapper: UIViewControllerRepresentable {
|
||||
func makeUIViewController(context: Context) -> AddAccountViewController {
|
||||
let controller = UIStoryboard.settings.instantiateViewController(withIdentifier: "AddAccountViewController") as! AddAccountViewController
|
||||
return controller
|
||||
}
|
||||
|
||||
func updateUIViewController(_ uiViewController: AddAccountViewController, context: Context) {
|
||||
//
|
||||
}
|
||||
|
||||
typealias UIViewControllerType = AddAccountViewController
|
||||
|
||||
}
|
||||
|
||||
struct AccountsManagementView: View {
|
||||
|
||||
@State private var showAddAccountSheet: Bool = false
|
||||
var cancellables = Set<AnyCancellable>()
|
||||
@State private var sortedAccounts = [Account]()
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
ForEach(sortedAccounts, id: \.self) { account in
|
||||
accountRow(account)
|
||||
}
|
||||
}
|
||||
.navigationTitle(Text("Accounts"))
|
||||
.tint(Color(uiColor: AppAssets.primaryAccentColor))
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button {
|
||||
showAddAccountSheet = true
|
||||
} label: {
|
||||
Image(systemName: "plus")
|
||||
}
|
||||
}
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .AccountStateDidChange)) { _ in
|
||||
refreshAccounts()
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .UserDidAddAccount)) { _ in
|
||||
refreshAccounts()
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .UserDidDeleteAccount)) { _ in
|
||||
refreshAccounts()
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .DisplayNameDidChange)) { _ in
|
||||
refreshAccounts()
|
||||
}
|
||||
.task(priority: .userInitiated) {
|
||||
refreshAccounts()
|
||||
}
|
||||
.sheet(isPresented: $showAddAccountSheet) {
|
||||
NavigationView {
|
||||
AddAccountWrapper()
|
||||
.navigationTitle("Add Account")
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func refreshAccounts() {
|
||||
sortedAccounts = []
|
||||
sortedAccounts = AccountManager.shared.sortedAccounts
|
||||
}
|
||||
|
||||
func accountRow(_ account: Account) -> some View {
|
||||
NavigationLink {
|
||||
AccountInspectorWrapper(account: account)
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
} label: {
|
||||
Image(uiImage: account.smallIcon!.image)
|
||||
.resizable()
|
||||
.frame(width: 25, height: 25)
|
||||
Text(account.nameForDisplay)
|
||||
}
|
||||
}
|
||||
|
||||
var inactiveFooterText: some View {
|
||||
if AccountManager.shared.sortedAccounts.filter({ $0.isActive == false }).count == 0 {
|
||||
return Text("There are no inactive accounts.")
|
||||
} else {
|
||||
return Text("")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct AddAccountView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
AccountsManagementView()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// ExtensionsManagementView.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Stuart Breckenridge on 30/11/2022.
|
||||
// Copyright © 2022 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Account
|
||||
|
||||
struct ExtensionsManagementView: View {
|
||||
|
||||
@State private var availableExtensionPointTypes = ExtensionPointManager.shared.availableExtensionPointTypes.sorted(by: { $0.title < $1.title })
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
Section(header: Text("Add Extension"), footer: Text("Extensions allow you to subscribe to some pages as if they were RSS feeds.")) {
|
||||
ForEach(0..<availableExtensionPointTypes.count, id: \.self) { i in
|
||||
NavigationLink {
|
||||
EnableExtensionPointViewWrapper(extensionPoint: availableExtensionPointTypes[i])
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
} label: {
|
||||
Image(uiImage: availableExtensionPointTypes[i].image)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 25, height: 25)
|
||||
|
||||
Text("\(availableExtensionPointTypes[i].title)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Section(header: Text("Active Extensions")) {
|
||||
ForEach(0..<ExtensionPointManager.shared.activeExtensionPoints.count, id: \.self) { i in
|
||||
let point = Array(ExtensionPointManager.shared.activeExtensionPoints)[i]
|
||||
NavigationLink {
|
||||
ExtensionPointInspectorWrapper(extensionPoint: point.value)
|
||||
.navigationBarTitle(Text(point.value.title))
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
} label: {
|
||||
Image(uiImage: point.value.image)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 25, height: 25)
|
||||
Text(point.value.title)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.navigationTitle(Text("Manage Extensions"))
|
||||
}
|
||||
}
|
||||
|
||||
struct ExtensionsManagementView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ExtensionsManagementView()
|
||||
}
|
||||
}
|
||||
@@ -11,38 +11,11 @@ import Account
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
|
||||
|
||||
|
||||
// MARK: - Headers
|
||||
|
||||
struct SettingsViewHeaders {
|
||||
|
||||
static func AddAccountHeader(_ showAddAccount: Binding<Bool>) -> some View {
|
||||
HStack {
|
||||
//Text("Accounts")
|
||||
Spacer()
|
||||
Button {
|
||||
showAddAccount.wrappedValue.toggle()
|
||||
} label: {
|
||||
Text("Add")
|
||||
.font(.caption)
|
||||
.bold()
|
||||
Image(systemName: "plus")
|
||||
.font(.caption)
|
||||
}
|
||||
.buttonBorderShape(.capsule)
|
||||
.buttonStyle(.bordered)
|
||||
.padding(.trailing, -15) // moves to trailing edge
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Rows
|
||||
|
||||
struct SettingsViewRows {
|
||||
|
||||
/// This row, when tapped, will open system settings.
|
||||
/// This row, when tapped, will open iOS System Settings.
|
||||
static var OpenSystemSettings: some View {
|
||||
Label {
|
||||
Text("Open System Settings")
|
||||
@@ -88,26 +61,10 @@ struct SettingsViewRows {
|
||||
}
|
||||
}
|
||||
|
||||
/// This `view` creates a `Label` for each active `Account`.
|
||||
/// Each `Label`, when tapped, will present the configurator for
|
||||
/// the `Account`.
|
||||
static var ActiveAccounts: some View {
|
||||
ForEach(AccountManager.shared.sortedActiveAccounts, id: \.self) { account in
|
||||
Label {
|
||||
Text(account.nameForDisplay)
|
||||
} icon: {
|
||||
Image(uiImage: AppAssets.image(for: account.type)!)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 25.0, height: 25.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// This row, when tapped, will push the the Add Extension screen
|
||||
/// This row, when tapped, will push the the Manage Extension screen
|
||||
/// in to view.
|
||||
static var AddExtension: some View {
|
||||
NavigationLink(destination: NotificationsViewControllerRepresentable()) {
|
||||
static var ManageExtensions: some View {
|
||||
NavigationLink(destination: ExtensionsManagementView()) {
|
||||
Label {
|
||||
Text("Manage Extensions")
|
||||
} icon: {
|
||||
@@ -199,6 +156,8 @@ struct SettingsViewRows {
|
||||
}
|
||||
}
|
||||
|
||||
/// This row, when tapped, will push the the Theme Selector screen
|
||||
/// in to view.
|
||||
static var ThemeSelection: some View {
|
||||
NavigationLink(destination: ArticleThemesViewControllerRepresentable().edgesIgnoringSafeArea(.all)) {
|
||||
HStack {
|
||||
@@ -220,7 +179,6 @@ struct SettingsViewRows {
|
||||
}
|
||||
|
||||
// TODO: Add Reader Mode Defaults here. See #3684.
|
||||
|
||||
static func EnableFullScreenArticles(_ preference: Binding<Bool>) -> some View {
|
||||
Toggle(isOn: preference) {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
@@ -28,7 +28,7 @@ struct SettingsView: View {
|
||||
// Account/Extensions/OPML Management
|
||||
Section(header: Text("Accounts & Extensions"), footer: Text("Add, delete, enable, or disable accounts and extensions.")) {
|
||||
SettingsViewRows.AddAccount
|
||||
SettingsViewRows.AddExtension
|
||||
SettingsViewRows.ManageExtensions
|
||||
SettingsViewRows.ImportExportOPML(showImportView: $viewModel.showImportView, showExportView: $viewModel.showExportView, importAccount: $viewModel.importAccount, exportDocument: $viewModel.exportDocument)
|
||||
}
|
||||
|
||||
@@ -28,6 +28,5 @@ public final class SettingsViewModel: ObservableObject {
|
||||
@Published public var showImportSuccess: Bool = false
|
||||
@Published public var showExportSuccess: Bool = false
|
||||
@Published public var exportDocument: OPMLDocument?
|
||||
|
||||
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public enum HelpSheet: CustomStringConvertible, CaseIterable {
|
||||
case .help:
|
||||
return NSLocalizedString("NetNewsWire Help", comment: "NetNewsWire Help")
|
||||
case .website:
|
||||
return NSLocalizedString("Website", comment: "Website")
|
||||
return NSLocalizedString("NetNewsWire Website", comment: "NetNewsWire Website")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ struct NewArticleNotificationsView: View {
|
||||
activeAccounts = AccountManager.shared.sortedActiveAccounts
|
||||
}
|
||||
}
|
||||
.tint(Color(uiColor: AppAssets.primaryAccentColor))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user