Skip to content

Commit 2a1a271

Browse files
committed
refactor: 메서드 및 타입 private 처리
1 parent 83ef7a3 commit 2a1a271

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

DevLog/Infra/Service/SocialLogin/GithubAuthenticationService.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ final class GithubAuthenticationService: NSObject, AuthenticationService {
152152
}
153153

154154
@MainActor
155-
func requestAuthorizationCode() async throws -> String {
155+
private func requestAuthorizationCode() async throws -> String {
156156
guard let clientID = Bundle.main.object(forInfoDictionaryKey: "GITHUB_CLIENT_ID") as? String,
157157
let redirectURL = Bundle.main.object(forInfoDictionaryKey: "APP_REDIRECT_URL") as? String,
158158
let urlComponents = URLComponents(string: redirectURL),
@@ -212,7 +212,7 @@ final class GithubAuthenticationService: NSObject, AuthenticationService {
212212
}
213213

214214
// Firebase Function 호출: Custom Token 발급
215-
func requestTokens(authorizationCode: String) async throws -> (String, String) {
215+
private func requestTokens(authorizationCode: String) async throws -> (String, String) {
216216
let requestTokenFunction = functions.httpsCallable(FunctionName.requestGithubTokens)
217217

218218
do {
@@ -229,7 +229,7 @@ final class GithubAuthenticationService: NSObject, AuthenticationService {
229229
}
230230
}
231231

232-
func revokeAccessToken(accessToken: String? = nil) async throws {
232+
private func revokeAccessToken(accessToken: String? = nil) async throws {
233233
var param: [String: Any] = [:]
234234

235235
if let accessToken = accessToken {
@@ -242,7 +242,7 @@ final class GithubAuthenticationService: NSObject, AuthenticationService {
242242
}
243243

244244
// GitHub API로 사용자 프로필 정보 가져오기
245-
func requestUserProfile(accessToken: String) async throws -> GitHubUser {
245+
private func requestUserProfile(accessToken: String) async throws -> GitHubUser {
246246
guard let url = URL(string: "https://api.github.com/user") else {
247247
throw URLError(.badURL)
248248
}
@@ -275,7 +275,7 @@ final class GithubAuthenticationService: NSObject, AuthenticationService {
275275
)
276276
}
277277

278-
func requestPrimaryVerifiedEmail(accessToken: String) async throws -> String? {
278+
private func requestPrimaryVerifiedEmail(accessToken: String) async throws -> String? {
279279
guard let url = URL(string: "https://api.github.com/user/emails") else {
280280
throw URLError(.badURL)
281281
}
@@ -302,7 +302,7 @@ final class GithubAuthenticationService: NSObject, AuthenticationService {
302302
return gitHubEmails.first(where: { $0.verified })?.email
303303
}
304304

305-
func mapRequestTokensError(_ error: Error) -> Error {
305+
private func mapRequestTokensError(_ error: Error) -> Error {
306306
let nsError = error as NSError
307307
guard nsError.domain == FunctionsErrorDomain,
308308
let details = nsError.userInfo[FunctionsErrorDetailsKey] as? [String: Any],
@@ -315,11 +315,7 @@ final class GithubAuthenticationService: NSObject, AuthenticationService {
315315
}
316316
}
317317

318-
extension GithubAuthenticationService: ASWebAuthenticationPresentationContextProviding {
319-
func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
320-
return provider.keyWindow() ?? ASPresentationAnchor()
321-
}
322-
318+
private extension GithubAuthenticationService {
323319
struct GitHubUser: Codable {
324320
let login: String
325321
let name: String?
@@ -339,5 +335,10 @@ extension GithubAuthenticationService: ASWebAuthenticationPresentationContextPro
339335
let primary: Bool
340336
let verified: Bool
341337
}
338+
}
342339

340+
extension GithubAuthenticationService: ASWebAuthenticationPresentationContextProviding {
341+
func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
342+
return provider.keyWindow() ?? ASPresentationAnchor()
343+
}
343344
}

0 commit comments

Comments
 (0)