|
|
|
// Copyright © 2023 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
import SessionUIKit
|
|
|
|
|
|
|
|
struct DisplayNameView: View {
|
|
|
|
@Environment(\.viewController) private var viewControllerHolder: UIViewController?
|
|
|
|
|
|
|
|
@State private var displayName: String = ""
|
|
|
|
|
|
|
|
private let flow: Onboarding.Flow
|
|
|
|
|
|
|
|
public init(flow: Onboarding.Flow) {
|
|
|
|
self.flow = flow
|
|
|
|
}
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
NavigationView {
|
|
|
|
ZStack(alignment: .center) {
|
|
|
|
if #available(iOS 14.0, *) {
|
|
|
|
ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary).ignoresSafeArea()
|
|
|
|
} else {
|
|
|
|
ThemeManager.currentTheme.colorSwiftUI(for: .backgroundPrimary)
|
|
|
|
}
|
|
|
|
|
|
|
|
VStack(
|
|
|
|
alignment: .leading,
|
|
|
|
spacing: Values.mediumSpacing
|
|
|
|
) {
|
|
|
|
Spacer()
|
|
|
|
|
|
|
|
Text("vc_display_name_title_2".localized())
|
|
|
|
.bold()
|
|
|
|
.font(.system(size: Values.veryLargeFontSize))
|
|
|
|
.foregroundColor(themeColor: .textPrimary)
|
|
|
|
.padding(.vertical, Values.mediumSpacing)
|
|
|
|
|
|
|
|
Text("onboarding_display_name_explanation".localized())
|
|
|
|
.font(.system(size: Values.smallFontSize))
|
|
|
|
.foregroundColor(themeColor: .textPrimary)
|
|
|
|
.padding(.vertical, Values.mediumSpacing)
|
|
|
|
|
|
|
|
SessionTextField(
|
|
|
|
$displayName,
|
|
|
|
placeholder: "onboarding_display_name_hint".localized()
|
|
|
|
)
|
|
|
|
|
|
|
|
Spacer()
|
|
|
|
}
|
|
|
|
.padding(.horizontal, Values.veryLargeSpacing)
|
|
|
|
.padding(.bottom, Values.massiveSpacing + Values.largeButtonHeight)
|
|
|
|
|
|
|
|
VStack() {
|
|
|
|
Spacer()
|
|
|
|
|
|
|
|
Button {
|
|
|
|
|
|
|
|
} label: {
|
|
|
|
Text("continue_2".localized())
|
|
|
|
.bold()
|
|
|
|
.font(.system(size: Values.smallFontSize))
|
|
|
|
.foregroundColor(themeColor: .sessionButton_text)
|
|
|
|
.frame(
|
|
|
|
maxWidth: .infinity,
|
|
|
|
maxHeight: Values.largeButtonHeight,
|
|
|
|
alignment: .center
|
|
|
|
)
|
|
|
|
.overlay(
|
|
|
|
Capsule()
|
|
|
|
.stroke(themeColor: .sessionButton_border)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
.padding(.horizontal, Values.massiveSpacing)
|
|
|
|
}
|
|
|
|
.padding(.vertical, Values.mediumSpacing)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct DisplayNameView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
DisplayNameView(flow: .register)
|
|
|
|
}
|
|
|
|
}
|