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

사용자 프로필 만들었습니다. #252

Merged
merged 10 commits into from
Feb 27, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = (scene as? UIWindowScene) else { return }

window = UIWindow(windowScene: windowScene)
let useCase = DefaultSelfCareUseCase(repository: SelfCareRepository(networkService: SelfCareService()))
let viewModel = SelfCareTargetMainViewModel(useCase: useCase)
let viewController = SelfCareTargetMainViewController(viewModel)
window?.configure(withRootViewController: viewController)
// let useCase = DefaultSelfCareUseCase(repository: SelfCareRepository(networkService: SelfCareService()))
// let viewModel = SelfCareTargetMainViewModel(useCase: useCase)
// let viewController = SelfCareTargetMainViewController(viewModel)
let viewController = SelfCareProfileViewController(ProfileEditViewModel())
window?.configure(withRootViewController: viewController)
window?.makeKeyAndVisible()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ public class SelfCareHomeViewController: BaseViewController<SelfCareHomeViewMode
mainText: SelfCareResourcesService.Title.selfCare,
subText: SelfCareResourcesService.Title.introductsSelfCare)

var profiles = SelfCareProfileModel(userImage: DSKitAsset.Assets.basicProfile.image,
var profiles = SelfCareProfileModel(userImage: DSKitAsset.Assets.basicProfileIcon.image,
userName: "박준하",
userTimer: 123,
userBage: SelfCareResourcesService.Assets.bage)

var menus = [SelfCareMenuModel(menuImage: DSKitAsset.Assets.selfCareMenuMyRoutine.image, menuName: "내루틴"),
SelfCareMenuModel(menuImage: DSKitAsset.Assets.selfCareGoul.image, menuName: "목표"),
SelfCareMenuModel(menuImage: DSKitAsset.Assets.selfCareFood.image, menuName: "식단"),
SelfCareMenuModel(menuImage: DSKitAsset.Assets.selfCareOunwan.image, menuName: "오운완")]
var menus = [SelfCareMenuModel(menuImage: DSKitAsset.Assets.appleLogo.image, menuName: "내루틴"),
SelfCareMenuModel(menuImage: DSKitAsset.Assets.appleLogo.image, menuName: "목표"),
SelfCareMenuModel(menuImage: DSKitAsset.Assets.appleLogo.image, menuName: "식단"),
SelfCareMenuModel(menuImage: DSKitAsset.Assets.appleLogo.image, menuName: "오운완")]

private lazy var tableView: UITableView = UITableView().then {
$0.delegate = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SelfCareProfileTableViewCell: BaseTableViewCell {

private let profileImageView = MGProfileView(
profileImage: MGProfileImage(type: .custom,
customImage: DSKitAsset.Assets.basicProfile.image),
customImage: DSKitAsset.Assets.basicProfileIcon.image),
profileType: .bigProfile
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import UIKit
import SelfCareFeatureInterface

import MGNetworks
import Domain

import DSKit
import Core

final public class SelfCareProfileViewController: BaseViewController<ProfileEditViewModel> {
private lazy var navBar = SelfCareProfileNavigationBar()

private lazy var userProfileImageView = MGProfileView(
profileImage: MGProfileImage(type: .custom,
customImage: SelfCareResourcesService.Assets.baseProfile),
profileType: .maxProfile)

private lazy var userNameLabel = MGLabel(text: "박준하",
font: UIFont.Pretendard.titleMedium,
textColor: .black)
private var bageView = SelfCareBageView()

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

view.backgroundColor = .white
}

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

navigationController?.isNavigationBarHidden = true
}

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

view.addSubviews([navBar,
userProfileImageView,
userNameLabel,
bageView
])

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

userProfileImageView.snp.makeConstraints {
$0.top.equalTo(navBar.snp.bottom).offset(24.0)
$0.leading.equalToSuperview().offset(20.0)
}

userNameLabel.snp.makeConstraints {
$0.top.equalTo(userProfileImageView.snp.bottom).offset(16.0)
$0.leading.equalTo(userProfileImageView.snp.leading)
}

bageView.snp.makeConstraints {
$0.top.equalTo(userNameLabel.snp.bottom).offset(32.0)
$0.width.equalTo(390)
$0.centerX.equalToSuperview()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import UIKit

import SnapKit
import Then

import DSKit

public class SelfCareBageView: UIView {
private let shadows = UIView()
private let shapes = UIView()
private let gradientLayer = CAGradientLayer()
private let heartImageView = UIImageView().then {
$0.contentMode = .scaleAspectFit
$0.image = UIImage(systemName: "heart.fill")
$0.tintColor = .red
}

public var bageNameLabel = MGLabel(text: "마음 뱃지",
font: UIFont.Pretendard.titleMedium,
textColor: .black)
public var userTimeLabel = MGLabel(text: "총 124시간 운동하셨어요!",
font: UIFont.Pretendard.bodyMedium,
textColor: .black)

override init(frame: CGRect) {
super.init(frame: frame)
setupView()
}

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
setupView()
}

private func setupView() {
self.frame = CGRect(x: 0, y: 0, width: 390, height: 247)

setupShadows()
setupShapes()
addHeartIcon()
}

private func setupShadows() {
shadows.frame = bounds
shadows.clipsToBounds = false
addSubview(shadows)

let shadowPath0 = UIBezierPath(roundedRect: shadows.bounds, cornerRadius: 16)
let layer0 = CALayer()
layer0.shadowPath = shadowPath0.cgPath
layer0.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.25).cgColor
layer0.shadowOpacity = 1
layer0.shadowRadius = 4
layer0.shadowOffset = CGSize(width: 0, height: 4)
layer0.bounds = shadows.bounds
layer0.position = shadows.center
shadows.layer.addSublayer(layer0)
}

private func setupShapes() {
shapes.frame = bounds
shapes.clipsToBounds = true
addSubview(shapes)

gradientLayer.colors = [
UIColor.lighterGray.cgColor,
UIColor.darkerGray.cgColor
]
gradientLayer.locations = [0, 1]
gradientLayer.startPoint = CGPoint(x: 0.25, y: 0.5)
gradientLayer.endPoint = CGPoint(x: 0.75, y: 0.5)
gradientLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransform(
a: 0, b: 1, c: -1, d: 0, tx: 1, ty: 0)
)
gradientLayer.bounds = shapes.bounds.insetBy(
dx: -0.5 * shapes.bounds.size.width, dy: -0.5 * shapes.bounds.size.height
)
gradientLayer.position = shapes.center
shapes.layer.addSublayer(gradientLayer)
shapes.layer.cornerRadius = 16
shapes.layer.borderWidth = 2
shapes.layer.borderColor = UIColor.lighterGray.cgColor
}

private func addHeartIcon() {
addSubviews([heartImageView,
bageNameLabel,
userTimeLabel])

heartImageView.snp.makeConstraints {
$0.top.equalToSuperview().offset(45.0)
$0.centerX.equalToSuperview()
$0.size.equalTo(80)
}

bageNameLabel.snp.makeConstraints {
$0.top.equalTo(heartImageView.snp.bottom).offset(32.0)
$0.centerX.equalToSuperview()
}

userTimeLabel.snp.makeConstraints {
$0.top.equalTo(bageNameLabel.snp.bottom).offset(6.0)
$0.centerX.equalToSuperview()
}
}
}

