@react-native-kakao/user 2.4.8-next.0 → 2.4.9
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 2.4.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b9f4a65: Backport Kakao Account fallback after KakaoTalk login failure on v2.
|
|
8
|
+
- @react-native-kakao/core@2.4.9
|
|
9
|
+
|
|
10
|
+
## 2.4.8
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 256f3cf: Unify package builds and internal dependency versions with Yarn workspaces. Include the compiled Expo config plugin and omit web-only declarations from published packages. Manage coordinated stable and prerelease versions with Changesets.
|
|
15
|
+
- Updated dependencies [256f3cf]
|
|
16
|
+
- @react-native-kakao/core@2.4.8
|
|
17
|
+
|
|
3
18
|
## 2.4.8-next.0
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -12,6 +12,8 @@ import com.kakao.sdk.auth.model.Prompt.CREATE
|
|
|
12
12
|
import com.kakao.sdk.auth.model.Prompt.LOGIN
|
|
13
13
|
import com.kakao.sdk.auth.model.Prompt.SELECT_ACCOUNT
|
|
14
14
|
import com.kakao.sdk.auth.model.Prompt.UNIFY_DAUM
|
|
15
|
+
import com.kakao.sdk.common.model.ClientError
|
|
16
|
+
import com.kakao.sdk.common.model.ClientErrorCause
|
|
15
17
|
import com.kakao.sdk.user.UserApiClient
|
|
16
18
|
import net.mjstudio.rnkakao.core.util.RNCKakaoResponseNotFoundException
|
|
17
19
|
import net.mjstudio.rnkakao.core.util.RNCKakaoUtil
|
|
@@ -86,6 +88,29 @@ class RNCKakaoUserModule internal constructor(
|
|
|
86
88
|
)
|
|
87
89
|
}
|
|
88
90
|
}
|
|
91
|
+
val requestedServiceTerms = serviceTerms?.filterIsInstance<String>()?.ifEmpty { null }
|
|
92
|
+
val requestedPrompts =
|
|
93
|
+
prompts
|
|
94
|
+
?.filterIsInstance<String>()
|
|
95
|
+
?.mapNotNull {
|
|
96
|
+
when (it) {
|
|
97
|
+
"Login" -> LOGIN
|
|
98
|
+
"Create" -> CREATE
|
|
99
|
+
"Cert" -> CERT
|
|
100
|
+
"UnifyDaum" -> UNIFY_DAUM
|
|
101
|
+
"SelectAccount" -> SELECT_ACCOUNT
|
|
102
|
+
else -> null
|
|
103
|
+
}
|
|
104
|
+
}?.ifEmpty { null }
|
|
105
|
+
val accountLogin = {
|
|
106
|
+
UserApiClient.instance.loginWithKakaoAccount(
|
|
107
|
+
context,
|
|
108
|
+
prompts = requestedPrompts,
|
|
109
|
+
nonce = nonce,
|
|
110
|
+
serviceTerms = requestedServiceTerms,
|
|
111
|
+
callback = callback,
|
|
112
|
+
)
|
|
113
|
+
}
|
|
89
114
|
|
|
90
115
|
if (scopes?.filterIsInstance<String>()?.isEmpty() == false) {
|
|
91
116
|
UserApiClient.instance.loginWithNewScopes(
|
|
@@ -100,32 +125,24 @@ class RNCKakaoUserModule internal constructor(
|
|
|
100
125
|
?.filterIsInstance<String>()
|
|
101
126
|
?.isEmpty() == true
|
|
102
127
|
) {
|
|
128
|
+
val talkCallback: (OAuthToken?, Throwable?) -> Unit = { token, error ->
|
|
129
|
+
if (error is ClientError && error.reason == ClientErrorCause.Cancelled) {
|
|
130
|
+
callback(token, error)
|
|
131
|
+
} else if (error != null || token == null) {
|
|
132
|
+
accountLogin()
|
|
133
|
+
} else {
|
|
134
|
+
callback(token, error)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
103
138
|
UserApiClient.instance.loginWithKakaoTalk(
|
|
104
139
|
context,
|
|
105
140
|
nonce = nonce,
|
|
106
|
-
serviceTerms =
|
|
107
|
-
callback =
|
|
141
|
+
serviceTerms = requestedServiceTerms,
|
|
142
|
+
callback = talkCallback,
|
|
108
143
|
)
|
|
109
144
|
} else {
|
|
110
|
-
|
|
111
|
-
context,
|
|
112
|
-
prompts =
|
|
113
|
-
prompts
|
|
114
|
-
?.filterIsInstance<String>()
|
|
115
|
-
?.mapNotNull {
|
|
116
|
-
when (it) {
|
|
117
|
-
"Login" -> LOGIN
|
|
118
|
-
"Create" -> CREATE
|
|
119
|
-
"Cert" -> CERT
|
|
120
|
-
"UnifyDaum" -> UNIFY_DAUM
|
|
121
|
-
"SelectAccount" -> SELECT_ACCOUNT
|
|
122
|
-
else -> null
|
|
123
|
-
}
|
|
124
|
-
}?.ifEmpty { null },
|
|
125
|
-
nonce = nonce,
|
|
126
|
-
serviceTerms = serviceTerms?.filterIsInstance<String>()?.ifEmpty { null },
|
|
127
|
-
callback = callback,
|
|
128
|
-
)
|
|
145
|
+
accountLogin()
|
|
129
146
|
}
|
|
130
147
|
}
|
|
131
148
|
|
|
@@ -60,17 +60,7 @@ import RNCKakaoCore
|
|
|
60
60
|
RNCKakaoUtil.reject(reject, RNCKakaoError.responseNotFound(name: "token"))
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
if !scopes.isEmpty {
|
|
65
|
-
UserApi.shared.loginWithKakaoAccount(scopes: scopes, nonce: nonce, completion: callback)
|
|
66
|
-
} else if UserApi.isKakaoTalkLoginAvailable(), !useKakaoAccountLogin {
|
|
67
|
-
UserApi.shared
|
|
68
|
-
.loginWithKakaoTalk(
|
|
69
|
-
serviceTerms: emptyArrayToNil(serviceTerms),
|
|
70
|
-
nonce: nonce,
|
|
71
|
-
completion: callback
|
|
72
|
-
)
|
|
73
|
-
} else {
|
|
63
|
+
let accountLogin = {
|
|
74
64
|
var _prompts: [Prompt] = []
|
|
75
65
|
for p in prompts {
|
|
76
66
|
if p == "Login" {
|
|
@@ -86,13 +76,39 @@ import RNCKakaoCore
|
|
|
86
76
|
_prompts.append(.UnifyDaum)
|
|
87
77
|
}
|
|
88
78
|
}
|
|
89
|
-
UserApi.shared
|
|
90
|
-
.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
79
|
+
UserApi.shared.loginWithKakaoAccount(
|
|
80
|
+
prompts: self.emptyArrayToNil(_prompts),
|
|
81
|
+
serviceTerms: self.emptyArrayToNil(serviceTerms),
|
|
82
|
+
nonce: nonce,
|
|
83
|
+
completion: callback
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if !scopes.isEmpty {
|
|
88
|
+
UserApi.shared.loginWithKakaoAccount(scopes: scopes, nonce: nonce, completion: callback)
|
|
89
|
+
} else if UserApi.isKakaoTalkLoginAvailable(), !useKakaoAccountLogin {
|
|
90
|
+
let talkCallback = { (token: OAuthToken?, error: Error?) in
|
|
91
|
+
if let sdkError = error as? SdkError {
|
|
92
|
+
switch sdkError {
|
|
93
|
+
case .ClientFailed(.Cancelled, _),
|
|
94
|
+
.AuthFailed(.AccessDenied, _):
|
|
95
|
+
callback(token, error)
|
|
96
|
+
default:
|
|
97
|
+
accountLogin()
|
|
98
|
+
}
|
|
99
|
+
} else if error != nil || token == nil {
|
|
100
|
+
accountLogin()
|
|
101
|
+
} else {
|
|
102
|
+
callback(token, error)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
UserApi.shared.loginWithKakaoTalk(
|
|
106
|
+
serviceTerms: emptyArrayToNil(serviceTerms),
|
|
107
|
+
nonce: nonce,
|
|
108
|
+
completion: talkCallback
|
|
109
|
+
)
|
|
110
|
+
} else {
|
|
111
|
+
accountLogin()
|
|
96
112
|
}
|
|
97
113
|
}
|
|
98
114
|
}
|
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": "2.4.
|
|
4
|
+
"version": "2.4.9",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
7
7
|
"types": "lib/typescript/src/index.d.ts",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@react-native-kakao/core": "2.4.
|
|
64
|
+
"@react-native-kakao/core": "2.4.9",
|
|
65
65
|
"@types/invariant": "^2",
|
|
66
66
|
"@types/jest": "^29.5.5",
|
|
67
67
|
"@types/react": "19.0.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"zx": "8.8.5"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@react-native-kakao/core": "2.4.
|
|
77
|
+
"@react-native-kakao/core": "2.4.9",
|
|
78
78
|
"react": "*",
|
|
79
79
|
"react-native": "*"
|
|
80
80
|
},
|