1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 06:40:32 +05:30

Add close video button to browser controls

This commit is contained in:
Arkadiusz Fal 2022-05-29 22:13:39 +02:00
parent 06a6126eb5
commit f2e9bcaefe

View File

@ -65,15 +65,6 @@ struct BrowserPlayerControls<Content: View, Toolbar: View>: View {
.lineLimit(1) .lineLimit(1)
} }
} }
.contextMenu {
Button {
model.closeCurrentItem()
} label: {
Label("Close Video", systemImage: "xmark.circle")
.labelStyle(.automatic)
}
.disabled(model.currentItem.isNil)
}
Spacer() Spacer()
} }
@ -82,9 +73,17 @@ struct BrowserPlayerControls<Content: View, Toolbar: View>: View {
} }
.padding(.vertical, 20) .padding(.vertical, 20)
ZStack(alignment: .bottom) {
HStack { HStack {
Group { Group {
if !model.currentItem.isNil {
Button {
model.closeCurrentItem()
model.closePiP()
} label: {
Label("Close Video", systemImage: "xmark")
}
}
if playerControls.isPlaying { if playerControls.isPlaying {
Button(action: { Button(action: {
model.pause() model.pause()
@ -110,16 +109,6 @@ struct BrowserPlayerControls<Content: View, Toolbar: View>: View {
} }
.disabled(model.queue.isEmpty) .disabled(model.queue.isEmpty)
} }
ProgressView(value: progressViewValue, total: progressViewTotal)
.progressViewStyle(.linear)
#if os(iOS)
.frame(maxWidth: 60)
#else
.offset(y: 6)
.frame(maxWidth: 70)
#endif
}
} }
.buttonStyle(.plain) .buttonStyle(.plain)
.labelStyle(.iconOnly) .labelStyle(.iconOnly)