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

[Feat] Wal Creator UI 및 API 연결 #147

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open
20 changes: 20 additions & 0 deletions WAL/WAL.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
9213AD042865A93A009B6002 /* HistoryResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9213AD032865A93A009B6002 /* HistoryResponse.swift */; };
9213AD072865AB67009B6002 /* HistoryService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9213AD062865AB67009B6002 /* HistoryService.swift */; };
9213AD0A2865ADBC009B6002 /* HistoryAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9213AD092865ADBC009B6002 /* HistoryAPI.swift */; };
921D34DD2AF6472A00419B3E /* WalCreatorViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 921D34DC2AF6472A00419B3E /* WalCreatorViewModel.swift */; };
924B60FD28A7D1E4002804B1 /* WalStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924B60FC28A7D1E4002804B1 /* WalStatus.swift */; };
925D13F929F95FB00024F0E5 /* BaseResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 925D13F829F95FB00024F0E5 /* BaseResponse.swift */; };
925D13FB29FABF220024F0E5 /* WalCategoryType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 925D13FA29FABF220024F0E5 /* WalCategoryType.swift */; };
Expand All @@ -105,13 +106,15 @@
926480FF2A34BB91007DEC0B /* CustomIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 926480FE2A34BB91007DEC0B /* CustomIndicator.swift */; };
926A2A132A02A85F005DDCEA /* MainSubtitle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 926A2A122A02A85F005DDCEA /* MainSubtitle.swift */; };
926A2A152A054BF9005DDCEA /* MainSubtitleStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 926A2A142A054BF9005DDCEA /* MainSubtitleStatus.swift */; };
926E1BBB2AF77761003BE5AF /* WalCreatorRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 926E1BBA2AF77761003BE5AF /* WalCreatorRequest.swift */; };
927519AF29815A6B0010022A /* MainViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 927519AE29815A6B0010022A /* MainViewModel.swift */; };
927D10EE28210F81001AEB78 /* HistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 927D10ED28210F81001AEB78 /* HistoryViewController.swift */; };
927D10F028210FD1001AEB78 /* HistoryReserveHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 927D10EF28210FD1001AEB78 /* HistoryReserveHeaderView.swift */; };
927D10F228210FF2001AEB78 /* HistoryCompleteHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 927D10F128210FF2001AEB78 /* HistoryCompleteHeaderView.swift */; };
927D10F428211017001AEB78 /* HistoryDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 927D10F328211017001AEB78 /* HistoryDataModel.swift */; };
927D10F6282110AA001AEB78 /* HistoryTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 927D10F5282110AA001AEB78 /* HistoryTableViewCell.swift */; };
929756A9285A4C4600A9FFA8 /* MainContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929756A8285A4C4600A9FFA8 /* MainContentView.swift */; };
92AD24412AA72CAF0075B48E /* WalCreatorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92AD24402AA72CAF0075B48E /* WalCreatorViewController.swift */; };
92B152D02954569800918A3B /* MainTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92B152CF2954569800918A3B /* MainTitleView.swift */; };
92C1B84E28633FB500F97D75 /* mintPaw.json in Resources */ = {isa = PBXBuildFile; fileRef = 92C1B84C28633FB500F97D75 /* mintPaw.json */; };
92C1B84F28633FB500F97D75 /* orangePaw.json in Resources */ = {isa = PBXBuildFile; fileRef = 92C1B84D28633FB500F97D75 /* orangePaw.json */; };
Expand Down Expand Up @@ -225,6 +228,7 @@
9213AD032865A93A009B6002 /* HistoryResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryResponse.swift; sourceTree = "<group>"; };
9213AD062865AB67009B6002 /* HistoryService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryService.swift; sourceTree = "<group>"; };
9213AD092865ADBC009B6002 /* HistoryAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryAPI.swift; sourceTree = "<group>"; };
921D34DC2AF6472A00419B3E /* WalCreatorViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalCreatorViewModel.swift; sourceTree = "<group>"; };
92322AAD28049C2C002E281F /* WAL.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = WAL.entitlements; sourceTree = "<group>"; };
924B60FC28A7D1E4002804B1 /* WalStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalStatus.swift; sourceTree = "<group>"; };
925D13F829F95FB00024F0E5 /* BaseResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseResponse.swift; sourceTree = "<group>"; };
Expand All @@ -234,13 +238,15 @@
926480FE2A34BB91007DEC0B /* CustomIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomIndicator.swift; sourceTree = "<group>"; };
926A2A122A02A85F005DDCEA /* MainSubtitle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainSubtitle.swift; sourceTree = "<group>"; };
926A2A142A054BF9005DDCEA /* MainSubtitleStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainSubtitleStatus.swift; sourceTree = "<group>"; };
926E1BBA2AF77761003BE5AF /* WalCreatorRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalCreatorRequest.swift; sourceTree = "<group>"; };
927519AE29815A6B0010022A /* MainViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewModel.swift; sourceTree = "<group>"; };
927D10ED28210F81001AEB78 /* HistoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryViewController.swift; sourceTree = "<group>"; };
927D10EF28210FD1001AEB78 /* HistoryReserveHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryReserveHeaderView.swift; sourceTree = "<group>"; };
927D10F128210FF2001AEB78 /* HistoryCompleteHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryCompleteHeaderView.swift; sourceTree = "<group>"; };
927D10F328211017001AEB78 /* HistoryDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryDataModel.swift; sourceTree = "<group>"; };
927D10F5282110AA001AEB78 /* HistoryTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryTableViewCell.swift; sourceTree = "<group>"; };
929756A8285A4C4600A9FFA8 /* MainContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainContentView.swift; sourceTree = "<group>"; };
92AD24402AA72CAF0075B48E /* WalCreatorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalCreatorViewController.swift; sourceTree = "<group>"; };
92B152CF2954569800918A3B /* MainTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTitleView.swift; sourceTree = "<group>"; };
92C1B84C28633FB500F97D75 /* mintPaw.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = mintPaw.json; sourceTree = "<group>"; };
92C1B84D28633FB500F97D75 /* orangePaw.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = orangePaw.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -375,6 +381,7 @@
5B44E58528A6C846000ABF0C /* UserAlarm.swift */,
5B44E58728A6C881000ABF0C /* UserCategory.swift */,
5B44E58928A6D044000ABF0C /* UserRequest.swift */,
926E1BBA2AF77761003BE5AF /* WalCreatorRequest.swift */,
);
path = Setting;
sourceTree = "<group>";
Expand Down Expand Up @@ -693,6 +700,7 @@
5BD17417282CDD0200C77A95 /* Model */,
5BD17414282CDCCD00C77A95 /* View */,
5BD1741A282CDD1C00C77A95 /* Controller */,
921D34DB2AF6470B00419B3E /* ViewModel */,
);
path = Setting;
sourceTree = "<group>";
Expand Down Expand Up @@ -725,6 +733,7 @@
5BC2DD032868DCCE00AFCC29 /* SettingCategoryViewController.swift */,
5BD3585F289D45D60066C804 /* ZanzanbariViewController.swift */,
5BD35862289D45F30066C804 /* SubController */,
92AD24402AA72CAF0075B48E /* WalCreatorViewController.swift */,
);
path = Controller;
sourceTree = "<group>";
Expand Down Expand Up @@ -792,6 +801,14 @@
path = History;
sourceTree = "<group>";
};
921D34DB2AF6470B00419B3E /* ViewModel */ = {
isa = PBXGroup;
children = (
921D34DC2AF6472A00419B3E /* WalCreatorViewModel.swift */,
);
path = ViewModel;
sourceTree = "<group>";
};
925D13F729F95F920024F0E5 /* Protocol */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1092,6 +1109,7 @@
5BA3896727F6C28C0010EAA1 /* AuthService.swift in Sources */,
5BC2DD042868DCCE00AFCC29 /* SettingCategoryViewController.swift in Sources */,
925D13FD29FABF360024F0E5 /* AlarmTimeType.swift in Sources */,
921D34DD2AF6472A00419B3E /* WalCreatorViewModel.swift in Sources */,
5BC2DD0D2868E75100AFCC29 /* ResignViewController.swift in Sources */,
5B44E57F28A6BCED000ABF0C /* SettingService.swift in Sources */,
927519AF29815A6B0010022A /* MainViewModel.swift in Sources */,
Expand Down Expand Up @@ -1142,12 +1160,14 @@
5BECCA8F286A43B800DD70A3 /* MenuButton.swift in Sources */,
925D13FF29FAC29B0024F0E5 /* UICollectionViewCell+.swift in Sources */,
5B422BA228676CF8001B6807 /* (null) in Sources */,
926E1BBB2AF77761003BE5AF /* WalCreatorRequest.swift in Sources */,
5B44E58A28A6D044000ABF0C /* UserRequest.swift in Sources */,
5BB6616828285A5B00D54353 /* TimeButton.swift in Sources */,
5BD17419282CDD0A00C77A95 /* Setting.swift in Sources */,
5BB3FB792857254200A8A70D /* Constant.swift in Sources */,
5B515DA52A07FBA50013F03B /* Interceptor.swift in Sources */,
5BB17B3A2865BB3000029824 /* OnboardAPI.swift in Sources */,
92AD24412AA72CAF0075B48E /* WalCreatorViewController.swift in Sources */,
5B7EE87E2822DCB5007BC265 /* MoyaLoggerPlugin.swift in Sources */,
5B020D3F281F31B00057F9B7 /* AlarmCollectionViewCell.swift in Sources */,
9213AD072865AB67009B6002 /* HistoryService.swift in Sources */,
Expand Down
11 changes: 10 additions & 1 deletion WAL/WAL.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
"version" : "3.3.1"
}
},
{
"identity" : "lottie-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/airbnb/lottie-ios.git",
"state" : {
"revision" : "7fe8b6f697ae7db4bf0df270119592cb5d502848",
"version" : "4.4.1"
}
},
{
"identity" : "snapkit",
"kind" : "remoteSourceControl",
Expand All @@ -24,7 +33,7 @@
"location" : "https://github.com/zanzanbari/WALKit.git",
"state" : {
"branch" : "develop",
"revision" : "31eaa8614c9e330f7e0c54d54e95aed1fc66e536"
"revision" : "c976c62e4986561c2eac9080cabfa3aee9dd7f97"
}
}
],
Expand Down
3 changes: 3 additions & 0 deletions WAL/WAL/Global/Extension/NSNotification.Name+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ extension NSNotification.Name {
static let renewToken = Notification.Name("renewToken")

static let enterMain = NSNotification.Name("EnterMain")

static let walTextViewTapped = NSNotification.Name("WalTextViewTapped")
static let walTextViewReturn = NSNotification.Name("WalTextViewReturn")
}
32 changes: 20 additions & 12 deletions WAL/WAL/Network/API/Setting/SettingAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ final class SettingAPI {
private(set) var alarm: UserAlarm?
private(set) var category: UserCategory?

// MARK: - GET 유저 닉네임 조회하기

/// 닉네임 조회하기 (GET)
func getUserInfo(completion: @escaping completion) {
settingProvider.request(.checkNickname) { [weak self] result in
guard let self else { return }
Expand All @@ -47,8 +46,7 @@ final class SettingAPI {
}
}

// MARK: - GET 알림 시간 조회하기

/// 알림 시간 조회하기 (GET)
func getAlarm(completion: @escaping alarmCompletion) {
settingProvider.request(.checkAlarm) { [weak self] result in
guard let self else { return }
Expand All @@ -69,8 +67,7 @@ final class SettingAPI {
}
}

// MARK: - GET 카테고리 조회하기

/// 카테고리 조회하기 (GET)
func getCategory(completion: @escaping categoryCompletion) {
settingProvider.request(.checkCategory) { result in
switch result {
Expand All @@ -90,8 +87,7 @@ final class SettingAPI {
}
}

// MARK: - POST 유저 닉네임 수정하기

/// 유저 닉네임 수정하기 (POST)
func postUserInfo(nickname: String, completion: @escaping completion) {
settingProvider.request(.editNickname(nickname)) { [weak self] result in
guard let self else { return }
Expand All @@ -106,8 +102,7 @@ final class SettingAPI {
}
}

// MARK: - POST 알림 시간 수정하기

/// 알림 시간 수정하기 (POST)
func postAlarm(data: [String], completion: @escaping defaultCompletion) {

let param = UserAlarmRequest(timeTypes: data)
Expand All @@ -124,8 +119,7 @@ final class SettingAPI {
}
}

// MARK: - POST 카테고리 수정하기

/// 카테고리 수정하기 (POST)
func postCategory(data: [String], completion: @escaping categoryCompletion) {

let param = UserCategoryRequest(categoryTypes: data)
Expand All @@ -141,4 +135,18 @@ final class SettingAPI {
}
}
}

/// 왈소리 만들기 (POST)
func postWal(param: WalCreatorRequest, completion: @escaping defaultCompletion) {
settingProvider.request(.walCreator(param)) { result in
switch result {
case .success(let response):
completion(nil, response.statusCode)
case .failure(let error):
print("[왈소리 만들기] DEBUG: - \(error.localizedDescription)")
completion(nil, error.response?.statusCode)
}
}
}

}
13 changes: 13 additions & 0 deletions WAL/WAL/Network/DataModel/Setting/WalCreatorRequest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// WalCreatorRequest.swift
// WAL
//
// Created by 소연 on 2023/11/05.
//

import Foundation

struct WalCreatorRequest: Codable {
let categoryType: String
let contents: String
}
6 changes: 5 additions & 1 deletion WAL/WAL/Network/Service/Setting/SettingService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum SettingService {
case editNickname(String)
case editAlarm(UserAlarmRequest)
case editCategory(UserCategoryRequest)
case walCreator(WalCreatorRequest)
}

extension SettingService: BaseTargetType {
Expand All @@ -26,14 +27,15 @@ extension SettingService: BaseTargetType {
case .editNickname: return "/user/me/nickname/edit"
case .editAlarm: return "/onboard/time/edit"
case .editCategory: return "/onboard/category/edit"
case .walCreator: return "/censor/create"
}
}

var method: Method {
switch self {
case .checkNickname, .checkAlarm, .checkCategory: return .get
case .editNickname: return .patch
case .editAlarm, .editCategory: return .post
case .editAlarm, .editCategory, .walCreator: return .post
}
}

Expand All @@ -47,6 +49,8 @@ extension SettingService: BaseTargetType {
return .requestJSONEncodable(param)
case .editCategory(let param):
return .requestJSONEncodable(param)
case .walCreator(let param):
return .requestJSONEncodable(param)
}
}
}
6 changes: 3 additions & 3 deletions WAL/WAL/Screen/Create/Controller/CreateViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ class CreateViewController: UIViewController {
//MARK: - CustomMethod

private func setSendButton() {
let isCotentFull = walSoundTextView.text.count > 0 && datePickerData.date != nil && datePickerData.time != nil
let isContentFull = walSoundTextView.text.count > 0 && datePickerData.date != nil && datePickerData.time != nil

sendButton.backgroundColor = isCotentFull ? .orange100 : .gray400
sendButton.isEnabled = isCotentFull
sendButton.backgroundColor = isContentFull ? .orange100 : .gray400
sendButton.isEnabled = isContentFull
}

private func scroll(_ datePickerType: DatePickerType) {
Expand Down
2 changes: 1 addition & 1 deletion WAL/WAL/Screen/History/View/HistoryTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class HistoryTableViewCell: UITableViewCell {

var dDayLabel = UILabel().then {
$0.text = "D-6"
$0.font = WALFont.body8.font
$0.font = WALFont.body10.font
$0.textColor = .mint100
}

Expand Down
16 changes: 12 additions & 4 deletions WAL/WAL/Screen/Setting/Controller/SettingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ final class SettingViewController: UIViewController, SendNicknameDelegate {

// MARK: - Life Cycle

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
configNavigationUI()
}

override func viewDidLoad() {
super.viewDidLoad()
configUI()
Expand All @@ -49,12 +54,16 @@ final class SettingViewController: UIViewController, SendNicknameDelegate {

// MARK: - InitUI

private func configNavigationUI() {
navigationController?.navigationBar.isHidden = true
}

private func configUI() {
view.backgroundColor = .white100
}

private func setupLayout() {
view.addSubviews([navigationBar, tableView, backView])
view.addSubviews([navigationBar, backView, tableView])

navigationBar.snp.makeConstraints { make in
make.top.equalTo(view.safeAreaLayoutGuide)
Expand Down Expand Up @@ -113,9 +122,8 @@ extension SettingViewController: UITableViewDelegate {
transition(viewController)
}
case 2:
print("여기 주석 처리 해제해주세요~ SettingVC 116번 줄")
// let viewController = WalCreatorViewController()
// transition(viewController)
let viewController = WalCreatorViewController()
transition(viewController)
default:
if indexPath.row == 0 {
let viewController = ZanzanbariViewController()
Expand Down
Loading