116 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			116 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
//
 | 
						|
//  FindPasswordView.swift
 | 
						|
//  SodaLive
 | 
						|
//
 | 
						|
//  Created by klaus on 2023/08/09.
 | 
						|
//
 | 
						|
 | 
						|
import SwiftUI
 | 
						|
 | 
						|
struct FindPasswordView: View {
 | 
						|
    
 | 
						|
    @StateObject var viewModel = FindPasswordViewModel()
 | 
						|
    @StateObject var keyboardHandler = KeyboardHandler()
 | 
						|
    @FocusState private var isFocused: Bool
 | 
						|
    
 | 
						|
    var body: some View {
 | 
						|
        BaseView(isLoading: $viewModel.isLoading) {
 | 
						|
            GeometryReader { proxy in
 | 
						|
                VStack(spacing: 0) {
 | 
						|
                    DetailNavigationBar(title: "비밀번호 재설정")
 | 
						|
                    
 | 
						|
                    ScrollView(.vertical, showsIndicators: false) {
 | 
						|
                        VStack(spacing: 0) {
 | 
						|
                            Text("회원가입한 이메일 주소로\n임시 비밀번호를 보내드립니다.")
 | 
						|
                                .font(.custom(Font.bold.rawValue, size: 16))
 | 
						|
                                .foregroundColor(Color(hex: "eeeeee"))
 | 
						|
                                .multilineTextAlignment(.center)
 | 
						|
                                .lineSpacing(6)
 | 
						|
                                .padding(.top, 40)
 | 
						|
                                .padding(.horizontal, 26.7)
 | 
						|
                            
 | 
						|
                            Text("임시 비밀번호로 로그인 후\n마이페이지 > 프로필 설정에서\n비밀번호를 변경하고 이용하세요.")
 | 
						|
                                .font(.custom(Font.medium.rawValue, size: 12))
 | 
						|
                                .foregroundColor(Color(hex: "909090"))
 | 
						|
                                .multilineTextAlignment(.center)
 | 
						|
                                .lineSpacing(6)
 | 
						|
                                .padding(.top, 40)
 | 
						|
                                .padding(.horizontal, 26.7)
 | 
						|
                            
 | 
						|
                            TextField("이메일을 입력하세요", text: $viewModel.email)
 | 
						|
                                .focused($isFocused)
 | 
						|
                                .autocapitalization(.none)
 | 
						|
                                .disableAutocorrection(true)
 | 
						|
                                .font(.custom(Font.medium.rawValue, size: 15))
 | 
						|
                                .foregroundColor(.grayee)
 | 
						|
                                .keyboardType(.emailAddress)
 | 
						|
                                .padding(.vertical, 18)
 | 
						|
                                .padding(.horizontal, 13.3)
 | 
						|
                                .frame(height: 56)
 | 
						|
                                .background(RoundedRectangle(cornerRadius: 6.7).fill(Color.gray33.opacity(0.7)))
 | 
						|
                                .padding(.top, 40)
 | 
						|
                                .padding(.horizontal, 26.7)
 | 
						|
                                .onTapGesture {
 | 
						|
                                    isFocused = true
 | 
						|
                                }
 | 
						|
                            
 | 
						|
                            Text("임시 비밀번호 받기")
 | 
						|
                                .font(.custom(Font.bold.rawValue, size: 18.3))
 | 
						|
                                .foregroundColor(Color.white)
 | 
						|
                                .frame(maxWidth: proxy.size.width - 26.7)
 | 
						|
                                .padding(.vertical, 16)
 | 
						|
                                .background(Color.button)
 | 
						|
                                .cornerRadius(6.7)
 | 
						|
                                .padding(.top, 60)
 | 
						|
                                .onTapGesture { viewModel.findPassword() }
 | 
						|
                            
 | 
						|
                            HStack(spacing: 13.3) {
 | 
						|
                                Image("ic_headphones_blue")
 | 
						|
                                
 | 
						|
                                Text("고객센터로 문의하기")
 | 
						|
                                    .font(.custom(Font.medium.rawValue, size: 13.3))
 | 
						|
                                    .foregroundColor(.button)
 | 
						|
                            }
 | 
						|
                            .padding(.vertical, 10.7)
 | 
						|
                            .padding(.horizontal, 18.7)
 | 
						|
                            .overlay(
 | 
						|
                                RoundedRectangle(cornerRadius: 8)
 | 
						|
                                    .stroke(Color.button, lineWidth: 1)
 | 
						|
                            )
 | 
						|
                            .padding(.top, 93)
 | 
						|
                            .onTapGesture {
 | 
						|
                                UIApplication.shared.open(URL(string: "http://pf.kakao.com/_lkxgxhG/chat")!)
 | 
						|
                            }
 | 
						|
                        }
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                .onAppear {
 | 
						|
                    isFocused = true
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
        .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) {
 | 
						|
            HStack {
 | 
						|
                Spacer()
 | 
						|
                Text(viewModel.errorMessage)
 | 
						|
                    .padding(.vertical, 13.3)
 | 
						|
                    .padding(.horizontal, 13.3)
 | 
						|
                    .frame(width: screenSize().width - 66.7, alignment: .center)
 | 
						|
                    .font(.custom(Font.medium.rawValue, size: 12))
 | 
						|
                    .background(Color(hex: "9970ff"))
 | 
						|
                    .foregroundColor(Color.white)
 | 
						|
                    .multilineTextAlignment(.leading)
 | 
						|
                    .cornerRadius(20)
 | 
						|
                    .padding(.bottom, 66.7)
 | 
						|
                Spacer()
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
struct FindPasswordView_Previews: PreviewProvider {
 | 
						|
    static var previews: some View {
 | 
						|
        FindPasswordView()
 | 
						|
    }
 | 
						|
}
 |