mirror of
https://github.com/yattee/yattee.git
synced 2024-12-14 06:10:32 +05:30
Performance improvements
This commit is contained in:
parent
4dbdd00829
commit
9197309115
@ -37,39 +37,25 @@ final class PlayerControlsModel: ObservableObject {
|
||||
}
|
||||
|
||||
func handlePresentationChange() {
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let self = self,
|
||||
let player = self.player else { return }
|
||||
if self.presentingControls {
|
||||
guard let player = player else { return }
|
||||
if presentingControls {
|
||||
player.backend.startControlsUpdates()
|
||||
self.resetTimer()
|
||||
resetTimer()
|
||||
} else {
|
||||
if !player.musicMode {
|
||||
player.backend.stopControlsUpdates()
|
||||
self.removeTimer()
|
||||
removeTimer()
|
||||
} else {
|
||||
self.presentingControls = true
|
||||
}
|
||||
presentingControls = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func handleSettingsOverlayPresentationChange() {
|
||||
player?.backend.setNeedsNetworkStateUpdates(presentingControlsOverlay && Defaults[.showMPVPlaybackStats])
|
||||
if presentingControlsOverlay {
|
||||
removeTimer()
|
||||
} else {
|
||||
resetTimer()
|
||||
}
|
||||
}
|
||||
|
||||
func handleDetailsOverlayPresentationChange() {
|
||||
if presentingDetailsOverlay {
|
||||
removeTimer()
|
||||
} else {
|
||||
resetTimer()
|
||||
}
|
||||
}
|
||||
func handleDetailsOverlayPresentationChange() {}
|
||||
|
||||
var presentingOverlays: Bool {
|
||||
presentingDetailsOverlay || presentingControlsOverlay
|
||||
|
@ -136,12 +136,7 @@ struct PlayerControls: View {
|
||||
}
|
||||
.onChange(of: model.presentingOverlays) { newValue in
|
||||
if newValue {
|
||||
player.backend.stopControlsUpdates()
|
||||
} else {
|
||||
#if os(tvOS)
|
||||
focusedField = .play
|
||||
#endif
|
||||
player.backend.startControlsUpdates()
|
||||
model.hide()
|
||||
}
|
||||
}
|
||||
#if os(tvOS)
|
||||
|
@ -103,7 +103,7 @@ struct VideoDescription: View {
|
||||
}
|
||||
|
||||
func updateUIView(_: UIViewType, context _: Context) {
|
||||
customizeLabel()
|
||||
updatePreferredMaxLayoutWidth()
|
||||
}
|
||||
|
||||
func customizeLabel() {
|
||||
@ -143,6 +143,10 @@ struct VideoDescription: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updatePreferredMaxLayoutWidth() {
|
||||
label.preferredMaxLayoutWidth = (detailsSize?.width ?? 330) - 30
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -454,10 +454,9 @@ struct VideoPlayerView: View {
|
||||
if drag > 60,
|
||||
player.playingFullScreen
|
||||
{
|
||||
player.exitFullScreen()
|
||||
player.exitFullScreen(showControls: false)
|
||||
if Defaults[.rotateToPortraitOnExitFullScreen] {
|
||||
Orientation.lockOrientation(.allButUpsideDown, andRotateTo: .portrait)
|
||||
playerControls.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,15 @@ struct ShareButton: View {
|
||||
|
||||
private var instanceActions: some View {
|
||||
Group {
|
||||
if let url = player.playerAPI.shareURL(contentItem) {
|
||||
Button(labelForShareURL(accounts.app.name)) {
|
||||
if let url = player.playerAPI.shareURL(contentItem) {
|
||||
shareAction(url)
|
||||
} else {
|
||||
navigation.presentAlert(
|
||||
title: "Could not create share link",
|
||||
message: "For custom locations you can configure Frontend URL in Locations settings"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if contentItemIsPlayerCurrentVideo {
|
||||
@ -44,7 +50,6 @@ struct ShareButton: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var youtubeActions: some View {
|
||||
Group {
|
||||
|
Loading…
Reference in New Issue
Block a user