Skip to content

Commit

Permalink
Merge pull request #223 from boostcampwm2023/iOS/chore#222
Browse files Browse the repository at this point in the history
chore: 변경된 서버 API 필드명으로 회원가입 여부 DTO 변경, 코드 리뷰 반영
  • Loading branch information
loinsir authored Dec 6, 2023
2 parents 1b51be2 + d7bdb5e commit d702bc6
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
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)

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

0 comments on commit d702bc6

Please sign in to comment.