mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Continue removing ExtensionPoint code.
This commit is contained in:
@@ -43,7 +43,6 @@ final class AppDefaults: ObservableObject {
|
||||
|
||||
struct Key {
|
||||
static let userInterfaceColorPalette = "userInterfaceColorPalette"
|
||||
static let activeExtensionPointIDs = "activeExtensionPointIDs"
|
||||
static let lastImageCacheFlushDate = "lastImageCacheFlushDate"
|
||||
static let firstRunDate = "firstRunDate"
|
||||
static let timelineGroupByFeed = "timelineGroupByFeed"
|
||||
@@ -122,16 +121,6 @@ final class AppDefaults: ObservableObject {
|
||||
}
|
||||
}
|
||||
|
||||
var activeExtensionPointIDs: [[AnyHashable : AnyHashable]]? {
|
||||
get {
|
||||
return UserDefaults.standard.object(forKey: Key.activeExtensionPointIDs) as? [[AnyHashable : AnyHashable]]
|
||||
}
|
||||
set {
|
||||
UserDefaults.standard.set(newValue, forKey: Key.activeExtensionPointIDs)
|
||||
AppDefaults.shared.objectWillChange.send()
|
||||
}
|
||||
}
|
||||
|
||||
var hasUsedFullScreenPreviously: Bool {
|
||||
get {
|
||||
return UserDefaults.standard.bool(forKey: Key.hasUsedFullScreenPreviously)
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
//
|
||||
// ExtensionInspectorView.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Stuart Breckenridge on 15/12/2022.
|
||||
// Copyright © 2022 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ExtensionInspectorView: View {
|
||||
|
||||
@Environment(\.dismiss) var dismiss
|
||||
@State private var showDeactivateConfirmation: Bool = false
|
||||
var extensionPoint: ExtensionPoint?
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
Section(header: extensionHeader) {}
|
||||
Section(footer: extensionExplainer, content: {
|
||||
//
|
||||
})
|
||||
|
||||
HStack {
|
||||
Spacer()
|
||||
Button(role: .destructive) {
|
||||
showDeactivateConfirmation = true
|
||||
} label: {
|
||||
Text("button.title.deactivate-extension", comment: "Deactivate Extension")
|
||||
}
|
||||
.alert(Text("alert.title.deactivate-extension.\(extensionPoint?.title ?? "")", comment: "Are you sure you want to deactivate “%@“?"), isPresented: $showDeactivateConfirmation) {
|
||||
|
||||
Button(role: .destructive) {
|
||||
ExtensionPointManager.shared.deactivateExtensionPoint(extensionPoint!.extensionPointID)
|
||||
dismiss()
|
||||
} label: {
|
||||
Text("button.title.deactivate-extension", comment: "Deactivate Extension")
|
||||
}
|
||||
|
||||
Button(role: .cancel) {
|
||||
//
|
||||
} label: {
|
||||
Text("button.title.cancel", comment: "Cancel")
|
||||
}
|
||||
} message: {
|
||||
Text("alert.message.cannot-undo-action", comment: "You can't undo this action.")
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
.navigationTitle(Text(extensionPoint?.title ?? ""))
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
.dismissOnExternalContextLaunch()
|
||||
}
|
||||
|
||||
var extensionHeader: some View {
|
||||
HStack {
|
||||
Spacer()
|
||||
Image(uiImage: extensionPoint!.image)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 48, height: 48)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
|
||||
var extensionExplainer: some View {
|
||||
Text(extensionPoint?.description.string ?? "")
|
||||
.multilineTextAlignment(.center)
|
||||
}
|
||||
}
|
||||
|
||||
struct ExtensionInspectorView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ExtensionInspectorView()
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,6 @@ class MasterFeedViewController: UITableViewController, UndoableCommandRunner, Ma
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(webFeedSettingDidChange(_:)), name: .WebFeedSettingDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange), name: UIContentSizeCategory.didChangeNotification, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(configureContextMenu(_:)), name: .ActiveExtensionPointsDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(displayNameDidChange(_:)), name: .DisplayNameDidChange, object: nil)
|
||||
|
||||
refreshControl = UIRefreshControl()
|
||||
|
||||
@@ -71,21 +71,6 @@ struct SettingsRow {
|
||||
}
|
||||
}
|
||||
|
||||
/// This row, when tapped, will push the the Manage Extension screen
|
||||
/// in to view.
|
||||
static var manageExtensions: some View {
|
||||
NavigationLink(destination: ExtensionsManagementView()) {
|
||||
Label {
|
||||
Text("button.title.manage-extensions", comment: "Manage Extensions")
|
||||
} icon: {
|
||||
Image("app.extension")
|
||||
.resizable()
|
||||
.frame(width: 25.0, height: 25.0)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 6))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// This row, when tapped, will present the Import
|
||||
/// Subscriptions Action Sheet.
|
||||
static func importOPML(showImportActionSheet: Binding<Bool>) -> some View {
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// ExtensionSectionHeader.swift
|
||||
// NetNewsWire-iOS
|
||||
//
|
||||
// Created by Stuart Breckenridge on 19/12/2022.
|
||||
// Copyright © 2022 Ranchero Software. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Account
|
||||
|
||||
struct ExtensionSectionHeader: View {
|
||||
|
||||
var extensionPoint: ExtensionPoint.Type
|
||||
|
||||
var body: some View {
|
||||
Section(header: headerImage) {}
|
||||
}
|
||||
|
||||
var headerImage: some View {
|
||||
HStack {
|
||||
Spacer()
|
||||
Image(uiImage: extensionPoint.image)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 48, height: 48)
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user