From 903cf7aae562a40581fd4d0db98c022ddbce98e9 Mon Sep 17 00:00:00 2001 From: Chanhee Jeong Date: Wed, 23 Nov 2022 10:49:21 +0900 Subject: [PATCH 1/6] =?UTF-8?q?Fix=F0=9F=90=9E:=20=EC=84=9C=EB=B2=84=20API?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Domain/Organization/VerifingCodeUseCase.swift | 6 ++++-- .../Domain/Place/AddPlace/AddPlaceUseCase.swift | 2 +- .../Place/PlaceSearch/PlaceSearchUseCase.swift | 2 +- Projects/App/Sources/Domain/Place/PlaceUseCase.swift | 9 ++++++++- .../App/Sources/Domain/User/UserInfoManager.swift | 10 +++++----- .../View/DomainSettingViewController.swift | 2 +- .../VerifyCode/ViewModel/VerifingCodeViewModel.swift | 2 +- .../PlaceList/View/PlaceListViewController.swift | 2 +- Projects/Network/Sources/API/PlaceAPI.swift | 4 ++-- Projects/Network/Sources/API/UserAPI.swift | 5 +++-- .../Sources/DTO/RequestDTO/SignUpUserDTO.swift | 6 +++--- .../DTO/ResponseDTO/User/UserProfileDTO.swift | 2 +- .../Network/Sources/Service/NetworkService.swift | 12 ++++++++++++ 13 files changed, 43 insertions(+), 21 deletions(-) diff --git a/Projects/App/Sources/Domain/Organization/VerifingCodeUseCase.swift b/Projects/App/Sources/Domain/Organization/VerifingCodeUseCase.swift index 09a23db0..7f611366 100644 --- a/Projects/App/Sources/Domain/Organization/VerifingCodeUseCase.swift +++ b/Projects/App/Sources/Domain/Organization/VerifingCodeUseCase.swift @@ -40,8 +40,9 @@ final class VerifingCodeUseCase { func postSignUp(email: String, orgnization: Organization) { guard let authorization = KeyChainManager.read(key: .authToken) else { return } - let userDTO = SignUpUserDTO(id: orgnization.id, email: email, organizationName: orgnization.name) + let userDTO = SignUpUserDTO(email: email, organizationName: orgnization.name) + // ✅ UserAPI.postSignUp(authorization: authorization, userDTO: userDTO) .sink { [weak self] error in guard let self = self else { return } @@ -51,7 +52,8 @@ final class VerifingCodeUseCase { self.isEmailOverlapedSubject.send(true) case .finished: break } - } receiveValue: { [weak self] _ in + } receiveValue: { [weak self] value in + print("✅받은값\(value)") guard let self = self else { return } self.isEmailOverlapedSubject.send(false) } diff --git a/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift b/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift index 7d6fa2cc..da8d66d8 100644 --- a/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift +++ b/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift @@ -29,7 +29,7 @@ final class AddPlaceUseCase: AddPlaceUseCaseType { func addNewPlace(with place: KakaoPlace, category: Int) -> AnyPublisher { let user = UserInfoManager.userInfo?.userID ?? 64 - let org = UserInfoManager.userInfo?.userOrganization ?? 400 + let org = UserInfoManager.userInfo?.userOrganization[0] ?? 400 let placeDTO = PlacePostDTO(address: place.address, name: place.placeName, latitude: place.lat, diff --git a/Projects/App/Sources/Domain/Place/PlaceSearch/PlaceSearchUseCase.swift b/Projects/App/Sources/Domain/Place/PlaceSearch/PlaceSearchUseCase.swift index 5a42c3d1..a8ac432c 100644 --- a/Projects/App/Sources/Domain/Place/PlaceSearch/PlaceSearchUseCase.swift +++ b/Projects/App/Sources/Domain/Place/PlaceSearch/PlaceSearchUseCase.swift @@ -22,7 +22,7 @@ final class PlaceSearchUseCase: PlaceSearchUseCaseType { func searchPlaces(with placeName: String) -> AnyPublisher<[Place], Error> { // TODO: ORG-ID 넣고 교체 필요 - let orgId = UserInfoManager.userInfo?.userOrganization ?? 400 + let orgId = UserInfoManager.userInfo?.userOrganization[0] ?? 400 PlaceAPI.fetchSearchPlaceResults(orgId: orgId, placeName: placeName) .sink { error in diff --git a/Projects/App/Sources/Domain/Place/PlaceUseCase.swift b/Projects/App/Sources/Domain/Place/PlaceUseCase.swift index 5c30d10b..76630f58 100644 --- a/Projects/App/Sources/Domain/Place/PlaceUseCase.swift +++ b/Projects/App/Sources/Domain/Place/PlaceUseCase.swift @@ -17,7 +17,14 @@ final class PlaceListUseCase { switch type { case .whole: - api = PlaceAPI.fetchPlaceList(with: page) + api = PlaceAPI.fetchPlaceList(with: page, token: KeyChainManager.read(key: .authToken) ?? "") + print("➡️➡️➡️➡️➡️") + print(KeyChainManager.read(key: .authToken)) + print(UserInfoManager.userInfo?.userID) + print(UserInfoManager.userInfo?.userNickname) + print(UserInfoManager.userInfo?.userOrgName) + print(UserInfoManager.userInfo?.userOrganization) + print("➡️➡️➡️➡️➡️") case .hot: api = PlaceAPI.fetchHotPlaceList(with: page) } diff --git a/Projects/App/Sources/Domain/User/UserInfoManager.swift b/Projects/App/Sources/Domain/User/UserInfoManager.swift index c6955484..0913fd3e 100644 --- a/Projects/App/Sources/Domain/User/UserInfoManager.swift +++ b/Projects/App/Sources/Domain/User/UserInfoManager.swift @@ -19,7 +19,7 @@ final class UserInfoManager { struct UserInfo: Codable { - init(userNickname: String? = nil, userID: Int? = nil, userOrganization: Int? = nil, userOrgName: String? = nil ) { + init(userNickname: String? = nil, userID: Int? = nil, userOrganization: [Int] = [], userOrgName: String? = nil ) { UserInfoManager.userInfo?.userNickname = userNickname UserInfoManager.userInfo?.userID = userID UserInfoManager.userInfo?.userOrganization = userOrganization @@ -48,10 +48,10 @@ final class UserInfoManager { UserDefaults.standard.set(newValue, forKey: UserInfoKeys.userID.rawValue) } } - var userOrganization: Int? { + var userOrganization: [Int] { get { - guard let userOrganization = UserDefaults.standard.value(forKey: UserInfoKeys.userOrganization.rawValue) as? Int else { - return nil + guard let userOrganization = UserDefaults.standard.value(forKey: UserInfoKeys.userOrganization.rawValue) as? [Int] else { + return [] } return userOrganization } @@ -93,7 +93,7 @@ final class UserInfoManager { UserInfoManager.userInfo = UserInfo() } - static func initialUserInfo(userNickname: String?, userID: Int?, userOrganization: Int?, userOrgName: String?) { + static func initialUserInfo(userNickname: String?, userID: Int?, userOrganization: [Int], userOrgName: String?) { UserInfoManager.userInfo = UserInfo() UserInfoManager.userInfo?.userNickname = userNickname UserInfoManager.userInfo?.userID = userID diff --git a/Projects/App/Sources/UI/Organization/DomainSetting/View/DomainSettingViewController.swift b/Projects/App/Sources/UI/Organization/DomainSetting/View/DomainSettingViewController.swift index 89c3a74a..ddcf7ac1 100644 --- a/Projects/App/Sources/UI/Organization/DomainSetting/View/DomainSettingViewController.swift +++ b/Projects/App/Sources/UI/Organization/DomainSetting/View/DomainSettingViewController.swift @@ -77,7 +77,7 @@ final class DomainSettingViewController: UIViewController { let orgID = viewModel.organization.id let orgName = viewModel.organization.name UserInfoManager.userInfo?.userOrgName = orgName - UserInfoManager.userInfo?.userOrganization = orgID + UserInfoManager.userInfo?.userOrganization = [orgID] navigationController?.pushViewController(DomainSettingCompleteViewController(), animated: true) } } diff --git a/Projects/App/Sources/UI/Organization/VerifyCode/ViewModel/VerifingCodeViewModel.swift b/Projects/App/Sources/UI/Organization/VerifyCode/ViewModel/VerifingCodeViewModel.swift index 4d8dcc51..3d4a31fd 100644 --- a/Projects/App/Sources/UI/Organization/VerifyCode/ViewModel/VerifingCodeViewModel.swift +++ b/Projects/App/Sources/UI/Organization/VerifyCode/ViewModel/VerifingCodeViewModel.swift @@ -68,7 +68,7 @@ extension VerifingCodeViewModel { let orgID = self.organization.id let orgName = self.organization.name UserInfoManager.userInfo?.userOrgName = orgName - UserInfoManager.userInfo?.userOrganization = orgID + UserInfoManager.userInfo?.userOrganization = (UserInfoManager.userInfo?.userOrganization ?? []) + [orgID] } self.isEmailOverlapedSubject.send(isEmailOverlaped) } diff --git a/Projects/App/Sources/UI/Place/PlaceList/View/PlaceListViewController.swift b/Projects/App/Sources/UI/Place/PlaceList/View/PlaceListViewController.swift index f3878835..84afd168 100644 --- a/Projects/App/Sources/UI/Place/PlaceList/View/PlaceListViewController.swift +++ b/Projects/App/Sources/UI/Place/PlaceList/View/PlaceListViewController.swift @@ -140,7 +140,7 @@ extension PlaceListViewController: QuestionButtonTapDelegate, UIAdaptivePresenta } @objc func orgDetailButtonTapped() { - navigationController?.pushViewController(OrgDetailViewController(viewModel: OrgDetailViewModel(orgId: UserInfoManager.userInfo?.userOrganization ?? 400)), animated: true) + navigationController?.pushViewController(OrgDetailViewController(viewModel: OrgDetailViewModel(orgId: UserInfoManager.userInfo?.userOrganization[0] ?? 400)), animated: true) FirebaseAnalytics.Analytics.logEvent(AnalyticsEventSelectItem, parameters: [ AnalyticsParameterItemListName: "org_detail_button" ]) diff --git a/Projects/Network/Sources/API/PlaceAPI.swift b/Projects/Network/Sources/API/PlaceAPI.swift index 2e774748..c304ea6f 100644 --- a/Projects/Network/Sources/API/PlaceAPI.swift +++ b/Projects/Network/Sources/API/PlaceAPI.swift @@ -13,8 +13,8 @@ public struct PlaceAPI { static let networkService = NetworkService() - public static func fetchPlaceList(with page: Int) -> AnyPublisher { - let header = ["Content-Type": "application/json"] + public static func fetchPlaceList(with page: Int, token: String) -> AnyPublisher { + let header = ["Content-Type": "application/json", "Authorization":"\(token)"] let query = ["cursor": "\(page)"] let endpoint = Endpoint(path: "/api/places", queryParams: query, headers: header) diff --git a/Projects/Network/Sources/API/UserAPI.swift b/Projects/Network/Sources/API/UserAPI.swift index b3605c5b..69ff22fa 100644 --- a/Projects/Network/Sources/API/UserAPI.swift +++ b/Projects/Network/Sources/API/UserAPI.swift @@ -17,7 +17,7 @@ public struct UserAPI { let header = ["Content-Type": "application/json", "Authorization": "\(authorization)"] let user = ["email": userDTO.email, "organizationName": userDTO.organizationName] let endpoint = Endpoint(path: "/api/users", method: .post, bodyParams: user, headers: header) - + print("✅✅✅✅postSignUp", userDTO) return networkService.request(with: endpoint) } @@ -71,13 +71,14 @@ public struct UserAPI { let header = ["Content-Type": "application/json"] let code = ["email": codeDTO.email, "code": codeDTO.code] let endpoint = Endpoint(path: "/api/users/verify", method: .post, bodyParams: code, headers: header) + print("📨📨📨📨📨code",codeDTO) return networkService.request(with: endpoint) } public static func postSendCode(email: String) -> AnyPublisher { let header = ["Content-Type": "application/json"] let endpoint = Endpoint(path: "/api/users/send/verifyCode", method: .post, bodyParams: ["email": email], headers: header) - + print("📨📨📨📨📨",email) return networkService.request(with: endpoint) } diff --git a/Projects/Network/Sources/DTO/RequestDTO/SignUpUserDTO.swift b/Projects/Network/Sources/DTO/RequestDTO/SignUpUserDTO.swift index 124159c9..0690038a 100644 --- a/Projects/Network/Sources/DTO/RequestDTO/SignUpUserDTO.swift +++ b/Projects/Network/Sources/DTO/RequestDTO/SignUpUserDTO.swift @@ -9,12 +9,12 @@ import Foundation public struct SignUpUserDTO: Encodable { - public let id: Int +// public let id: Int public let email: String public let organizationName: String - public init(id: Int, email: String, organizationName: String) { - self.id = id + public init(email: String, organizationName: String) { +// self.id = id self.email = email self.organizationName = organizationName } diff --git a/Projects/Network/Sources/DTO/ResponseDTO/User/UserProfileDTO.swift b/Projects/Network/Sources/DTO/ResponseDTO/User/UserProfileDTO.swift index 59a23575..3dcaec58 100644 --- a/Projects/Network/Sources/DTO/ResponseDTO/User/UserProfileDTO.swift +++ b/Projects/Network/Sources/DTO/ResponseDTO/User/UserProfileDTO.swift @@ -13,7 +13,7 @@ public struct UserProfileDTO: Decodable { public let nickname: String? public let email: String? public let social: String - public let organization: Int? + public let organization: [Int] public let deletedAt: String? public let createdAt: String public let updatedAt: String diff --git a/Projects/Network/Sources/Service/NetworkService.swift b/Projects/Network/Sources/Service/NetworkService.swift index 22785701..8e568f61 100644 --- a/Projects/Network/Sources/Service/NetworkService.swift +++ b/Projects/Network/Sources/Service/NetworkService.swift @@ -55,8 +55,20 @@ extension NetworkService { do { let request = try endpoint.urlRequest() + print("✨✨REQUEST✨✨") + print(request) + print("✨✨✨✨✨✨") + return session.dataTaskPublisher(for: request) .tryMap({ (data, response) in + print(""" + 📨📨📨RESPONSE📨📨📨 + \(response) + """) + print(""" + 📦📦📦BODY📦📦📦 + \(String(data: data, encoding: .utf8) ?? "") + """) if let error = self.checkError(data: data, response: response) { throw error } From 3467267a7bf2eb7236044e3d4b5749996dd58b94 Mon Sep 17 00:00:00 2001 From: "Nick(taehoKim)" Date: Wed, 23 Nov 2022 13:34:18 +0900 Subject: [PATCH 2/6] =?UTF-8?q?Fix=F0=9F=AA=B3:=20=20=EC=84=9C=EB=B2=84api?= =?UTF-8?q?=EC=88=98=EC=A0=95=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EB=B0=8F=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: chaneeii Co-authored-by: Lia316 --- .../Domain/Place/AddPlace/AddPlaceUseCase.swift | 4 +++- .../App/Sources/Domain/Place/PlaceUseCase.swift | 14 +++++--------- Projects/Network/Sources/API/PlaceAPI.swift | 13 +++++++------ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift b/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift index da8d66d8..0ee185c0 100644 --- a/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift +++ b/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift @@ -91,7 +91,9 @@ final class AddPlaceUseCase: AddPlaceUseCaseType { */ func checkRegisterdPlace(with kakaoPlaceId: Int) -> AnyPublisher { - PlaceAPI.checkRegisterdPlace(kakaoPlaceId: kakaoPlaceId) + guard let orgId = UserInfoManager.userInfo?.userOrganization else { return Fail(error: AddPlaceError.none).eraseToAnyPublisher() } + + return PlaceAPI.checkRegisterdPlace(kakaoPlaceId: kakaoPlaceId, orgId: UserInfoManager.userInfo?.userOrganization[0] ?? 400) .mapError { _ -> AddPlaceError in return .none }.eraseToAnyPublisher() diff --git a/Projects/App/Sources/Domain/Place/PlaceUseCase.swift b/Projects/App/Sources/Domain/Place/PlaceUseCase.swift index 76630f58..752cac8e 100644 --- a/Projects/App/Sources/Domain/Place/PlaceUseCase.swift +++ b/Projects/App/Sources/Domain/Place/PlaceUseCase.swift @@ -15,18 +15,14 @@ final class PlaceListUseCase { func fetchPlaceList(with page: Int, type: PlaceType) -> AnyPublisher<[Place], NetworkError> { let api: AnyPublisher + guard let authorization = KeyChainManager.read(key: .authToken) else { return Fail(error: NetworkError.unauthorized("권한이 없습니다")).eraseToAnyPublisher() } + print("auth: ", authorization) + switch type { case .whole: - api = PlaceAPI.fetchPlaceList(with: page, token: KeyChainManager.read(key: .authToken) ?? "") - print("➡️➡️➡️➡️➡️") - print(KeyChainManager.read(key: .authToken)) - print(UserInfoManager.userInfo?.userID) - print(UserInfoManager.userInfo?.userNickname) - print(UserInfoManager.userInfo?.userOrgName) - print(UserInfoManager.userInfo?.userOrganization) - print("➡️➡️➡️➡️➡️") + api = PlaceAPI.fetchPlaceList(with: page, authorization: authorization) case .hot: - api = PlaceAPI.fetchHotPlaceList(with: page) + api = PlaceAPI.fetchHotPlaceList(with: page, authorization: authorization) } return api diff --git a/Projects/Network/Sources/API/PlaceAPI.swift b/Projects/Network/Sources/API/PlaceAPI.swift index c304ea6f..1bfe4da5 100644 --- a/Projects/Network/Sources/API/PlaceAPI.swift +++ b/Projects/Network/Sources/API/PlaceAPI.swift @@ -13,16 +13,16 @@ public struct PlaceAPI { static let networkService = NetworkService() - public static func fetchPlaceList(with page: Int, token: String) -> AnyPublisher { - let header = ["Content-Type": "application/json", "Authorization":"\(token)"] + public static func fetchPlaceList(with page: Int, authorization: String) -> AnyPublisher { + let header = ["Content-Type": "application/json", "Authorization": "\(authorization)"] let query = ["cursor": "\(page)"] let endpoint = Endpoint(path: "/api/places", queryParams: query, headers: header) return networkService.request(with: endpoint, responseType: PlaceListDTO.self) } - public static func fetchHotPlaceList(with page: Int) -> AnyPublisher { - let header = ["Content-Type": "application/json"] + public static func fetchHotPlaceList(with page: Int, authorization: String) -> AnyPublisher { + let header = ["Content-Type": "application/json", "Authorization": "\(authorization)"] let query = ["cursor": "\(page)"] let endpoint = Endpoint(path: "/api/places/goods", queryParams: query, headers: header) @@ -37,10 +37,11 @@ public struct PlaceAPI { return networkService.request(with: endpoint, responseType: KakaoPlaceListDTO.self) } - public static func checkRegisterdPlace(kakaoPlaceId: Int) -> AnyPublisher { + public static func checkRegisterdPlace(kakaoPlaceId: Int, orgId: Int) -> AnyPublisher { let header = ["Content-Type": "application/json"] - let endpoint = Endpoint(path: "/api/places/kakaoPlace/\(kakaoPlaceId)/registered", headers: header) + let query = ["organizationId": "\(orgId)"] + let endpoint = Endpoint(path: "/api/places/kakaoPlace/\(kakaoPlaceId)/registered", queryParams: query, headers: header) return networkService.request(with: endpoint, responseType: Bool.self) } From eebeedddaa75eca4970490044c8f11a80bb45cce Mon Sep 17 00:00:00 2001 From: Chanhee Jeong Date: Wed, 23 Nov 2022 13:47:54 +0900 Subject: [PATCH 3/6] =?UTF-8?q?Fix=F0=9F=90=9E:=20=EB=8C=80=ED=95=99?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=ED=95=98=EB=93=9C=EC=BD=94=EB=94=A9?= =?UTF-8?q?=ED=95=B4=EB=92=80=EB=8D=98=20=EB=B6=80=EB=B6=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/OrgDetailViewController.swift | 22 +++++++++---------- .../View/PlaceListViewController.swift | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Projects/App/Sources/UI/Organization/OrgDetail/View/OrgDetailViewController.swift b/Projects/App/Sources/UI/Organization/OrgDetail/View/OrgDetailViewController.swift index e89fbae5..b32be939 100644 --- a/Projects/App/Sources/UI/Organization/OrgDetail/View/OrgDetailViewController.swift +++ b/Projects/App/Sources/UI/Organization/OrgDetail/View/OrgDetailViewController.swift @@ -25,7 +25,7 @@ final class OrgDetailViewController: UIViewController { private let orgInformationStackView3 = UIStackView() private let orgInfoImageView1 = UIImageView() private let orgInfoImageView2 = UIImageView() - private let orgInfoImageView3 = UIImageView() +// private let orgInfoImageView3 = UIImageView() private let orgInviteButton = FullWidthBlackButton() private var orgDetailInformationView1 = OrgDetailInformationView() @@ -121,7 +121,7 @@ extension OrgDetailViewController { orgDetailInformationView2 = OrgDetailInformationView() orgDetailInformationView3 = OrgDetailInformationView() - orgNameLabel.text = "애플 디벨로퍼 아카데미" + orgNameLabel.text = UserInfoManager.userInfo?.userOrgName ?? "(인증대학없음)" orgNameLabel.textColor = .black orgNameLabel.font = UIFont.systemFont(ofSize: CGFloat(26), weight: .bold) orgNameLabel.textAlignment = .center @@ -158,11 +158,11 @@ extension OrgDetailViewController { orgDetailInformationView2.informationLabel.text = "등록된 맛집" orgDetailInformationView2.numberLabel.text = "0곳" - orgInfoImageView3.image = UIImage(.img_reviewfriends_photo) - orgInfoImageView3.contentMode = .scaleAspectFit - orgInfoImageView3.layer.applyFigmaShadow(color: .black, opacity: 0.1, xCoord: 0, yCoord: 0, blur: 5, spread: 0) - orgDetailInformationView3.informationLabel.text = "업로드된 사진" - orgDetailInformationView3.numberLabel.text = "0개" +// orgInfoImageView3.image = UIImage(.img_reviewfriends_photo) +// orgInfoImageView3.contentMode = .scaleAspectFit +// orgInfoImageView3.layer.applyFigmaShadow(color: .black, opacity: 0.1, xCoord: 0, yCoord: 0, blur: 5, spread: 0) +// orgDetailInformationView3.informationLabel.text = "업로드된 사진" +// orgDetailInformationView3.numberLabel.text = "0개" orgInviteButton.setTitle("우리학교 사람들 초대하기", for: .normal) orgInviteButton.addTarget(self, action: #selector(shareAppStoreLink), for: .touchUpInside) @@ -173,7 +173,7 @@ extension OrgDetailViewController { orgInformationSuperStackView.addArrangedSubviews([orgInformationStackView1, orgInformationStackView2, orgInformationStackView3]) orgInformationStackView1.addArrangedSubviews([orgInfoImageView1, orgDetailInformationView1]) orgInformationStackView2.addArrangedSubviews([orgInfoImageView2, orgDetailInformationView2]) - orgInformationStackView3.addArrangedSubviews([orgInfoImageView3, orgDetailInformationView3]) +// orgInformationStackView3.addArrangedSubviews([orgInfoImageView3, orgDetailInformationView3]) orgNameLabel.snp.makeConstraints { make in make.top.equalTo(view.safeAreaLayoutGuide).inset(30) @@ -206,9 +206,9 @@ extension OrgDetailViewController { make.width.height.equalTo(60) } - orgInfoImageView3.snp.makeConstraints { make in - make.width.height.equalTo(60) - } +// orgInfoImageView3.snp.makeConstraints { make in +// make.width.height.equalTo(60) +// } orgInviteButton.snp.makeConstraints { make in make.horizontalEdges.bottom.equalTo(view.safeAreaLayoutGuide).inset(20) diff --git a/Projects/App/Sources/UI/Place/PlaceList/View/PlaceListViewController.swift b/Projects/App/Sources/UI/Place/PlaceList/View/PlaceListViewController.swift index 84afd168..87207feb 100644 --- a/Projects/App/Sources/UI/Place/PlaceList/View/PlaceListViewController.swift +++ b/Projects/App/Sources/UI/Place/PlaceList/View/PlaceListViewController.swift @@ -241,7 +241,7 @@ extension PlaceListViewController { let placeTitle = UILabel() let tapGesture = UITapGestureRecognizer(target: self, action: #selector(orgDetailButtonTapped)) - placeTitle.text = "애플디벨로퍼아카데미" + placeTitle.text = UserInfoManager.userInfo?.userOrgName ?? "(인증대학없음)" placeTitle.font = .systemFont(ofSize: 17, weight: .bold) placeTitle.isUserInteractionEnabled = true placeTitle.addGestureRecognizer(tapGesture) From 4fcb68ad906cfd32d9486641f4c545666d7796ce Mon Sep 17 00:00:00 2001 From: Chanhee Jeong Date: Wed, 23 Nov 2022 13:58:47 +0900 Subject: [PATCH 4/6] =?UTF-8?q?Chore=F0=9F=A7=B9:=20=EB=94=94=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=EC=9A=A9=20=ED=94=84=EB=A6=B0=ED=8A=B8=EB=AC=B8=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Domain/Organization/VerifingCodeUseCase.swift | 1 - .../App/Sources/Domain/Place/PlaceUseCase.swift | 3 +-- .../Views/ExplanationPopOverViewController.swift | 1 - Projects/Network/Sources/API/UserAPI.swift | 3 --- .../Network/Sources/Service/NetworkService.swift | 14 +------------- 5 files changed, 2 insertions(+), 20 deletions(-) diff --git a/Projects/App/Sources/Domain/Organization/VerifingCodeUseCase.swift b/Projects/App/Sources/Domain/Organization/VerifingCodeUseCase.swift index 7f611366..d60a827f 100644 --- a/Projects/App/Sources/Domain/Organization/VerifingCodeUseCase.swift +++ b/Projects/App/Sources/Domain/Organization/VerifingCodeUseCase.swift @@ -53,7 +53,6 @@ final class VerifingCodeUseCase { case .finished: break } } receiveValue: { [weak self] value in - print("✅받은값\(value)") guard let self = self else { return } self.isEmailOverlapedSubject.send(false) } diff --git a/Projects/App/Sources/Domain/Place/PlaceUseCase.swift b/Projects/App/Sources/Domain/Place/PlaceUseCase.swift index 752cac8e..b4a9bb02 100644 --- a/Projects/App/Sources/Domain/Place/PlaceUseCase.swift +++ b/Projects/App/Sources/Domain/Place/PlaceUseCase.swift @@ -16,13 +16,12 @@ final class PlaceListUseCase { let api: AnyPublisher guard let authorization = KeyChainManager.read(key: .authToken) else { return Fail(error: NetworkError.unauthorized("권한이 없습니다")).eraseToAnyPublisher() } - print("auth: ", authorization) switch type { case .whole: api = PlaceAPI.fetchPlaceList(with: page, authorization: authorization) case .hot: - api = PlaceAPI.fetchHotPlaceList(with: page, authorization: authorization) + api = PlaceAPI.fetchHotPlaceList(with: page, authorization: authorization) } return api diff --git a/Projects/App/Sources/UI/Place/PlaceList/View/Views/ExplanationPopOverViewController.swift b/Projects/App/Sources/UI/Place/PlaceList/View/Views/ExplanationPopOverViewController.swift index b1d8af6c..b2b0a9fd 100644 --- a/Projects/App/Sources/UI/Place/PlaceList/View/Views/ExplanationPopOverViewController.swift +++ b/Projects/App/Sources/UI/Place/PlaceList/View/Views/ExplanationPopOverViewController.swift @@ -15,7 +15,6 @@ final class ExplanationPopOverViewController: UIViewController { // MARK: - Properties private var explanationLabel = UILabel() - // MARK: - LifeCycle override func viewDidLoad() { diff --git a/Projects/Network/Sources/API/UserAPI.swift b/Projects/Network/Sources/API/UserAPI.swift index 69ff22fa..e65686a1 100644 --- a/Projects/Network/Sources/API/UserAPI.swift +++ b/Projects/Network/Sources/API/UserAPI.swift @@ -17,7 +17,6 @@ public struct UserAPI { let header = ["Content-Type": "application/json", "Authorization": "\(authorization)"] let user = ["email": userDTO.email, "organizationName": userDTO.organizationName] let endpoint = Endpoint(path: "/api/users", method: .post, bodyParams: user, headers: header) - print("✅✅✅✅postSignUp", userDTO) return networkService.request(with: endpoint) } @@ -71,14 +70,12 @@ public struct UserAPI { let header = ["Content-Type": "application/json"] let code = ["email": codeDTO.email, "code": codeDTO.code] let endpoint = Endpoint(path: "/api/users/verify", method: .post, bodyParams: code, headers: header) - print("📨📨📨📨📨code",codeDTO) return networkService.request(with: endpoint) } public static func postSendCode(email: String) -> AnyPublisher { let header = ["Content-Type": "application/json"] let endpoint = Endpoint(path: "/api/users/send/verifyCode", method: .post, bodyParams: ["email": email], headers: header) - print("📨📨📨📨📨",email) return networkService.request(with: endpoint) } diff --git a/Projects/Network/Sources/Service/NetworkService.swift b/Projects/Network/Sources/Service/NetworkService.swift index 8e568f61..069f2057 100644 --- a/Projects/Network/Sources/Service/NetworkService.swift +++ b/Projects/Network/Sources/Service/NetworkService.swift @@ -54,21 +54,9 @@ extension NetworkService { -> AnyPublisher { do { let request = try endpoint.urlRequest() - - print("✨✨REQUEST✨✨") - print(request) - print("✨✨✨✨✨✨") - + return session.dataTaskPublisher(for: request) .tryMap({ (data, response) in - print(""" - 📨📨📨RESPONSE📨📨📨 - \(response) - """) - print(""" - 📦📦📦BODY📦📦📦 - \(String(data: data, encoding: .utf8) ?? "") - """) if let error = self.checkError(data: data, response: response) { throw error } From 4e542f9173c7a3eaeaaf6e9f5b446ffd9764c4cc Mon Sep 17 00:00:00 2001 From: Chanhee Jeong Date: Wed, 23 Nov 2022 14:56:38 +0900 Subject: [PATCH 5/6] =?UTF-8?q?Chore=F0=9F=A7=B9:=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../App/Sources/Domain/Organization/VerifingCodeUseCase.swift | 3 +-- .../App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift | 2 +- .../Sources/Domain/Place/PlaceSearch/PlaceSearchUseCase.swift | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Projects/App/Sources/Domain/Organization/VerifingCodeUseCase.swift b/Projects/App/Sources/Domain/Organization/VerifingCodeUseCase.swift index d60a827f..b4150aa1 100644 --- a/Projects/App/Sources/Domain/Organization/VerifingCodeUseCase.swift +++ b/Projects/App/Sources/Domain/Organization/VerifingCodeUseCase.swift @@ -42,7 +42,6 @@ final class VerifingCodeUseCase { let userDTO = SignUpUserDTO(email: email, organizationName: orgnization.name) - // ✅ UserAPI.postSignUp(authorization: authorization, userDTO: userDTO) .sink { [weak self] error in guard let self = self else { return } @@ -52,7 +51,7 @@ final class VerifingCodeUseCase { self.isEmailOverlapedSubject.send(true) case .finished: break } - } receiveValue: { [weak self] value in + } receiveValue: { [weak self] _ in guard let self = self else { return } self.isEmailOverlapedSubject.send(false) } diff --git a/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift b/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift index 0ee185c0..c6fa092f 100644 --- a/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift +++ b/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift @@ -93,7 +93,7 @@ final class AddPlaceUseCase: AddPlaceUseCaseType { func checkRegisterdPlace(with kakaoPlaceId: Int) -> AnyPublisher { guard let orgId = UserInfoManager.userInfo?.userOrganization else { return Fail(error: AddPlaceError.none).eraseToAnyPublisher() } - return PlaceAPI.checkRegisterdPlace(kakaoPlaceId: kakaoPlaceId, orgId: UserInfoManager.userInfo?.userOrganization[0] ?? 400) + return PlaceAPI.checkRegisterdPlace(kakaoPlaceId: kakaoPlaceId, orgId: orgId[0]) .mapError { _ -> AddPlaceError in return .none }.eraseToAnyPublisher() diff --git a/Projects/App/Sources/Domain/Place/PlaceSearch/PlaceSearchUseCase.swift b/Projects/App/Sources/Domain/Place/PlaceSearch/PlaceSearchUseCase.swift index a8ac432c..4c6f9a92 100644 --- a/Projects/App/Sources/Domain/Place/PlaceSearch/PlaceSearchUseCase.swift +++ b/Projects/App/Sources/Domain/Place/PlaceSearch/PlaceSearchUseCase.swift @@ -21,7 +21,6 @@ final class PlaceSearchUseCase: PlaceSearchUseCaseType { func searchPlaces(with placeName: String) -> AnyPublisher<[Place], Error> { -// TODO: ORG-ID 넣고 교체 필요 let orgId = UserInfoManager.userInfo?.userOrganization[0] ?? 400 PlaceAPI.fetchSearchPlaceResults(orgId: orgId, placeName: placeName) From 1767bcc2a3baa08675f7aa362a5406453a254125 Mon Sep 17 00:00:00 2001 From: Chanhee Jeong Date: Wed, 23 Nov 2022 15:23:04 +0900 Subject: [PATCH 6/6] =?UTF-8?q?Feat=E2=9C=A8:=20=20=EC=9D=B8=EC=A6=9D?= =?UTF-8?q?=EB=8C=80=ED=95=99=EC=A0=95=EB=B3=B4=EA=B0=80=20=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20=EC=A1=B0=EC=A7=81=EC=83=81?= =?UTF-8?q?=EC=84=B8=EC=A0=95=EB=B3=B4=EB=A5=BC=20=EB=88=8C=EB=A0=80?= =?UTF-8?q?=EC=9D=84=EB=95=8C=20alert=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Place/AddPlace/AddPlaceUseCase.swift | 1 - .../View/OrgDetailViewController.swift | 1 + .../View/PlaceListViewController.swift | 18 +++++++++++++++--- .../Sources/DTO/RequestDTO/SignUpUserDTO.swift | 2 -- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift b/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift index c6fa092f..cc06990d 100644 --- a/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift +++ b/Projects/App/Sources/Domain/Place/AddPlace/AddPlaceUseCase.swift @@ -12,7 +12,6 @@ import Network protocol AddPlaceUseCaseType { func searchKakaoPlaces(with name: String) -> AnyPublisher<[KakaoPlace], Error> -// func checkRegisterdPlace(with kakaoPlaceId: Int) -> AnyPublisher func checkRegisterdPlace(with kakaoPlaceId: Int) -> AnyPublisher func fetchCategories() -> AnyPublisher<[Category], Error> func addNewPlace(with place: KakaoPlace, category: Int) -> AnyPublisher diff --git a/Projects/App/Sources/UI/Organization/OrgDetail/View/OrgDetailViewController.swift b/Projects/App/Sources/UI/Organization/OrgDetail/View/OrgDetailViewController.swift index b32be939..d29e3159 100644 --- a/Projects/App/Sources/UI/Organization/OrgDetail/View/OrgDetailViewController.swift +++ b/Projects/App/Sources/UI/Organization/OrgDetail/View/OrgDetailViewController.swift @@ -158,6 +158,7 @@ extension OrgDetailViewController { orgDetailInformationView2.informationLabel.text = "등록된 맛집" orgDetailInformationView2.numberLabel.text = "0곳" + // TODO: - 백엔드 작업 완료 후 복구 // orgInfoImageView3.image = UIImage(.img_reviewfriends_photo) // orgInfoImageView3.contentMode = .scaleAspectFit // orgInfoImageView3.layer.applyFigmaShadow(color: .black, opacity: 0.1, xCoord: 0, yCoord: 0, blur: 5, spread: 0) diff --git a/Projects/App/Sources/UI/Place/PlaceList/View/PlaceListViewController.swift b/Projects/App/Sources/UI/Place/PlaceList/View/PlaceListViewController.swift index 87207feb..9452de9e 100644 --- a/Projects/App/Sources/UI/Place/PlaceList/View/PlaceListViewController.swift +++ b/Projects/App/Sources/UI/Place/PlaceList/View/PlaceListViewController.swift @@ -138,9 +138,21 @@ extension PlaceListViewController: QuestionButtonTapDelegate, UIAdaptivePresenta func addPlaceButtonTapped() { navigationController?.pushViewController(AddPlaceSearchViewController(viewModel: AddPlaceSearchViewModel()), animated: true) } - - @objc func orgDetailButtonTapped() { - navigationController?.pushViewController(OrgDetailViewController(viewModel: OrgDetailViewModel(orgId: UserInfoManager.userInfo?.userOrganization[0] ?? 400)), animated: true) + + @objc func orgDetailButtonTapped() throws { + + if let orgId = UserInfoManager.userInfo?.userOrganization.first { + navigationController?.pushViewController(OrgDetailViewController(viewModel: OrgDetailViewModel(orgId: orgId)), + animated: true) + } else { + let alert = UIAlertController(title: "인증대학없음", + message: "등록되어 있는 대학 정보가 없습니다", + preferredStyle: .alert) + let okAction = UIAlertAction(title: "닫기", style: .default) + alert.addAction(okAction) + self.present(alert, animated: false) + } + FirebaseAnalytics.Analytics.logEvent(AnalyticsEventSelectItem, parameters: [ AnalyticsParameterItemListName: "org_detail_button" ]) diff --git a/Projects/Network/Sources/DTO/RequestDTO/SignUpUserDTO.swift b/Projects/Network/Sources/DTO/RequestDTO/SignUpUserDTO.swift index 0690038a..3838c039 100644 --- a/Projects/Network/Sources/DTO/RequestDTO/SignUpUserDTO.swift +++ b/Projects/Network/Sources/DTO/RequestDTO/SignUpUserDTO.swift @@ -9,12 +9,10 @@ import Foundation public struct SignUpUserDTO: Encodable { -// public let id: Int public let email: String public let organizationName: String public init(email: String, organizationName: String) { -// self.id = id self.email = email self.organizationName = organizationName }