Skip to content

Commit

Permalink
[Refacotr/#84] DIContainer 생성 및 ServiceLayer 구성
Browse files Browse the repository at this point in the history
  • Loading branch information
HELLOHIDI committed Aug 13, 2024
1 parent 9d13b7b commit e8155d3
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// DIContainer.swift
// MyPageFeatureInterface
//
// Created by 류희재 on 8/13/24.
// Copyright © 2024 HMH-iOS. All rights reserved.
//

import Foundation

class DIContainer: ObservableObject {
var repositorys: RepositoryType

init(repositorys: RepositoryType) {
self.repositorys = repositorys
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import DSKit

struct MyPageButton_Refactor: View {

// @ObservedObject var viewModel: MyPageViewModel_Refactor
@ObservedObject var viewModel: MyPageViewModel_Refactor

var buttonType: MyPageButtonType

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class MyPageViewModel_Refactor: ObservableObject {
@Published var point = 0
@Published var navigateToPrepare = false



//TODO: 네트워크 부분은 의존성 정리한 뒤에 다시 연결해봅시다
func getUserData() {
// let provider = Providers.myPageProvider
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// AuthService.swift
// MyPageFeatureInterface
//
// Created by 류희재 on 8/13/24.
// Copyright © 2024 HMH-iOS. All rights reserved.
//

import Foundation

protocol AuthServiceType {
}

class AuthService: AuthServiceType {}

class StubAuthService: AuthServiceType {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// Services.swift
// MyPageFeatureInterface
//
// Created by 류희재 on 8/13/24.
// Copyright © 2024 HMH-iOS. All rights reserved.
//

import Foundation

protocol ServiceType {
var authService: AuthenticationServiceType { get set }
var userService: UserServiceType { get set }
}

class Services: ServiceType {
var authService: AuthenticationServiceType
var userService: UserServiceType

init() {
self.authService = AuthenticationService()
self.userService = UserService(dbRepository: UserDBRepository())
}
}

class StubService: ServiceType {
var authService: AuthenticationServiceType = StubAuthenticationService()
var userService: UserServiceType = StubUserService()
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// UserService.swift
// MyPageFeatureInterface
//
// Created by 류희재 on 8/13/24.
// Copyright © 2024 HMH-iOS. All rights reserved.
//

import Foundation

protocol UserServiceType {
}

class UserService: UserServiceType {}

class StubUserService: UserServiceType {}
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,26 @@ extension MyPageView {
}
}
private func AccountControlView() -> some View {
HStack {
Text(StringLiteral.MyPageAccountControl.logout)
.font(.text6_medium_14)
HStack(spacing: 19) {
Button(action: {
viewModel.logoutButtonClicked()
}) {
Text(StringLiteral.MyPageAccountControl.logout)
.font(.text6_medium_14)
}
.foregroundColor(DSKitAsset.gray3.swiftUIColor)

Rectangle()
.frame(width: 1, height: 16)
Text(StringLiteral.MyPageAccountControl.revoke)
.font(.text6_medium_14)

Button(action: {
viewModel.withdrawButtonClicked()
}) {
Text(StringLiteral.MyPageAccountControl.revoke)
.font(.text6_medium_14)
}
.foregroundColor(DSKitAsset.gray3.swiftUIColor)
}
.foregroundColor(DSKitAsset.gray3.swiftUIColor)
.frame(height: 77)
}
}

0 comments on commit e8155d3

Please sign in to comment.