mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-05 00:59:55 +00:00
fixed issues
This commit is contained in:
parent
ce29144951
commit
58c3642dc1
2 changed files with 16 additions and 17 deletions
|
|
@ -10,7 +10,7 @@ import SwiftUI
|
|||
struct SettingsViewLogger: View {
|
||||
@State private var logs: String = ""
|
||||
@StateObject private var filterViewModel = LogFilterViewModel.shared
|
||||
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
ScrollView {
|
||||
|
|
@ -29,9 +29,6 @@ struct SettingsViewLogger: View {
|
|||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
HStack {
|
||||
NavigationLink(destination: SettingsViewLoggerFilter(viewModel: filterViewModel)) {
|
||||
Image(systemName: "gearshape")
|
||||
|
||||
Menu {
|
||||
Button(action: {
|
||||
UIPasteboard.general.string = logs
|
||||
|
|
@ -49,6 +46,9 @@ struct SettingsViewLogger: View {
|
|||
.resizable()
|
||||
.frame(width: 20, height: 20)
|
||||
}
|
||||
|
||||
NavigationLink(destination: SettingsViewLoggerFilter(viewModel: filterViewModel)) {
|
||||
Image(systemName: "slider.horizontal.3")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,9 @@ struct LogFilter: Identifiable, Hashable {
|
|||
let description: String
|
||||
}
|
||||
|
||||
|
||||
class LogFilterViewModel: ObservableObject {
|
||||
static let shared = LogFilterViewModel() // Singleton instance
|
||||
|
||||
static let shared = LogFilterViewModel()
|
||||
|
||||
@Published var filters: [LogFilter] = [] {
|
||||
didSet {
|
||||
saveFiltersToUserDefaults()
|
||||
|
|
@ -26,10 +25,10 @@ class LogFilterViewModel: ObservableObject {
|
|||
|
||||
private let userDefaultsKey = "LogFilterStates"
|
||||
private let hardcodedFilters: [(type: String, description: String, defaultState: Bool)] = [
|
||||
("General", "Logs for general events and activities.", true),
|
||||
("Stream", "Logs for streaming and video playback.", true),
|
||||
("Error", "Logs for errors and critical issues.", true),
|
||||
("Debug", "Logs for debugging and troubleshooting.", false)
|
||||
("General", "General events and activities.", true),
|
||||
("Stream", "Streaming and video playback.", true),
|
||||
("Error", "Errors and critical issues.", true),
|
||||
("Debug", "Debugging and troubleshooting.", false)
|
||||
]
|
||||
|
||||
private init() {
|
||||
|
|
@ -70,21 +69,21 @@ class LogFilterViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
struct SettingsViewLoggerFilter: View {
|
||||
@ObservedObject var viewModel = LogFilterViewModel.shared
|
||||
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
ForEach($viewModel.filters) { $filter in
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
Toggle(filter.type, isOn: $filter.isEnabled)
|
||||
.font(.headline)
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
HStack {
|
||||
Toggle(filter.type, isOn: $filter.isEnabled)
|
||||
Spacer()
|
||||
}
|
||||
|
||||
Text(filter.description)
|
||||
.font(.subheadline)
|
||||
.foregroundColor(.secondary)
|
||||
.padding(.leading, 5)
|
||||
}
|
||||
.padding(.vertical, 5)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue