Add login background to tvOS

This commit is contained in:
David Ullmer 2022-07-12 10:35:34 +02:00
parent be66d1008e
commit 270b0802c9
2 changed files with 38 additions and 28 deletions

View File

@ -25,6 +25,7 @@ final class UserSignInViewModel: ViewModel {
init(server: SwiftfinStore.State.Server) {
self.server = server
JellyfinAPIAPI.basePath = server.currentURI
}
var alertTitle: String {
@ -58,7 +59,6 @@ final class UserSignInViewModel: ViewModel {
func loadUsers() {
self.isLoadingUsers = true
JellyfinAPIAPI.basePath = server.currentURI
UserAPI.getPublicUsers()
.sink(receiveCompletion: { completion in
self.handleAPIRequestError(displayMessage: L10n.unableToConnectServer, completion: completion)
@ -76,4 +76,9 @@ final class UserSignInViewModel: ViewModel {
quality: 90).URLString
return URL(string: urlString)
}
func getSplashscreenUrl() -> URL? {
let urlString = ImageAPI.getSplashscreenWithRequestBuilder().URLString
return URL(string: urlString)
}
}

View File

@ -19,8 +19,12 @@ struct UserSignInView: View {
private var password: String = ""
var body: some View {
ZStack {
ImageView(viewModel.getSplashscreenUrl())
.ignoresSafeArea()
Color.black.opacity(0.9)
.ignoresSafeArea()
Form {
Section {
TextField(L10n.username, text: $username)
.disableAutocorrection(true)
@ -54,4 +58,5 @@ struct UserSignInView: View {
}
.navigationTitle(L10n.signIn)
}
}
}