mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Add MPV logs export
This commit is contained in:
@@ -6,6 +6,12 @@ struct AdvancedSettings: View {
|
||||
@Default(.showMPVPlaybackStats) private var showMPVPlaybackStats
|
||||
@Default(.mpvCacheSecs) private var mpvCacheSecs
|
||||
@Default(.mpvCachePauseWait) private var mpvCachePauseWait
|
||||
@Default(.mpvEnableLogging) private var mpvEnableLogging
|
||||
|
||||
@EnvironmentObject<PlayerModel> private var player
|
||||
|
||||
@State private var presentingShareSheet = false
|
||||
@State private var filesToShare = [MPVClient.logFile]
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading) {
|
||||
@@ -17,6 +23,10 @@ struct AdvancedSettings: View {
|
||||
advancedSettings
|
||||
}
|
||||
#if os(iOS)
|
||||
.sheet(isPresented: $presentingShareSheet) {
|
||||
ShareSheet(activityItems: filesToShare)
|
||||
.id("logs-\(filesToShare.count)")
|
||||
}
|
||||
.listStyle(.insetGrouped)
|
||||
#endif
|
||||
#endif
|
||||
@@ -27,9 +37,29 @@ struct AdvancedSettings: View {
|
||||
.navigationTitle("Advanced")
|
||||
}
|
||||
|
||||
var logButton: some View {
|
||||
Button {
|
||||
#if os(macOS)
|
||||
NSWorkspace.shared.selectFile(MPVClient.logFile.path, inFileViewerRootedAtPath: YatteeApp.logsDirectory.path)
|
||||
#else
|
||||
presentingShareSheet = true
|
||||
#endif
|
||||
} label: {
|
||||
#if os(macOS)
|
||||
let labelText = "Open logs in Finder"
|
||||
#else
|
||||
let labelText = "Share Logs..."
|
||||
#endif
|
||||
Text(labelText)
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder var advancedSettings: some View {
|
||||
Section(header: SettingsHeader(text: "MPV"), footer: mpvFooter) {
|
||||
showMPVPlaybackStatsToggle
|
||||
#if !os(tvOS)
|
||||
mpvEnableLoggingToggle
|
||||
#endif
|
||||
|
||||
HStack {
|
||||
Text("cache-secs")
|
||||
@@ -44,6 +74,10 @@ struct AdvancedSettings: View {
|
||||
TextField("cache-pause-wait", text: $mpvCachePauseWait)
|
||||
}
|
||||
.multilineTextAlignment(.trailing)
|
||||
|
||||
if mpvEnableLogging {
|
||||
logButton
|
||||
}
|
||||
}
|
||||
|
||||
Section(header: manifestHeader) {
|
||||
@@ -85,6 +119,10 @@ struct AdvancedSettings: View {
|
||||
Toggle("Show playback statistics", isOn: $showMPVPlaybackStats)
|
||||
}
|
||||
|
||||
var mpvEnableLoggingToggle: some View {
|
||||
Toggle("Enable logging", isOn: $mpvEnableLogging)
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
private func onHover(_ inside: Bool) {
|
||||
if inside {
|
||||
|
@@ -226,7 +226,7 @@ struct SettingsView: View {
|
||||
case .locations:
|
||||
return 480
|
||||
case .advanced:
|
||||
return 300
|
||||
return 320
|
||||
case .help:
|
||||
return 600
|
||||
}
|
||||
|
Reference in New Issue
Block a user