@react-native-kakao/user 0.10.0 → 1.0.3

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,5 +1,6 @@
1
1
  package net.mjstudio.rnkakao.user
2
2
 
3
+ import android.content.ActivityNotFoundException
3
4
  import com.facebook.react.bridge.Promise
4
5
  import com.facebook.react.bridge.ReactApplicationContext
5
6
  import com.facebook.react.bridge.ReactMethod
@@ -40,6 +41,11 @@ class RNCKakaoUserModule internal constructor(context: ReactApplicationContext)
40
41
  scopes: ReadableArray?,
41
42
  promise: Promise
42
43
  ) {
44
+ val context = currentActivity
45
+ if (context == null) {
46
+ promise.rejectWith(ActivityNotFoundException())
47
+ return
48
+ }
43
49
  val callback: (OAuthToken?, Throwable?) -> Unit = { token, error ->
44
50
  if (error != null) {
45
51
  promise.rejectWith(error)
@@ -74,21 +80,19 @@ class RNCKakaoUserModule internal constructor(context: ReactApplicationContext)
74
80
 
75
81
  if (scopes?.filterIsInstance<String>()?.isEmpty() == false) {
76
82
  UserApiClient.instance.loginWithNewScopes(
77
- reactApplicationContext,
78
- scopes = scopes.filterIsInstance<String>(),
79
- callback = callback
83
+ context, scopes = scopes.filterIsInstance<String>(), callback = callback
80
84
  )
81
- } else if (UserApiClient.instance.isKakaoTalkLoginAvailable(reactApplicationContext) && !useKakaoAccountLogin && scopes?.filterIsInstance<String>()
85
+ } else if (UserApiClient.instance.isKakaoTalkLoginAvailable(context) && !useKakaoAccountLogin && scopes?.filterIsInstance<String>()
82
86
  ?.isEmpty() == true
83
87
  ) {
84
88
  UserApiClient.instance.loginWithKakaoTalk(
85
- reactApplicationContext,
89
+ context,
86
90
  serviceTerms = serviceTerms?.filterIsInstance<String>()?.ifEmpty { null },
87
91
  callback = callback
88
92
  )
89
93
  } else {
90
94
  UserApiClient.instance.loginWithKakaoAccount(
91
- reactApplicationContext,
95
+ context,
92
96
  prompts = prompts?.filterIsInstance<String>()?.mapNotNull {
93
97
  when (it) {
94
98
  "Login" -> LOGIN
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-native-kakao/user",
3
3
  "description": "React Native Kakao User SDK",
4
- "version": "0.10.0",
4
+ "version": "1.0.3",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
7
7
  "types": "lib/typescript/src/index.d.ts",
@@ -62,7 +62,7 @@
62
62
  "access": "public"
63
63
  },
64
64
  "devDependencies": {
65
- "@react-native-kakao/core": "^0.10.0",
65
+ "@react-native-kakao/core": "^1.0.3",
66
66
  "@types/invariant": "^2",
67
67
  "@types/jest": "^29.5.5",
68
68
  "@types/react": "^18.2.44",
@@ -74,7 +74,7 @@
74
74
  "typescript": "5.1.6"
75
75
  },
76
76
  "peerDependencies": {
77
- "@react-native-kakao/core": "^0.10.0",
77
+ "@react-native-kakao/core": "^1.0.3",
78
78
  "react": "*",
79
79
  "react-native": "*"
80
80
  },
@@ -110,7 +110,7 @@
110
110
  "javaPackageName": "net.mjstudio.rnkakao.user"
111
111
  }
112
112
  },
113
- "gitHead": "654ea83ecf7e1629fb2b5d3123ff40f6475d9d75",
113
+ "gitHead": "cf8ba9ec1f6d12aa33b34c63d89229dac2c460a4",
114
114
  "dependencies": {
115
115
  "@mj-studio/js-util": "^1.0.34"
116
116
  }