mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-02 14:16:59 +02:00
Add login screen.
This commit is contained in:
+3
-29
@@ -90,35 +90,9 @@ struct AuthenticationRegistrationScreen: View {
|
||||
|
||||
/// The sever information section that includes a button to select a different server.
|
||||
var serverInfo: some View {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(VectorL10n.authenticationRegistrationServerTitle)
|
||||
.font(theme.fonts.subheadline)
|
||||
.foregroundColor(theme.colors.secondaryContent)
|
||||
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
Text(viewModel.viewState.homeserverAddress)
|
||||
.font(theme.fonts.body)
|
||||
.foregroundColor(theme.colors.primaryContent)
|
||||
|
||||
if let serverDescription = viewModel.viewState.serverDescription {
|
||||
Text(serverDescription)
|
||||
.font(theme.fonts.caption1)
|
||||
.foregroundColor(theme.colors.tertiaryContent)
|
||||
.accessibilityIdentifier("serverDescriptionText")
|
||||
}
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Button { viewModel.send(viewAction: .selectServer) } label: {
|
||||
Text(VectorL10n.edit)
|
||||
.font(theme.fonts.body)
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 6)
|
||||
.overlay(RoundedRectangle(cornerRadius: 8).stroke(theme.colors.accent))
|
||||
}
|
||||
}
|
||||
AuthenticationServerInfoSection(address: viewModel.viewState.homeserverAddress,
|
||||
description: viewModel.viewState.serverDescription) {
|
||||
viewModel.send(viewAction: .selectServer)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
/// An button that displays the icon and name of an SSO provider.
|
||||
struct AuthenticationSSOButton: View {
|
||||
|
||||
// MARK: - Constants
|
||||
|
||||
enum Brand: String {
|
||||
case apple, facebook, github, gitlab, google, twitter
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
@Environment(\.theme) private var theme
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
let provider: SSOIdentityProvider
|
||||
let action: () -> Void
|
||||
|
||||
// MARK: - Views
|
||||
|
||||
var body: some View {
|
||||
Button(action: action) {
|
||||
HStack {
|
||||
icon
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
Text(VectorL10n.socialLoginButtonTitleContinue(provider.name))
|
||||
.foregroundColor(theme.colors.primaryContent)
|
||||
.multilineTextAlignment(.center)
|
||||
.layoutPriority(1)
|
||||
|
||||
icon
|
||||
.frame(minWidth: 0, maxWidth: .infinity, alignment: .trailing)
|
||||
.opacity(0)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.contentShape(RoundedRectangle(cornerRadius: 8))
|
||||
}
|
||||
.buttonStyle(SecondaryActionButtonStyle(customColor: theme.colors.quinaryContent))
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
var icon: some View {
|
||||
switch provider.brand {
|
||||
case Brand.apple.rawValue:
|
||||
Image(Asset.Images.authenticationSsoIconApple.name)
|
||||
.renderingMode(.template)
|
||||
.foregroundColor(theme.colors.primaryContent)
|
||||
case Brand.facebook.rawValue:
|
||||
Image(Asset.Images.authenticationSsoIconFacebook.name)
|
||||
case Brand.github.rawValue:
|
||||
Image(Asset.Images.authenticationSsoIconGithub.name)
|
||||
.renderingMode(.template)
|
||||
.foregroundColor(theme.colors.primaryContent)
|
||||
case Brand.gitlab.rawValue:
|
||||
Image(Asset.Images.authenticationSsoIconGitlab.name)
|
||||
case Brand.google.rawValue:
|
||||
Image(Asset.Images.authenticationSsoIconGoogle.name)
|
||||
case Brand.twitter.rawValue:
|
||||
Image(Asset.Images.authenticationSsoIconTwitter.name)
|
||||
default:
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user