From 38242edf0c25b2fd0098cb932a9043d14b28d367 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Wed, 6 May 2026 21:44:55 +0200 Subject: [PATCH] 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. --- Yattee/Views/Settings/EditSourceView.swift | 9 ++++++ Yattee/Views/Settings/InstanceLoginView.swift | 31 ++++++------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/Yattee/Views/Settings/EditSourceView.swift b/Yattee/Views/Settings/EditSourceView.swift index e73a6fbd..96f95203 100644 --- a/Yattee/Views/Settings/EditSourceView.swift +++ b/Yattee/Views/Settings/EditSourceView.swift @@ -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 diff --git a/Yattee/Views/Settings/InstanceLoginView.swift b/Yattee/Views/Settings/InstanceLoginView.swift index 1b463c91..9ab2190d 100644 --- a/Yattee/Views/Settings/InstanceLoginView.swift +++ b/Yattee/Views/Settings/InstanceLoginView.swift @@ -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 {