Skip to content

Commit

Permalink
Merge branch 'develop' into discussions-ui-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rnr committed Mar 22, 2024
2 parents 7f8e35d + 6f1ec1b commit d21a3bd
Show file tree
Hide file tree
Showing 52 changed files with 2,679 additions and 2,268 deletions.
205 changes: 104 additions & 101 deletions Authorization/Authorization/Presentation/Login/SignInView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,117 +56,120 @@ public struct SignInView: View {
.padding(.bottom, isHorizontal ? 10 : 40)
.accessibilityIdentifier("logo_image")

ScrollView {
VStack {
VStack(alignment: .leading) {
Text(AuthLocalization.SignIn.logInTitle)
.font(Theme.Fonts.displaySmall)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.bottom, 4)
.accessibilityIdentifier("signin_text")
Text(AuthLocalization.SignIn.welcomeBack)
.font(Theme.Fonts.titleSmall)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.bottom, 20)
.accessibilityIdentifier("welcome_back_text")

Text(AuthLocalization.SignIn.emailOrUsername)
.font(Theme.Fonts.labelLarge)
.foregroundColor(Theme.Colors.textPrimary)
.accessibilityIdentifier("username_text")
TextField(AuthLocalization.SignIn.emailOrUsername, text: $email)
.font(Theme.Fonts.bodyLarge)
.foregroundColor(Theme.Colors.textPrimary)
.keyboardType(.emailAddress)
.textContentType(.emailAddress)
.autocapitalization(.none)
.autocorrectionDisabled()
.padding(.all, 14)
.background(
Theme.Shapes.textInputShape
.fill(Theme.Colors.textInputBackground)
)
.overlay(
Theme.Shapes.textInputShape
.stroke(lineWidth: 1)
.fill(Theme.Colors.textInputStroke)
)
.accessibilityIdentifier("username_textfield")

Text(AuthLocalization.SignIn.password)
.font(Theme.Fonts.labelLarge)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.top, 18)
.accessibilityIdentifier("password_text")
SecureField(AuthLocalization.SignIn.password, text: $password)
.font(Theme.Fonts.bodyLarge)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.all, 14)
.background(
Theme.Shapes.textInputShape
.fill(Theme.Colors.textInputBackground)
)
.overlay(
Theme.Shapes.textInputShape
.stroke(lineWidth: 1)
.fill(Theme.Colors.textInputStroke)
)
.accessibilityIdentifier("password_textfield")
HStack {
if !viewModel.config.features.startupScreenEnabled {
Button(CoreLocalization.SignIn.registerBtn) {
viewModel.router.showRegisterScreen(sourceScreen: viewModel.sourceScreen)
GeometryReader { proxy in
ScrollView {
VStack {
VStack(alignment: .leading) {
Text(AuthLocalization.SignIn.logInTitle)
.font(Theme.Fonts.displaySmall)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.bottom, 4)
.accessibilityIdentifier("signin_text")
Text(AuthLocalization.SignIn.welcomeBack)
.font(Theme.Fonts.titleSmall)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.bottom, 20)
.accessibilityIdentifier("welcome_back_text")

Text(AuthLocalization.SignIn.emailOrUsername)
.font(Theme.Fonts.labelLarge)
.foregroundColor(Theme.Colors.textPrimary)
.accessibilityIdentifier("username_text")
TextField(AuthLocalization.SignIn.emailOrUsername, text: $email)
.font(Theme.Fonts.bodyLarge)
.foregroundColor(Theme.Colors.textPrimary)
.keyboardType(.emailAddress)
.textContentType(.emailAddress)
.autocapitalization(.none)
.autocorrectionDisabled()
.padding(.all, 14)
.background(
Theme.Shapes.textInputShape
.fill(Theme.Colors.textInputBackground)
)
.overlay(
Theme.Shapes.textInputShape
.stroke(lineWidth: 1)
.fill(Theme.Colors.textInputStroke)
)
.accessibilityIdentifier("username_textfield")

Text(AuthLocalization.SignIn.password)
.font(Theme.Fonts.labelLarge)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.top, 18)
.accessibilityIdentifier("password_text")
SecureField(AuthLocalization.SignIn.password, text: $password)
.font(Theme.Fonts.bodyLarge)
.foregroundColor(Theme.Colors.textPrimary)
.padding(.all, 14)
.background(
Theme.Shapes.textInputShape
.fill(Theme.Colors.textInputBackground)
)
.overlay(
Theme.Shapes.textInputShape
.stroke(lineWidth: 1)
.fill(Theme.Colors.textInputStroke)
)
.accessibilityIdentifier("password_textfield")
HStack {
if !viewModel.config.features.startupScreenEnabled {
Button(CoreLocalization.SignIn.registerBtn) {
viewModel.router.showRegisterScreen(sourceScreen: viewModel.sourceScreen)
}
.foregroundColor(Theme.Colors.accentColor)
.accessibilityIdentifier("register_button")

Spacer()
}
.foregroundColor(Theme.Colors.accentColor)
.accessibilityIdentifier("register_button")

Spacer()
Button(AuthLocalization.SignIn.forgotPassBtn) {
viewModel.trackForgotPasswordClicked()
viewModel.router.showForgotPasswordScreen()
}
.font(Theme.Fonts.bodyLarge)
.foregroundColor(Theme.Colors.accentXColor)
.padding(.top, 0)
.accessibilityIdentifier("forgot_password_button")
}

Button(AuthLocalization.SignIn.forgotPassBtn) {
viewModel.trackForgotPasswordClicked()
viewModel.router.showForgotPasswordScreen()

if viewModel.isShowProgress {
HStack(alignment: .center) {
ProgressBar(size: 40, lineWidth: 8)
.padding(20)
.accessibilityIdentifier("progressbar")
}.frame(maxWidth: .infinity)
} else {
StyledButton(CoreLocalization.SignIn.logInBtn) {
Task {
await viewModel.login(username: email, password: password)
}
}
.frame(maxWidth: .infinity)
.padding(.top, 40)
.accessibilityIdentifier("signin_button")
}
.font(Theme.Fonts.bodyLarge)
.foregroundColor(Theme.Colors.accentXColor)
.padding(.top, 0)
.accessibilityIdentifier("forgot_password_button")
}

if viewModel.isShowProgress {
HStack(alignment: .center) {
ProgressBar(size: 40, lineWidth: 8)
.padding(20)
.accessibilityIdentifier("progressbar")
}.frame(maxWidth: .infinity)
} else {
StyledButton(CoreLocalization.SignIn.logInBtn) {
Task {
await viewModel.login(username: email, password: password)
if viewModel.socialAuthEnabled {
SocialAuthView(
viewModel: .init(
config: viewModel.config
) { result in
Task { await viewModel.login(with: result) }
}
}
.frame(maxWidth: .infinity)
.padding(.top, 40)
.accessibilityIdentifier("signin_button")
)
}
agreements
Spacer()
}
if viewModel.socialAuthEnabled {
SocialAuthView(
viewModel: .init(
config: viewModel.config
) { result in
Task { await viewModel.login(with: result) }
}
)
}
agreements
Spacer()
.padding(.horizontal, 24)
.padding(.top, 50)
.frameLimit(width: proxy.size.width)
}
.padding(.horizontal, 24)
.padding(.top, 50)
}.roundedBackground(Theme.Colors.loginBackground)
.roundedBackground(Theme.Colors.loginBackground)
.scrollAvoidKeyboard(dismissKeyboardByTap: true)

}
}

// MARK: - Alert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public struct SignUpView: View {
}
.padding(.horizontal, 24)
.padding(.top, 24)

.frameLimit(width: proxy.size.width)
}
.roundedBackground(Theme.Colors.background)
.onRightSwipeGesture {
Expand Down
Loading

0 comments on commit d21a3bd

Please sign in to comment.