Skip to content

Commit

Permalink
Merge pull request #88 from Umpah-swim-wave/fix/86-routine-detailView-qa
Browse files Browse the repository at this point in the history
[FIX] 루틴상세뷰, element μˆ˜μ • λ·° λ””μžμΈ QA 반영
  • Loading branch information
hryeong66 authored Feb 18, 2022
2 parents be8a183 + fa7acbd commit ca84957
Show file tree
Hide file tree
Showing 13 changed files with 167 additions and 184 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,16 @@
debugServiceExtension = "internal"
allowLocationSimulation = "YES"
launchAutomaticallySubstyle = "32">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/Uhpuh WatchKit App">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EDD43FE326483C9600C866F3"
BuildableName = "Umpah-iOS WatchKit App.app"
BlueprintName = "Umpah-iOS WatchKit App"
ReferencedContainer = "container:Umpah-iOS.xcodeproj">
</BuildableReference>
</RemoteRunnable>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand All @@ -75,27 +73,16 @@
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
launchAutomaticallySubstyle = "32">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/Uhpuh WatchKit App">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EDD43FE326483C9600C866F3"
BuildableName = "Umpah-iOS WatchKit App.app"
BlueprintName = "Umpah-iOS WatchKit App"
ReferencedContainer = "container:Umpah-iOS.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EDD43FE326483C9600C866F3"
BuildableName = "Umpah-iOS WatchKit App.app"
BlueprintName = "Umpah-iOS WatchKit App"
ReferencedContainer = "container:Umpah-iOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,46 +54,33 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/Uhpuh WatchKit App">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EDD43FE326483C9600C866F3"
BuildableName = "Umpah-iOS WatchKit App.app"
BlueprintName = "Umpah-iOS WatchKit App"
ReferencedContainer = "container:Umpah-iOS.xcodeproj">
</BuildableReference>
</RemoteRunnable>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/Uhpuh WatchKit App">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EDD43FE326483C9600C866F3"
BuildableName = "Umpah-iOS WatchKit App.app"
BlueprintName = "Umpah-iOS WatchKit App"
ReferencedContainer = "container:Umpah-iOS.xcodeproj">
</BuildableReference>
</RemoteRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "EDD43FE326483C9600C866F3"
BuildableName = "Umpah-iOS WatchKit App.app"
BlueprintName = "Umpah-iOS WatchKit App"
ReferencedContainer = "container:Umpah-iOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
Expand Down
20 changes: 19 additions & 1 deletion Umpah-iOS/Umpah-iOS/Network/Model/Record/RoutineDataModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,26 @@ struct RoutineItemData {
var time : Int = 0

func getTimeToString() -> String{
let minute = time / 60 < 10 ? "0\(time / 60)" : "\(time / 60))"
let minute = time / 60 < 10 ? "0\(time / 60)" : "\(time / 60)"
let second = time % 60 < 10 ? "0\(time % 60)" : "\(time % 60)"
return minute + ":" + second
}

func getAutomaticTimeToString() -> String{
let newTime = distance * getTimeAccoringToStorke()
let minute = newTime / 60 < 10 ? "0\(newTime / 60)" : "\(newTime / 60)"
let second = newTime % 60 < 10 ? "0\(newTime % 60)" : "\(newTime % 60)"
return minute + ":" + second
}

//데이터 ν˜•μ‹μ— 맞게 λ°”κΎΈκΈ°
func getTimeAccoringToStorke() -> Int{
switch stroke {
case "μžμœ ν˜•": return 11
case "ν‰μ˜": return 22
case "배영": return 33
case "μ ‘μ˜": return 44
default: return 99
}
}
}
4 changes: 2 additions & 2 deletions Umpah-iOS/Umpah-iOS/Resource/Storyboards/Routine.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Y6W-OH-hqX">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Y6W-OH-hqX">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ final class RoutineTVC: UITableViewCell, NibLoadableView, ReusableView {
$0.textColor = .upuhBlack
$0.numberOfLines = 2
}
private let deleteButton = UIButton(frame: CGRect(origin: .zero, size: CGSize(width: 22, height: 22))).then {
let deleteButton = UIButton(frame: CGRect(origin: .zero, size: CGSize(width: 22, height: 22))).then {
$0.setImage(UIImage(named: "ic_trash"), for: .normal)
}
private let disposeBag = DisposeBag()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ extension ExpandedStateTableView: UITableViewDataSource {
case .routine:
guard let cell = tableView.dequeueReusableCell(withIdentifier: RoutineTVC.className) as? RoutineTVC else { return UITableViewCell() }
cell.setContentData(overview: upuhRoutineOverViewList[indexPath.row])
cell.deleteButton.isHidden = true
return cell
default:
return UITableViewCell()
Expand Down Expand Up @@ -115,6 +116,8 @@ extension ExpandedStateTableView: UITableViewDelegate {
cell.separatorInset = .init(top: 0, left: 80, bottom: 0, right: 20)
case .month:
cell.separatorInset = .init(top: 0, left: 90, bottom: 0, right: 20)
case .routine:
tableView.backgroundColor = .upuhBackground
default:
break
}
Expand All @@ -140,7 +143,7 @@ extension ExpandedStateTableView: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if currentMainViewState == .routine {
let storyboard = UIStoryboard(name: "Routine", bundle: nil)
guard let routineVC = storyboard.instantiateViewController(withIdentifier: RoutineVC.identifier) as? RoutineVC else {return}
guard let routineVC = storyboard.instantiateViewController(withIdentifier: RoutineVC.className) as? RoutineVC else {return}
routineVC.modalPresentationStyle = .overFullScreen
rootVC?.present(routineVC, animated: true, completion: nil)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ final class ExpandedStateView: ExpandedStateTableView {

private func setupRoutineFilterActions(){
let presentinglevelAction = UIAction { _ in
self.presentToModifyElement(elementType: .level)
self.presentToModifyElementView(of: .level, before: self.routineFilterView.levelText)
}
let presentingStrokeAction = UIAction { _ in
self.presentToModifyElement(elementType: .exceptStorke)
self.presentToModifyElementView(of: .exceptStorke, before: self.routineFilterView.exceptionStrokeText)
}
let changeOrderingDistanceAction = UIAction { _ in
self.routineFilterView.changeDistanceButton()
Expand All @@ -125,16 +125,20 @@ final class ExpandedStateView: ExpandedStateTableView {
}
filteredOverViewList = upuhRoutineOverViewList
}

private func presentToModifyElement(elementType: ModifyElementType){
func presentToModifyElementView(of type: ModifyElementType, setTitle: String = "", index: Int = 0, before data: String = ""){
let storyboard = UIStoryboard(name: "ModifyElement", bundle: nil)
guard let nextVC = storyboard.instantiateViewController(withIdentifier: ModifyElementVC.identifier) as? ModifyElementVC else {return}

guard let nextVC = storyboard.instantiateViewController(identifier: ModifyElementVC.className) as? ModifyElementVC else {
return
}
nextVC.sendFilterData = { [weak self] in
self?.rootVC?.setupCardViewState(to: .expanded)
}

nextVC.setupModificationContent(of: type,
setTitle: setTitle,
index: index, before: data)

nextVC.elementType = elementType
nextVC.backgroundImage = self.rootVC?.view.asImage()
nextVC.modalPresentationStyle = .overCurrentContext
nextVC.modalTransitionStyle = .crossDissolve
Expand Down
9 changes: 9 additions & 0 deletions Umpah-iOS/Umpah-iOS/Screen/Main/Controller/MainVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ extension MainVC: UITableViewDelegate {
}
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if currentMainViewState == .routine {
let storyboard = UIStoryboard(name: "Routine", bundle: nil)
guard let routineVC = storyboard.instantiateViewController(withIdentifier: RoutineVC.className) as? RoutineVC else {return}
routineVC.modalPresentationStyle = .overFullScreen
present(routineVC, animated: true, completion: nil)
}
}

func scrollViewDidScroll(_ scrollView: UIScrollView) {
let offsetY = scrollView.contentOffset.y
let touchToSafeAreaTop = offsetY >= 188
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import UIKit

class ModifyElementTVC: UITableViewCell {

static let identifier = "ModifyElementTVC"

public var nameLabel = UILabel().then{
$0.textColor = .upuhBlack
$0.font = .IBMPlexSansRegular(ofSize: 16)
Expand All @@ -31,6 +29,7 @@ class ModifyElementTVC: UITableViewCell {
super.setSelected(selected, animated: animated)
checkImageView.isHidden = selected ? false : true
nameLabel.textColor = selected ? .upuhBlue2 : .upuhBlack
nameLabel.font = selected ? .IBMPlexSansSemiBold(ofSize: 16) : .IBMPlexSansRegular(ofSize: 16)
}

func setupLayout(){
Expand Down
12 changes: 8 additions & 4 deletions Umpah-iOS/Umpah-iOS/Screen/Routine/Cell/RoutineItemTVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import SnapKit
import Then

class RoutineItemTVC: UITableViewCell {
static let identifier = "RoutineItemTVC"

public var selectStorke: (() -> ())?
//MARK: Properties

public var selectStorke: ((String) -> ())?
public var selectDistance: ((Int) -> ())?
public var selectTime: ((Int) -> ())?
public var isSelectedDistance: Bool = true
Expand Down Expand Up @@ -89,11 +90,13 @@ class RoutineItemTVC: UITableViewCell {
}
strokeButton.setTitle(item.stroke, for: .normal)
distanceTextField.text = "\(item.distance)m"
timeTextField.text = item.getTimeToString()
timeTextField.text = item.getAutomaticTimeToString()
}

func addActions(){
let touchUpToselectStorke = UIAction {_ in self.selectStorke?()}
let touchUpToselectStorke = UIAction { _ in
self.selectStorke?(self.routineItem?.stroke ?? "")
}
let checkDistanceAction = UIAction{ _ in
print("checkDistanceAction isSelectedDistance = \(self.isSelectedDistance)")
self.isSelectedDistance = true
Expand Down Expand Up @@ -168,6 +171,7 @@ extension RoutineItemTVC: UIPickerViewDelegate{
if isSelectedDistance {
distanceTextField.text = "\(distanceList[row])m"
routineItem?.distance = distanceList[row]
timeTextField.text = routineItem?.getAutomaticTimeToString()
}else{
if component == 0{
selectedTime.0 = miniteList[row]*60
Expand Down
26 changes: 8 additions & 18 deletions Umpah-iOS/Umpah-iOS/Screen/Routine/Cell/RoutineSetTVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ protocol RoutineCellDelegate{
}

class RoutineSetTVC: UITableViewCell {
static let identifier = "RoutineSetTVC"
public var viewModel: RoutineViewModel?
private var routineListInSet : [RoutineItemData] = []
public var routineItemCellList: [RoutineItemTVC] = []
Expand Down Expand Up @@ -57,7 +56,7 @@ class RoutineSetTVC: UITableViewCell {
}

public var tableView = UITableView().then{
$0.registerCustomXib(name: RoutineItemTVC.identifier)
$0.registerCustomXib(name: RoutineItemTVC.className)
}

private var reorderControlImageView: UIImageView? {
Expand All @@ -71,7 +70,6 @@ class RoutineSetTVC: UITableViewCell {

public var isEditingMode: Bool = false {
didSet{
print("routine setμ—μ„œ λ°”λ€”κΊΌμž„ \(isEditingMode)")
if isEditingMode{
changeLayoutAtEditingMode()
tableView.tableFooterView = setTableViewFooter()
Expand All @@ -80,7 +78,6 @@ class RoutineSetTVC: UITableViewCell {
tableView.tableFooterView = nil
}
routineItemCellList.forEach{
print("item에 넣어쀄 editing mode \(isEditingMode)")
$0.isEditingMode = isEditingMode
}
}
Expand Down Expand Up @@ -137,7 +134,7 @@ class RoutineSetTVC: UITableViewCell {
}

private func getRoutineItemCell(item: RoutineItemData) -> RoutineItemTVC {
guard let cell = tableView.dequeueReusableCell(withIdentifier: RoutineItemTVC.identifier) as? RoutineItemTVC else{
guard let cell = tableView.dequeueReusableCell(withIdentifier: RoutineItemTVC.className) as? RoutineItemTVC else{
return RoutineItemTVC()
}
cell.setRoutineItem(item: item, isEditing: isEditingMode)
Expand Down Expand Up @@ -174,7 +171,6 @@ extension RoutineSetTVC: UITableViewDelegate{
}

func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
print("indexPath = \(indexPath), editingStyle = \(editingStyle)")
if editingStyle == .delete{
viewModel?.routineStorage.delete(setTitle: routineSetTitle, index: indexPath.row)
routineItemCellList.remove(at: indexPath.row)
Expand All @@ -196,7 +192,7 @@ extension RoutineSetTVC: UITableViewDataSource{

public func setTableViewFooter() -> UIView{
let view = UIView(frame: CGRect(x: 0, y: 0,
width: UIScreen.getDeviceWidth(),
width: tableView.frame.width,
height: 68))

let titleButton = UIButton().then{
Expand All @@ -212,18 +208,17 @@ extension RoutineSetTVC: UITableViewDataSource{

view.addSubviews([titleButton,
titleUnderline])
let centerX = UIScreen.getDeviceWidth() / 2.0
print("centerX = \(centerX)")
let titleButtonX = (view.frame.width - titleButton.frame.width) / 2.0
titleButton.snp.makeConstraints{
$0.center.equalToSuperview()
$0.centerY.equalToSuperview()
$0.centerX.equalToSuperview().offset(6)
}
titleButton.center.x = centerX

titleUnderline.snp.makeConstraints{
$0.top.equalTo(titleButton.snp.bottom).offset(-8)
$0.top.equalTo(titleButton.snp.bottom).offset(-9)
$0.centerX.equalTo(titleButton.snp.centerX)
$0.width.equalTo(titleButton.snp.width)
$0.height.equalTo(1)
$0.height.equalTo(1.5)
}
return view
}
Expand All @@ -250,8 +245,6 @@ extension RoutineSetTVC: UITableViewDataSource{
cell.isEditingMode = true
routineItemCellList.append(cell)
tableView.reloadData()

print("cell.editingStyle = \(cell.editingStyle.rawValue)")
}
}

Expand Down Expand Up @@ -335,12 +328,9 @@ extension RoutineSetTVC {
}

public func updateReorderImageView(){
print("reorderControlImageView?.frame = \(reorderControlImageView?.frame)")
reorderImageView.snp.remakeConstraints{
$0.centerY.equalTo(titleLabel.snp.centerY)
$0.trailing.equalToSuperview().inset(24)
// $0.height.equalTo(reorderControlImageView?.frame.height ?? 30)
// $0.width.equalTo(reorderControlImageView?.frame.width ?? 30)
$0.height.equalTo(30)
$0.width.equalTo(30)

Expand Down
Loading

0 comments on commit ca84957

Please sign in to comment.