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

Network&feat/#291 #292

Draft
wants to merge 44 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
488778b
[Add] #288 - 선호장르 선택을 위한 장르 이미지 추가
Naknakk Oct 1, 2024
1803d92
[Design] #288 - 선호장르 선택 뷰의 StringLiterals 추가
Naknakk Oct 1, 2024
8884d78
[Add] #288 - 선호장르 선택뷰 추가. 기본 설정
Naknakk Oct 1, 2024
8acfcb7
[Design] #288 - GenrePreferenceView 전체 OnboardingView에 추가
Naknakk Oct 1, 2024
0b35969
[Add] #288 - 선호장르 선택을 위한 장르 enum 프로퍼티 및 데이터 추가
Naknakk Oct 1, 2024
c71754b
[Add] #288 - 선호 장르 선택시 이미지 에셋 추가
Naknakk Oct 1, 2024
1acde59
[Add] #288 - 선호장르 버튼 View 추가
Naknakk Oct 1, 2024
dd148d9
[Design] #288 - 건너뛰기 버튼 색 설정
Naknakk Oct 1, 2024
a341c6f
[Chore] #288 - 파일 위치 정렬
Naknakk Oct 1, 2024
1b26294
[Add] #288 - 장르 이미지 PNG 로 변경. 근데 그래도 깨진다..
Naknakk Oct 1, 2024
8f9127a
[Design] #288 - 버튼 사이즈 기기대응 구현
Naknakk Oct 1, 2024
0198703
[Design] #288 - 선호 장르 버튼 배치. 스택들을 활용하여..
Naknakk Oct 1, 2024
7ce431a
[Design #288 - 스크롤뷰 레이아웃 오류 수정
Naknakk Oct 1, 2024
b7178f6
[Design] #288 - 프로그레스바 이동 애니메이션이 스크롤 뷰 이동 애니메이션에 맞게 끝나도록 변경
Naknakk Oct 1, 2024
992b711
[Design] #288 - 장르 버튼 레이아웃 오류 변경
Naknakk Oct 1, 2024
6ff1fe0
[Design] #288 - 장르 버튼 선택/선택해제 UI 구현
Naknakk Oct 1, 2024
69d3919
[Design] #288 - 선택한 장르가 있는지에 따라 다음 버튼 활성화
Naknakk Oct 1, 2024
de5e1b3
[Design] #288 - 건너뛰기 버튼 추가 및 기능구현
Naknakk Oct 1, 2024
9203fea
[Fix] #288 - 장르 이미지 중복 문제 해결
Naknakk Oct 3, 2024
a719942
[Design] #288 - 성별 남자 -> 남성 으로 UX라이팅 변경
Naknakk Oct 3, 2024
24871a5
[Design] #288 - 년도 기본 선택 2000으로 변경. - 추후 따로 컴포넌트 제작 필요
Naknakk Oct 3, 2024
a2daf06
[Design] #288-3 - OnboardingSuccess UI를 위한 기초 세팅
Naknakk Oct 4, 2024
7ed9d8c
[Design] #288-3 - StringLiterals 추가
Naknakk Oct 4, 2024
905ceb7
[Design] #288-3 - VC 기본 세팅, View 바텀 버튼 추가
Naknakk Oct 4, 2024
3ee8c55
[Design] #288-3 - OnboardingSuccess UI 구현 완료 - 로띠는 중앙 배치를 위해 약간 오른쪽으로…
Naknakk Oct 4, 2024
7a37f50
[Design] #288-3 - 로띠 사이즈를 화면 비율에 따라 크게 만들면 글씨에 비해 너무 커지는 문제가 있어서 300으…
Naknakk Oct 4, 2024
6bd8d1b
[Design] #288-3 - rootVC를 TabBarController로 변경할 때 애니메이션 효과 추가
Naknakk Oct 4, 2024
cd32d75
[Design] #288-3 - SuccessVC push 방식에서 present 방식으로 변경
Naknakk Oct 4, 2024
1ce383b
[Design] #288-3 - SuccessVC 완료 버튼 클릭 시 기능 추가
Naknakk Oct 4, 2024
d8fa771
[Design] #288-3 - 앞에서 입력한 nickname이 반영되도록 적용
Naknakk Oct 4, 2024
ad8dfe4
[Chore] #288-3 - 코드 알아보기 쉽도록 위치 정리
Naknakk Oct 4, 2024
b99a5c7
[Chore] #288-3 - 세로모드 고정, iPhone 용으로 설정 변경
Naknakk Oct 5, 2024
46c5146
[Feat] #291 - NicknameAvailablity Enum 구조체 구현
Naknakk Oct 5, 2024
30d377a
[Feat] #291 - 닉네임 유효성 검증 및 에러문구 구현 완료
Naknakk Oct 5, 2024
4541bd6
[Feat] #291 - 텍스트 필드 내의 x 버튼 기능 구현 완료
Naknakk Oct 5, 2024
a0d3a82
[Feat] #291 - 텍스트 필드 내의 x 버튼 기능 구현방식 변경
Naknakk Oct 5, 2024
bb5d570
[Feat] #291 - 닉네임 유효성 체크 과정을 메서드로 빼면서 코드 정리
Naknakk Oct 5, 2024
92412ee
[Network] #291 - 닉네임 유효성 검증 메서드 추가, 테스트 레포지토리로 테스트 먼저 진행햘 예정
Naknakk Oct 6, 2024
a9d1da8
[Network] #291 - 닉네임 유효성 검증 기능 추가, 테스트 레포지토리로 작동 확인.
Naknakk Oct 6, 2024
93b2ab4
[Network] #291 - 닉네임 유효성 검증 API 연결 완료. 에러가 나면 앱이 터지지 않고 결과를 받아오도록 해야함
Naknakk Oct 6, 2024
cc05d16
[Network] #291 - 닉네임 유효성 검증 error 반환 시에도 앱 터지지 않도록 새로운 에러 추가 및 서비스 구현
Naknakk Oct 6, 2024
6a7a51e
[Chore] #288-3 - VM 프로퍼티에 private 추가
Naknakk Oct 6, 2024
64ec1d5
[Chore] #291 - 현재 브랜치 최신화
Naknakk Oct 6, 2024
51cf23c
[Network] #291 - 에러 처리에 따른 중복확인 결과 구현 완료
Naknakk Oct 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 130 additions & 35 deletions WSSiOS/WSSiOS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions WSSiOS/WSSiOS/App/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
let isLoggedIn = APIConstants.isLogined
let navigationController = UINavigationController(rootViewController: WSSTabBarController(isLoggedIn: isLoggedIn))
navigationController.isNavigationBarHidden = true
window?.rootViewController = navigationController
guard let window else { return }
UIView.transition(with: window,
duration: 0.3,
options: .transitionCrossDissolve,
animations: {
window.rootViewController = navigationController },
completion: nil)
}

