-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat/#350 카카오로그인 구현완료 #351
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
// | ||
|
||
import UIKit | ||
|
||
import KakaoSDKCommon | ||
import KakaoSDKAuth | ||
import Firebase | ||
|
@@ -19,30 +20,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | |
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? | ||
) -> Bool { | ||
|
||
UNUserNotificationCenter.current().delegate = LocalNotificationManager.shared | ||
|
||
// KakaoSDK 초기화 과정에서 앱 키를 동적으로 불러오기 | ||
if let kakaoAppKey = fetchKakaoAppKeyFromPrivacyInfo() { | ||
KakaoSDK.initSDK(appKey: kakaoAppKey) | ||
// KakaoSDK 초기화 | ||
if let kakaoAppKey = Bundle.main.privacyInfo?["NATIVE_APP_KEY"] as? String { | ||
KakaoSDK.initSDK(appKey: kakaoAppKey, loggingEnable: true) | ||
print("Kakao SDK initialized with app key: \(kakaoAppKey)") | ||
} else { | ||
print("Failed to load KAKAO_APP_KEY from PrivacyInfo.plist") | ||
} | ||
|
||
setupFirebase(application: application) | ||
|
||
return true | ||
} | ||
|
||
func fetchKakaoAppKeyFromPrivacyInfo() -> String? { | ||
guard let path = Bundle.main.path(forResource: "PrivacyInfo", ofType: "plist"), | ||
let dict = NSDictionary(contentsOfFile: path) as? [String: AnyObject], | ||
let appKey = dict["NATIVE_APP_KEY"] as? String else { | ||
return nil | ||
} | ||
return appKey | ||
} | ||
|
||
// 카카오 로그인 | ||
|
||
// 카카오 로그인 URL 처리 (중복 제거) | ||
func application( | ||
_ app: UIApplication, | ||
open url: URL, | ||
|
@@ -117,7 +108,7 @@ extension AppDelegate: MessagingDelegate, UNUserNotificationCenterDelegate { | |
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { | ||
Messaging.messaging().apnsToken = deviceToken | ||
|
||
Messaging.messaging().token { [weak self] token, error in | ||
Messaging.messaging().token { token, error in | ||
if let error = error { | ||
print("Error fetching FCM registration token: \(error)") | ||
} else if let token = token { | ||
Comment on lines
112
to
114
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아래와 같이 좀 더 간결하게 표현 가능합니다. (Swift 5.7부터 인걸로 알고 있어요.) if let error {
} else if let token { |
||
|
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 |
---|---|---|
|
@@ -39,12 +39,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
} | ||
|
||
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) { | ||
if let url = URLContexts.first?.url { | ||
if (AuthApi.isKakaoTalkLoginUrl(url)) { | ||
_ = AuthController.handleOpenUrl(url: url) | ||
if let url = URLContexts.first?.url { | ||
if (AuthApi.isKakaoTalkLoginUrl(url)) { | ||
_ = AuthController.handleOpenUrl(url: url) | ||
} | ||
} | ||
Comment on lines
+42
to
46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 개인적인 의견입니다만, 저는 뎁스를 좀 지양하는 편이라 아래와 같이 표현도 가능해 보입니다. // guard 문 사용
guard let url = URLContexts.first?.url, AuthApi.isKakaoTalkLoginUrl(url) else {
return
}
_ = AuthController.handleOpenUrl(url: url)
// if 문 사용
if let url = URLContexts.first?.url, AuthApi.isKakaoTalkLoginUrl(url) {
_ = AuthController.handleOpenUrl(url: url)
} |
||
} | ||
} | ||
|
||
func application( | ||
_ app: UIApplication, | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
성공했을 때는 print 디버깅은 필요없을 것 같네요.