Format code
This commit is contained in:
parent
9250dc650d
commit
fcc022ea22
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
import CoreStore
|
import CoreStore
|
||||||
import Foundation
|
import Foundation
|
||||||
import Stinsen
|
|
||||||
import JellyfinAPI
|
import JellyfinAPI
|
||||||
|
import Stinsen
|
||||||
|
|
||||||
final class UserSignInViewModel: ViewModel {
|
final class UserSignInViewModel: ViewModel {
|
||||||
|
|
||||||
|
|
|
@ -6,24 +6,24 @@
|
||||||
// Copyright (c) 2022 Jellyfin & Jellyfin Contributors
|
// Copyright (c) 2022 Jellyfin & Jellyfin Contributors
|
||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
import JellyfinAPI
|
import JellyfinAPI
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
struct UserLoginCellView: View {
|
struct UserLoginCellView: View {
|
||||||
|
|
||||||
@State
|
@State
|
||||||
private var expanded = false;
|
private var expanded = false
|
||||||
|
|
||||||
@State
|
@State
|
||||||
private var enteredPassword: String = ""
|
private var enteredPassword: String = ""
|
||||||
|
|
||||||
var user: UserDto
|
var user: UserDto
|
||||||
var baseURL: String?
|
var baseURL: String?
|
||||||
var loginTapped : (String, String) -> Void
|
var loginTapped: (String, String) -> Void
|
||||||
var cancelTapped: () -> Void
|
var cancelTapped: () -> Void
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
DisclosureGroup() {
|
DisclosureGroup {
|
||||||
VStack(alignment: .leading, spacing: 16) {
|
VStack(alignment: .leading, spacing: 16) {
|
||||||
SecureField(L10n.password, text: $enteredPassword)
|
SecureField(L10n.password, text: $enteredPassword)
|
||||||
Button {
|
Button {
|
||||||
|
@ -35,8 +35,7 @@ struct UserLoginCellView: View {
|
||||||
.padding(.leading, -16)
|
.padding(.leading, -16)
|
||||||
} label: {
|
} label: {
|
||||||
HStack(spacing: 4.0) {
|
HStack(spacing: 4.0) {
|
||||||
AsyncImage(
|
AsyncImage(url: getProfileImageUrl(),
|
||||||
url: getProfileImageUrl(),
|
|
||||||
content: { image in
|
content: { image in
|
||||||
image.resizable()
|
image.resizable()
|
||||||
.aspectRatio(contentMode: .fit)
|
.aspectRatio(contentMode: .fit)
|
||||||
|
|
|
@ -22,17 +22,17 @@ struct UserSignInView: View {
|
||||||
List {
|
List {
|
||||||
#if !os(tvOS)
|
#if !os(tvOS)
|
||||||
// DisclosureGroup not available on tvOS
|
// DisclosureGroup not available on tvOS
|
||||||
if (viewModel.users.count > 0) {
|
if !viewModel.users.isEmpty {
|
||||||
Section(header: L10n.knownUsers.text) {
|
Section(header: L10n.knownUsers.text) {
|
||||||
ForEach(viewModel.users, id: \.id) { user in
|
ForEach(viewModel.users, id: \.id) { user in
|
||||||
UserLoginCellView(user: user, baseURL: viewModel.server.currentURI, loginTapped: viewModel.login, cancelTapped: viewModel.cancelSignIn)
|
UserLoginCellView(user: user, baseURL: viewModel.server.currentURI, loginTapped: viewModel.login,
|
||||||
|
cancelTapped: viewModel.cancelSignIn)
|
||||||
.disabled(viewModel.isLoading)
|
.disabled(viewModel.isLoading)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
TextField(L10n.username, text: $username)
|
TextField(L10n.username, text: $username)
|
||||||
.disableAutocorrection(true)
|
.disableAutocorrection(true)
|
||||||
|
|
Loading…
Reference in New Issue