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

FIX :: [#326] 루틴 개발 중단 #331

Merged
merged 7 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -18,8 +18,10 @@ 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 = SelfCareHomeViewModel()
let viewController = SelfCareHomeViewController(viewModel)
// let viewModel = SelfCareMyRoutineViewModel(useCase: useCase)
// let viewController = SelfCareMyRoutineViewController(viewModel)
window?.configure(withRootViewController: viewController)
window?.makeKeyAndVisible()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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<SelfCareMyRoutineAddViewModel>, 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()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
$0.showsHorizontalScrollIndicator = false
$0.backgroundColor = .white
$0.separatorStyle = .none
$0.register(MyRoutineDetailTableViewCell.self,
forCellReuseIdentifier: MyRoutineDetailTableViewCell.identifier)
$0.register(
MyRoutineDetailTableViewCell.self,
forCellReuseIdentifier: MyRoutineDetailTableViewCell.identifier
)
}

private var bottomLine = MGLine(lineHeight: 1)
Expand Down Expand Up @@ -134,7 +136,7 @@
let input = SelfCareMyRoutineDetailViewModel.Input(
getMyRoutineDetailData: Observable.just(()).asDriver(onErrorDriveWith: .never()))

let output = viewModel.transform(input, action: { output in

Check notice on line 139 in Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineDetailViewController.swift

View check run for this annotation

Xcode Cloud / MaeumGaGym_iOS | 통합 테스트 | Test - iOS (SelfCareFeature)

Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineDetailViewController.swift#L139

Initialization of immutable value 'output' was never used; consider replacing with assignment to '_' or removing it
output.myRoutineDetailData
.subscribe(onNext: { myRoutineDetailData in
MGLogger.debug("myRoutineDetailData: \(myRoutineDetailData)")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,41 @@
import SelfCareFeatureInterface

public class SelfCareMyRoutineViewController: BaseViewController<SelfCareMyRoutineViewModel>, 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 {
$0.showsVerticalScrollIndicator = false
$0.showsHorizontalScrollIndicator = false
$0.backgroundColor = .white
$0.separatorStyle = .none
$0.register(MyRoutineTableViewCell.self,
forCellReuseIdentifier: MyRoutineTableViewCell.identifier)
$0.register(
MyRoutineTableViewCell.self,
forCellReuseIdentifier: MyRoutineTableViewCell.identifier
)
}

private var plusRoutineButton = SelfCareButton(type: .plusRoutine)
Expand All @@ -76,11 +79,11 @@

public override func layout() {
super.layout()

view.addSubviews([naviBar, myRoutineTableView, plusRoutineButton, headerView])

naviBar.snp.makeConstraints {
$0.leading.top.trailing.equalTo(view.safeAreaLayoutGuide)
$0.top.leading.trailing.equalTo(view.safeAreaLayoutGuide)
}

headerView = UIView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 144.0))
Expand All @@ -97,14 +100,11 @@

myRoutineTitleLabel.snp.makeConstraints {
$0.top.leading.equalToSuperview()
$0.width.equalToSuperview()
$0.height.equalTo(48.0)
}

myRoutineSubTitleLabel.snp.makeConstraints {
$0.leading.bottom.equalToSuperview()
$0.width.equalToSuperview()
$0.height.equalTo(40.0)
$0.top.equalTo(myRoutineTitleLabel.snp.bottom).offset(12.0)
$0.leading.equalToSuperview()
}

myRoutineTableView.tableHeaderView = headerView
Expand All @@ -115,12 +115,22 @@
}

plusRoutineButton.snp.makeConstraints {
$0.bottom.equalToSuperview().offset(-54.0)
$0.leading.trailing.equalToSuperview().inset(20.0)
$0.bottom.equalToSuperview().inset(54.0)
$0.height.equalTo(58.0)
}
}

public override func bindActions() {
plusRoutineButton.rx.tap
.bind(onNext: { [weak self] in
let useCase = DefaultSelfCareUseCase(repository: SelfCareRepository(networkService: SelfCareService()))

let viewModel = SelfCareMyRoutineAddViewModel(useCase: useCase)
let vc = SelfCareMyRoutineAddViewController(viewModel)
self?.navigationController?.pushViewController(vc, animated: true)
}).disposed(by: disposeBag)
}
public override func bindViewModel() {
let useCase = DefaultSelfCareUseCase(repository: SelfCareRepository(networkService: SelfCareService()))

Expand All @@ -129,7 +139,7 @@
let input = SelfCareMyRoutineViewModel.Input(
getMyRoutineData: Observable.just(()).asDriver(onErrorDriveWith: .never()))

let output = viewModel.transform(input, action: { output in

Check notice on line 142 in Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineViewController.swift

View check run for this annotation

Xcode Cloud / MaeumGaGym_iOS | 통합 테스트 | Test - iOS (SelfCareFeature)

Projects/Features/SelfCareFeature/Sources/RoutineScene/VC/SelfCareMyRoutineViewController.swift#L142

Initialization of immutable value 'output' was never used; consider replacing with assignment to '_' or removing it
output.myRoutineData
.subscribe(onNext: { myRoutineData in
MGLogger.debug("myRoutineData: \(myRoutineData)")
Expand All @@ -148,6 +158,7 @@
}
}
}

extension SelfCareMyRoutineViewController: UITableViewDataSource {
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
myRoutineModel.myRoutineData.count + 1
Expand All @@ -165,6 +176,12 @@
let routine = myRoutineModel.myRoutineData[indexPath.row]
cell?.setup(with: routine)
cell?.selectionStyle = .none
cell?.dotsButtonTap
.bind(onNext: { [weak self] in
let modal = MGBottomSheetViewController(type: .plain)
self?.present(modal, animated: true)
}).disposed(by: disposeBag)

return cell ?? UITableViewCell()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// SelfCarePostureAddViewController.swift
// SelfCareFeatureInterface
//
// Created by 조영준 on 5/16/24.
// Copyright © 2024 MaeumGaGym-iOS. All rights reserved.
//

import UIKit

class SelfCarePostureAddViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

// 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.
}
*/

}
Loading
Loading