mirror of
https://github.com/yattee/yattee.git
synced 2026-02-21 18:29:44 +00:00
Fix tvOS onboarding background transparency and button styling
Add opaque black background to onboarding on tvOS to prevent Home screen content from leaking through the fullScreenCover. Replace toolbar Skip button with plain overlay button to avoid blurred material style, and add tvOS card button style with default focus on Continue button.
This commit is contained in:
@@ -63,7 +63,19 @@ struct OnboardingSheetView: View {
|
|||||||
#elseif os(iOS)
|
#elseif os(iOS)
|
||||||
.tabViewStyle(.page(indexDisplayMode: .never))
|
.tabViewStyle(.page(indexDisplayMode: .never))
|
||||||
#endif
|
#endif
|
||||||
|
#if os(tvOS)
|
||||||
|
.background(Color.black.ignoresSafeArea())
|
||||||
|
.overlay(alignment: .topLeading) {
|
||||||
|
Button(String(localized: "onboarding.skip")) {
|
||||||
|
completeOnboarding()
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
.padding(40)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
.interactiveDismissDisabled()
|
.interactiveDismissDisabled()
|
||||||
|
#if !os(tvOS)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem(placement: .cancellationAction) {
|
ToolbarItem(placement: .cancellationAction) {
|
||||||
Button(String(localized: "onboarding.skip")) {
|
Button(String(localized: "onboarding.skip")) {
|
||||||
@@ -71,6 +83,7 @@ struct OnboardingSheetView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
.task {
|
.task {
|
||||||
guard !hasCheckedLegacyData else { return }
|
guard !hasCheckedLegacyData else { return }
|
||||||
hasCheckedLegacyData = true
|
hasCheckedLegacyData = true
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ import SwiftUI
|
|||||||
struct OnboardingTitleScreen: View {
|
struct OnboardingTitleScreen: View {
|
||||||
let onContinue: () -> Void
|
let onContinue: () -> Void
|
||||||
|
|
||||||
|
#if os(tvOS)
|
||||||
|
@FocusState private var continueButtonFocused: Bool
|
||||||
|
#endif
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
GeometryReader { geometry in
|
GeometryReader { geometry in
|
||||||
let iconSize = min(max(geometry.size.height * 0.13, 60), 140)
|
let iconSize = min(max(geometry.size.height * 0.13, 60), 140)
|
||||||
@@ -67,15 +71,26 @@ struct OnboardingTitleScreen: View {
|
|||||||
.font(.headline)
|
.font(.headline)
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
.padding()
|
.padding()
|
||||||
|
#if os(tvOS)
|
||||||
|
.background(Color.accentColor.opacity(0.2))
|
||||||
|
#else
|
||||||
.background(Color.accentColor)
|
.background(Color.accentColor)
|
||||||
.foregroundStyle(.white)
|
.foregroundStyle(.white)
|
||||||
|
#endif
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 12))
|
.clipShape(RoundedRectangle(cornerRadius: 12))
|
||||||
}
|
}
|
||||||
|
#if os(tvOS)
|
||||||
|
.buttonStyle(.card)
|
||||||
|
.focused($continueButtonFocused)
|
||||||
|
#endif
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
.padding(.bottom)
|
.padding(.bottom)
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.padding()
|
.padding()
|
||||||
|
#if os(tvOS)
|
||||||
|
.onAppear { continueButtonFocused = true }
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user