mirror of
https://github.com/yattee/yattee.git
synced 2026-05-13 10:55:03 +00:00
Present instance login as full-screen cover on tvOS
The .sheet rendering on tvOS produced a tiny floating modal where the "Sign In" title wrapped onto two lines and form fields overflowed. Use .fullScreenCover on tvOS and wrap the login form in TVSidebarDetailContainer so the title/icon sit in the standard 400pt left sidebar. iOS and macOS keep the existing sheet presentation.
This commit is contained in:
@@ -353,12 +353,21 @@ private struct EditRemoteServerContent: View {
|
|||||||
Button(String(localized: "common.cancel"), role: .cancel) {}
|
Button(String(localized: "common.cancel"), role: .cancel) {}
|
||||||
}
|
}
|
||||||
.presentationCompactAdaptation(.sheet)
|
.presentationCompactAdaptation(.sheet)
|
||||||
|
#if os(tvOS)
|
||||||
|
.fullScreenCover(isPresented: $showLoginSheet) {
|
||||||
|
InstanceLoginView(instance: instance) { credential in
|
||||||
|
appEnvironment?.credentialsManager(for: instance)?.setCredential(credential, for: instance)
|
||||||
|
isLoggedIn = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
.sheet(isPresented: $showLoginSheet) {
|
.sheet(isPresented: $showLoginSheet) {
|
||||||
InstanceLoginView(instance: instance) { credential in
|
InstanceLoginView(instance: instance) { credential in
|
||||||
appEnvironment?.credentialsManager(for: instance)?.setCredential(credential, for: instance)
|
appEnvironment?.credentialsManager(for: instance)?.setCredential(credential, for: instance)
|
||||||
isLoggedIn = true
|
isLoggedIn = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
.onAppear {
|
.onAppear {
|
||||||
isLoggedIn = appEnvironment?.credentialsManager(for: instance)?.isLoggedIn(for: instance) ?? false
|
isLoggedIn = appEnvironment?.credentialsManager(for: instance)?.isLoggedIn(for: instance) ?? false
|
||||||
|
|
||||||
|
|||||||
@@ -20,28 +20,15 @@ struct InstanceLoginView: View {
|
|||||||
@State private var errorMessage: String?
|
@State private var errorMessage: String?
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationStack {
|
|
||||||
#if os(tvOS)
|
#if os(tvOS)
|
||||||
VStack(spacing: 0) {
|
TVSidebarDetailContainer(systemImage: "person.badge.key", title: String(localized: "login.title")) {
|
||||||
HStack {
|
|
||||||
Button(String(localized: "common.cancel")) {
|
|
||||||
dismiss()
|
|
||||||
}
|
|
||||||
.buttonStyle(TVToolbarButtonStyle())
|
|
||||||
Spacer()
|
|
||||||
Text(String(localized: "login.title"))
|
|
||||||
.font(.title2)
|
|
||||||
.fontWeight(.semibold)
|
|
||||||
Spacer()
|
|
||||||
Color.clear.frame(width: 100)
|
|
||||||
}
|
|
||||||
.padding(.horizontal, 48)
|
|
||||||
.padding(.vertical, 24)
|
|
||||||
|
|
||||||
formContent
|
formContent
|
||||||
}
|
}
|
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
|
.background(Color.black.ignoresSafeArea())
|
||||||
.accessibilityIdentifier("instance.login.view")
|
.accessibilityIdentifier("instance.login.view")
|
||||||
#else
|
#else
|
||||||
|
NavigationStack {
|
||||||
formContent
|
formContent
|
||||||
.navigationTitle(String(localized: "login.title"))
|
.navigationTitle(String(localized: "login.title"))
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
@@ -55,8 +42,8 @@ struct InstanceLoginView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.accessibilityIdentifier("instance.login.view")
|
.accessibilityIdentifier("instance.login.view")
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private var formContent: some View {
|
private var formContent: some View {
|
||||||
|
|||||||
Reference in New Issue
Block a user