extension UIColor {
static var lighterGray: UIColor {
return UIColor(red: 0.942, green: 0.948, blue: 0.961, alpha: 1)
}

static var darkerGray: UIColor {
return UIColor.white
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// ProfileNavigationBar.swift
// SelfCareFeatureInterface
//
// Created by 박준하 on 2/27/24.
// Copyright © 2024 MaeumGaGym-iOS. All rights reserved.
//

import UIKit

import RxSwift
import RxCocoa

import Core
import DSKit

import MGNetworks

final public class SelfCareProfileNavigationBar: UIView {

public var leftButtonTap: ControlEvent<Void> {
return leftButton.rx.tap
}

private let leftButton = MGImageButton(image: SelfCareResourcesService.Assets.leftArrow.withTintColor(.black))

private let leftLabel = MGLabel(text: SelfCareResourcesService.Title.myProfileEdit,
font: UIFont.Pretendard.labelLarge,
textColor: .black
)

private lazy var leftItemsStackView = UIStackView(arrangedSubviews: [leftButton, leftLabel]).then {
$0.axis = .horizontal
$0.spacing = 0
$0.distribution = .fillEqually
}

public init() {
super.init(frame: .zero)
setUI()
setLayout()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

private extension SelfCareProfileNavigationBar {
func setUI() {
self.backgroundColor = .white
}

func setLayout() {
self.addSubview(leftItemsStackView)

self.snp.makeConstraints {
$0.height.equalTo(48.0)
}

leftItemsStackView.snp.makeConstraints {
$0.top.bottom.equalToSuperview()
$0.leading.equalToSuperview().offset(-10.0)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import UIKit

import RxFlow
import RxCocoa
import RxSwift

import Core

public class ProfileEditViewModel: BaseViewModel {
public func transform(_ input: Input, action: (Output) -> Void) -> Output {
return Output()
}

public struct Input {

}

public struct Output {

}

public init() {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class SelfCareMyRoutineDetailViewController: BaseViewController<SelfCareM

private var deleteRoutineButton = SelfCareButton(type: .deleteRotine)
private var editRoutineButton = SelfCareButton(type: .editRoutine)
private var dotsButton = MGImageButton(image: DSKitAsset.Assets.selfCareDots.image)
private var dotsButton = MGImageButton(image: DSKitAsset.Assets.dotsActIcon.image)

public override func attribute() {
super.attribute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class MyRoutineDetailTableViewCell: BaseTableViewCell {
)

private var deatilImage = UIImageView().then {
$0.image = DSKitAsset.Assets.right.image
$0.image = DSKitAsset.Assets.rightArrow.image
$0.layer.cornerRadius = 40.0
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public class MyRoutineCountView: BaseView {
$0.layer.borderWidth = 1
}

private var minusButton = MGImageButton(image: DSKitAsset.Assets.selfCareMinus.image)
private var minusButton = MGImageButton(image: DSKitAsset.Assets.blackMinus.image)

private var plusButtonn = MGImageButton(image: DSKitAsset.Assets.selfCarePlus.image)
private var plusButtonn = MGImageButton(image: DSKitAsset.Assets.blackPlus.image)

private var numberTextField = UITextField().then {
$0.font = UIFont.Pretendard.bodyMedium
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class MyRoutineEditTableViewCell: BaseTableViewCell {
$0.font = UIFont.Pretendard.bodyMedium
}

private var deleteButton = MGImageButton(image: DSKitAsset.Assets.selfCareDelete.image)
private var deleteButton = MGImageButton(image: DSKitAsset.Assets.appleLogo.image)

private let numberCountView = MyRoutineCountView()
private let setCountView = MyRoutineCountView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class MyRoutineTableViewCell: BaseTableViewCell {
$0.isHidden = true
}

private let dotsButton = MGImageButton(image: DSKitAsset.Assets.selfCareDots.image)
private let dotsButton = MGImageButton(image: DSKitAsset.Assets.dotsActIcon.image)

public func setup(with model: SelfCareRoutineModel) {
routineNameLabel.text = model.routineNameText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ public enum SelfCareButtonType {
var buttonImage: UIImage? {
switch self {
case .plusRoutine:
return DSKitAsset.Assets.selfCarePlus.image
return DSKitAsset.Assets.blackPlus.image
case .deleteRotine:
return DSKitAsset.Assets.selfCareTrash.image
return DSKitAsset.Assets.trashActIcon.image
case .editRoutine:
return DSKitAsset.Assets.selfCarePencil.image
return DSKitAsset.Assets.pencilActIcon.image
case .posturePlus:
return DSKitAsset.Assets.selfCarePlus.image
return DSKitAsset.Assets.blackPlus.image
case .plusTarget:
return DSKitAsset.Assets.selfCarePlus.image
return DSKitAsset.Assets.blackPlus.image
default:
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class TargetMainTableViewCell: BaseTableViewCell {
numberOfLineCount: 1
)

private let dotsButton = MGImageButton(image: DSKitAsset.Assets.selfCareDots.image)
private let dotsButton = MGImageButton(image: DSKitAsset.Assets.dotsActIcon.image)

public func setup(with model: TargetContentModel) {
changeTargetName(text: model.targetTitle)
Expand Down
Loading