Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge :: 비밀번호 변경 UI 구현 #107

Merged
merged 31 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
98a6bdb
feat :: RenewalPasswordFeature 생성
kimdaehee0824 Oct 23, 2022
47cf644
feat :: view file 생성
kimdaehee0824 Oct 23, 2022
3ebda15
merge :: develop에서 풀 받음
kimdaehee0824 Oct 25, 2022
2283d1f
style :: 주석 제거 후 린트에 맞게 변경
kimdaehee0824 Oct 26, 2022
632da45
Merge remote-tracking branch 'origin/develop' into 79-renewal-passwor…
kimdaehee0824 Oct 26, 2022
fcbeb62
Merge remote-tracking branch 'origin/develop' into 79-renewal-passwor…
kimdaehee0824 Oct 26, 2022
52d83bf
Merge remote-tracking branch 'origin/develop' into 79-renewal-passwor…
kimdaehee0824 Oct 27, 2022
fca112a
feat :: needle
kimdaehee0824 Oct 27, 2022
29ab511
Merge remote-tracking branch 'origin/develop' into 79-renewal-passwor…
kimdaehee0824 Oct 27, 2022
1a5cc00
feat :: AuthenticationEmail 관련 구현
kimdaehee0824 Oct 27, 2022
ed442e5
feat :: 폴더링 다시 하기
kimdaehee0824 Oct 27, 2022
528a182
feat :: ChangePasswordParm
kimdaehee0824 Oct 27, 2022
1a24c70
feat :: AuthenticationEmailParam lint 지킴
kimdaehee0824 Oct 27, 2022
3a43de4
feat :: ChangePasswordViewModel
kimdaehee0824 Oct 27, 2022
0179bdb
feat :: ChangePasswordView
kimdaehee0824 Oct 27, 2022
b73c182
feat :: ChangePasswordComponent
kimdaehee0824 Oct 27, 2022
929622d
feat :: Needle
kimdaehee0824 Oct 27, 2022
50060b4
Merge remote-tracking branch 'origin/develop' into 79-renewal-passwor…
kimdaehee0824 Oct 27, 2022
a1af66d
feat ::EnterInformationView navigate
kimdaehee0824 Oct 27, 2022
a41afcb
feat :: AuthenticationEmail navigate
kimdaehee0824 Oct 27, 2022
cf68c78
feat :: needle
kimdaehee0824 Oct 27, 2022
730c4d1
Merge remote-tracking branch 'origin/develop' into 79-renewal-passwor…
kimdaehee0824 Oct 27, 2022
52edc93
feat :: 뭔가 머지 잘못되서 수정
kimdaehee0824 Oct 27, 2022
0335b7d
feat :: 비밀번호 설정 글자 관련 퍼블리싱
kimdaehee0824 Oct 27, 2022
53c9721
feat :: 같은거 선언한거 하나 지우기
kimdaehee0824 Oct 27, 2022
9809093
fix :: type password로 변경
kimdaehee0824 Oct 28, 2022
ee85c4d
fix :: blockEmailView 죽이기
kimdaehee0824 Oct 28, 2022
c86695f
Update Projects/Features/RenewalPasswordFeature/Sources/EnterInformat…
kimdaehee0824 Oct 28, 2022
fa171c6
Merge remote-tracking branch 'origin/79-renewal-password-ui' into 79-…
kimdaehee0824 Oct 28, 2022
ecf288c
feat :: 이름 변경
kimdaehee0824 Oct 28, 2022
b4aa315
Merge remote-tracking branch 'origin/develop' into 79-renewal-passwor…
kimdaehee0824 Oct 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public extension TargetDependency {
public extension TargetDependency.Project.Features {
static let SignupFeature = TargetDependency.feature(name: "SignupFeature")
static let HomeFeature = TargetDependency.feature(name: "HomeFeature")
static let RenewalPasswordFeature = TargetDependency.feature(name: "RenewalPasswordFeature")
static let MainTabFeature = TargetDependency.feature(name: "MainTabFeature")
static let FindIDFeature = TargetDependency.feature(name: "FindIDFeature")
static let SigninFeature = TargetDependency.feature(name: "SigninFeature")
Expand Down
11 changes: 11 additions & 0 deletions Projects/App/Sources/Application/DI/AppComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import SignupFeature

import FindIDFeature
import SigninFeature
import RenewalPasswordFeature
import MainTabFeature
import HomeFeature

Expand Down Expand Up @@ -39,11 +40,21 @@ public extension AppComponent {
var signupEmailAuthCodeVerifyComponent: SignupEmailAuthCodeVerifyComponent {
SignupEmailAuthCodeVerifyComponent(parent: self)
}
var enterInformationComponent: EnterInformationComponent {
EnterInformationComponent(parent: self)
}
var authenticationEmailComponent: AuthenticationEmailComponent {
AuthenticationEmailComponent(parent: self)
}
var changePasswordComponent: ChangePasswordComponent {
ChangePasswordComponent(parent: self)
}
var signupProfileImageComponent: SignupProfileImageComponent {
SignupProfileImageComponent(parent: self)
}
var signupPasswordComponent: SignupPasswordComponent {
SignupPasswordComponent(parent: self)
}
var signupTermsComponent: SignupTermsComponent {
SignupTermsComponent(parent: self)
}
Expand Down
75 changes: 74 additions & 1 deletion Projects/App/Sources/Application/NeedleGenerated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import KeychainModule
import MainTabFeature
import NeedleFoundation
import NetworkModule
import RenewalPasswordFeature
import SigninFeature
import SignupFeature
import SwiftUI
Expand Down Expand Up @@ -155,6 +156,54 @@ private class HomeDependency443c4e1871277bd8432aProvider: HomeDependency {
private func factory67229cdf0f755562b2b1f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject {
return HomeDependency443c4e1871277bd8432aProvider(appComponent: parent1(component) as! AppComponent)
}
private class AuthenticationEmailDependency73189eb572618b10e0fbProvider: AuthenticationEmailDependency {
var verifyAuthCodeUseCase: any VerifyAuthCodeUseCase {
return appComponent.verifyAuthCodeUseCase
}
var sendAuthCodeUseCase: any SendAuthCodeUseCase {
return appComponent.sendAuthCodeUseCase
}
var changePasswordComponent: ChangePasswordComponent {
return appComponent.changePasswordComponent
}
private let appComponent: AppComponent
init(appComponent: AppComponent) {
self.appComponent = appComponent
}
}
/// ^->AppComponent->AuthenticationEmailComponent
private func factory8798d0becd9d2870112af47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject {
return AuthenticationEmailDependency73189eb572618b10e0fbProvider(appComponent: parent1(component) as! AppComponent)
}
private class ChangePasswordDependency04ab7ced24136c4fb27eProvider: ChangePasswordDependency {
var renewalPasswordUseCase: any RenewalPasswordUseCase {
return appComponent.renewalPasswordUseCase
}
private let appComponent: AppComponent
init(appComponent: AppComponent) {
self.appComponent = appComponent
}
}
/// ^->AppComponent->ChangePasswordComponent
private func factoryab7c4d87dab53e0a51b9f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject {
return ChangePasswordDependency04ab7ced24136c4fb27eProvider(appComponent: parent1(component) as! AppComponent)
}
private class EnterInformationDependency9204f24c784151f429ddProvider: EnterInformationDependency {
var checkAccountIDIsExistUseCase: any CheckAccountIDIsExistUseCase {
return appComponent.checkAccountIDIsExistUseCase
}
var authenticationEmailComponent: AuthenticationEmailComponent {
return appComponent.authenticationEmailComponent
}
private let appComponent: AppComponent
init(appComponent: AppComponent) {
self.appComponent = appComponent
}
}
/// ^->AppComponent->EnterInformationComponent
private func factory359a960501e79e833f64f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject {
return EnterInformationDependency9204f24c784151f429ddProvider(appComponent: parent1(component) as! AppComponent)
}
private class FindIDDependencyb481fe947a844cc29913Provider: FindIDDependency {
var findIDUseCase: any FindIDUseCase {
return appComponent.findIDUseCase
Expand Down Expand Up @@ -191,9 +240,12 @@ extension AppComponent: Registration {
localTable["schoolConfirmationQuestionsComponent-SchoolConfirmationQuestionsComponent"] = { self.schoolConfirmationQuestionsComponent as Any }
localTable["signupEmailVerifyComponent-SignupEmailVerifyComponent"] = { self.signupEmailVerifyComponent as Any }
localTable["signupEmailAuthCodeVerifyComponent-SignupEmailAuthCodeVerifyComponent"] = { self.signupEmailAuthCodeVerifyComponent as Any }
localTable["signupTermsComponent-SignupTermsComponent"] = { self.signupTermsComponent as Any }
localTable["enterInformationComponent-EnterInformationComponent"] = { self.enterInformationComponent as Any }
localTable["authenticationEmailComponent-AuthenticationEmailComponent"] = { self.authenticationEmailComponent as Any }
localTable["changePasswordComponent-ChangePasswordComponent"] = { self.changePasswordComponent as Any }
localTable["signupProfileImageComponent-SignupProfileImageComponent"] = { self.signupProfileImageComponent as Any }
localTable["signupPasswordComponent-SignupPasswordComponent"] = { self.signupPasswordComponent as Any }
localTable["signupTermsComponent-SignupTermsComponent"] = { self.signupTermsComponent as Any }
localTable["mainTabComponent-MainTabComponent"] = { self.mainTabComponent as Any }
localTable["homeComponent-HomeComponent"] = { self.homeComponent as Any }
localTable["remoteStudentsDataSource-any RemoteStudentsDataSource"] = { self.remoteStudentsDataSource as Any }
Expand Down Expand Up @@ -270,6 +322,24 @@ extension HomeComponent: Registration {
keyPathToName[\HomeDependency.fetchMealListUseCase] = "fetchMealListUseCase-any FetchMealListUseCase"
}
}
extension AuthenticationEmailComponent: Registration {
public func registerItems() {
keyPathToName[\AuthenticationEmailDependency.verifyAuthCodeUseCase] = "verifyAuthCodeUseCase-any VerifyAuthCodeUseCase"
keyPathToName[\AuthenticationEmailDependency.sendAuthCodeUseCase] = "sendAuthCodeUseCase-any SendAuthCodeUseCase"
keyPathToName[\AuthenticationEmailDependency.changePasswordComponent] = "changePasswordComponent-ChangePasswordComponent"
}
}
extension ChangePasswordComponent: Registration {
public func registerItems() {
keyPathToName[\ChangePasswordDependency.renewalPasswordUseCase] = "renewalPasswordUseCase-any RenewalPasswordUseCase"
}
}
extension EnterInformationComponent: Registration {
public func registerItems() {
keyPathToName[\EnterInformationDependency.checkAccountIDIsExistUseCase] = "checkAccountIDIsExistUseCase-any CheckAccountIDIsExistUseCase"
keyPathToName[\EnterInformationDependency.authenticationEmailComponent] = "authenticationEmailComponent-AuthenticationEmailComponent"
}
}
extension FindIDComponent: Registration {
public func registerItems() {
keyPathToName[\FindIDDependency.findIDUseCase] = "findIDUseCase-any FindIDUseCase"
Expand Down Expand Up @@ -303,6 +373,9 @@ private func register1() {
registerProviderFactory("^->AppComponent->MainTabComponent", factory1ab5a747ddf21e1393f9f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->SigninComponent", factory2882a056d84a613debccf47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->HomeComponent", factory67229cdf0f755562b2b1f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->AuthenticationEmailComponent", factory8798d0becd9d2870112af47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->ChangePasswordComponent", factoryab7c4d87dab53e0a51b9f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->EnterInformationComponent", factory359a960501e79e833f64f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->FindIDComponent", factory8dd2f9e0b545ead35ecaf47b58f8f304c97af4d5)
}
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
10 changes: 10 additions & 0 deletions Projects/Features/RenewalPasswordFeature/Project.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ProjectDescription
import ProjectDescriptionHelpers

let project = Project.makeModule(
name: "RenewalPasswordFeature",
product: .staticFramework,
dependencies: [
.Project.Features.BaseFeature
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import DomainModule
import NeedleFoundation
import SwiftUI

public protocol AuthenticationEmailDependency: Dependency {
var verifyAuthCodeUseCase: any VerifyAuthCodeUseCase { get }
var sendAuthCodeUseCase: any SendAuthCodeUseCase { get }
var changePasswordComponent: ChangePasswordComponent { get }

}

public final class AuthenticationEmailComponent: Component<AuthenticationEmailDependency> {
public func makeView(authenticationEmailParam: AuthenticationEmailParam) -> some View {
AuthenticationEmailView(
viewModel: .init(
sendAuthCodeUseCase: self.dependency.sendAuthCodeUseCase,
verifyAuthCodeUseCase: self.dependency.verifyAuthCodeUseCase,
authenticationEmailParam: authenticationEmailParam
),
changePasswordComponent: dependency.changePasswordComponent
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Foundation

public struct AuthenticationEmailParam: Equatable {
public init(
name: String,
email: String,
id: String
) {
self.name = name
self.email = email
self.id = id
}

public let name: String
public let email: String
public let id: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import SwiftUI
import DesignSystem

struct AuthenticationEmailView: View {
@StateObject var viewModel: AuthenticationEmailViewModel
let changePasswordComponent: ChangePasswordComponent
@Environment(\.dismiss) var dismiss

init(
viewModel: AuthenticationEmailViewModel,
changePasswordComponent: ChangePasswordComponent
) {
_viewModel = StateObject(wrappedValue: viewModel)
self.changePasswordComponent = changePasswordComponent
}

var body: some View {
VStack {
HStack {
VStack(alignment: .leading, spacing: 8) {
Text("DMS")
.dmsFont(.title(.extraLarge), color: .PrimaryVariant.primary)

Text("이메일 주소 입력")
.dmsFont(.text(.medium), color: .GrayScale.gray6)
}

Spacer()
}
.padding(.top, 24)

VStack(spacing: 40) {
DMSPassCodeView(codeCount: 6, text: $viewModel.authCode)

Text(viewModel.isErrorOcuured ? viewModel.errorMessage : "이메일로 전송된 인증코드 6자리를 입력해주세요.")
.dmsFont(.text(.small), color: viewModel.isErrorOcuured ? .System.error : .GrayScale.gray5)
}
.padding(.top, 60)

Text(viewModel.timeText)
.dmsFont(.text(.small), color: .PrimaryVariant.primary)
.padding(.top, 10)

Spacer()

DMSButton(text: "인증코드 재발송", style: .underline, color: .GrayScale.gray6) {
viewModel.sendEmailAuthCode()
}

DMSWideButton(text: "인증", color: .PrimaryVariant.primary) {
viewModel.verifyEmailAuthCode()
}
.padding(.top, 32)
.padding(.bottom, 40)
}
.padding(.horizontal, 24)
.onAppear {
UIApplication.shared.hideKeyboard()
viewModel.sendEmailAuthCode()
}
.dmsToast(isShowing: $viewModel.isShowingToast, message: viewModel.toastMessage, style: .success)
.navigate(
to: changePasswordComponent.makeView(
changePasswordParm: .init(
name: viewModel.authenticationEmailParam.name,
email: viewModel.authenticationEmailParam.email,
id: viewModel.authenticationEmailParam.id,
authCode: viewModel.authCode
)
),
when: $viewModel.isNavigateChangePassword
)
.dmsBackButton(dismiss: dismiss)

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import BaseFeature
import Combine
import DomainModule
import ErrorModule
import Foundation

final class AuthenticationEmailViewModel: BaseViewModel {
@Published var authCode = "" {
didSet { isErrorOcuured = false }
}
@Published var timeRemaining = 180
@Published var isShowingToast = false
@Published var toastMessage = ""
@Published var isNavigateChangePassword = false
private let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
var timeText: String {
timeRemaining % 60 < 10 ?
"\(timeRemaining/60):0\(timeRemaining%60)" :
"\(timeRemaining/60):\(timeRemaining%60)"
}

private let sendAuthCodeUseCase: any SendAuthCodeUseCase
private let verifyAuthCodeUseCase: any VerifyAuthCodeUseCase
let authenticationEmailParam: AuthenticationEmailParam

init(
sendAuthCodeUseCase: any SendAuthCodeUseCase,
verifyAuthCodeUseCase: any VerifyAuthCodeUseCase,
authenticationEmailParam: AuthenticationEmailParam
) {
self.sendAuthCodeUseCase = sendAuthCodeUseCase
self.verifyAuthCodeUseCase = verifyAuthCodeUseCase
self.authenticationEmailParam = authenticationEmailParam
super.init()

addCancellable(
timer.setFailureType(to: DmsError.self).eraseToAnyPublisher()
) { [weak self] _ in
guard let self, self.timeRemaining > 0 else { return }
self.timeRemaining -= 1
}
}

func sendEmailAuthCode() {
addCancellable(
sendAuthCodeUseCase.execute(
req: .init(email: authenticationEmailParam.email, type: .signup)
)
) { [weak self] _ in
self?.authCode = ""
self?.timeRemaining = 180
self?.toastMessage = "입력하신 이메일로 인증번호가 전송되었습니다."
self?.isShowingToast = true
}
}

func verifyEmailAuthCode() {
addCancellable(
verifyAuthCodeUseCase.execute(
req: .init(email: authenticationEmailParam.email, authCode: authCode, type: .signup)
kimdaehee0824 marked this conversation as resolved.
Show resolved Hide resolved
)
) { [weak self] _ in
self?.isNavigateChangePassword = true
} onReceiveError: { [weak self] _ in
self?.authCode = ""
}
}
}
Loading