diff --git a/Shared/ViewModels/UserSignInViewModel.swift b/Shared/ViewModels/UserSignInViewModel.swift index ba96db73..32e037b3 100644 --- a/Shared/ViewModels/UserSignInViewModel.swift +++ b/Shared/ViewModels/UserSignInViewModel.swift @@ -22,6 +22,7 @@ final class UserSignInViewModel: ViewModel { init(server: SwiftfinStore.State.Server) { self.server = server + JellyfinAPIAPI.basePath = server.currentURI } var alertTitle: String { @@ -54,7 +55,6 @@ final class UserSignInViewModel: ViewModel { } func loadUsers() { - JellyfinAPIAPI.basePath = server.currentURI UserAPI.getPublicUsers() .trackActivity(loading) .sink(receiveCompletion: { completion in @@ -72,4 +72,9 @@ final class UserSignInViewModel: ViewModel { quality: 90).URLString return URL(string: urlString) } + + func getSplashscreenUrl() -> URL? { + let urlString = ImageAPI.getSplashscreenWithRequestBuilder().URLString + return URL(string: urlString) + } } diff --git a/Swiftfin tvOS/Views/UserSignInView.swift b/Swiftfin tvOS/Views/UserSignInView.swift index b779f7bb..03f7aa0d 100644 --- a/Swiftfin tvOS/Views/UserSignInView.swift +++ b/Swiftfin tvOS/Views/UserSignInView.swift @@ -19,39 +19,47 @@ struct UserSignInView: View { private var password: String = "" var body: some View { - Form { + ZStack { + ImageView(viewModel.getSplashscreenUrl()) + .ignoresSafeArea() - Section { - TextField(L10n.username, text: $username) - .disableAutocorrection(true) - .autocapitalization(.none) + Color.black + .opacity(0.9) + .ignoresSafeArea() - SecureField(L10n.password, text: $password) - .disableAutocorrection(true) - .autocapitalization(.none) + Form { + Section { + TextField(L10n.username, text: $username) + .disableAutocorrection(true) + .autocapitalization(.none) - Button { - viewModel.login(username: username, password: password) - } label: { - HStack { - L10n.connect.text - Spacer() - if viewModel.isLoading { - ProgressView() + SecureField(L10n.password, text: $password) + .disableAutocorrection(true) + .autocapitalization(.none) + + Button { + viewModel.login(username: username, password: password) + } label: { + HStack { + L10n.connect.text + Spacer() + if viewModel.isLoading { + ProgressView() + } } } - } - .disabled(viewModel.isLoading || username.isEmpty) + .disabled(viewModel.isLoading || username.isEmpty) - } header: { - L10n.signInToServer(viewModel.server.name).text + } header: { + L10n.signInToServer(viewModel.server.name).text + } } + .alert(item: $viewModel.errorMessage) { _ in + Alert(title: Text(viewModel.alertTitle), + message: Text(viewModel.errorMessage?.message ?? L10n.unknownError), + dismissButton: .cancel()) + } + .navigationTitle(L10n.signIn) } - .alert(item: $viewModel.errorMessage) { _ in - Alert(title: Text(viewModel.alertTitle), - message: Text(viewModel.errorMessage?.message ?? L10n.unknownError), - dismissButton: .cancel()) - } - .navigationTitle(L10n.signIn) } } diff --git a/Translations/ja.lproj/Localizable.strings b/Translations/ja.lproj/Localizable.strings index ed60b89c..5dbdb718 100644 Binary files a/Translations/ja.lproj/Localizable.strings and b/Translations/ja.lproj/Localizable.strings differ