From 17de4b462dc59a7eb9ef0042897c9f0b45f0460c Mon Sep 17 00:00:00 2001 From: Choyoungjun Date: Thu, 16 May 2024 08:52:55 +0900 Subject: [PATCH 1/6] =?UTF-8?q?REFACT=20::=20[#326]=20=EB=82=B4=20?= =?UTF-8?q?=EB=A3=A8=ED=8B=B4=20=EB=B7=B0=20=EC=BD=94=EB=93=9C=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Test/TestViewController.swift | 30 +++++++ ...elfCareMyRoutineDetailViewController.swift | 6 +- .../SelfCareMyRoutineViewController.swift | 78 +++++++++++++------ .../Main/MyRoutineTableViewCell.swift | 12 +++ 4 files changed, 101 insertions(+), 25 deletions(-) create mode 100644 Projects/Features/SelfCareFeature/Sources/RoutineScene/Test/TestViewController.swift diff --git a/Projects/Features/SelfCareFeature/Sources/RoutineScene/Test/TestViewController.swift b/Projects/Features/SelfCareFeature/Sources/RoutineScene/Test/TestViewController.swift new file mode 100644 index 00000000..8c87edf4 --- /dev/null +++ b/Projects/Features/SelfCareFeature/Sources/RoutineScene/Test/TestViewController.swift @@ -0,0 +1,30 @@ +// +// TestViewController.swift +// SelfCareFeatureInterface +// +// Created by 조영준 on 5/13/24. +// Copyright © 2024 MaeumGaGym-iOS. All rights reserved. +// + +import UIKit + +public class TestViewController: UIViewController { + + public override func viewDidLoad() { + super.viewDidLoad() + self.view.backgroundColor = .blue + // Do any additional setup after loading the view. + } + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/Projects/Features/SelfCareFeature/Sources/RoutineScene/View/SelfCareMyRoutineDetailViewController.swift b/Projects/Features/SelfCareFeature/Sources/RoutineScene/View/SelfCareMyRoutineDetailViewController.swift index ac0ed381..b7281ddc 100644 --- a/Projects/Features/SelfCareFeature/Sources/RoutineScene/View/SelfCareMyRoutineDetailViewController.swift +++ b/Projects/Features/SelfCareFeature/Sources/RoutineScene/View/SelfCareMyRoutineDetailViewController.swift @@ -36,8 +36,10 @@ public class SelfCareMyRoutineDetailViewController: BaseViewController, Stepper, UIGestureRecognizerDelegate { - + private var naviBar = RoutineNavigationBarBar() private var myRoutineModel: SelfCareMyRoutineModel = SelfCareMyRoutineModel( - titleTextData: - SelfCareMyRoutineTextModel( + titleTextData: SelfCareMyRoutineTextModel( titleText: "", - infoText: ""), - myRoutineData: [] + infoText: "" + ), myRoutineData: [] ) private var containerView = UIView() private var headerView = UIView() - private let myRoutineTitleLabel = MGLabel(font: UIFont.Pretendard.titleLarge, - textColor: .black, - isCenter: false + private let myRoutineTitleLabel = MGLabel( + font: UIFont.Pretendard.titleLarge, + textColor: .black, + isCenter: false ) - private let myRoutineSubTitleLabel = MGLabel(font: UIFont.Pretendard.bodyMedium, - textColor: DSKitAsset.Colors.gray600.color, - isCenter: false, - numberOfLineCount: 2 + private let myRoutineSubTitleLabel = MGLabel( + font: UIFont.Pretendard.bodyMedium, + textColor: DSKitAsset.Colors.gray600.color, + isCenter: false, + numberOfLineCount: 2 ) private var myRoutineTableView = UITableView().then { @@ -48,8 +49,10 @@ public class SelfCareMyRoutineViewController: BaseViewController Int { myRoutineModel.myRoutineData.count + 1 @@ -165,6 +176,27 @@ extension SelfCareMyRoutineViewController: UITableViewDataSource { let routine = myRoutineModel.myRoutineData[indexPath.row] cell?.setup(with: routine) cell?.selectionStyle = .none + cell?.dotsButtonTap + .bind(onNext: { [weak self] in + let modal = TestViewController() + + if #available(iOS 16.0, *) { + let customDetent = UISheetPresentationController.Detent.custom(identifier: .init("custom")) { _ in + return 257 + } + if let sheet = modal.sheetPresentationController { + sheet.detents = [customDetent] + sheet.prefersGrabberVisible = true + } + } else { + if let sheet = modal.sheetPresentationController { + sheet.detents = [.medium()] + sheet.prefersGrabberVisible = true + } + } + self?.present(modal, animated: true) + }).disposed(by: disposeBag) + return cell ?? UITableViewCell() } } diff --git a/Projects/Features/SelfCareFeature/Sources/Supporter/MyRoutine/Main/MyRoutineTableViewCell.swift b/Projects/Features/SelfCareFeature/Sources/Supporter/MyRoutine/Main/MyRoutineTableViewCell.swift index f7bb0de4..15a7cdd0 100644 --- a/Projects/Features/SelfCareFeature/Sources/Supporter/MyRoutine/Main/MyRoutineTableViewCell.swift +++ b/Projects/Features/SelfCareFeature/Sources/Supporter/MyRoutine/Main/MyRoutineTableViewCell.swift @@ -3,6 +3,9 @@ import UIKit import SnapKit import Then +import RxSwift +import RxCocoa + import Core import DSKit import Domain @@ -11,6 +14,10 @@ import MGNetworks public class MyRoutineTableViewCell: BaseTableViewCell { + public var dotsButtonTap: ControlEvent { + return dotsButton.rx.tap + } + static let identifier: String = "MyRoutineTableViewCell" private var containerView = UIView().then { @@ -43,6 +50,11 @@ public class MyRoutineTableViewCell: BaseTableViewCell { changeSharingState(state: model.sharingState) } + public override func prepareForReuse() { + super.prepareForReuse() + self.disposeBag = DisposeBag() + } + override public func layout() { super.layout() From 316c69d8961caff1c02f695ecc083c8940b75ee6 Mon Sep 17 00:00:00 2001 From: Choyoungjun Date: Thu, 16 May 2024 08:53:31 +0900 Subject: [PATCH 2/6] =?UTF-8?q?REFACT=20::=20[#326]=20SceneDelegate=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Demo/Sources/Application/SceneDelegate.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/Features/SelfCareFeature/Demo/Sources/Application/SceneDelegate.swift b/Projects/Features/SelfCareFeature/Demo/Sources/Application/SceneDelegate.swift index 74362303..f182e3d6 100644 --- a/Projects/Features/SelfCareFeature/Demo/Sources/Application/SceneDelegate.swift +++ b/Projects/Features/SelfCareFeature/Demo/Sources/Application/SceneDelegate.swift @@ -18,8 +18,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { window = UIWindow(windowScene: windowScene) let useCase = DefaultSelfCareUseCase(repository: SelfCareRepository(networkService: SelfCareService())) - let viewModel = SelfCareMyRoutineEditViewModel(useCase: useCase) - let viewController = SelfCareMyRoutineEditViewController(viewModel) + let viewModel = SelfCareMyRoutineViewModel(useCase: useCase) + let viewController = SelfCareMyRoutineViewController(viewModel) window?.configure(withRootViewController: viewController) window?.makeKeyAndVisible() } From 4907073d798d89ad13c76fca6e49a085831fc6b1 Mon Sep 17 00:00:00 2001 From: Choyoungjun Date: Thu, 16 May 2024 08:54:08 +0900 Subject: [PATCH 3/6] =?UTF-8?q?ADD=20::=20[#327]=20UIImage=20Extension=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Extension/Image/UIImage+.swift | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 Projects/Modules/DSKit/Sources/Extension/Image/UIImage+.swift diff --git a/Projects/Modules/DSKit/Sources/Extension/Image/UIImage+.swift b/Projects/Modules/DSKit/Sources/Extension/Image/UIImage+.swift new file mode 100644 index 00000000..897ec9e0 --- /dev/null +++ b/Projects/Modules/DSKit/Sources/Extension/Image/UIImage+.swift @@ -0,0 +1,123 @@ +import UIKit + +public extension UIImage { + //MARK: ActIcon + static let bellActIcon = DSKitAsset.Assets.bellActIcon.image + static let blackDosActIcon = DSKitAsset.Assets.blackDotsActIcon.image + static let blackImageActIcon = DSKitAsset.Assets.blackImageActIcon.image + static let blackSearchActIcon = DSKitAsset.Assets.blackSearchActIcon.image + static let cameraActIcon = DSKitAsset.Assets.cameraActIcon.image + static let commentActIcon = DSKitAsset.Assets.commentActIcon.image + static let dotsActIcon = DSKitAsset.Assets.dotsActIcon.image + static let grayDotsActIcon = DSKitAsset.Assets.grayDotsActIcon.image + static let heartActIcon = DSKitAsset.Assets.heartActIcon.image + static let imageActIcon = DSKitAsset.Assets.imageActIcon.image + static let noCheckActIcon = DSKitAsset.Assets.noCheckActIcon.image + static let pauseActIcon = DSKitAsset.Assets.pauseActIcon.image + static let pencilActIcon = DSKitAsset.Assets.pencilActIcon.image + static let playActIcon = DSKitAsset.Assets.playActIcon.image + static let redHeartActIcon = DSKitAsset.Assets.redHaertActIcon.image + static let searchActIcon = DSKitAsset.Assets.searchActIcon.image + static let settingActIcon = DSKitAsset.Assets.settingActIcon.image + static let shareActIcon = DSKitAsset.Assets.shareActIcon.image + static let timerActIcon = DSKitAsset.Assets.timerActIcon.image + static let trashActIcon = DSKitAsset.Assets.trashActIcon.image + static let vibrationActIcon = DSKitAsset.Assets.vibrationActIcon.image + static let volumeActIcon = DSKitAsset.Assets.volumeActIcon.image + static let whitePencilActIcon = DSKitAsset.Assets.whitePencilActIcon.image + static let yesCheckActIcon = DSKitAsset.Assets.yesCheckActIcon.image + + //MARK: Arrow + static let blackLeftBarArrow = DSKitAsset.Assets.blackLeftBarArrow.image + static let bottomArrow = DSKitAsset.Assets.bottomArrow.image + static let leftBarArrow = DSKitAsset.Assets.leftBarArrow.image + static let leftOpenArrow = DSKitAsset.Assets.leftOpenArrow.image + static let redoArrow = DSKitAsset.Assets.redoArrow.image + static let rightArrow = DSKitAsset.Assets.rightArrow.image + static let topArrow = DSKitAsset.Assets.topArrow.image + static let turnArrow = DSKitAsset.Assets.turnArrow.image + + //MARK: Calculation + static let blackCancel = DSKitAsset.Assets.blackCancel.image + static let blackMinus = DSKitAsset.Assets.blackMinus.image + static let blackPlus = DSKitAsset.Assets.blackPlus.image + static let blueCancel = DSKitAsset.Assets.blueCancel.image + static let circleCancel = DSKitAsset.Assets.circleCancel.image + static let grayCancel = DSKitAsset.Assets.grayCancel.image + static let whiteAdd = DSKitAsset.Assets.whiteAdd.image + static let whiteCancel = DSKitAsset.Assets.whiteCancel.image + + //MARK: Icons + static let albumIcon = DSKitAsset.Assets.albumIcon.image + static let basicProfileIcon = DSKitAsset.Assets.basicProfileIcon.image + static let blackEarth = DSKitAsset.Assets.blackEarth.image + static let blueArmIcon = DSKitAsset.Assets.blueArmIcon.image + static let blueDumbellIcon = DSKitAsset.Assets.blueDumbelIcon.image + static let blueEarthIcon = DSKitAsset.Assets.blueEarthIcon.image + static let calculatorIcon = DSKitAsset.Assets.calculatorIcon.image + static let cameraIcon = DSKitAsset.Assets.cameraIcon.image + static let dietIcon = DSKitAsset.Assets.dietIcon.image + static let earthIcon = DSKitAsset.Assets.earthIcon.image + static let goalIcon = DSKitAsset.Assets.goalIcon.image + static let introIcon = DSKitAsset.Assets.introIcon.image + static let profileDotIcon = DSKitAsset.Assets.profileDotIcon.image + static let timeIcon = DSKitAsset.Assets.timerIcon.image + + //MARK: TapBarIcon + static let baHomeTapBar = DSKitAsset.Assets.baHomeTapBar + static let baMuscleTapBar = DSKitAsset.Assets.baMuscleTapBar + static let baPickleTapBar = DSKitAsset.Assets.baPickleTapBar + static let baShopTapBar = DSKitAsset.Assets.baShopTapBar + static let biHomeTapBar = DSKitAsset.Assets.blHomeTapBar + static let biPeopleTapBar = DSKitAsset.Assets.blPeopleTapBar + static let biPickleTapBar = DSKitAsset.Assets.blPickleTapBar + static let biShopTapBar = DSKitAsset.Assets.blShopTapBar + static let bPeopleTapBar = DSKitAsset.Assets.bPeopleTapBar + static let whitePickle = DSKitAsset.Assets.whitePickle + + //MARK: Logo + static let appleLogo = DSKitAsset.Assets.appleLogo.image + static let googleLogo = DSKitAsset.Assets.googleLogo.image + static let kakaoLogo = DSKitAsset.Assets.kakaoLogo.image + static let mainLogo = DSKitAsset.Assets.mainLogo.image + static let mainTextLogo = DSKitAsset.Assets.mainTextLogo.image + + //MARK: Exercise + + static let airSqt = DSKitAsset.Assets.airSqt.image + static let archPushUp = DSKitAsset.Assets.archPushUp.image + static let babelBackSqt = DSKitAsset.Assets.babelBackSqt.image + static let babelBgrSplitSqt = DSKitAsset.Assets.babelBgrSplitSqt.image + static let babelLow = DSKitAsset.Assets.babelLow.image + static let backExtension = DSKitAsset.Assets.backExtension.image + static let benchPress = DSKitAsset.Assets.benchPress.image + static let bodyOverHeadSqt = DSKitAsset.Assets.bodyOverheadSqt.image + static let bodySplitSqt = DSKitAsset.Assets.bodySplitSqt.image + static let clapPushUp = DSKitAsset.Assets.clapPushUp.image + static let closeGripPushUp = DSKitAsset.Assets.closeGripPushUp.image + static let deeps = DSKitAsset.Assets.deeps.image + static let dumbelBenchPress = DSKitAsset.Assets.dumbelBenchPress.image + static let dumbelBgrSplitSqt = DSKitAsset.Assets.dumbelBgrSplitSqt.image + static let dumbelGoblinSqt = DSKitAsset.Assets.dumbelGoblinSqt.image + static let dumbelLow = DSKitAsset.Assets.dumbelLow.image + static let dumbelSplitSqt = DSKitAsset.Assets.dumbelSplitSqt.image + static let dumbelSqzPress = DSKitAsset.Assets.dumbelSqzPress.image + static let FrontSqt = DSKitAsset.Assets.frontSqt.image + static let goodMorningExercise = DSKitAsset.Assets.goodMorningExercise.image + static let hinduPushUp = DSKitAsset.Assets.hinduPushUp.image + static let hyperExtension = DSKitAsset.Assets.hyperExtension.image + static let inClineBenchPress = DSKitAsset.Assets.inclineBenchPress.image + static let inClineDumbelBenchPress = DSKitAsset.Assets.inclineDumbelBenchPress.image + static let inclineDumbelLow = DSKitAsset.Assets.inclineDumbelLow.image + static let invertedLow = DSKitAsset.Assets.invertedLow.image + static let jumpSqt = DSKitAsset.Assets.jumpSqt.image + static let lyingHeapAvdt = DSKitAsset.Assets.lyingHeapAvdt.image + static let pullUp = DSKitAsset.Assets.pullUp.image + static let pushUp = DSKitAsset.Assets.pushUp.image + static let ratPullDown = DSKitAsset.Assets.ratPullDown.image + static let runge = DSKitAsset.Assets.runge.image + static let weightDeeps = DSKitAsset.Assets.weightDeeps.image + + //MARK: Sample + +} From 09a2bc7c8e029ab78a222a183bc96b33815b52f1 Mon Sep 17 00:00:00 2001 From: Choyoungjun Date: Thu, 16 May 2024 08:54:36 +0900 Subject: [PATCH 4/6] =?UTF-8?q?ADD=20::=20[#327]=20UIColor=20Extension=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Extension/Color/UIColor+.swift | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Projects/Modules/DSKit/Sources/Extension/Color/UIColor+.swift diff --git a/Projects/Modules/DSKit/Sources/Extension/Color/UIColor+.swift b/Projects/Modules/DSKit/Sources/Extension/Color/UIColor+.swift new file mode 100644 index 00000000..b202914e --- /dev/null +++ b/Projects/Modules/DSKit/Sources/Extension/Color/UIColor+.swift @@ -0,0 +1,54 @@ +import UIKit + +public extension UIColor { + + //MARK: blue + static let blue50 = DSKitAsset.Colors.blue50.color + static let blue100 = DSKitAsset.Colors.blue100.color + static let blue200 = DSKitAsset.Colors.blue200.color + static let blue300 = DSKitAsset.Colors.blue300.color + static let blue400 = DSKitAsset.Colors.blue400.color + static let blue500 = DSKitAsset.Colors.blue500.color + static let blue600 = DSKitAsset.Colors.blue600.color + static let blue700 = DSKitAsset.Colors.blue700.color + static let blue800 = DSKitAsset.Colors.blue800.color + static let blue900 = DSKitAsset.Colors.blue900.color + + //MARK: gray + static let gray25 = DSKitAsset.Colors.gray25.color + static let gray50 = DSKitAsset.Colors.gray50.color + static let gray100 = DSKitAsset.Colors.gray100.color + static let gray200 = DSKitAsset.Colors.gray200.color + static let gray300 = DSKitAsset.Colors.gray300.color + static let gray400 = DSKitAsset.Colors.gray400.color + static let gray500 = DSKitAsset.Colors.gray500.color + static let gray600 = DSKitAsset.Colors.gray600.color + static let gray700 = DSKitAsset.Colors.gray700.color + static let gray800 = DSKitAsset.Colors.gray800.color + static let gray900 = DSKitAsset.Colors.gray900.color + + //MARK: red + static let red50 = DSKitAsset.Colors.red50.color + static let red100 = DSKitAsset.Colors.red100.color + static let red200 = DSKitAsset.Colors.red200.color + static let red300 = DSKitAsset.Colors.red300.color + static let red400 = DSKitAsset.Colors.red400.color + static let red500 = DSKitAsset.Colors.red500.color + static let red600 = DSKitAsset.Colors.red600.color + static let red700 = DSKitAsset.Colors.red700.color + static let red800 = DSKitAsset.Colors.red800.color + static let red900 = DSKitAsset.Colors.red900.color + + //MARK: yellow + static let yellow50 = DSKitAsset.Colors.yellow50.color + static let yellow100 = DSKitAsset.Colors.yellow100.color + static let yellow200 = DSKitAsset.Colors.yellow200.color + static let yellow300 = DSKitAsset.Colors.yellow300.color + static let yellow400 = DSKitAsset.Colors.yellow400.color + static let yellow500 = DSKitAsset.Colors.yellow500.color + static let yellow600 = DSKitAsset.Colors.yellow600.color + static let yellow700 = DSKitAsset.Colors.yellow700.color + static let yellow800 = DSKitAsset.Colors.yellow800.color + static let yellow900 = DSKitAsset.Colors.yellow900.color + +} From 4541384b35e56e400c9b666cd8bd0e288cab3353 Mon Sep 17 00:00:00 2001 From: Choyoungjun Date: Thu, 16 May 2024 08:54:57 +0900 Subject: [PATCH 5/6] =?UTF-8?q?REFACT=20::=20[#327]=20UIFont=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/Modules/DSKit/Sources/{ => Extension/Font}/UIFont+.swift | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Projects/Modules/DSKit/Sources/{ => Extension/Font}/UIFont+.swift (100%) diff --git a/Projects/Modules/DSKit/Sources/UIFont+.swift b/Projects/Modules/DSKit/Sources/Extension/Font/UIFont+.swift similarity index 100% rename from Projects/Modules/DSKit/Sources/UIFont+.swift rename to Projects/Modules/DSKit/Sources/Extension/Font/UIFont+.swift From 729195465a3ecf54ee019e320f43fdf884f40c2a Mon Sep 17 00:00:00 2001 From: Choyoungjun Date: Thu, 16 May 2024 22:43:38 +0900 Subject: [PATCH 6/6] =?UTF-8?q?BURN=20::=20[#326]=20=EC=A4=91=EB=8B=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Application/SceneDelegate.swift | 6 +- .../SelfCareMyRoutineAddViewController.swift | 202 ++++++++++++++++++ ...elfCareMyRoutineDetailViewController.swift | 0 .../SelfCareMyRoutineEditViewController.swift | 0 .../SelfCareMyRoutineViewController.swift | 21 +- .../SelfCarePostureAddViewController.swift} | 10 +- .../{View => VC}/SelfCareViewController.swift | 0 .../Detail/MyRoutineDetailTableViewCell.swift | 0 .../Detail/MyRoutineDetailTitleView.swift | 0 .../View}/Edit/MyRoutineCountView.swift | 0 .../MyRoutineDateCollectionViewCell.swift | 0 .../Edit/MyRoutineDateTableViewCell.swift | 0 .../Edit/MyRoutineEditTableViewCell.swift | 0 .../View}/Main/MyRoutineTableViewCell.swift | 0 .../SelfCareMyRoutineAddViewModel.swift | 56 +++++ .../Sources/Supporter/SelfCareButton.swift | 2 +- 16 files changed, 271 insertions(+), 26 deletions(-) create mode 100644 Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineAddViewController.swift rename Projects/Features/SelfCareFeature/Sources/RoutineScene/{View => VC}/SelfCareMyRoutineDetailViewController.swift (100%) rename Projects/Features/SelfCareFeature/Sources/RoutineScene/{View => VC}/SelfCareMyRoutineEditViewController.swift (100%) rename Projects/Features/SelfCareFeature/Sources/RoutineScene/{View => VC}/SelfCareMyRoutineViewController.swift (86%) rename Projects/Features/SelfCareFeature/Sources/RoutineScene/{Test/TestViewController.swift => VC/SelfCarePostureAddViewController.swift} (73%) rename Projects/Features/SelfCareFeature/Sources/RoutineScene/{View => VC}/SelfCareViewController.swift (100%) rename Projects/Features/SelfCareFeature/Sources/{Supporter/MyRoutine => RoutineScene/View}/Detail/MyRoutineDetailTableViewCell.swift (100%) rename Projects/Features/SelfCareFeature/Sources/{Supporter/MyRoutine => RoutineScene/View}/Detail/MyRoutineDetailTitleView.swift (100%) rename Projects/Features/SelfCareFeature/Sources/{Supporter/MyRoutine => RoutineScene/View}/Edit/MyRoutineCountView.swift (100%) rename Projects/Features/SelfCareFeature/Sources/{Supporter/MyRoutine => RoutineScene/View}/Edit/MyRoutineDateCollectionViewCell.swift (100%) rename Projects/Features/SelfCareFeature/Sources/{Supporter/MyRoutine => RoutineScene/View}/Edit/MyRoutineDateTableViewCell.swift (100%) rename Projects/Features/SelfCareFeature/Sources/{Supporter/MyRoutine => RoutineScene/View}/Edit/MyRoutineEditTableViewCell.swift (100%) rename Projects/Features/SelfCareFeature/Sources/{Supporter/MyRoutine => RoutineScene/View}/Main/MyRoutineTableViewCell.swift (100%) create mode 100644 Projects/Features/SelfCareFeature/Sources/RoutineScene/ViewModel/SelfCareMyRoutineAddViewModel.swift diff --git a/Projects/Features/SelfCareFeature/Demo/Sources/Application/SceneDelegate.swift b/Projects/Features/SelfCareFeature/Demo/Sources/Application/SceneDelegate.swift index f182e3d6..49ca62b0 100644 --- a/Projects/Features/SelfCareFeature/Demo/Sources/Application/SceneDelegate.swift +++ b/Projects/Features/SelfCareFeature/Demo/Sources/Application/SceneDelegate.swift @@ -18,8 +18,10 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { window = UIWindow(windowScene: windowScene) let useCase = DefaultSelfCareUseCase(repository: SelfCareRepository(networkService: SelfCareService())) - let viewModel = SelfCareMyRoutineViewModel(useCase: useCase) - let viewController = SelfCareMyRoutineViewController(viewModel) + let viewModel = SelfCareHomeViewModel() + let viewController = SelfCareHomeViewController(viewModel) +// let viewModel = SelfCareMyRoutineViewModel(useCase: useCase) +// let viewController = SelfCareMyRoutineViewController(viewModel) window?.configure(withRootViewController: viewController) window?.makeKeyAndVisible() } diff --git a/Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineAddViewController.swift b/Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineAddViewController.swift new file mode 100644 index 00000000..6ec27647 --- /dev/null +++ b/Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineAddViewController.swift @@ -0,0 +1,202 @@ +import UIKit + +import RxFlow +import RxCocoa +import RxSwift + +import SnapKit +import Then + +import Core +import Data +import DSKit + +import Domain +import MGLogger +import MGNetworks + +import SelfCareFeatureInterface + +public class SelfCareMyRoutineAddViewController: BaseViewController, Stepper, UIGestureRecognizerDelegate { + + private var myRoutineEditData: SelfCareMyRoutineEditModel = + SelfCareMyRoutineEditModel( + textFieldData: + MyRoutineEditTextFieldModel( + textFieldTitle: "", + textFieldText: "", + textFieldPlaceholder: "" + ), date: [], + exerciseData: [] + ) + + private var naviBar = RoutineNavigationBarBar() + + private var headerView = UIView() + + private var titleTextView = MGTitleTextFieldView(titleText: "제목", textLimit: 3, placeholder: "제목을 입력해주세요") + + private var textFieldData: MyRoutineEditTextFieldModel = MyRoutineEditTextFieldModel( + textFieldTitle: "", + textFieldText: "", + textFieldPlaceholder: "" + ) + private var myRoutineDetailTableView = UITableView().then { + $0.showsVerticalScrollIndicator = false + $0.showsHorizontalScrollIndicator = false + $0.backgroundColor = .white + $0.separatorStyle = .none + $0.register( + MyRoutineEditTableViewCell.self, + forCellReuseIdentifier: MyRoutineEditTableViewCell.identifier + ) + $0.register( + MyRoutineDateTableViewCell.self, + forCellReuseIdentifier: MyRoutineDateTableViewCell.identifier + ) + } + + private let underLine = MGLine(lineHeight: 1.0) + private let underBackView = UIView() + private let buttonSpaceView = UIView() + + private var plusPostureButton = SelfCareButton(type: .posturePlus) + private var editButton = SelfCareButton(type: .complete) + + override public func viewDidLoad() { + super.viewDidLoad() + + view.backgroundColor = .white + } + + public override func configureNavigationBar() { + super.configureNavigationBar() + navigationController?.isNavigationBarHidden = true + self.view.frame = self.view.frame.inset(by: UIEdgeInsets(top: .zero, left: 0, bottom: .zero, right: 0)) + } + + public override func attribute() { + super.attribute() + + naviBar.setLeftText(text: "루틴 추가") + + myRoutineDetailTableView.delegate = self + myRoutineDetailTableView.dataSource = self + navigationController?.interactivePopGestureRecognizer?.delegate = self + } + + public override func layout() { + super.layout() + + headerView = UIView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 132.0)) + view.addSubviews([naviBar, myRoutineDetailTableView, underBackView]) + + headerView.addSubview(titleTextView) + + naviBar.snp.makeConstraints { + $0.leading.top.trailing.equalTo(view.safeAreaLayoutGuide) + } + + titleTextView.snp.makeConstraints { + $0.top.equalToSuperview().offset(24.0) + $0.leading.trailing.equalToSuperview().inset(20.0) + $0.bottom.equalToSuperview().inset(32.0) + } + + myRoutineDetailTableView.tableHeaderView = headerView + myRoutineDetailTableView.snp.makeConstraints { + $0.top.equalToSuperview().offset(105.0) + $0.leading.trailing.equalToSuperview() + $0.height.equalTo(695.0) + } + + underBackView.snp.makeConstraints { + $0.bottom.equalTo(view.safeAreaLayoutGuide) + $0.leading.trailing.equalToSuperview() + $0.top.equalTo(myRoutineDetailTableView.snp.bottom) + } + + underBackView.addSubviews([underLine, buttonSpaceView, plusPostureButton, editButton]) + + underLine.snp.makeConstraints { + $0.trailing.leading.equalToSuperview() + $0.top.equalToSuperview() + } + + buttonSpaceView.snp.makeConstraints { + $0.top.bottom.equalToSuperview() + $0.width.equalTo(8.0) + $0.centerX.equalToSuperview() + } + + plusPostureButton.snp.makeConstraints { + $0.top.bottom.equalToSuperview().inset(20.0) + $0.leading.equalToSuperview().offset(20.0) + $0.trailing.equalTo(buttonSpaceView.snp.leading) + } + + editButton.snp.makeConstraints { + $0.top.bottom.equalToSuperview().inset(20.0) + $0.trailing.equalToSuperview().offset(-20.0) + $0.leading.equalTo(buttonSpaceView.snp.trailing) + } + } + + public override func bindActions() { + self.naviBar.leftButtonTap + .bind(onNext: { [weak self] in + self?.navigationController?.popViewController(animated: true) + }).disposed(by: disposeBag) + } +// public override func bindViewModel() { +// let useCase = DefaultSelfCareUseCase(repository: SelfCareRepository(networkService: SelfCareService())) +// +// viewModel = SelfCareMyRoutineEditViewModel(useCase: useCase) +// +// let input = SelfCareMyRoutineEditViewModel.Input( +// getMyRoutineEditData: Observable.just(()).asDriver(onErrorDriveWith: .never())) +// +// let output = viewModel.transform(input, action: { output in +// output.myRoutineEditData +// .subscribe(onNext: { myRoutineEditData in +// MGLogger.debug("myRoutineEditData: \(myRoutineEditData)") +// self.myRoutineEditData = myRoutineEditData +// self.textFieldData = myRoutineEditData.textFieldData +// }).disposed(by: disposeBag) +// }) +// } +} + +extension SelfCareMyRoutineAddViewController: UITableViewDelegate { + public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + switch indexPath.row { + case 0: + return 104 + default: + return 216 + } + } +} + +extension SelfCareMyRoutineAddViewController: UITableViewDataSource { + public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + myRoutineEditData.exerciseData.count + 1 + } + + public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + switch indexPath.row { + case 0: + let cell = tableView.dequeueReusableCell(withIdentifier: MyRoutineDateTableViewCell.identifier, for: indexPath) as? MyRoutineDateTableViewCell + cell?.selectionStyle = .none + return cell ?? UITableViewCell() + default: + let cell = tableView.dequeueReusableCell( + withIdentifier: MyRoutineEditTableViewCell.identifier, + for: indexPath) as? MyRoutineEditTableViewCell + let editData = myRoutineEditData.exerciseData[indexPath.row - 1] + cell?.setup(with: editData) + cell?.selectionStyle = .none + return cell ?? UITableViewCell() + } + } +} diff --git a/Projects/Features/SelfCareFeature/Sources/RoutineScene/View/SelfCareMyRoutineDetailViewController.swift b/Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineDetailViewController.swift similarity index 100% rename from Projects/Features/SelfCareFeature/Sources/RoutineScene/View/SelfCareMyRoutineDetailViewController.swift rename to Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineDetailViewController.swift diff --git a/Projects/Features/SelfCareFeature/Sources/RoutineScene/View/SelfCareMyRoutineEditViewController.swift b/Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineEditViewController.swift similarity index 100% rename from Projects/Features/SelfCareFeature/Sources/RoutineScene/View/SelfCareMyRoutineEditViewController.swift rename to Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineEditViewController.swift diff --git a/Projects/Features/SelfCareFeature/Sources/RoutineScene/View/SelfCareMyRoutineViewController.swift b/Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineViewController.swift similarity index 86% rename from Projects/Features/SelfCareFeature/Sources/RoutineScene/View/SelfCareMyRoutineViewController.swift rename to Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineViewController.swift index 0f923909..a1186e0f 100644 --- a/Projects/Features/SelfCareFeature/Sources/RoutineScene/View/SelfCareMyRoutineViewController.swift +++ b/Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineViewController.swift @@ -126,8 +126,8 @@ public class SelfCareMyRoutineViewController: BaseViewController + } + + public struct Output { + let myRoutineEditData: Observable + } + + private let myRoutineEditDataSubject = PublishSubject() + + public init(useCase: SelfCareUseCase) { + self.useCase = useCase + } + + public func transform(_ input: Input, action: (Output) -> Void) -> Output { + let output = Output( + myRoutineEditData: myRoutineEditDataSubject.asObservable() + ) + + action(output) + + self.bindOutput(output: output) + + input.getMyRoutineEditData + .drive(onNext: { [weak self] _ in + self?.useCase.getMyRoutineEditData() + }).disposed(by: disposeBag) + + return output + } + + private func bindOutput(output: Output) { + useCase.myRoutineEditData + .subscribe(onNext: { myRoutineEditData in + self.myRoutineEditDataSubject.onNext(myRoutineEditData) + }).disposed(by: disposeBag) + } +} diff --git a/Projects/Features/SelfCareFeature/Sources/Supporter/SelfCareButton.swift b/Projects/Features/SelfCareFeature/Sources/Supporter/SelfCareButton.swift index 150919e1..101cdfd6 100644 --- a/Projects/Features/SelfCareFeature/Sources/Supporter/SelfCareButton.swift +++ b/Projects/Features/SelfCareFeature/Sources/Supporter/SelfCareButton.swift @@ -13,7 +13,7 @@ public class SelfCareButton: BaseButton { private var buttonImage = UIImageView() private var buttonLabel = MGLabel(font: UIFont.Pretendard.labelLarge, - isCenter: false, + isCenter: true, numberOfLineCount: 1 )