Run SwiftFormat.

This commit is contained in:
Doug
2026-05-27 14:38:50 +01:00
committed by Doug
parent 5138e05e47
commit fa67713726
573 changed files with 2426 additions and 2426 deletions
@@ -10,10 +10,10 @@ import SwiftUI
struct SoftLogoutScreen: View {
@State private var showingClearDataConfirmation = false
/// The focus state of the password text field.
@FocusState private var isPasswordFocused: Bool
@Bindable var context: SoftLogoutScreenViewModel.Context
var body: some View {
@@ -22,7 +22,7 @@ struct SoftLogoutScreen: View {
header
.padding(.top, UIConstants.titleTopPaddingToNavigationBar)
.padding(.bottom, 36)
switch context.viewState.loginMode {
case .password:
loginForm
@@ -31,7 +31,7 @@ struct SoftLogoutScreen: View {
default:
loginUnavailableText
}
clearDataForm
.padding(.top, 16)
}
@@ -45,7 +45,7 @@ struct SoftLogoutScreen: View {
context.send(viewAction: .updateWindow(window))
}
}
/// The title, message and icon at the top of the screen.
var header: some View {
VStack(alignment: .leading, spacing: 16) {
@@ -54,13 +54,13 @@ struct SoftLogoutScreen: View {
.multilineTextAlignment(.leading)
.foregroundColor(.compound.textPrimary)
.accessibilityIdentifier(A11yIdentifiers.softLogoutScreen.title)
Text(UntranslatedL10n.softLogoutSigninNotice(context.viewState.credentials.homeserverName, context.viewState.credentials.userDisplayName, context.viewState.credentials.userID))
.font(.compound.bodyLG)
.multilineTextAlignment(.leading)
.foregroundColor(.compound.textPrimary)
.accessibilityIdentifier(A11yIdentifiers.softLogoutScreen.message)
if context.viewState.showRecoverEncryptionKeysMessage {
Text(UntranslatedL10n.softLogoutSigninE2eWarningNotice)
.font(.compound.bodyLG)
@@ -69,7 +69,7 @@ struct SoftLogoutScreen: View {
}
}
}
/// The form with text fields for username and password, along with a submit button.
var loginForm: some View {
VStack(spacing: 14) {
@@ -80,7 +80,7 @@ struct SoftLogoutScreen: View {
.submitLabel(.done)
.onSubmit(submit)
.accessibilityIdentifier(A11yIdentifiers.softLogoutScreen.password)
Button { context.send(viewAction: .forgotPassword) } label: {
Text(L10n.actionForgotPassword)
.font(.compound.bodyLG)
@@ -88,7 +88,7 @@ struct SoftLogoutScreen: View {
.frame(maxWidth: .infinity, alignment: .trailing)
.padding(.bottom, 8)
.accessibilityIdentifier(A11yIdentifiers.softLogoutScreen.forgotPassword)
Button(action: submit) {
Text(L10n.actionNext)
}
@@ -97,7 +97,7 @@ struct SoftLogoutScreen: View {
.accessibilityIdentifier(A11yIdentifiers.softLogoutScreen.next)
}
}
/// The OAuth button that can be used for login.
var oAuthButton: some View {
Button { context.send(viewAction: .continueWithOAuth) } label: {
@@ -105,7 +105,7 @@ struct SoftLogoutScreen: View {
}
.buttonStyle(.compound(.primary))
}
/// Text shown if neither password or OAuth login is supported.
var loginUnavailableText: some View {
Text(L10n.screenLoginErrorUnsupportedAuthentication)
@@ -114,7 +114,7 @@ struct SoftLogoutScreen: View {
.foregroundColor(.compound.textPrimary)
.frame(maxWidth: .infinity)
}
/// The text field and submit button where the user enters an email address.
var clearDataForm: some View {
VStack(alignment: .leading, spacing: 12) {
@@ -123,14 +123,14 @@ struct SoftLogoutScreen: View {
.multilineTextAlignment(.leading)
.foregroundColor(.compound.textPrimary)
.accessibilityIdentifier(A11yIdentifiers.softLogoutScreen.clearDataTitle)
Text(UntranslatedL10n.softLogoutClearDataNotice)
.font(.compound.bodyLG)
.multilineTextAlignment(.leading)
.foregroundColor(.compound.textPrimary)
.accessibilityIdentifier(A11yIdentifiers.softLogoutScreen.clearDataMessage)
.padding(.bottom, 12)
Button(role: .destructive, action: clearData) {
Text(UntranslatedL10n.softLogoutClearDataSubmit)
}
@@ -146,13 +146,13 @@ struct SoftLogoutScreen: View {
}
}
}
/// Sends the `login` view action so long as a valid email address has been input.
func submit() {
guard context.viewState.canSubmit else { return }
context.send(viewAction: .login)
}
/// Sends the `clearAllData` view action.
func clearData() {
context.send(viewAction: .clearAllData)
@@ -167,7 +167,7 @@ struct SoftLogoutScreen_Previews: PreviewProvider, TestablePreview {
screen(for: state.viewModel)
}
}
static func screen(for viewModel: SoftLogoutScreenViewModel) -> some View {
ElementNavigationStack {
SoftLogoutScreen(context: viewModel.context)