From af582af3efa7f7d4393d3a6d2b46ff9854b4d334 Mon Sep 17 00:00:00 2001 From: Sanghee Date: Wed, 31 Aug 2022 10:53:12 +0900 Subject: [PATCH 1/2] =?UTF-8?q?:bulb:=20=EB=93=B1=EB=A1=9D=20=ED=99=94?= =?UTF-8?q?=EB=A9=B4=EC=97=90=EC=84=9C=20=EB=8B=A4=EC=96=91=ED=95=9C=20?= =?UTF-8?q?=EC=8B=9C=EA=B0=84=20=EC=84=A0=ED=83=9D=ED=95=A0=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=EC=8B=9C=EA=B0=84=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#198)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RegisterGifticonViewController.swift | 7 +- .../App/Sources/Register/RegisterTime.swift | 170 ++++++++++++++++++ .../Sources/Usecase/SprinkleInformation.swift | 4 +- 3 files changed, 177 insertions(+), 4 deletions(-) create mode 100644 Projects/App/Sources/Register/RegisterTime.swift diff --git a/Projects/App/Sources/Register/RegisterGifticonViewController.swift b/Projects/App/Sources/Register/RegisterGifticonViewController.swift index dd705e7..afa9107 100644 --- a/Projects/App/Sources/Register/RegisterGifticonViewController.swift +++ b/Projects/App/Sources/Register/RegisterGifticonViewController.swift @@ -252,9 +252,12 @@ extension RegisterGifticonViewController: UIScrollViewDelegate { extension RegisterGifticonViewController { private func showPicker() { + var times = [String]() + for time in RegisterTime.allCases { + times.append(time.rawValue) + } let pickerViewController = PickerViewController(PickerViewModel(dataSourceType: .title( - // TODO: - 임의로 넣은 피커 데이터. 확인 필요 - ["30분", "1시간", "1시간30분", "2시간", "2시간 30분"] + times ), didSelectItem: { [weak self] time in guard let time = time as? String else { return } self?.registerGifticonView.updateTime(time) diff --git a/Projects/App/Sources/Register/RegisterTime.swift b/Projects/App/Sources/Register/RegisterTime.swift new file mode 100644 index 0000000..1c65436 --- /dev/null +++ b/Projects/App/Sources/Register/RegisterTime.swift @@ -0,0 +1,170 @@ +// +// RegisterTime.swift +// DDip +// +// Created by 안상희 on 2022/08/31. +// Copyright © 2022 dvHuni. All rights reserved. +// + +import Foundation + +enum RegisterTime: String, CaseIterable { + case _5 = "5분" + case _10 = "10분" + case _20 = "20분" + case _30 = "30분" + case _60 = "1시간" // 1 + case _90 = "1시간 30분" // 1:30 + case _120 = "2시간" // 2 + case _150 = "2시간 30분" // 2:30 + case _180 = "3시간" // 3 + case _210 = "3시간 30분" // 3:30 + case _240 = "4시간" // 4 + case _270 = "4시간 30분" // 4:30 + case _300 = "5시간" // 5 + case _330 = "5시간 30분" // 5:30 + case _360 = "6시간" // 6 + case _390 = "6시간 30분" // 6:30 + case _420 = "7시간" // 7 + case _450 = "7시간 30분" // 7:30 + case _480 = "8시간" // 8 + case _510 = "8시간 30분" // 8:30 + case _540 = "9시간" // 9 + case _570 = "9시간 30분" // 9:30 + case _600 = "10시간" // 10 + case _630 = "10시간 30분" // 10:30 + case _660 = "11시간" // 11 + case _690 = "11시간 30분" // 11:30 + case _720 = "12시간" // 12 + case _750 = "12시간 30분" // 12:30 + case _780 = "13시간" // 13 + case _810 = "13시간 30분" // 13:30 + case _840 = "14시간" // 14 + case _870 = "14시간 30분" // 14:30 + case _900 = "15시간" // 15 + case _930 = "15시간 30분" // 15:30 + case _960 = "16시간" // 16 + case _990 = "16시간 30분" // 16:30 + case _1020 = "17시간" // 17 + case _1050 = "17시간 30분" // 17:30 + case _1080 = "18시간" // 18 + case _1110 = "18시간 30분" // 18:30 + case _1140 = "19시간" // 19 + case _1170 = "19시간 30분" // 19:30 + case _1200 = "20시간" // 20 + case _1230 = "20시간 30분" // 20:30 + case _1260 = "21시간" // 21 + case _1290 = "21시간 30분" // 21:30 + case _1320 = "22시간" // 22 + case _1350 = "22시간 30분" // 22:30 + case _1380 = "23시간" // 23 + case _1410 = "23시간 30분" // 23:30 + case _1440 = "24시간" // 24 + + var description: Int { + switch self { + case ._5: + return 5 + case ._10: + return 10 + case ._20: + return 20 + case ._30: + return 30 + case ._60: + return 60 + case ._90: + return 90 + case ._120: + return 120 + case ._150: + return 150 + case ._180: + return 180 + case ._210: + return 210 + case ._240: + return 240 + case ._270: + return 270 + case ._300: + return 300 + case ._330: + return 330 + case ._360: + return 360 + case ._390: + return 390 + case ._420: + return 420 + case ._450: + return 450 + case ._480: + return 480 + case ._510: + return 510 + case ._540: + return 540 + case ._570: + return 570 + case ._600: + return 600 + case ._630: + return 630 + case ._660: + return 660 + case ._690: + return 690 + case ._720: + return 720 + case ._750: + return 750 + case ._780: + return 780 + case ._810: + return 810 + case ._840: + return 840 + case ._870: + return 870 + case ._900: + return 900 + case ._930: + return 930 + case ._960: + return 960 + case ._990: + return 990 + case ._1020: + return 1020 + case ._1050: + return 1050 + case ._1080: + return 1080 + case ._1110: + return 1110 + case ._1140: + return 1140 + case ._1170: + return 1170 + case ._1200: + return 1200 + case ._1230: + return 1230 + case ._1260: + return 1260 + case ._1290: + return 1290 + case ._1320: + return 1320 + case ._1350: + return 1350 + case ._1380: + return 1380 + case ._1410: + return 1410 + case ._1440: + return 1440 + } + } +} diff --git a/Projects/App/Sources/Usecase/SprinkleInformation.swift b/Projects/App/Sources/Usecase/SprinkleInformation.swift index 3c36195..74e0568 100644 --- a/Projects/App/Sources/Usecase/SprinkleInformation.swift +++ b/Projects/App/Sources/Usecase/SprinkleInformation.swift @@ -54,8 +54,8 @@ struct SprinkleInformation { func intDeadLineMinute() -> Int { if let deadlineMinute = deadlineMinute, deadlineMinute.isEmpty == false { - // TODO: 분, 시간 -> 분으로 변경하는 로직 추가하기 - return 30 + guard let time = RegisterTime(rawValue: deadlineMinute)?.description else { return .zero } + return time } return .zero From e86e743316be884480df96f6f624acc3b6648bba Mon Sep 17 00:00:00 2001 From: Sanghee Date: Wed, 31 Aug 2022 10:57:55 +0900 Subject: [PATCH 2/2] =?UTF-8?q?:recycle:=20=EC=A3=BC=EC=84=9D=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../App/Sources/Register/RegisterTime.swift | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/Projects/App/Sources/Register/RegisterTime.swift b/Projects/App/Sources/Register/RegisterTime.swift index 1c65436..ed1c1c2 100644 --- a/Projects/App/Sources/Register/RegisterTime.swift +++ b/Projects/App/Sources/Register/RegisterTime.swift @@ -13,53 +13,53 @@ enum RegisterTime: String, CaseIterable { case _10 = "10분" case _20 = "20분" case _30 = "30분" - case _60 = "1시간" // 1 - case _90 = "1시간 30분" // 1:30 - case _120 = "2시간" // 2 - case _150 = "2시간 30분" // 2:30 - case _180 = "3시간" // 3 - case _210 = "3시간 30분" // 3:30 - case _240 = "4시간" // 4 - case _270 = "4시간 30분" // 4:30 - case _300 = "5시간" // 5 - case _330 = "5시간 30분" // 5:30 - case _360 = "6시간" // 6 - case _390 = "6시간 30분" // 6:30 - case _420 = "7시간" // 7 - case _450 = "7시간 30분" // 7:30 - case _480 = "8시간" // 8 - case _510 = "8시간 30분" // 8:30 - case _540 = "9시간" // 9 - case _570 = "9시간 30분" // 9:30 - case _600 = "10시간" // 10 - case _630 = "10시간 30분" // 10:30 - case _660 = "11시간" // 11 - case _690 = "11시간 30분" // 11:30 - case _720 = "12시간" // 12 - case _750 = "12시간 30분" // 12:30 - case _780 = "13시간" // 13 - case _810 = "13시간 30분" // 13:30 - case _840 = "14시간" // 14 - case _870 = "14시간 30분" // 14:30 - case _900 = "15시간" // 15 - case _930 = "15시간 30분" // 15:30 - case _960 = "16시간" // 16 - case _990 = "16시간 30분" // 16:30 - case _1020 = "17시간" // 17 - case _1050 = "17시간 30분" // 17:30 - case _1080 = "18시간" // 18 - case _1110 = "18시간 30분" // 18:30 - case _1140 = "19시간" // 19 - case _1170 = "19시간 30분" // 19:30 - case _1200 = "20시간" // 20 - case _1230 = "20시간 30분" // 20:30 - case _1260 = "21시간" // 21 - case _1290 = "21시간 30분" // 21:30 - case _1320 = "22시간" // 22 - case _1350 = "22시간 30분" // 22:30 - case _1380 = "23시간" // 23 - case _1410 = "23시간 30분" // 23:30 - case _1440 = "24시간" // 24 + case _60 = "1시간" + case _90 = "1시간 30분" + case _120 = "2시간" + case _150 = "2시간 30분" + case _180 = "3시간" + case _210 = "3시간 30분" + case _240 = "4시간" + case _270 = "4시간 30분" + case _300 = "5시간" + case _330 = "5시간 30분" + case _360 = "6시간" + case _390 = "6시간 30분" + case _420 = "7시간" + case _450 = "7시간 30분" + case _480 = "8시간" + case _510 = "8시간 30분" + case _540 = "9시간" + case _570 = "9시간 30분" + case _600 = "10시간" + case _630 = "10시간 30분" + case _660 = "11시간" + case _690 = "11시간 30분" + case _720 = "12시간" + case _750 = "12시간 30분" + case _780 = "13시간" + case _810 = "13시간 30분" + case _840 = "14시간" + case _870 = "14시간 30분" + case _900 = "15시간" + case _930 = "15시간 30분" + case _960 = "16시간" + case _990 = "16시간 30분" + case _1020 = "17시간" + case _1050 = "17시간 30분" + case _1080 = "18시간" + case _1110 = "18시간 30분" + case _1140 = "19시간" + case _1170 = "19시간 30분" + case _1200 = "20시간" + case _1230 = "20시간 30분" + case _1260 = "21시간" + case _1290 = "21시간 30분" + case _1320 = "22시간" + case _1350 = "22시간 30분" + case _1380 = "23시간" + case _1410 = "23시간 30분" + case _1440 = "24시간" var description: Int { switch self {