mirror of
https://github.com/jellyfin/Swiftfin.git
synced 2024-11-27 00:00:37 +00:00
Update tvOS onChange
(#1141)
This commit is contained in:
parent
29b917ead0
commit
5ee2eac11d
@ -22,7 +22,7 @@ struct CinematicBackgroundView<Item: Poster>: View {
|
||||
|
||||
var body: some View {
|
||||
RotateContentView(proxy: proxy)
|
||||
.onChange(of: viewModel.currentItem) { newItem in
|
||||
.onChange(of: viewModel.currentItem) { _, newItem in
|
||||
proxy.update {
|
||||
ImageView(newItem?.cinematicImageSources(maxWidth: nil) ?? [])
|
||||
.placeholder { _ in
|
||||
|
@ -86,7 +86,7 @@ struct CinematicItemSelector<Item: Poster>: View {
|
||||
}
|
||||
.frame(height: UIScreen.main.bounds.height - 75)
|
||||
.frame(maxWidth: .infinity)
|
||||
.onChange(of: focusedItem) { newValue in
|
||||
.onChange(of: focusedItem) { _, newValue in
|
||||
guard let newValue else { return }
|
||||
viewModel.select(item: newValue)
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ struct PagingLibraryView<Element: Poster>: View {
|
||||
viewModel.send(.refresh)
|
||||
}
|
||||
}
|
||||
.onChange(of: focusedItem) { newValue in
|
||||
.onChange(of: focusedItem) { _, newValue in
|
||||
guard let newValue else {
|
||||
withAnimation {
|
||||
presentBackground = false
|
||||
|
@ -72,7 +72,7 @@ struct PosterButton<Item: Poster>: View {
|
||||
.ifLet(onFocusChanged) { view, onFocusChanged in
|
||||
view
|
||||
.focused($isFocused)
|
||||
.onChange(of: isFocused) { newValue in
|
||||
.onChange(of: isFocused) { _, newValue in
|
||||
onFocusChanged(newValue)
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ struct FocusGuideModifier: ViewModifier {
|
||||
})
|
||||
.focused($focusDirection, equals: .bottom)
|
||||
}
|
||||
.onChange(of: focusDirection) { focusDirection in
|
||||
.onChange(of: focusDirection) { _, focusDirection in
|
||||
guard let focusDirection = focusDirection else { return }
|
||||
switch focusDirection {
|
||||
case .top:
|
||||
@ -70,7 +70,7 @@ struct FocusGuideModifier: ViewModifier {
|
||||
case .content: ()
|
||||
}
|
||||
}
|
||||
.onChange(of: focusGuide.focusedTag) { newTag in
|
||||
.onChange(of: focusGuide.focusedTag) { _, newTag in
|
||||
if newTag == focusConstructor.tag {
|
||||
if let onContentFocus = onContentFocus {
|
||||
onContentFocus()
|
||||
|
@ -78,10 +78,10 @@ extension SeriesEpisodeSelector {
|
||||
onContentFocus: { focusedEpisodeID = lastFocusedEpisodeID },
|
||||
top: "seasons"
|
||||
)
|
||||
.onChange(of: viewModel) { newValue in
|
||||
.onChange(of: viewModel) { _, newValue in
|
||||
lastFocusedEpisodeID = newValue.elements.first?.id
|
||||
}
|
||||
.onChange(of: focusedEpisodeID) { newValue in
|
||||
.onChange(of: focusedEpisodeID) { _, newValue in
|
||||
guard let newValue else { return }
|
||||
lastFocusedEpisodeID = newValue
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ struct SeriesEpisodeSelector: View {
|
||||
selection = viewModel.seasons.first
|
||||
}
|
||||
}
|
||||
.onChange(of: selection) { newValue in
|
||||
.onChange(of: selection) { _, newValue in
|
||||
guard let newValue else { return }
|
||||
|
||||
if newValue.state == .initial {
|
||||
@ -120,7 +120,7 @@ extension SeriesEpisodeSelector {
|
||||
.frame(height: 20)
|
||||
}
|
||||
}
|
||||
.onChange(of: focusedSeason) { newValue in
|
||||
.onChange(of: focusedSeason) { _, newValue in
|
||||
guard let newValue else { return }
|
||||
selection.wrappedValue = newValue
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ extension EpisodeItemView.ContentView {
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 50)
|
||||
.onChange(of: focusedLayer) { layer in
|
||||
.onChange(of: focusedLayer) { _, layer in
|
||||
if layer == .top {
|
||||
focusedLayer = .playButton
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ extension ItemView {
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 50)
|
||||
.onChange(of: focusedLayer) { layer in
|
||||
.onChange(of: focusedLayer) { _, layer in
|
||||
if layer == .top {
|
||||
focusedLayer = .playButton
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ struct MediaSourceInfoView: View {
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.onChange(of: selectedMediaStream) { newValue in
|
||||
.onChange(of: selectedMediaStream) { _, newValue in
|
||||
guard let newValue else { return }
|
||||
lastSelectedMediaStream = newValue
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ extension MediaView {
|
||||
}
|
||||
.buttonStyle(.card)
|
||||
.onFirstAppear(perform: setImageSources)
|
||||
.onChange(of: useRandomImage) { _ in
|
||||
.onChange(of: useRandomImage) { _, _ in
|
||||
setImageSources()
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ struct SearchView: View {
|
||||
.onFirstAppear {
|
||||
viewModel.send(.getSuggestions)
|
||||
}
|
||||
.onChange(of: searchQuery) { newValue in
|
||||
.onChange(of: searchQuery) { _, newValue in
|
||||
viewModel.send(.search(query: newValue))
|
||||
}
|
||||
.searchable(text: $searchQuery, prompt: L10n.search)
|
||||
|
@ -137,7 +137,7 @@ struct SelectUserView: View {
|
||||
}
|
||||
}
|
||||
.padding(EdgeInsets.edgePadding * 2.5)
|
||||
.onChange(of: gridItemSize) { newValue in
|
||||
.onChange(of: gridItemSize) { _, newValue in
|
||||
let columns = Int(contentSize.width / (newValue.width + EdgeInsets.edgePadding))
|
||||
|
||||
padGridItemColumnCount = columns
|
||||
@ -283,7 +283,7 @@ struct SelectUserView: View {
|
||||
// }
|
||||
// )
|
||||
}
|
||||
.onChange(of: serverSelection) { newValue in
|
||||
.onChange(of: serverSelection) { _, newValue in
|
||||
gridItems = makeGridItems(for: newValue)
|
||||
|
||||
splashScreenImageSource = makeSplashScreenImageSource(
|
||||
@ -291,7 +291,7 @@ struct SelectUserView: View {
|
||||
allServersSelection: .all
|
||||
)
|
||||
}
|
||||
.onChange(of: viewModel.servers) { _ in
|
||||
.onChange(of: viewModel.servers) { _, _ in
|
||||
gridItems = makeGridItems(for: serverSelection)
|
||||
|
||||
splashScreenImageSource = makeSplashScreenImageSource(
|
||||
|
@ -106,7 +106,7 @@ extension LiveVideoPlayer.Overlay {
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
}
|
||||
.onChange(of: isPresentingOverlay) { newValue in
|
||||
.onChange(of: isPresentingOverlay) { _, newValue in
|
||||
guard newValue else { return }
|
||||
}
|
||||
}
|
||||
|
@ -40,14 +40,14 @@ extension LiveVideoPlayer {
|
||||
// .animation(.linear(duration: 0.1), value: currentOverlayType)
|
||||
// .environment(\.currentOverlayType, $currentOverlayType)
|
||||
// .environmentObject(overlayTimer)
|
||||
// .onChange(of: currentOverlayType) { newValue in
|
||||
// .onChange(of: currentOverlayType) { _, newValue in
|
||||
// if [.smallMenu, .chapters].contains(newValue) {
|
||||
// overlayTimer.pause()
|
||||
// } else if isPresentingOverlay {
|
||||
// overlayTimer.start(5)
|
||||
// }
|
||||
// }
|
||||
// .onChange(of: overlayTimer.isActive) { isActive in
|
||||
// .onChange(of: overlayTimer.isActive) { _, isActive in
|
||||
// guard !isActive else { return }
|
||||
//
|
||||
// withAnimation(.linear(duration: 0.3)) {
|
||||
|
@ -49,14 +49,14 @@ extension LiveVideoPlayer {
|
||||
.animation(.linear(duration: 0.1), value: currentOverlayType)
|
||||
.environment(\.currentOverlayType, $currentOverlayType)
|
||||
.environmentObject(overlayTimer)
|
||||
.onChange(of: currentOverlayType) { newValue in
|
||||
.onChange(of: currentOverlayType) { _, newValue in
|
||||
if [.smallMenu, .chapters].contains(newValue) {
|
||||
overlayTimer.pause()
|
||||
} else if isPresentingOverlay {
|
||||
overlayTimer.start(5)
|
||||
}
|
||||
}
|
||||
.onChange(of: overlayTimer.isActive) { isActive in
|
||||
.onChange(of: overlayTimer.isActive) { _, isActive in
|
||||
guard !isActive else { return }
|
||||
|
||||
withAnimation(.linear(duration: 0.3)) {
|
||||
|
@ -71,7 +71,7 @@ struct LiveVideoPlayer: View {
|
||||
.environment(\.isPresentingOverlay, $isPresentingOverlay)
|
||||
.environment(\.isScrubbing, $isScrubbing)
|
||||
}
|
||||
.onChange(of: videoPlayerManager.currentProgressHandler.scrubbedProgress) { newValue in
|
||||
.onChange(of: videoPlayerManager.currentProgressHandler.scrubbedProgress) { _, newValue in
|
||||
guard !newValue.isNaN && !newValue.isInfinite else {
|
||||
return
|
||||
}
|
||||
@ -99,7 +99,7 @@ struct LiveVideoPlayer: View {
|
||||
}
|
||||
}
|
||||
.ignoresSafeArea()
|
||||
.onChange(of: isScrubbing) { newValue in
|
||||
.onChange(of: isScrubbing) { _, newValue in
|
||||
guard !newValue else { return }
|
||||
videoPlayerManager.proxy.setTime(.seconds(currentProgressHandler.scrubbedSeconds))
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ extension VideoPlayer {
|
||||
.padding2()
|
||||
.padding2(.horizontal)
|
||||
}
|
||||
.onChange(of: currentOverlayType) { newValue in
|
||||
.onChange(of: currentOverlayType) { _, newValue in
|
||||
guard newValue == .chapters else { return }
|
||||
if let currentChapter = viewModel.chapter(from: currentProgressHandler.seconds) {
|
||||
scrollViewProxy?.scrollTo(currentChapter.hashValue, anchor: .center)
|
||||
|
@ -102,7 +102,7 @@ extension VideoPlayer.Overlay {
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
}
|
||||
.onChange(of: isPresentingOverlay) { newValue in
|
||||
.onChange(of: isPresentingOverlay) { _, newValue in
|
||||
guard newValue else { return }
|
||||
}
|
||||
}
|
||||
|
@ -50,14 +50,14 @@ extension VideoPlayer {
|
||||
.animation(.linear(duration: 0.1), value: currentOverlayType)
|
||||
.environment(\.currentOverlayType, $currentOverlayType)
|
||||
.environmentObject(overlayTimer)
|
||||
.onChange(of: currentOverlayType) { newValue in
|
||||
.onChange(of: currentOverlayType) { _, newValue in
|
||||
if [.smallMenu, .chapters].contains(newValue) {
|
||||
overlayTimer.pause()
|
||||
} else if isPresentingOverlay {
|
||||
overlayTimer.start(5)
|
||||
}
|
||||
}
|
||||
.onChange(of: overlayTimer.isActive) { isActive in
|
||||
.onChange(of: overlayTimer.isActive) { _, isActive in
|
||||
guard !isActive else { return }
|
||||
|
||||
withAnimation(.linear(duration: 0.3)) {
|
||||
|
@ -160,7 +160,7 @@ extension VideoPlayer {
|
||||
endPoint: .bottom
|
||||
)
|
||||
}
|
||||
.onChange(of: focusedSection) { newValue in
|
||||
.onChange(of: focusedSection) { _, newValue in
|
||||
guard let newValue else { return }
|
||||
lastFocusedSection = newValue
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ struct VideoPlayer: View {
|
||||
.environment(\.isPresentingOverlay, $isPresentingOverlay)
|
||||
.environment(\.isScrubbing, $isScrubbing)
|
||||
}
|
||||
.onChange(of: videoPlayerManager.currentProgressHandler.scrubbedProgress) { newValue in
|
||||
.onChange(of: videoPlayerManager.currentProgressHandler.scrubbedProgress) { _, newValue in
|
||||
guard !newValue.isNaN && !newValue.isInfinite else {
|
||||
return
|
||||
}
|
||||
@ -102,7 +102,7 @@ struct VideoPlayer: View {
|
||||
}
|
||||
}
|
||||
.ignoresSafeArea()
|
||||
.onChange(of: isScrubbing) { newValue in
|
||||
.onChange(of: isScrubbing) { _, newValue in
|
||||
guard !newValue else { return }
|
||||
videoPlayerManager.proxy.setTime(.seconds(currentProgressHandler.scrubbedSeconds))
|
||||
}
|
||||
|
@ -820,7 +820,6 @@
|
||||
E1DABAFC2A270EE7008AC34A /* MediaSourcesCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1DABAFB2A270EE7008AC34A /* MediaSourcesCard.swift */; };
|
||||
E1DABAFE2A27B982008AC34A /* RatingsCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1DABAFD2A27B982008AC34A /* RatingsCard.swift */; };
|
||||
E1DC9814296DC06200982F06 /* PulseLogHandler in Frameworks */ = {isa = PBXBuildFile; productRef = E1DC9813296DC06200982F06 /* PulseLogHandler */; };
|
||||
E1DC9819296DD1CD00982F06 /* CinematicBackgroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1DC9818296DD1CD00982F06 /* CinematicBackgroundView.swift */; };
|
||||
E1DC981A296DD1CD00982F06 /* CinematicBackgroundView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1DC9818296DD1CD00982F06 /* CinematicBackgroundView.swift */; };
|
||||
E1DC983D296DEB9B00982F06 /* UnwatchedIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1DC983C296DEB9B00982F06 /* UnwatchedIndicator.swift */; };
|
||||
E1DC983E296DEB9B00982F06 /* UnwatchedIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1DC983C296DEB9B00982F06 /* UnwatchedIndicator.swift */; };
|
||||
@ -4400,7 +4399,6 @@
|
||||
E10231482BCF8A6D009D71FC /* ChannelLibraryViewModel.swift in Sources */,
|
||||
E107BB9327880A8F00354E07 /* CollectionItemViewModel.swift in Sources */,
|
||||
E129428828F0831F00796AC6 /* SplitTimestamp.swift in Sources */,
|
||||
E1DC9819296DD1CD00982F06 /* CinematicBackgroundView.swift in Sources */,
|
||||
C46DD8E72A8FA77F0046A504 /* LiveBottomBarView.swift in Sources */,
|
||||
E11CEB8D28999B4A003E74C7 /* Font.swift in Sources */,
|
||||
E139CC1F28EC83E400688DE2 /* Int.swift in Sources */,
|
||||
|
Loading…
Reference in New Issue
Block a user