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

chore: 변경된 서버 API 필드명으로 회원가입 여부 DTO 변경, 코드 리뷰 반영 #223

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion iOS/Layover/Layover/Network/DTOs/CheckSignUpDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
import Foundation

struct CheckSignUpDTO: Decodable {
let isValid: Bool
let isAlreadyExist: Bool
}
2 changes: 1 addition & 1 deletion iOS/Layover/Layover/Network/Mock/MockData/CheckSignUp.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"message": "성공",
"statusCode": 200,
"data": {
"isValid": true
"isAlreadyExist": true
}
}
14 changes: 7 additions & 7 deletions iOS/Layover/Layover/Network/Mock/MockData/LoginData.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"customCode": "SUCCESS",
"message": "성공",
"statusCode": 200,
"data": {
"accessToken": "mockAccessToken",
"refreshToken": "mockRefreshToken"
}
"customCode": "SUCCESS",
"message": "성공",
"statusCode": 200,
"data": {
"accessToken": "mockAccessToken",
"refreshToken": "mockRefreshToken"
}
}
8 changes: 4 additions & 4 deletions iOS/Layover/Layover/Scenes/Login/LoginInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ extension LoginInteractor: LoginBusinessLogic {
guard let token = await worker?.fetchKakaoLoginToken() else { return }
kakaoLoginToken = token
if await worker?.isRegisteredKakao(with: token) == true,
await worker?.loginKakao(with: token) == true {
await worker?.loginKakao(with: token) == true {
await MainActor.run {
presenter?.presentPerformLogin()
}
Expand Down Expand Up @@ -77,10 +77,10 @@ extension LoginInteractor: ASAuthorizationControllerDelegate {
}
appleLoginToken = identityToken
Task {
async let isRegistered: Bool = worker?.isRegisteredApple(with: identityToken) ?? false
async let loginResult: Bool = worker?.loginApple(with: identityToken) ?? false
let isRegistered = await worker?.isRegisteredApple(with: identityToken)
let loginResult = await worker?.loginApple(with: identityToken)
Comment on lines -80 to +81
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전에 그 병렬 처리 코드네요 확인했습니다.

Copy link
Collaborator Author

@loinsir loinsir Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mock으로 하니까 여기도 간헐적으로 오류가 나네요 ㅠ 실 Worker로 하면 원래 코드는 오류 나지 않을 거에요


if await !isRegistered, await loginResult {
if isRegistered == true, loginResult == true {
await MainActor.run {
presenter?.presentPerformLogin()
}
Expand Down
4 changes: 2 additions & 2 deletions iOS/Layover/Layover/Scenes/Login/LoginWorker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ extension LoginWorker: LoginWorkerProtocol {
do {
let endPoint = loginEndPointFactory.makeCheckKakaoIsSignedUpEndPoint(with: socialToken)
let result = try await provider.request(with: endPoint, authenticationIfNeeded: false)
return result.data?.isValid
return result.data?.isAlreadyExist
} catch {
os_log(.error, log: .data, "%@", error.localizedDescription)
return nil
Expand Down Expand Up @@ -101,7 +101,7 @@ extension LoginWorker: LoginWorkerProtocol {
do {
let endPoint = loginEndPointFactory.makeCheckAppleIsSignedUpEndPoint(with: identityToken)
let result = try await provider.request(with: endPoint, authenticationIfNeeded: false)
return result.data?.isValid
return result.data?.isAlreadyExist
} catch {
os_log(.error, log: .data, "%@", error.localizedDescription)
return nil
Expand Down
4 changes: 2 additions & 2 deletions iOS/Layover/Layover/Workers/Mocks/MockLoginWorker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ final class MockLoginWorker: LoginWorkerProtocol {
method: .POST,
bodyParameters: bodyParameters)
let response = try await provider.request(with: endPoint, authenticationIfNeeded: false, retryCount: 0)
return response.data?.isValid
return response.data?.isAlreadyExist
} catch {
os_log(.error, log: .data, "%@", error.localizedDescription)
return nil
Expand Down Expand Up @@ -107,7 +107,7 @@ final class MockLoginWorker: LoginWorkerProtocol {
method: .POST,
bodyParameters: bodyParameters)
let response = try await provider.request(with: endPoint, authenticationIfNeeded: false, retryCount: 0)
return response.data?.isValid
return response.data?.isAlreadyExist
} catch {
os_log(.error, log: .data, "%@", error.localizedDescription)
return nil
Expand Down