Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature/(#9)-main_…
Browse files Browse the repository at this point in the history
…publishing

# Conflicts:
#	Projects/App/Sources/Application/DI/AppComponent.swift
#	Projects/App/Sources/Application/NeedleGenerated.swift
#	Projects/Feature/SigninFeature/Sources/SigninView.swift
  • Loading branch information
juyeong525 committed May 8, 2024
2 parents 8a74255 + 42bf49a commit f819ee3
Show file tree
Hide file tree
Showing 69 changed files with 954 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extension ModulePaths: MicroTargetPathConvertable {

public extension ModulePaths {
enum Feature: String, MicroTargetPathConvertable {
case FindPasswordFeature
case SignupFeature
case MainFeature
case SigninFeature
Expand Down
6 changes: 5 additions & 1 deletion Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import Foundation
import ProjectDescription
import ProjectDescriptionHelpers

let configurations: [Configuration] = .default
let configurations: [Configuration] = [
.debug(name: .dev, xcconfig: .relativeToXCConfig(type: .dev, name: env.name)),
.debug(name: .stage, xcconfig: .relativeToXCConfig(type: .stage, name: env.name)),
.release(name: .prod, xcconfig: .relativeToXCConfig(type: .prod, name: env.name))
]

let settings: Settings = .settings(
base: env.baseSetting,
Expand Down
23 changes: 19 additions & 4 deletions Projects/App/Sources/Application/DI/AppComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import SignupFeature
import SignupFeatureInterface
import MainFeature
import MainFeatureInterface
import FindPasswordFeature
import FindPasswordFeatureInterface
>>>>>>> origin/develop

public final class AppComponent: BootstrapComponent {
// private let _keychain: any Keychain
Expand Down Expand Up @@ -41,15 +44,18 @@ public extension AppComponent {
SigninComponent(parent: self)
}
// Signup
var signupEmailVerifyFactory: any SignupEmailVerifyFactory {
SignupEmailVerifyComponent(parent: self)
var signupEmailFactory: any SignupEmailFactory {
SignupEmailComponent(parent: self)
}
var signupEmailAuthCodeVerifyFactory: any SignupEmailAuthCodeVerifyFactory {
SignupEmailAuthCodeVerifyComponent(parent: self)
var signupVerifyAuthCode: any SignupVerifyAuthCodeFactory {
SignupVerifyAuthCodeComponent(parent: self)
}
var signupPasswordFactory: any SignupPasswordFactory {
SignupPasswordComponent(parent: self)
}
var signupUserInfoFlowFactory: any SignupUserInfoFlowFactory {
SignupUserInfoFlowComponent(parent: self)
}
var signupNameFactory: any SignupNameFactory {
SignupNameComponent(parent: self)
}
Expand All @@ -64,5 +70,14 @@ public extension AppComponent {
}
var mainFactory: any MainFactory {
MainComponent(parent: self)
// Find Password
var inputEmailFactory: any InputEmailFactory {
InputEmailComponent(parent: self)
}
var verifyAuthCodeFactory: any VerifyAuthCodeFactory {
VerifyAuthCodeComponent(parent: self)
}
var inputNewPasswordFactory: any InputNewPasswordFactory {
InputNewPasswordComponent(parent: self)
}
}
183 changes: 138 additions & 45 deletions Projects/App/Sources/Application/NeedleGenerated.swift

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Projects/App/Support/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundleDisplayName</key>
<string>$(BUNDLE_DISPLAY_NAME)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import SwiftUI

public struct RootPresentationModeKey: EnvironmentKey {
public static let defaultValue: Binding<RootPresentationMode> = .constant(RootPresentationMode())
}

public extension EnvironmentValues {
var rootPresentationMode: Binding<RootPresentationMode> {
get { return self[RootPresentationModeKey.self] }
set { self[RootPresentationModeKey.self] = newValue }
}
}

public typealias RootPresentationMode = Bool

public extension Binding<RootPresentationMode> {
func popToRootView() {
self.wrappedValue.toggle()
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftUI

public protocol SignupEmailVerifyFactory {
public protocol InputEmailFactory {
associatedtype SomeView: View
func makeView() -> SomeView
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftUI

public protocol SignupEmailAuthCodeVerifyFactory {
public protocol InputNewPasswordFactory {
associatedtype SomeView: View
func makeView() -> SomeView
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import SwiftUI

public protocol VerifyAuthCodeFactory {
associatedtype SomeView: View
func makeView() -> SomeView
}
17 changes: 17 additions & 0 deletions Projects/Feature/FindPasswordFeature/Project.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import DependencyPlugin
import ProjectDescription
import ProjectDescriptionHelpers

let project = Project.module(
name: ModulePaths.Feature.FindPasswordFeature.rawValue,
targets: [
.interface(module: .feature(.FindPasswordFeature)),
.implements(module: .feature(.FindPasswordFeature), dependencies: [
.feature(target: .FindPasswordFeature, type: .interface),
.feature(target: .BaseFeature)
]),
.tests(module: .feature(.FindPasswordFeature), dependencies: [
.feature(target: .FindPasswordFeature)
])
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import SwiftUI
import NeedleFoundation
import FindPasswordFeatureInterface

public protocol InputEmailDependency: Dependency {
var verifyAuthCodeFactory: any VerifyAuthCodeFactory { get }
}

public final class InputEmailComponent: Component<InputEmailDependency>, InputEmailFactory {
public func makeView() -> some View {
InputEmailView(
viewModel: .init(),
verifyAuthCodeFactory: dependency.verifyAuthCodeFactory
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import BaseFeature
import Combine

final class InputEmailViewModel: BaseViewModel {
@Published var email: String = ""

@Published var isNavigatedToVerifyAuthCode: Bool = false

func nextButtonDidTap() {
self.isNavigatedToVerifyAuthCode = true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import DesignSystem
import SwiftUI
import BaseFeature
import ViewUtil
import FindPasswordFeatureInterface

struct InputEmailView: View {
private enum FocusField {
case email
}
@FocusState private var focusField: FocusField?
@StateObject var viewModel: InputEmailViewModel
@Environment(\.rootPresentationMode) var rootPresentationMode

private let verifyAuthCodeFactory: any VerifyAuthCodeFactory

init(
viewModel: InputEmailViewModel,
verifyAuthCodeFactory: any VerifyAuthCodeFactory
) {
_viewModel = StateObject(wrappedValue: viewModel)
self.verifyAuthCodeFactory = verifyAuthCodeFactory
}

var body: some View {
VStack(spacing: 0) {
NavigationTitleView(
title: "이메일을 입력해 주세요",
description: "이메일로 인증번호를 전송해 드릴게요"
)

KGTextField(
"이메일을 입력해주세요",
text: $viewModel.email,
title: "이메일",
isError: viewModel.isErrorOccurred,
errorMessage: viewModel.errorMessage,
onCommit: viewModel.nextButtonDidTap
)
.textContentType(.emailAddress)
.keyboardType(.emailAddress)
.focused($focusField, equals: .email)

Spacer()
}
.bottomButton(
text: "다음",
isEditing: focusField != nil,
isDisabled: viewModel.email.isEmpty,
action: viewModel.nextButtonDidTap
)
.navigationBackButton()
.kgBackground()
.hideKeyboardWhenTap()
.navigate(
to: verifyAuthCodeFactory.makeView().eraseToAnyView()
.environment(\.rootPresentationMode, rootPresentationMode),
when: $viewModel.isNavigatedToVerifyAuthCode
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import SwiftUI
import NeedleFoundation
import FindPasswordFeatureInterface

public protocol InputNewPasswordDependency: Dependency {}

public final class InputNewPasswordComponent: Component<InputNewPasswordDependency>, InputNewPasswordFactory {
public func makeView() -> some View {
InputNewPasswordView(
viewModel: .init()
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import DesignSystem
import SwiftUI
import BaseFeature
import SignupFeatureInterface
import ViewUtil

struct InputNewPasswordView: View {
private enum FocusField {
case password
case checkPassword
}
@FocusState private var focusField: FocusField?
@StateObject var viewModel: InputNewPasswordViewModel
@Environment(\.rootPresentationMode) var rootPresentationMode

init(
viewModel: InputNewPasswordViewModel
) {
_viewModel = StateObject(wrappedValue: viewModel)
}

var body: some View {
VStack(spacing: 0) {
NavigationTitleView(
title: "새 비밀번호를 입력해주세요",
description: "비밀번호는 영어와 숫자를 조합해 만들어 주세요"
)

KGTextField(
"비밀번호(8~12자)를 입력해 주세요",
text: $viewModel.password,
title: "비밀번호",
isError: viewModel.isErrorOccurred,
errorMessage: viewModel.errorMessage,
isSecure: true
) {
self.focusField = .checkPassword
}
.textContentType(.password)
.focused($focusField, equals: .password)

KGTextField(
"비밀번호 다시 입력해 주세요",
text: $viewModel.checkPassword,
title: "비밀번호 확인",
isError: viewModel.isErrorOccurred,
errorMessage: viewModel.errorMessage,
isSecure: true,
onCommit: viewModel.nextButtonDidTap
)
.textContentType(.password)
.focused($focusField, equals: .checkPassword)

Spacer()
}
.bottomButton(
text: "다음",
isEditing: focusField != nil,
isDisabled: viewModel.password.isEmpty || viewModel.checkPassword.isEmpty,
action: viewModel.nextButtonDidTap
)
.navigationBar()
.kgBackground()
.hideKeyboardWhenTap()
.onSuccess(of: viewModel.isSuccessToChangePassword) {
DispatchQueue.main.async {
self.rootPresentationMode.popToRootView()
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import BaseFeature
import Combine

final class InputNewPasswordViewModel: BaseViewModel {
@Published var password: String = ""
@Published var checkPassword: String = ""

@Published var isSuccessToChangePassword: Bool = false

func nextButtonDidTap() {
self.isSuccessToChangePassword = true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import SwiftUI
import NeedleFoundation
import FindPasswordFeatureInterface

public protocol VerifyAuthCodeDependency: Dependency {
var inputNewPasswordFactory: any InputNewPasswordFactory { get }
}

public final class VerifyAuthCodeComponent: Component<VerifyAuthCodeDependency>,
VerifyAuthCodeFactory {
public func makeView() -> some View {
VerifyAuthCodeView(
viewModel: .init(),
inputNewPasswordFactory: dependency.inputNewPasswordFactory
)
}
}
Loading

0 comments on commit f819ee3

Please sign in to comment.