-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/origin/suyeon'
Conflicts: KkuMulKum.xcodeproj/project.pbxproj
- Loading branch information
Showing
13 changed files
with
337 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ struct ErrorResponse: Codable { | |
let code: Int | ||
let message: String | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// LoginService.swift | ||
// KkuMulKum | ||
// | ||
// Created by 이지훈 on 7/15/24. | ||
// | ||
|
||
import Foundation | ||
|
||
import Moya | ||
|
||
enum LoginTargetType { | ||
case appleLogin(identityToken: String, fcmToken: String) | ||
case kakaoLogin(accessToken: String, fcmToken: String) | ||
} | ||
|
||
extension LoginTargetType: TargetType { | ||
var baseURL: URL { | ||
guard let privacyInfo = Bundle.main.privacyInfo, | ||
let urlString = privacyInfo["BASE_URL"] as? String, | ||
let url = URL(string: urlString) else { | ||
fatalError("Invalid BASE_URL in PrivacyInfo.plist") | ||
} | ||
return url | ||
} | ||
|
||
var path: String { | ||
return "/api/v1/auth/signin" | ||
} | ||
|
||
var method: Moya.Method { | ||
return .post | ||
} | ||
|
||
var task: Task { | ||
switch self { | ||
case let .appleLogin(_, fcmToken): | ||
return .requestParameters( | ||
parameters: ["provider": "APPLE", "fcmToken": fcmToken], | ||
encoding: JSONEncoding.default | ||
) | ||
case let .kakaoLogin(_, fcmToken): | ||
return .requestParameters( | ||
parameters: ["provider": "KAKAO", "fcmToken": fcmToken], | ||
encoding: JSONEncoding.default | ||
) | ||
} | ||
} | ||
|
||
var headers: [String : String]? { | ||
switch self { | ||
case .appleLogin(let identityToken, _): | ||
return ["Authorization": identityToken, "Content-Type": "application/json"] | ||
case .kakaoLogin(let accessToken, _): | ||
return ["Authorization": accessToken, "Content-Type": "application/json"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// Bundle.swift | ||
// KkuMulKum | ||
// | ||
// Created by 이지훈 on 7/15/24. | ||
// | ||
|
||
import Foundation | ||
|
||
extension Bundle { | ||
var privacyInfo: [String: Any]? { | ||
guard let url = self.url(forResource: "PrivacyInfo", withExtension: "plist"), | ||
let data = try? Data(contentsOf: url), | ||
let result = try? PropertyListSerialization.propertyList( | ||
from: data, | ||
options: [], | ||
format: nil | ||
) as? [String: Any] else { | ||
return nil | ||
} | ||
return result | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
KkuMulKum/Source/Onboarding/Login/Service/AuthService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// AuthServiceType.swift | ||
// KkuMulKum | ||
// | ||
// Created by 이지훈 on 7/14/24. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol AuthServiceType { | ||
|
||
// TODO: 토큰 관리를 위한 메서드 (키체인 생성이후 구현예정) | ||
func saveToken(_ token: String) | ||
func getToken() -> String? | ||
func clearToken() | ||
} | ||
|
||
class AuthService: AuthServiceType { | ||
func saveToken(_ token: String) { | ||
|
||
} | ||
|
||
func getToken() -> String? { | ||
|
||
return nil | ||
} | ||
|
||
func clearToken() { | ||
} | ||
|
||
} |
Oops, something went wrong.