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 :: MyPage - RewardPointDetail UI #137

Merged
merged 25 commits into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
468c66f
feat :: RewardPointDetailView
sian7563 Nov 10, 2022
ff32ff9
feat :: RewardPointDetailComponent
sian7563 Nov 10, 2022
a61de8f
feat :: RewardPointDetailViewModel
sian7563 Nov 10, 2022
b278395
feat :: AppComponent
sian7563 Nov 10, 2022
9d64591
feat :: AppComponent 추가
sian7563 Nov 11, 2022
8a222bd
feat :: RewardPointDetailComponent
sian7563 Nov 11, 2022
7507bcb
feat :: RewardPointDetailView Component 추가
sian7563 Nov 11, 2022
e7f24ba
feat :: RewardPointDetailViewModel
sian7563 Nov 11, 2022
2308c16
feat :: RewardPointDetailComponent 구현
sian7563 Nov 13, 2022
6dba4c9
feat :: RewardPointDetailView 구현
sian7563 Nov 13, 2022
b1d1641
feat :: RewardPointDetailViewModel 구현
sian7563 Nov 13, 2022
3f6bac8
feat :; NeedleGenerated
sian7563 Nov 13, 2022
d324aff
feat :: PointEntity 구현
sian7563 Nov 13, 2022
9a86b47
feat :: WholeButton 파일 생성
sian7563 Nov 13, 2022
febaad1
feat :: PointEntity 삭제
sian7563 Nov 14, 2022
8a3eadc
feat :: PointScreen UI
sian7563 Nov 18, 2022
7e7a919
Merge branch 'develop' of https://github.com/DSM-FLOW/DMS-iOS into fe…
baekteun Nov 19, 2022
c009173
refactor :: 기존Points 리리리팩토링
baekteun Nov 19, 2022
d1a4711
feat :: RewardPointDetailUI 구현
sian7563 Nov 22, 2022
d7a4bb2
feat :: RewardPointDetailUI 구현
sian7563 Nov 23, 2022
f462960
Merge branch 'develop' into feat/119_MyPage-RewardPointDetail-UI
sian7563 Nov 23, 2022
f0ba6fe
feat :: 피드백 수정
sian7563 Nov 23, 2022
c6f8b4a
Merge branch 'feat/119_MyPage-RewardPointDetail-UI' of https://github…
sian7563 Nov 23, 2022
a093746
feat :: NeedleGenerated
sian7563 Nov 23, 2022
f3a2ce9
feat :: 피드백 수정
sian7563 Nov 23, 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
3 changes: 3 additions & 0 deletions Projects/App/Sources/Application/DI/AppComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,7 @@ public extension AppComponent {
var noticeDetailComponent: NoticeDetailComponent {
NoticeDetailComponent(parent: self)
}
var rewardPointDetailComponent: RewardPointDetailComponent {
RewardPointDetailComponent(parent: self)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import DataModule
public extension AppComponent {
var remoteAuthDataSource: any RemoteAuthDataSource {
shared {
// RemoteAuthDataSourceStub() // TODO: 퍼블리싱용 Stub, 테스트 서버 나오면 변경
RemoteAuthDataSourceImpl(keychain: keychain)
RemoteAuthDataSourceStub() // TODO: 퍼블리싱용 Stub, 테스트 서버 나오면 변경
// RemoteAuthDataSourceImpl(keychain: keychain)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import NetworkModule
public extension AppComponent {
var remoteFilesDataSource: any RemoteFilesDataSource {
shared {
// RemoteFilesDataSourceStub()
RemoteFilesDataSourceImpl(keychain: keychain)
RemoteFilesDataSourceStub()
// RemoteFilesDataSourceImpl(keychain: keychain)
}
}
var filesRepository: any FilesRepository {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import DataModule
public extension AppComponent {
var remoteMealDataSource: any RemoteMealDataSource {
shared {
// RemoteMealDataSourceStub()
RemoteMealDataSourceImpl(keychain: keychain)
RemoteMealDataSourceStub()
// RemoteMealDataSourceImpl(keychain: keychain)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import NetworkModule
public extension AppComponent {
var remoteNoticeDataSource: any RemoteNoticeDataSource {
shared {
// RemoteNoticeDataSourceStub()
RemoteNoticeDataSourceImpl(keychain: keychain)
RemoteNoticeDataSourceStub()
// RemoteNoticeDataSourceImpl(keychain: keychain)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import NeedleFoundation
import NetworkModule
import DomainModule
import DataModule

public extension AppComponent {
var remotePointsDataSource: any RemotePointsDataSource {
shared {
RemotePointsDataSourceStub()
}
// RemotePointsDataSourceImpl(keychain: keychain)
}

var pointsRepository: any PointsRepository {
shared {
PointsRepositoryImpl(remotePointsDataSource: remotePointsDataSource)
}
}

var fetchPointListUseCase: any FetchPointListUseCase {
shared {
FetchPointListUseCaseImpl(pointsRepository: pointsRepository)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import DataModule
public extension AppComponent {
var remoteSchoolDataSource: any RemoteSchoolDataSource {
shared {
// RemoteSchoolDataSourceStub()
RemoteSchoolDataSourceImpl(keychain: keychain)
RemoteSchoolDataSourceStub()
// RemoteSchoolDataSourceImpl(keychain: keychain)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import DataModule
public extension AppComponent {
var remoteStudentsDataSource: any RemoteStudentsDataSource {
shared {
// RemoteStudentsDataSourceStub()
RemoteStudentsDataSourceImpl(keychain: keychain)
RemoteStudentsDataSourceStub()
// RemoteStudentsDataSourceImpl(keychain: keychain)
}
}

Expand Down
5 changes: 3 additions & 2 deletions Projects/App/Sources/Application/DMSApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ struct DMSApp: App {

var body: some Scene {
WindowGroup {
AppComponent().makeRootView()
.environmentObject(appState)
// AppComponent().makeRootView()
// .environmentObject(appState)
AppComponent().rewardPointDetailComponent.makeView()
}
}
}
29 changes: 28 additions & 1 deletion Projects/App/Sources/Application/NeedleGenerated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,22 @@ private class MyPageDependency48d84b530313b3ee40feProvider: MyPageDependency {
private func factory0f6f456ebf157d02dfb3f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject {
return MyPageDependency48d84b530313b3ee40feProvider(appComponent: parent1(component) as! AppComponent)
}
private class RewardPointDetailDependency623f1251c3863ea3b233Provider: RewardPointDetailDependency {
var fetchPointListUseCase: any FetchPointListUseCase {
return appComponent.fetchPointListUseCase
}
var rewardPointDetailComponent: RewardPointDetailComponent {
return appComponent.rewardPointDetailComponent
}
private let appComponent: AppComponent
init(appComponent: AppComponent) {
self.appComponent = appComponent
}
}
/// ^->AppComponent->RewardPointDetailComponent
private func factory87993268d9e212be8b1af47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject {
return RewardPointDetailDependency623f1251c3863ea3b233Provider(appComponent: parent1(component) as! AppComponent)
}
private class ChangeProfileDependency18055275199967076a28Provider: ChangeProfileDependency {
var changeProfileImageUseCase: any ChangeProfileImageUseCase {
return appComponent.changeProfileImageUseCase
Expand Down Expand Up @@ -406,6 +422,7 @@ extension AppComponent: Registration {
localTable["myPageComponent-MyPageComponent"] = { self.myPageComponent as Any }
localTable["changeProfileComponent-ChangeProfileComponent"] = { self.changeProfileComponent as Any }
localTable["noticeDetailComponent-NoticeDetailComponent"] = { self.noticeDetailComponent as Any }
localTable["rewardPointDetailComponent-RewardPointDetailComponent"] = { self.rewardPointDetailComponent as Any }
localTable["remoteNoticeDataSource-any RemoteNoticeDataSource"] = { self.remoteNoticeDataSource as Any }
localTable["noticeRepository-any NoticeRepository"] = { self.noticeRepository as Any }
localTable["fetchWhetherNewNoticeUseCase-any FetchWhetherNewNoticeUseCase"] = { self.fetchWhetherNewNoticeUseCase as Any }
Expand All @@ -425,6 +442,9 @@ extension AppComponent: Registration {
localTable["usersRepository-any UsersRepository"] = { self.usersRepository as Any }
localTable["changePasswordUseCase-any ChangePasswordUseCase"] = { self.changePasswordUseCase as Any }
localTable["compareCurrentPasswordUseCase-any CompareCurrentPasswordUseCase"] = { self.compareCurrentPasswordUseCase as Any }
localTable["remotePointsDataSource-any RemotePointsDataSource"] = { self.remotePointsDataSource as Any }
localTable["pointsRepository-any PointsRepository"] = { self.pointsRepository as Any }
localTable["fetchPointListUseCase-any FetchPointListUseCase"] = { self.fetchPointListUseCase as Any }
localTable["remoteMealDataSource-any RemoteMealDataSource"] = { self.remoteMealDataSource as Any }
localTable["mealRepository-any MealRepository"] = { self.mealRepository as Any }
localTable["fetchMealListUseCase-any FetchMealListUseCase"] = { self.fetchMealListUseCase as Any }
Expand Down Expand Up @@ -502,6 +522,12 @@ extension MyPageComponent: Registration {
keyPathToName[\MyPageDependency.changeProfileComponent] = "changeProfileComponent-ChangeProfileComponent"
}
}
extension RewardPointDetailComponent: Registration {
public func registerItems() {
keyPathToName[\RewardPointDetailDependency.fetchPointListUseCase] = "fetchPointListUseCase-any FetchPointListUseCase"
keyPathToName[\RewardPointDetailDependency.rewardPointDetailComponent] = "rewardPointDetailComponent-RewardPointDetailComponent"
}
}
extension ChangeProfileComponent: Registration {
public func registerItems() {
keyPathToName[\ChangeProfileDependency.changeProfileImageUseCase] = "changeProfileImageUseCase-any ChangeProfileImageUseCase"
Expand Down Expand Up @@ -582,7 +608,7 @@ private func registerProviderFactory(_ componentPath: String, _ factory: @escapi

#if !NEEDLE_DYNAMIC

@inline(never) private func register1() {
private func register1() {
registerProviderFactory("^->AppComponent", factoryEmptyDependencyProvider)
registerProviderFactory("^->AppComponent->SchoolConfirmationQuestionsComponent", factoryd462667f0418a53210fcf47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->SchoolCodeComponent", factoryb65c1efbf06b87162473f47b58f8f304c97af4d5)
Expand All @@ -594,6 +620,7 @@ private func registerProviderFactory(_ componentPath: String, _ factory: @escapi
registerProviderFactory("^->AppComponent->SignupProfileImageComponent", factory6792674212c15df7e9cff47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->MainTabComponent", factory1ab5a747ddf21e1393f9f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->MyPageComponent", factory0f6f456ebf157d02dfb3f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->RewardPointDetailComponent", factory87993268d9e212be8b1af47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->ChangeProfileComponent", factory239204ef0c47c0c68c97f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->RootComponent", factory264bfc4d4cb6b0629b40f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->SigninComponent", factory2882a056d84a613debccf47b58f8f304c97af4d5)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import DomainModule
import NeedleFoundation
import SwiftUI

public protocol RewardPointDetailDependency: Dependency {
var fetchPointListUseCase: any FetchPointListUseCase { get }
var rewardPointDetailComponent: RewardPointDetailComponent { get }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rewardPointDetailComponent가 rewardPointDetailComponent를 주입받네요..?

}

public final class RewardPointDetailComponent: Component<RewardPointDetailDependency> {
public func makeView() -> some View {
RewardPointDetailView(
viewModel: .init(
fetchPointListUseCase: self.dependency.fetchPointListUseCase
),
rewardPointDetailComponent: dependency.rewardPointDetailComponent
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import DesignSystem
import DataMappingModule
import SwiftUI

struct RewardPointDetailView: View {
@StateObject var viewModel: RewardPointDetailViewModel
private let rewardPointDetailComponent: RewardPointDetailComponent

init(
viewModel: RewardPointDetailViewModel,
rewardPointDetailComponent: RewardPointDetailComponent
) {
_viewModel = StateObject(wrappedValue: viewModel)
self.rewardPointDetailComponent = rewardPointDetailComponent
}

var body: some View {
NavigationView {
VStack(alignment: .leading) {
HStack {
ForEach(PointsType.allCases, id: \.self) { point in
DMSButton(text: point.display,
style: viewModel.pointsType == point ? .contained : .outlined,
color: viewModel.pointsType == point ? .PrimaryVariant.primary : .GrayScale.gray6) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스타일 가이드 맞춰주세요 🎲

viewModel.pointsType = point
viewModel.fetchPointList()
}
.padding(.trailing, 12)
}
}
.padding(.leading, 24)
.padding(.top, 16)

Text("\(viewModel.point?.totalPoint ?? 0)" + " 점")
.dmsFont(.title(.large), color: .GrayScale.gray6)
.padding(.top, 44)
.padding(.horizontal, 24)
.padding(.bottom, 44)
ScrollView {
VStack {
ForEach(viewModel.point?.poinsts ?? [], id: \.self) { pointList in
pointsListCellView(
date: pointList.date.toSmallDMSDateString(),
name: pointList.name,
score: "\(pointList.score)"
)
.padding(.top, 5)
.listRowInsets(EdgeInsets())
}
}
.padding(.horizontal, 24)
}
.navigationTitle("상벌점 현황")
.navigationBarTitleDisplayMode(.inline)
.dmsBackground()
}
}
}

@ViewBuilder
func pointsListCellView(date: String, name: String, score: String) -> some View {
ZStack {
Color.System.surface
.cornerRadius(6)

HStack {
VStack(alignment: .leading, spacing: 8) {
Text(date)
.dmsFont(.text(.extraSmall), color: .System.title)

Text(name)
.dmsFont(.text(.medium), color: .System.text)
}
HStack {
Spacer()

Text(score)
.dmsFont(.text(.medium), color: score.contains("-") ? .System.error : .PrimaryVariant.darken2)
}

Spacer()
}
.padding(.horizontal, 16)
}
.frame(height: 68)
.shadow(color: .GrayScale.gray5.opacity(0.15), blur: 20)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import BaseFeature
import Foundation
import DomainModule
import ErrorModule
import Combine
import DataMappingModule
import DesignSystem

final class RewardPointDetailViewModel: BaseViewModel {
@Published var point: PointEntity?
@Published var pointsType: PointsType = .all

private let fetchPointListUseCase: any FetchPointListUseCase

init(
fetchPointListUseCase: any FetchPointListUseCase
) {
self.fetchPointListUseCase = fetchPointListUseCase
super.init()
fetchPointList()
}

func fetchPointList() {
addCancellable(
self.fetchPointListUseCase.execute(
type: pointsType
)) { [weak self] point in
self?.point = point
}
}
}
7 changes: 3 additions & 4 deletions Projects/Services/APIKit/Sources/PointsAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ extension PointsAPI: DmsAPI {

public var urlPath: String {
switch self {
case let .fetchPointsList(type):
return "/\(type)"
case .fetchPointsList:
return "/"
}
}

Expand All @@ -27,8 +27,7 @@ extension PointsAPI: DmsAPI {
case let .fetchPointsList(type):
return .requestParameters(parameters: [
"type": type.rawValue
],
encoding: JSONEncoding.default)
], encoding: URLEncoding.queryString)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import Foundation

public enum PointsType: String {
public enum PointsType: String, CaseIterable {
case all = "ALL"
case bonus = "BONUS"
case minus = "MINUS"

public var display: String {
switch self {
case .all:
return "전체"
case .bonus:
return "상점"
case .minus:
return "벌점"
}
}
}

This file was deleted.

Loading