mirror of
https://github.com/yattee/yattee.git
synced 2025-12-16 13:08:14 +00:00
Compare commits
1 Commits
update-int
...
video-deta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4bcd0c0a0 |
@@ -15,7 +15,7 @@ struct AppSidebarNavigation: View {
|
|||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
content.introspect(.viewController, on: .iOS(.v15, .v16, .v17, .v18)) { viewController in
|
content.introspect(.viewController, on: .iOS(.v15, .v16, .v17)) { viewController in
|
||||||
// workaround for an empty supplementary view on launch
|
// workaround for an empty supplementary view on launch
|
||||||
// the supplementary view is determined by the default selection inside the
|
// the supplementary view is determined by the default selection inside the
|
||||||
// primary view, but the primary view is not loaded so its selection is not read
|
// primary view, but the primary view is not loaded so its selection is not read
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ struct PlayerBackendView: View {
|
|||||||
Color.clear
|
Color.clear
|
||||||
.onAppear { player.playerSize = proxy.size }
|
.onAppear { player.playerSize = proxy.size }
|
||||||
.onChange(of: proxy.size) { _ in player.playerSize = proxy.size }
|
.onChange(of: proxy.size) { _ in player.playerSize = proxy.size }
|
||||||
.onChange(of: player.controls.presentingOverlays) { _ in player.playerSize = proxy.size }
|
.onChange(of: player.currentItem?.id) { _ in player.playerSize = proxy.size }
|
||||||
})
|
})
|
||||||
|
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ extension VideoPlayerView {
|
|||||||
player.seek.gestureStart = time
|
player.seek.gestureStart = time
|
||||||
}
|
}
|
||||||
let timeSeek = (time / player.playerSize.width) * horizontalDrag * seekGestureSpeed
|
let timeSeek = (time / player.playerSize.width) * horizontalDrag * seekGestureSpeed
|
||||||
|
|
||||||
player.seek.gestureSeek = timeSeek
|
player.seek.gestureSeek = timeSeek
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@@ -80,6 +79,54 @@ extension VideoPlayerView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var detailsDragGesture: some Gesture {
|
||||||
|
DragGesture(minimumDistance: 30)
|
||||||
|
.onChanged { value in
|
||||||
|
handleDetailsDragChange(value)
|
||||||
|
}
|
||||||
|
.onEnded { value in
|
||||||
|
handleDetailsDragEnd(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleDetailsDragChange(_ value: DragGesture.Value) {
|
||||||
|
let maxOffset = -player.playerSize.height
|
||||||
|
|
||||||
|
// Continuous drag update for smooth movement of VideoDetails
|
||||||
|
if fullScreenDetails {
|
||||||
|
// Allow only downward dragging when in fullscreen
|
||||||
|
if value.translation.height > 0 {
|
||||||
|
detailViewDragOffset = min(value.translation.height, abs(maxOffset))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Allow only upward dragging when not in fullscreen
|
||||||
|
if value.translation.height < 0 {
|
||||||
|
detailViewDragOffset = max(value.translation.height, maxOffset)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func handleDetailsDragEnd(_ value: DragGesture.Value) {
|
||||||
|
if value.translation.height < -50, !fullScreenDetails {
|
||||||
|
// Swipe up to enter fullscreen
|
||||||
|
withAnimation(Constants.overlayAnimation) {
|
||||||
|
fullScreenDetails = true
|
||||||
|
detailViewDragOffset = 0
|
||||||
|
}
|
||||||
|
} else if value.translation.height > 50, fullScreenDetails {
|
||||||
|
// Swipe down to exit fullscreen
|
||||||
|
withAnimation(Constants.overlayAnimation) {
|
||||||
|
fullScreenDetails = false
|
||||||
|
detailViewDragOffset = 0
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Reset offset if drag was not significant
|
||||||
|
withAnimation(Constants.overlayAnimation) {
|
||||||
|
detailViewDragOffset = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func onPlayerDragGestureEnded() {
|
func onPlayerDragGestureEnded() {
|
||||||
if horizontalPlayerGestureEnabled, isHorizontalDrag {
|
if horizontalPlayerGestureEnabled, isHorizontalDrag {
|
||||||
isHorizontalDrag = false
|
isHorizontalDrag = false
|
||||||
@@ -108,7 +155,6 @@ extension VideoPlayerView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to temporarily disable the toggle gesture after a fullscreen change
|
|
||||||
private func disableGestureTemporarily() {
|
private func disableGestureTemporarily() {
|
||||||
disableToggleGesture = true
|
disableToggleGesture = true
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ struct VideoDetails: View {
|
|||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.contentShape(Rectangle())
|
.contentShape(Rectangle())
|
||||||
.padding(.horizontal, 16)
|
.padding(.horizontal, 16)
|
||||||
// swiftlint:disable trailing_closure
|
|
||||||
// TODO: when setting tvOS minimum to 16, the platform modifier can be removed
|
// TODO: when setting tvOS minimum to 16, the platform modifier can be removed
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
.simultaneousGesture( // Simultaneous gesture to prioritize button tap
|
.simultaneousGesture( // Simultaneous gesture to prioritize button tap
|
||||||
@@ -234,7 +234,7 @@ struct VideoDetails: View {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
#endif
|
#endif
|
||||||
// swiftlint:enable trailing_closure
|
|
||||||
if VideoActions().isAnyActionVisible() {
|
if VideoActions().isAnyActionVisible() {
|
||||||
VideoActions(video: player.videoForDisplay)
|
VideoActions(video: player.videoForDisplay)
|
||||||
.padding(.vertical, 5)
|
.padding(.vertical, 5)
|
||||||
|
|||||||
@@ -24,13 +24,12 @@ struct VideoPlayerView: View {
|
|||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
335
|
335
|
||||||
#else
|
#else
|
||||||
200
|
140
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@State private var playerSize: CGSize = .zero { didSet { updateSidebarQueue() } }
|
@State private var playerSize: CGSize = .zero { didSet { updateSidebarQueue() } }
|
||||||
@State private var hoveringPlayer = false
|
@State private var hoveringPlayer = false
|
||||||
@State private var fullScreenDetails = false
|
|
||||||
@State private var sidebarQueue = defaultSidebarQueueValue
|
@State private var sidebarQueue = defaultSidebarQueueValue
|
||||||
|
|
||||||
@Environment(\.colorScheme) private var colorScheme
|
@Environment(\.colorScheme) private var colorScheme
|
||||||
@@ -51,12 +50,14 @@ struct VideoPlayerView: View {
|
|||||||
@State var isHorizontalDrag = false
|
@State var isHorizontalDrag = false
|
||||||
@State var isVerticalDrag = false
|
@State var isVerticalDrag = false
|
||||||
@State var viewDragOffset = Self.hiddenOffset
|
@State var viewDragOffset = Self.hiddenOffset
|
||||||
|
@State var detailViewDragOffset: Double = 0
|
||||||
// swiftlint:enable private_swiftui_state
|
// swiftlint:enable private_swiftui_state
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// swiftlint:disable private_swiftui_state
|
// swiftlint:disable private_swiftui_state
|
||||||
@State var disableToggleGesture = false
|
@State var disableToggleGesture = false
|
||||||
|
@State var fullScreenDetails = false
|
||||||
// swiftlint:enable private_swiftui_state
|
// swiftlint:enable private_swiftui_state
|
||||||
|
|
||||||
@ObservedObject var player = PlayerModel.shared // swiftlint:disable:this swiftui_state_private
|
@ObservedObject var player = PlayerModel.shared // swiftlint:disable:this swiftui_state_private
|
||||||
@@ -307,6 +308,8 @@ struct VideoPlayerView: View {
|
|||||||
#endif
|
#endif
|
||||||
.id(player.currentVideo?.cacheKey)
|
.id(player.currentVideo?.cacheKey)
|
||||||
.transition(.opacity)
|
.transition(.opacity)
|
||||||
|
.offset(y: detailViewDragOffset)
|
||||||
|
.gesture(detailsDragGesture)
|
||||||
} else {
|
} else {
|
||||||
VStack {}
|
VStack {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ struct FocusableSearchTextField: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
SearchTextField()
|
SearchTextField()
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
.introspect(.textField, on: .macOS(.v12, .v13, .v14, .v15)) { textField in
|
.introspect(.textField, on: .macOS(.v12, .v13, .v14)) { textField in
|
||||||
state.textField = textField
|
state.textField = textField
|
||||||
}
|
}
|
||||||
.onAppear {
|
.onAppear {
|
||||||
@@ -18,7 +18,7 @@ struct FocusableSearchTextField: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elseif os(iOS)
|
#elseif os(iOS)
|
||||||
.introspect(.textField, on: .iOS(.v15, .v16, .v17, .v18)) { textField in
|
.introspect(.textField, on: .iOS(.v15, .v16, .v17)) { textField in
|
||||||
state.textField = textField
|
state.textField = textField
|
||||||
}
|
}
|
||||||
.onChange(of: state.focused) { newValue in
|
.onChange(of: state.focused) { newValue in
|
||||||
|
|||||||
@@ -4913,7 +4913,7 @@
|
|||||||
repositoryURL = "https://github.com/sindresorhus/Defaults";
|
repositoryURL = "https://github.com/sindresorhus/Defaults";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
kind = upToNextMajorVersion;
|
||||||
minimumVersion = 7.3.1;
|
minimumVersion = 7.0.0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
372AA40E286D067B0000B1DC /* XCRemoteSwiftPackageReference "Repeat" */ = {
|
372AA40E286D067B0000B1DC /* XCRemoteSwiftPackageReference "Repeat" */ = {
|
||||||
@@ -4928,8 +4928,8 @@
|
|||||||
isa = XCRemoteSwiftPackageReference;
|
isa = XCRemoteSwiftPackageReference;
|
||||||
repositoryURL = "https://github.com/hyperoslo/Cache.git";
|
repositoryURL = "https://github.com/hyperoslo/Cache.git";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
branch = master;
|
||||||
minimumVersion = 7.4.0;
|
kind = branch;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
375B8AAF28B57F4200397B31 /* XCRemoteSwiftPackageReference "KeychainAccess" */ = {
|
375B8AAF28B57F4200397B31 /* XCRemoteSwiftPackageReference "KeychainAccess" */ = {
|
||||||
@@ -4944,16 +4944,16 @@
|
|||||||
isa = XCRemoteSwiftPackageReference;
|
isa = XCRemoteSwiftPackageReference;
|
||||||
repositoryURL = "https://github.com/pinterest/PINCache";
|
repositoryURL = "https://github.com/pinterest/PINCache";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
branch = master;
|
||||||
minimumVersion = 3.0.4;
|
kind = branch;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
379325D329A265A300181CF1 /* XCRemoteSwiftPackageReference "swift-log" */ = {
|
379325D329A265A300181CF1 /* XCRemoteSwiftPackageReference "swift-log" */ = {
|
||||||
isa = XCRemoteSwiftPackageReference;
|
isa = XCRemoteSwiftPackageReference;
|
||||||
repositoryURL = "https://github.com/apple/swift-log.git";
|
repositoryURL = "https://github.com/yattee/swift-log.git";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
branch = main;
|
||||||
minimumVersion = 1.6.1;
|
kind = branch;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
3797104728D3D10600D5F53C /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */ = {
|
3797104728D3D10600D5F53C /* XCRemoteSwiftPackageReference "SDWebImageSwiftUI" */ = {
|
||||||
@@ -4961,7 +4961,7 @@
|
|||||||
repositoryURL = "https://github.com/SDWebImage/SDWebImageSwiftUI.git";
|
repositoryURL = "https://github.com/SDWebImage/SDWebImageSwiftUI.git";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
kind = upToNextMajorVersion;
|
||||||
minimumVersion = 2.2.7;
|
minimumVersion = 2.1.0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
3797757B268922D100DD52A8 /* XCRemoteSwiftPackageReference "siesta" */ = {
|
3797757B268922D100DD52A8 /* XCRemoteSwiftPackageReference "siesta" */ = {
|
||||||
@@ -4969,7 +4969,7 @@
|
|||||||
repositoryURL = "https://github.com/bustoutsolutions/siesta";
|
repositoryURL = "https://github.com/bustoutsolutions/siesta";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
kind = upToNextMajorVersion;
|
||||||
minimumVersion = 1.5.2;
|
minimumVersion = 1.5.0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
3799AC0728B03CEC001376F9 /* XCRemoteSwiftPackageReference "ActiveLabel.swift" */ = {
|
3799AC0728B03CEC001376F9 /* XCRemoteSwiftPackageReference "ActiveLabel.swift" */ = {
|
||||||
@@ -4985,7 +4985,7 @@
|
|||||||
repositoryURL = "https://github.com/Alamofire/Alamofire.git";
|
repositoryURL = "https://github.com/Alamofire/Alamofire.git";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
kind = upToNextMajorVersion;
|
||||||
minimumVersion = 5.9.1;
|
minimumVersion = 5.0.0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
37BD07C52698B27B003EBB87 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = {
|
37BD07C52698B27B003EBB87 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = {
|
||||||
@@ -4993,7 +4993,7 @@
|
|||||||
repositoryURL = "https://github.com/siteline/SwiftUI-Introspect.git";
|
repositoryURL = "https://github.com/siteline/SwiftUI-Introspect.git";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
kind = upToNextMajorVersion;
|
||||||
minimumVersion = 1.3.0;
|
minimumVersion = 0.1.3;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
37CF8B8228535E4F00B71E37 /* XCRemoteSwiftPackageReference "SDWebImage" */ = {
|
37CF8B8228535E4F00B71E37 /* XCRemoteSwiftPackageReference "SDWebImage" */ = {
|
||||||
@@ -5001,7 +5001,7 @@
|
|||||||
repositoryURL = "https://github.com/SDWebImage/SDWebImage";
|
repositoryURL = "https://github.com/SDWebImage/SDWebImage";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
kind = upToNextMajorVersion;
|
||||||
minimumVersion = 5.19.7;
|
minimumVersion = 5.19.1;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
37D4B19B2671817900C925CA /* XCRemoteSwiftPackageReference "SwiftyJSON" */ = {
|
37D4B19B2671817900C925CA /* XCRemoteSwiftPackageReference "SwiftyJSON" */ = {
|
||||||
@@ -5009,7 +5009,7 @@
|
|||||||
repositoryURL = "https://github.com/SwiftyJSON/SwiftyJSON.git";
|
repositoryURL = "https://github.com/SwiftyJSON/SwiftyJSON.git";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
kind = upToNextMajorVersion;
|
||||||
minimumVersion = 5.0.2;
|
minimumVersion = 5.0.0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
37EE6DC328A305AD00BFD632 /* XCRemoteSwiftPackageReference "Reachability" */ = {
|
37EE6DC328A305AD00BFD632 /* XCRemoteSwiftPackageReference "Reachability" */ = {
|
||||||
@@ -5017,7 +5017,7 @@
|
|||||||
repositoryURL = "https://github.com/ashleymills/Reachability.swift";
|
repositoryURL = "https://github.com/ashleymills/Reachability.swift";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
kind = upToNextMajorVersion;
|
||||||
minimumVersion = 5.2.3;
|
minimumVersion = 5.1.0;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
37FB2847272207F000A57617 /* XCRemoteSwiftPackageReference "SDWebImageWebPCoder" */ = {
|
37FB2847272207F000A57617 /* XCRemoteSwiftPackageReference "SDWebImageWebPCoder" */ = {
|
||||||
@@ -5025,7 +5025,7 @@
|
|||||||
repositoryURL = "https://github.com/SDWebImage/SDWebImageWebPCoder.git";
|
repositoryURL = "https://github.com/SDWebImage/SDWebImageWebPCoder.git";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = upToNextMajorVersion;
|
kind = upToNextMajorVersion;
|
||||||
minimumVersion = 0.14.6;
|
minimumVersion = 0.8.4;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
37FB285227220D8400A57617 /* XCRemoteSwiftPackageReference "SDWebImagePINPlugin" */ = {
|
37FB285227220D8400A57617 /* XCRemoteSwiftPackageReference "SDWebImagePINPlugin" */ = {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"originHash" : "173de1b718eb898698eaba0221b46be9781899a652725709c8400d3ddfb01980",
|
"originHash" : "515d8e68c4a31658288fb3f94789ee539399b042082c08c39f4c03c27fd8860c",
|
||||||
"pins" : [
|
"pins" : [
|
||||||
{
|
{
|
||||||
"identity" : "activelabel.swift",
|
"identity" : "activelabel.swift",
|
||||||
@@ -24,8 +24,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/hyperoslo/Cache.git",
|
"location" : "https://github.com/hyperoslo/Cache.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "24e47109e31b2031cb26e25cc1b81b607496066c",
|
"branch" : "master",
|
||||||
"version" : "7.4.0"
|
"revision" : "81a0277cbc6b63f4e0cd6f42c4abefa1011bbfa9"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -69,8 +69,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/pinterest/PINCache",
|
"location" : "https://github.com/pinterest/PINCache",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "2fb85948463292c2e824148cf17dc62a4c217a94",
|
"branch" : "master",
|
||||||
"version" : "3.0.4"
|
"revision" : "2fb85948463292c2e824148cf17dc62a4c217a94"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -148,10 +148,10 @@
|
|||||||
{
|
{
|
||||||
"identity" : "swift-log",
|
"identity" : "swift-log",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/apple/swift-log.git",
|
"location" : "https://github.com/yattee/swift-log.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",
|
"branch" : "main",
|
||||||
"version" : "1.6.1"
|
"revision" : "3f3dc1390a2f116894887c352792dc8d5fa9e875"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -168,8 +168,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/siteline/SwiftUI-Introspect.git",
|
"location" : "https://github.com/siteline/SwiftUI-Introspect.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "807f73ce09a9b9723f12385e592b4e0aaebd3336",
|
"revision" : "121c146fe591b1320238d054ae35c81ffa45f45a",
|
||||||
"version" : "1.3.0"
|
"version" : "0.12.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user