func setRootToLoginViewController() {
let navigationController = UINavigationController(rootViewController: ModuleFactory.shared.makeLoginViewController())
navigationController.isNavigationBarHidden = true
Expand Down
2 changes: 0 additions & 2 deletions WSSiOS/WSSiOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<dict>
<key>BASE_URL</key>
<string>$(BASE_URL)</string>
<key>TEST_TOKEN</key>
<string>$(TEST_TOKEN)</string>
<key>BUCKET_URL</key>
<string>$(BUCKET_URL)</string>
<key>NSAppTransportSecurity</key>
Expand Down
81 changes: 81 additions & 0 deletions WSSiOS/WSSiOS/Network/Foundation/NewNetworkingServiceError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//
// NewNetworkingServiceError.swift
// WSSiOS
//
// Created by YunhakLee on 10/6/24.
//

import Foundation

enum NewNetworkServiceError: Error, LocalizedError, CustomStringConvertible {
case invalidURLError
case httpError(statusCode: Int, code: String?, message: String?)
case responseDecodingError
case requestBodyEncodingError
case emptyDataError
case unknownError

public var errorDescription: String? { description }

init(statusCode: Int, errorResponse: ServerErrorResponse? = nil) {
switch statusCode {
case 400...499:
self = .httpError(statusCode: statusCode, code: errorResponse?.code, message: errorResponse?.message)
case 500...599:
self = .httpError(statusCode: statusCode, code: nil, message: nil)
default:
self = .unknownError
}
}

var description: String {
switch self {
case .invalidURLError:
return "INVALID_URL_ERROR"
case .httpError(let statusCode, let code, let message):
switch statusCode {
case 400:
return "400:INVALID_REQUEST_ERROR \(code ?? ""): \(message ?? "")"
case 401:
return "401:AUTHENTICATION_FAILURE_ERROR \(code ?? ""): \(message ?? "")"
case 403:
return "403:FORBIDDEN_ERROR \(code ?? ""): \(message ?? "")"
case 404:
return "404:NOT_FOUND_ERROR \(code ?? ""): \(message ?? "")"
case 405:
return "405:NOT_ALLOWED_HTTP_METHOD_ERROR \(code ?? ""): \(message ?? "")"
case 408:
return "408:TIMEOUT_ERROR \(code ?? ""): \(message ?? "")"
case 500:
return "500:INTERNAL_SERVER_ERROR"
case 501:
return "501:NOT_SUPPORTED_ERROR"
case 502:
return "502:BAD_GATEWAY_ERROR"
case 503:
return "503:INVALID_SERVICE_ERROR"
default:
if (400...499).contains(statusCode) {
return "\(statusCode):CLIENT_ERROR \(code ?? ""): \(message ?? "")"
} else if (500...599).contains(statusCode) {
return "\(statusCode):SERVER_ERROR"
} else {
return "\(statusCode):UNKNOWN_HTTP_ERROR"
}
}
case .responseDecodingError:
return "RESPONSE_DECODING_ERROR"
case .requestBodyEncodingError:
return "REQUEST_BODY_ENCODING_ERROR"
case .emptyDataError:
return "RESPONSE_DATA_EMPTY_ERROR"
case .unknownError:
return "UNKNOWN_ERROR"
}
}
}

struct ServerErrorResponse: Codable {
let code: String
let message: String
}
80 changes: 80 additions & 0 deletions WSSiOS/WSSiOS/Network/Onboarding/OnboardingService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
//
// OnboardingService.swift
// WSSiOS
//
// Created by YunhakLee on 10/6/24.
//

import Foundation

import RxSwift

protocol OnboardingService {
func getNicknameisValid(_ nickname: String) -> Single<OnboardingResult>
}

final class DefaultOnboardingService: NSObject, Networking {
private var urlSession: URLSession = URLSession(configuration: URLSessionConfiguration.default,
delegate: nil,
delegateQueue: nil)
}

extension DefaultOnboardingService: OnboardingService {
func getNicknameisValid(_ nickname: String) -> Single<OnboardingResult> {
let nicknameisValidQueryItems: [URLQueryItem] = [
URLQueryItem(name: "nickname", value: String(describing: nickname))
]

return Single.create { single in
do {
let request = try self.makeHTTPRequest(
method: .get,
path: URLs.Onboarding.nicknameCheck,
queryItems: nicknameisValidQueryItems,
headers: APIConstants.testTokenHeader,
body: nil
)

NetworkLogger.log(request: request)

let task = self.urlSession.dataTask(with: request) { data, response, error in
if let error = error {
single(.failure(error))
return
}

guard let response = response as? HTTPURLResponse else {
single(.failure(NewNetworkServiceError.unknownError))
return
}

guard let data = data else {
single(.failure(NewNetworkServiceError.emptyDataError))
return
}

if 200..<300 ~= response.statusCode {
do {
let result = try self.decode(data: data, to: OnboardingResult.self)
single(.success(result))
} catch {
single(.failure(NewNetworkServiceError.responseDecodingError))
}
} else {
let result = try? self.decode(data: data, to: ServerErrorResponse.self)
single(.failure(NewNetworkServiceError(statusCode: response.statusCode, errorResponse: result)))
}

}
task.resume()
return Disposables.create {
task.cancel()
}
} catch {
single(.failure(error))
}

return Disposables.create()
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"images" : [
{
"filename" : "icGenreBL.svg",
"idiom" : "universal"
"filename" : "genre=icGenreBL.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "genre=icGenreBL@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "genre=icGenreBL@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"images" : [
{
"filename" : "icGenreD.svg",
"idiom" : "universal"
"filename" : "genre=icGenreD.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "genre=icGenreD@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "genre=icGenreD@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"images" : [
{
"filename" : "icGenreF.svg",
"idiom" : "universal"
"filename" : "genre=icGenreF.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "genre=icGenreF@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "genre=icGenreF@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"images" : [
{
"filename" : "icGenreHF.svg",
"idiom" : "universal"
"filename" : "genre=icGenreHF.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "genre=icGenreHF@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "genre=icGenreHF@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"images" : [
{
"filename" : "icGenreLN.svg",
"idiom" : "universal"
"filename" : "genre=icGenreLN.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "genre=icGenreLN@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "genre=icGenreLN@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"images" : [
{
"filename" : "icGenreMH.svg",
"idiom" : "universal"
"filename" : "genre=icGenreMH.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "genre=icGenreMH@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "genre=icGenreMH@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
{
"images" : [
{
"filename" : "icGenreMT.svg",
"idiom" : "universal"
"filename" : "genre=icGenreMT.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "genre=icGenreMT@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "genre=icGenreMT@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading