@chuseok22/capacitor-kakao-login 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- export const APP_VERSION = '0.1.5';
1
+ export const APP_VERSION = '0.1.6';
2
2
  //# sourceMappingURL=version.js.map
@@ -4,11 +4,6 @@ import KakaoSDKCommon
4
4
  import KakaoSDKAuth
5
5
  import KakaoSDKUser
6
6
 
7
- /// Capacitor 플러그인 — 카카오 소셜 로그인
8
- ///
9
- /// capacitor.config.ts에 appKey를 설정하면 load() 시점에 KakaoSDK를 자동 초기화하고,
10
- /// ApplicationDelegateProxy에 등록해 URL 처리도 자동으로 수행한다.
11
- /// AppDelegate를 수정할 필요가 없다.
12
7
  @objc(KakaoLoginPlugin)
13
8
  public class KakaoLoginPlugin: CAPPlugin, CAPBridgedPlugin {
14
9
 
@@ -18,44 +13,32 @@ public class KakaoLoginPlugin: CAPPlugin, CAPBridgedPlugin {
18
13
  CAPPluginMethod(name: "login", returnType: CAPPluginReturnPromise)
19
14
  ]
20
15
 
21
- /// 플러그인 로드 시 KakaoSDK를 자동 초기화한다.
22
- /// capacitor.config.ts의 plugins.KakaoLogin.appKey 값을 읽는다.
23
16
  public override func load() {
24
17
  guard let appKey = getConfigValue("appKey") as? String, !appKey.isEmpty else {
25
18
  print("[KakaoLoginPlugin] ⚠️ appKey가 capacitor.config.ts에 설정되지 않았습니다.")
26
19
  print("[KakaoLoginPlugin] plugins: { KakaoLogin: { appKey: 'YOUR_NATIVE_APP_KEY' } }")
27
20
  return
28
21
  }
29
-
30
22
  KakaoSDK.initSDK(appKey: appKey)
31
-
32
- // Capacitor AppDelegate는 이미 ApplicationDelegateProxy.shared를 통해 URL을 라우팅한다.
33
- // 여기에 self를 등록해두면 AppDelegate 수정 없이 URL 콜백을 처리할 수 있다.
34
- ApplicationDelegateProxy.shared.add(self)
23
+ // handleOpenUrl 오버라이드로 URL 처리 — ApplicationDelegateProxy.add() 불필요
35
24
  }
36
25
 
37
- /// ApplicationDelegateProxy호출하는 URL 핸들러.
38
- /// 카카오톡 로그인 앱으로 돌아오는 URL 처리한다.
39
- @objc public func application(
40
- _ app: UIApplication,
41
- open url: URL,
42
- options: [UIApplication.OpenURLOptionsKey: Any]
43
- ) -> Bool {
44
- if AuthApi.isKakaoTalkLoginUrl(url) {
45
- return AuthController.handleOpenUrl(url: url)
26
+ // CapacitorAppDelegate.application(_:open:options:)를 플러그인으로 라우팅
27
+ @objc public override func handleOpenUrl(_ url: URL, _ options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
28
+ guard AuthApi.isKakaoTalkLoginUrl(url) else { return false }
29
+ // AuthController.handleOpenUrl은 @MainActor — URL 콜백은 메인 스레드 보장
30
+ return MainActor.assumeIsolated {
31
+ AuthController.handleOpenUrl(url: url)
46
32
  }
47
- return false
48
33
  }
49
34
 
50
35
  @objc func login(_ call: CAPPluginCall) {
51
36
  DispatchQueue.main.async {
52
37
  if UserApi.isKakaoTalkLoginAvailable() {
53
- // 카카오톡 앱 로그인
54
38
  UserApi.shared.loginWithKakaoTalk { [weak self] oauthToken, error in
55
39
  self?.handleLoginResult(call: call, oauthToken: oauthToken, error: error)
56
40
  }
57
41
  } else {
58
- // 카카오 계정 웹뷰 로그인 (카카오톡 미설치 환경)
59
42
  UserApi.shared.loginWithKakaoAccount { [weak self] oauthToken, error in
60
43
  self?.handleLoginResult(call: call, oauthToken: oauthToken, error: error)
61
44
  }
@@ -77,12 +60,10 @@ public class KakaoLoginPlugin: CAPPlugin, CAPBridgedPlugin {
77
60
  call.reject("카카오 사용자 정보 조회 실패", nil, error)
78
61
  return
79
62
  }
80
-
81
63
  guard let userId = user?.id else {
82
64
  call.reject("카카오 사용자 ID를 가져올 수 없습니다")
83
65
  return
84
66
  }
85
-
86
67
  call.resolve(["socialId": String(userId)])
87
68
  }
88
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chuseok22/capacitor-kakao-login",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Capacitor plugin for Kakao social login (iOS & Android)",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/plugin.esm.mjs",
@@ -1,3 +0,0 @@
1
- // 이 파일은 더 이상 사용되지 않습니다.
2
- // 소스는 ios/Sources/Chuseok22CapacitorKakaoLogin/KakaoLoginPlugin.swift 로 이동되었습니다.
3
- // This file is intentionally left empty to prevent duplicate symbol compilation errors.