Skip to content

Commit

Permalink
Remove ConsoleConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Aug 3, 2024
1 parent bb0ba1b commit 939d295
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 37 deletions.
26 changes: 0 additions & 26 deletions Sources/PulseUI/Features/Console/ConsoleConfiguration.swift

This file was deleted.

4 changes: 1 addition & 3 deletions Sources/PulseUI/Features/Console/ConsoleEnvironment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ final class ConsoleEnvironment: ObservableObject {

let initialMode: ConsoleMode
let delegate: ConsoleViewDelegate
let configuration: ConsoleConfiguration

@Published var mode: ConsoleMode
@Published var listOptions: ConsoleListOptions = .init()
Expand All @@ -39,7 +38,7 @@ final class ConsoleEnvironment: ObservableObject {

private var cancellables: [AnyCancellable] = []

init(store: LoggerStore, mode: ConsoleMode = .all, configuration: ConsoleConfiguration = .default, delegate: ConsoleViewDelegate = DefaultConsoleViewDelegate()) {
init(store: LoggerStore, mode: ConsoleMode = .all, delegate: ConsoleViewDelegate = DefaultConsoleViewDelegate()) {
self.store = store
switch mode {
case .all: self.title = "Console"
Expand All @@ -55,7 +54,6 @@ final class ConsoleEnvironment: ObservableObject {
}

self.delegate = delegate
self.configuration = configuration

func makeDefaultOptions() -> ConsoleDataSource.PredicateOptions {
var options = ConsoleDataSource.PredicateOptions()
Expand Down
4 changes: 1 addition & 3 deletions Sources/PulseUI/Features/Console/ConsoleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ extension ConsoleView {
/// - mode: The initial console mode. By default, ``ConsoleMode/all``. If you change
/// the mode to ``ConsoleMode/network``, the console will display the
/// network messages up on appearance.
/// - configuration: Configuration options to alter the UI behavior and settings.
/// - delegate: The delegate that allows you to customize multiple aspects
/// of the console view.
public init(
store: LoggerStore = .shared,
mode: ConsoleMode = .all,
configuration: ConsoleConfiguration = .default,
delegate: ConsoleViewDelegate? = nil
) {
self.init(environment: .init(store: store, mode: mode, configuration: configuration, delegate: delegate ?? DefaultConsoleViewDelegate()))
self.init(environment: .init(store: store, mode: mode, delegate: delegate ?? DefaultConsoleViewDelegate()))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ extension ConsoleRouterView {

private var destinationSettings: some View {
SettingsView()
.frame(width: 320, height: environment.configuration.allowRemoteLogging ? 420 : 175)
.frame(width: 320, height: UserSettings.shared.isRemoteLoggingHidden ? 175 : 420)
.navigationTitle("Settings")
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Expand Down
3 changes: 2 additions & 1 deletion Sources/PulseUI/Features/Settings/SettingsView-ios.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public struct SettingsView: View {

public var body: some View {
Form {
if store === RemoteLogger.shared.store {
if !UserSettings.shared.isRemoteLoggingHidden,
store === RemoteLogger.shared.store {
RemoteLoggerSettingsView(viewModel: .shared)
}
Section {
Expand Down
2 changes: 1 addition & 1 deletion Sources/PulseUI/Features/Settings/SettingsView-macos.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct SettingsView: View {

var body: some View {
List {
if environment.configuration.allowRemoteLogging {
if !UserSettings.shared.isRemoteLoggingHidden {
if store === RemoteLogger.shared.store {
RemoteLoggerSettingsView(viewModel: .shared)
} else {
Expand Down
3 changes: 2 additions & 1 deletion Sources/PulseUI/Features/Settings/SettingsView-tvos.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public struct SettingsView: View {

public var body: some View {
Form {
if store === RemoteLogger.shared.store {
if !UserSettings.shared.isRemoteLoggingHidden,
store === RemoteLogger.shared.store {
RemoteLoggerSettingsView(viewModel: .shared)
}
Section {
Expand Down
3 changes: 2 additions & 1 deletion Sources/PulseUI/Features/Settings/SettingsView-watchos.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public struct SettingsView: View {
public var body: some View {
Form {
Section {
if store === RemoteLogger.shared.store {
if !UserSettings.shared.isRemoteLoggingHidden,
store === RemoteLogger.shared.store {
#if targetEnvironment(simulator)
RemoteLoggerSettingsView(viewModel: .shared)
#else
Expand Down
4 changes: 4 additions & 0 deletions Sources/PulseUI/Features/Settings/UserSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,8 @@ public final class UserSettings: ObservableObject {

@AppStorage("com.github.kean.pulse.allowedShareStoreOutputs")
var rawAllowedShareStoreOutputs: String = "[]"

/// If enabled, the console stops showing the remote logging option.
@AppStorage("com.github.kean.pulse.isRemoteLoggingAllowed")
public var isRemoteLoggingHidden = false
}

0 comments on commit 939d295

Please sign in to comment.