mirror of
https://github.com/yattee/yattee.git
synced 2026-05-12 18:35:05 +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) {}
|
||||
}
|
||||
.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) {
|
||||
InstanceLoginView(instance: instance) { credential in
|
||||
appEnvironment?.credentialsManager(for: instance)?.setCredential(credential, for: instance)
|
||||
isLoggedIn = true
|
||||
}
|
||||
}
|
||||
#endif
|
||||
.onAppear {
|
||||
isLoggedIn = appEnvironment?.credentialsManager(for: instance)?.isLoggedIn(for: instance) ?? false
|
||||
|
||||
|
||||
@@ -20,28 +20,15 @@ struct InstanceLoginView: View {
|
||||
@State private var errorMessage: String?
|
||||
|
||||
var body: some View {
|
||||
#if os(tvOS)
|
||||
TVSidebarDetailContainer(systemImage: "person.badge.key", title: String(localized: "login.title")) {
|
||||
formContent
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background(Color.black.ignoresSafeArea())
|
||||
.accessibilityIdentifier("instance.login.view")
|
||||
#else
|
||||
NavigationStack {
|
||||
#if os(tvOS)
|
||||
VStack(spacing: 0) {
|
||||
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
|
||||
}
|
||||
.accessibilityIdentifier("instance.login.view")
|
||||
#else
|
||||
formContent
|
||||
.navigationTitle(String(localized: "login.title"))
|
||||
#if os(iOS)
|
||||
@@ -55,8 +42,8 @@ struct InstanceLoginView: View {
|
||||
}
|
||||
}
|
||||
.accessibilityIdentifier("instance.login.view")
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private var formContent: some View {
|
||||
|
||||
Reference in New Issue
Block a user