@react-native-kakao/user 3.1.0-next.0 → 3.1.0-next.1
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 +30 -0
- package/android/src/main/java/net/mjstudio/rnkakao/user/RNCKakaoUserModule.kt +289 -128
- package/ios/RNCKakaoUser.mm +58 -6
- package/ios/RNCKakaoUserManager.swift +211 -43
- package/lib/commonjs/index.js +66 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +106 -5
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/spec/NativeKakaoUser.ts +23 -1
- package/lib/module/index.js +61 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +101 -5
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/spec/NativeKakaoUser.ts +23 -1
- package/lib/typescript/src/index.d.ts +58 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/spec/NativeKakaoUser.d.ts +8 -2
- package/lib/typescript/src/spec/NativeKakaoUser.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +157 -4
- package/src/index.web.ts +123 -7
- package/src/spec/NativeKakaoUser.ts +23 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.1.0-next.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 250d066: Expose group user tokens consistently on Android, iOS, and web.
|
|
8
|
+
- 3d92882: Expose the iOS token refresh request logging option without changing global SDK logging or Android behavior.
|
|
9
|
+
- f1fd1e2: Add manual signup and profile connection state on Android, iOS, and web.
|
|
10
|
+
- f6e0207: Add a shared loginHint option for Kakao Account login on Android, iOS, and web.
|
|
11
|
+
- a8a2e24: Expose partner legal identity fields and consent flags on Android, iOS, and web.
|
|
12
|
+
- d81f9b7: Expose iOS authorization-code and certification-code token exchange with PKCE options, normalized web token issuance, and explicit unsupported-platform errors.
|
|
13
|
+
- 7fe7820: Add native login method selection and explicit refresh of stored OAuth tokens.
|
|
14
|
+
- 524be2c: Expose profile image defaults, leap-month flags, and the user's KakaoTalk UUID on Android, iOS, and web.
|
|
15
|
+
- e25e428: Allow explicit native tokens when refreshing and normalize remaining token lifetimes across native responses.
|
|
16
|
+
- 97a99b5: Add updateProfile to store registered custom user properties on Android, iOS, and web.
|
|
17
|
+
- b6ff8a9: Add channel selection to login on Android, iOS, and web.
|
|
18
|
+
- bd1bb64: Add the secureResource profile image URL option on Android, iOS, and web.
|
|
19
|
+
- 87e8aa7: Allow a custom Android KakaoTalk login request code while preserving the SDK default when omitted. Accept the SDK's full 32-bit request code range for regular and certification login.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- dfd32ca: Upgrade all Kakao Android SDK modules to 2.25.1 and preserve web shipping-address queries with JavaScript SDK 2.8.4.
|
|
24
|
+
- da4db1c: Return canonical profile enum strings on Android and preserve birthday type strings on iOS.
|
|
25
|
+
- Updated dependencies [d5c5fb8]
|
|
26
|
+
- Updated dependencies [3027207]
|
|
27
|
+
- Updated dependencies [dfd32ca]
|
|
28
|
+
- Updated dependencies [2b223bf]
|
|
29
|
+
- Updated dependencies [67cd4e2]
|
|
30
|
+
- Updated dependencies [d81f9b7]
|
|
31
|
+
- @react-native-kakao/core@3.1.0-next.1
|
|
32
|
+
|
|
3
33
|
## 3.1.0-next.0
|
|
4
34
|
|
|
5
35
|
### Minor Changes
|
|
@@ -5,8 +5,11 @@ import com.facebook.react.bridge.Promise
|
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.bridge.ReactMethod
|
|
7
7
|
import com.facebook.react.bridge.ReadableArray
|
|
8
|
+
import com.facebook.react.bridge.ReadableMap
|
|
8
9
|
import com.kakao.sdk.auth.AuthApiClient
|
|
10
|
+
import com.kakao.sdk.auth.AuthCodeClient
|
|
9
11
|
import com.kakao.sdk.auth.model.OAuthToken
|
|
12
|
+
import com.kakao.sdk.auth.model.Prompt
|
|
10
13
|
import com.kakao.sdk.auth.model.Prompt.CERT
|
|
11
14
|
import com.kakao.sdk.auth.model.Prompt.CREATE
|
|
12
15
|
import com.kakao.sdk.auth.model.Prompt.LOGIN
|
|
@@ -14,8 +17,14 @@ import com.kakao.sdk.auth.model.Prompt.SELECT_ACCOUNT
|
|
|
14
17
|
import com.kakao.sdk.common.model.ClientError
|
|
15
18
|
import com.kakao.sdk.common.model.ClientErrorCause
|
|
16
19
|
import com.kakao.sdk.user.UserApiClient
|
|
20
|
+
import com.kakao.sdk.user.model.AccountLoginParams
|
|
21
|
+
import com.kakao.sdk.user.model.AgeRange
|
|
22
|
+
import com.kakao.sdk.user.model.BirthdayType
|
|
23
|
+
import com.kakao.sdk.user.model.Gender
|
|
24
|
+
import com.kakao.sdk.user.model.LoginUiMode
|
|
17
25
|
import com.kakao.sdk.user.model.UserShippingAddresses
|
|
18
26
|
import net.mjstudio.rnkakao.core.util.RNCKakaoResponseNotFoundException
|
|
27
|
+
import net.mjstudio.rnkakao.core.util.RNCKakaoUnsupportedPlatformException
|
|
19
28
|
import net.mjstudio.rnkakao.core.util.RNCKakaoUtil
|
|
20
29
|
import net.mjstudio.rnkakao.core.util.argArr
|
|
21
30
|
import net.mjstudio.rnkakao.core.util.argMap
|
|
@@ -28,9 +37,12 @@ import net.mjstudio.rnkakao.core.util.putD
|
|
|
28
37
|
import net.mjstudio.rnkakao.core.util.putI
|
|
29
38
|
import net.mjstudio.rnkakao.core.util.putL
|
|
30
39
|
import net.mjstudio.rnkakao.core.util.rejectWith
|
|
40
|
+
import net.mjstudio.rnkakao.core.util.toStringMap
|
|
31
41
|
import net.mjstudio.rnkakao.core.util.unix
|
|
32
42
|
import java.util.Date
|
|
33
43
|
|
|
44
|
+
private const val MILLISECONDS_PER_SECOND = 1000.0
|
|
45
|
+
|
|
34
46
|
class RNCKakaoUserModule internal constructor(
|
|
35
47
|
context: ReactApplicationContext,
|
|
36
48
|
) : NativeKakaoUserSpec(context) {
|
|
@@ -41,6 +53,9 @@ class RNCKakaoUserModule internal constructor(
|
|
|
41
53
|
useKakaoAccountLogin: Boolean,
|
|
42
54
|
scopes: ReadableArray?,
|
|
43
55
|
nonce: String?,
|
|
56
|
+
loginHint: String?,
|
|
57
|
+
channelPublicIds: ReadableArray?,
|
|
58
|
+
androidRequestCode: Double?,
|
|
44
59
|
promise: Promise,
|
|
45
60
|
) = onMain {
|
|
46
61
|
val context =
|
|
@@ -48,63 +63,18 @@ class RNCKakaoUserModule internal constructor(
|
|
|
48
63
|
promise.rejectWith(ActivityNotFoundException())
|
|
49
64
|
return@onMain
|
|
50
65
|
}
|
|
51
|
-
val callback
|
|
52
|
-
if (error != null) {
|
|
53
|
-
promise.rejectWith(error)
|
|
54
|
-
} else if (token == null) {
|
|
55
|
-
promise.rejectWith(RNCKakaoResponseNotFoundException("token"))
|
|
56
|
-
} else {
|
|
57
|
-
promise.resolve(
|
|
58
|
-
argMap().apply {
|
|
59
|
-
putString("accessToken", token.accessToken)
|
|
60
|
-
putString("refreshToken", token.refreshToken)
|
|
61
|
-
putString("tokenType", null)
|
|
62
|
-
putString("idToken", token.idToken)
|
|
63
|
-
putDouble(
|
|
64
|
-
"accessTokenExpiresAt",
|
|
65
|
-
token.accessTokenExpiresAt.unix.toDouble(),
|
|
66
|
-
)
|
|
67
|
-
putDouble(
|
|
68
|
-
"refreshTokenExpiresAt",
|
|
69
|
-
token.refreshTokenExpiresAt.unix.toDouble(),
|
|
70
|
-
)
|
|
71
|
-
putDouble(
|
|
72
|
-
"accessTokenExpiresIn",
|
|
73
|
-
RNCKakaoUtil.diffSec(token.accessTokenExpiresAt, Date()).toDouble(),
|
|
74
|
-
)
|
|
75
|
-
putDouble(
|
|
76
|
-
"refreshTokenExpiresIn",
|
|
77
|
-
RNCKakaoUtil.diffSec(token.refreshTokenExpiresAt, Date()).toDouble(),
|
|
78
|
-
)
|
|
79
|
-
putArray(
|
|
80
|
-
"scopes",
|
|
81
|
-
argArr().apply {
|
|
82
|
-
pushStringList(token.scopes ?: listOf())
|
|
83
|
-
},
|
|
84
|
-
)
|
|
85
|
-
},
|
|
86
|
-
)
|
|
87
|
-
}
|
|
88
|
-
}
|
|
66
|
+
val callback = tokenCallback(promise)
|
|
89
67
|
val requestedServiceTerms = serviceTerms?.filterIsInstance<String>()?.ifEmpty { null }
|
|
90
|
-
val
|
|
91
|
-
|
|
92
|
-
?.filterIsInstance<String>()
|
|
93
|
-
?.mapNotNull {
|
|
94
|
-
when (it) {
|
|
95
|
-
"Login" -> LOGIN
|
|
96
|
-
"Create" -> CREATE
|
|
97
|
-
"Cert" -> CERT
|
|
98
|
-
"SelectAccount" -> SELECT_ACCOUNT
|
|
99
|
-
else -> null
|
|
100
|
-
}
|
|
101
|
-
}?.ifEmpty { null }
|
|
68
|
+
val requestedChannelPublicIds = channelPublicIds?.filterIsInstance<String>()?.ifEmpty { null }
|
|
69
|
+
val requestedPrompts = loginPrompts(prompts)
|
|
102
70
|
val accountLogin = {
|
|
103
71
|
UserApiClient.instance.loginWithKakaoAccount(
|
|
104
72
|
context,
|
|
105
73
|
prompts = requestedPrompts,
|
|
74
|
+
loginHint = loginHint,
|
|
106
75
|
nonce = nonce,
|
|
107
76
|
serviceTerms = requestedServiceTerms,
|
|
77
|
+
channelPublicIds = requestedChannelPublicIds,
|
|
108
78
|
callback = callback,
|
|
109
79
|
)
|
|
110
80
|
}
|
|
@@ -134,8 +104,10 @@ class RNCKakaoUserModule internal constructor(
|
|
|
134
104
|
|
|
135
105
|
UserApiClient.instance.loginWithKakaoTalk(
|
|
136
106
|
context,
|
|
107
|
+
requestCode = androidRequestCode?.toInt() ?: AuthCodeClient.DEFAULT_REQUEST_CODE,
|
|
137
108
|
nonce = nonce,
|
|
138
109
|
serviceTerms = requestedServiceTerms,
|
|
110
|
+
channelPublicIds = requestedChannelPublicIds,
|
|
139
111
|
callback = talkCallback,
|
|
140
112
|
)
|
|
141
113
|
} else {
|
|
@@ -143,12 +115,92 @@ class RNCKakaoUserModule internal constructor(
|
|
|
143
115
|
}
|
|
144
116
|
}
|
|
145
117
|
|
|
118
|
+
@ReactMethod
|
|
119
|
+
override fun loginWithKakao(
|
|
120
|
+
uiMode: String,
|
|
121
|
+
orientation: String,
|
|
122
|
+
launchMethod: String,
|
|
123
|
+
prompts: ReadableArray,
|
|
124
|
+
loginHint: String?,
|
|
125
|
+
nonce: String?,
|
|
126
|
+
channelPublicIds: ReadableArray?,
|
|
127
|
+
serviceTerms: ReadableArray?,
|
|
128
|
+
promise: Promise,
|
|
129
|
+
) = onMain {
|
|
130
|
+
val context =
|
|
131
|
+
reactApplicationContext.currentActivity ?: run {
|
|
132
|
+
promise.rejectWith(ActivityNotFoundException())
|
|
133
|
+
return@onMain
|
|
134
|
+
}
|
|
135
|
+
UserApiClient.instance.loginWithKakao(
|
|
136
|
+
context,
|
|
137
|
+
uiMode = LoginUiMode.entries.firstOrNull { it.name.equals(uiMode, ignoreCase = true) } ?: LoginUiMode.AUTO,
|
|
138
|
+
accountParams = AccountLoginParams(prompts = loginPrompts(prompts), loginHint = loginHint),
|
|
139
|
+
nonce = nonce,
|
|
140
|
+
channelPublicIds = channelPublicIds?.filterIsInstance<String>()?.ifEmpty { null },
|
|
141
|
+
serviceTerms = serviceTerms?.filterIsInstance<String>()?.ifEmpty { null },
|
|
142
|
+
callback = tokenCallback(promise),
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@ReactMethod
|
|
147
|
+
override fun issueAccessTokenWithCode(
|
|
148
|
+
code: String,
|
|
149
|
+
codeVerifier: String?,
|
|
150
|
+
redirectUri: String?,
|
|
151
|
+
promise: Promise,
|
|
152
|
+
) {
|
|
153
|
+
promise.rejectWith(RNCKakaoUnsupportedPlatformException("issueAccessTokenWithCode", "iOS and web"))
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@ReactMethod
|
|
157
|
+
override fun refreshToken(
|
|
158
|
+
token: ReadableMap?,
|
|
159
|
+
iosLoggingEnabled: Boolean?,
|
|
160
|
+
promise: Promise,
|
|
161
|
+
) = onMain {
|
|
162
|
+
try {
|
|
163
|
+
val oldToken =
|
|
164
|
+
token?.let {
|
|
165
|
+
OAuthToken(
|
|
166
|
+
accessToken = requireNotNull(it.getString("accessToken")),
|
|
167
|
+
accessTokenExpiresAt = Date((it.getDouble("accessTokenExpiresAt") * MILLISECONDS_PER_SECOND).toLong()),
|
|
168
|
+
refreshToken = requireNotNull(it.getString("refreshToken")),
|
|
169
|
+
refreshTokenExpiresAt = Date((it.getDouble("refreshTokenExpiresAt") * MILLISECONDS_PER_SECOND).toLong()),
|
|
170
|
+
idToken = it.getString("idToken"),
|
|
171
|
+
scopes = it.getArray("scopes")?.filterIsInstance<String>(),
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
if (oldToken == null) {
|
|
175
|
+
AuthApiClient.instance.refreshToken(callback = tokenCallback(promise))
|
|
176
|
+
} else {
|
|
177
|
+
AuthApiClient.instance.refreshToken(oldToken = oldToken, callback = tokenCallback(promise))
|
|
178
|
+
}
|
|
179
|
+
} catch (error: Exception) {
|
|
180
|
+
promise.rejectWith(error)
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
146
184
|
@ReactMethod
|
|
147
185
|
override fun isKakaoTalkLoginAvailable(promise: Promise) =
|
|
148
186
|
onMain {
|
|
149
187
|
promise.resolve(UserApiClient.instance.isKakaoTalkLoginAvailable(reactApplicationContext))
|
|
150
188
|
}
|
|
151
189
|
|
|
190
|
+
@ReactMethod
|
|
191
|
+
override fun signup(
|
|
192
|
+
properties: ReadableMap?,
|
|
193
|
+
promise: Promise,
|
|
194
|
+
) = onMain {
|
|
195
|
+
UserApiClient.instance.signup(properties?.toStringMap()) { error ->
|
|
196
|
+
if (error != null) {
|
|
197
|
+
promise.rejectWith(error)
|
|
198
|
+
} else {
|
|
199
|
+
promise.resolve(null)
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
152
204
|
@ReactMethod
|
|
153
205
|
override fun logout(promise: Promise) =
|
|
154
206
|
onMain {
|
|
@@ -378,87 +430,113 @@ class RNCKakaoUserModule internal constructor(
|
|
|
378
430
|
}
|
|
379
431
|
|
|
380
432
|
@ReactMethod
|
|
381
|
-
override fun
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
putL("synchedAt", user.synchedAt?.unix)
|
|
394
|
-
putString("name", user.kakaoAccount?.name)
|
|
433
|
+
override fun updateProfile(
|
|
434
|
+
properties: ReadableMap,
|
|
435
|
+
promise: Promise,
|
|
436
|
+
) = onMain {
|
|
437
|
+
UserApiClient.instance.updateProfile(properties.toStringMap()) { error ->
|
|
438
|
+
if (error != null) {
|
|
439
|
+
promise.rejectWith(error)
|
|
440
|
+
} else {
|
|
441
|
+
promise.resolve(null)
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
395
445
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
446
|
+
@ReactMethod
|
|
447
|
+
override fun me(
|
|
448
|
+
secureResource: Boolean?,
|
|
449
|
+
promise: Promise,
|
|
450
|
+
) = onMain {
|
|
451
|
+
UserApiClient.instance.me(secureResource = secureResource ?: true) { user, error ->
|
|
452
|
+
if (error != null) {
|
|
453
|
+
promise.rejectWith(error)
|
|
454
|
+
} else if (user == null) {
|
|
455
|
+
promise.rejectWith(RNCKakaoResponseNotFoundException("user"))
|
|
456
|
+
} else {
|
|
457
|
+
promise.resolve(
|
|
458
|
+
argMap().apply {
|
|
459
|
+
putD("id", user.id?.toDouble())
|
|
460
|
+
putB("hasSignedUp", user.hasSignedUp)
|
|
461
|
+
putString("uuid", user.uuid)
|
|
462
|
+
putString("groupUserToken", user.groupUserToken)
|
|
463
|
+
putL("connectedAt", user.connectedAt?.unix)
|
|
464
|
+
putL("synchedAt", user.synchedAt?.unix)
|
|
465
|
+
putString("name", user.kakaoAccount?.name)
|
|
466
|
+
|
|
467
|
+
putString("email", user.kakaoAccount?.email)
|
|
468
|
+
putString("nickname", user.kakaoAccount?.profile?.nickname)
|
|
469
|
+
putString("profileImageUrl", user.kakaoAccount?.profile?.profileImageUrl)
|
|
470
|
+
putString("thumbnailImageUrl", user.kakaoAccount?.profile?.thumbnailImageUrl)
|
|
471
|
+
putB("isDefaultImage", user.kakaoAccount?.profile?.isDefaultImage)
|
|
472
|
+
putString("phoneNumber", user.kakaoAccount?.phoneNumber)
|
|
473
|
+
putString("ageRange", user.kakaoAccount?.ageRange.toBridgeValue())
|
|
474
|
+
putString("birthday", user.kakaoAccount?.birthday)
|
|
475
|
+
putString("birthdayType", user.kakaoAccount?.birthdayType.toBridgeValue())
|
|
476
|
+
putB("isLeapMonth", user.kakaoAccount?.isLeapMonth)
|
|
477
|
+
putString("birthyear", user.kakaoAccount?.birthyear)
|
|
478
|
+
putString("gender", user.kakaoAccount?.gender.toBridgeValue())
|
|
479
|
+
putB("isEmailValid", user.kakaoAccount?.isEmailValid)
|
|
480
|
+
putB("isEmailVerified", user.kakaoAccount?.isEmailVerified)
|
|
481
|
+
putB("isKorean", user.kakaoAccount?.isKorean)
|
|
482
|
+
putB(
|
|
483
|
+
"ageRangeNeedsAgreement",
|
|
484
|
+
user.kakaoAccount?.ageRangeNeedsAgreement,
|
|
485
|
+
)
|
|
486
|
+
putB(
|
|
487
|
+
"birthdayNeedsAgreement",
|
|
488
|
+
user.kakaoAccount?.birthdayNeedsAgreement,
|
|
489
|
+
)
|
|
490
|
+
putB(
|
|
491
|
+
"birthyearNeedsAgreement",
|
|
492
|
+
user.kakaoAccount?.birthyearNeedsAgreement,
|
|
493
|
+
)
|
|
494
|
+
putB(
|
|
495
|
+
"emailNeedsAgreement",
|
|
496
|
+
user.kakaoAccount?.emailNeedsAgreement,
|
|
497
|
+
)
|
|
498
|
+
putB(
|
|
499
|
+
"genderNeedsAgreement",
|
|
500
|
+
user.kakaoAccount?.genderNeedsAgreement,
|
|
501
|
+
)
|
|
502
|
+
putB(
|
|
503
|
+
"isKoreanNeedsAgreement",
|
|
504
|
+
user.kakaoAccount?.isKoreanNeedsAgreement,
|
|
505
|
+
)
|
|
506
|
+
putB(
|
|
507
|
+
"phoneNumberNeedsAgreement",
|
|
508
|
+
user.kakaoAccount?.phoneNumberNeedsAgreement,
|
|
509
|
+
)
|
|
510
|
+
putB(
|
|
511
|
+
"profileNeedsAgreement",
|
|
512
|
+
user.kakaoAccount?.profileNeedsAgreement,
|
|
513
|
+
)
|
|
514
|
+
putB(
|
|
515
|
+
"nameNeedsAgreement",
|
|
516
|
+
user.kakaoAccount?.nameNeedsAgreement,
|
|
517
|
+
)
|
|
518
|
+
putB(
|
|
519
|
+
"profileImageNeedsAgreement",
|
|
520
|
+
user.kakaoAccount?.profileImageNeedsAgreement,
|
|
521
|
+
)
|
|
522
|
+
putB(
|
|
523
|
+
"profileNicknameNeedsAgreement",
|
|
524
|
+
user.kakaoAccount?.profileNicknameNeedsAgreement,
|
|
525
|
+
)
|
|
526
|
+
putB(
|
|
527
|
+
"legalBirthDateNeedsAgreement",
|
|
528
|
+
user.kakaoAccount?.legalBirthDateNeedsAgreement,
|
|
529
|
+
)
|
|
530
|
+
putString("legalName", user.kakaoAccount?.legalName)
|
|
531
|
+
putB("legalNameNeedsAgreement", user.kakaoAccount?.legalNameNeedsAgreement)
|
|
532
|
+
putString("legalBirthDate", user.kakaoAccount?.legalBirthDate)
|
|
533
|
+
putString("legalGender", user.kakaoAccount?.legalGender.toBridgeValue())
|
|
534
|
+
putB("legalGenderNeedsAgreement", user.kakaoAccount?.legalGenderNeedsAgreement)
|
|
535
|
+
},
|
|
536
|
+
)
|
|
460
537
|
}
|
|
461
538
|
}
|
|
539
|
+
}
|
|
462
540
|
|
|
463
541
|
@ReactMethod
|
|
464
542
|
override fun getAccessToken(promise: Promise) =
|
|
@@ -479,4 +557,87 @@ class RNCKakaoUserModule internal constructor(
|
|
|
479
557
|
}
|
|
480
558
|
}
|
|
481
559
|
}
|
|
560
|
+
|
|
561
|
+
private fun tokenCallback(promise: Promise): (OAuthToken?, Throwable?) -> Unit =
|
|
562
|
+
{ token, error ->
|
|
563
|
+
if (error != null) {
|
|
564
|
+
promise.rejectWith(error)
|
|
565
|
+
} else if (token == null) {
|
|
566
|
+
promise.rejectWith(RNCKakaoResponseNotFoundException("token"))
|
|
567
|
+
} else {
|
|
568
|
+
promise.resolve(
|
|
569
|
+
argMap().apply {
|
|
570
|
+
putString("accessToken", token.accessToken)
|
|
571
|
+
putString("refreshToken", token.refreshToken)
|
|
572
|
+
putString("tokenType", null)
|
|
573
|
+
putString("idToken", token.idToken)
|
|
574
|
+
putDouble(
|
|
575
|
+
"accessTokenExpiresAt",
|
|
576
|
+
token.accessTokenExpiresAt.unix.toDouble(),
|
|
577
|
+
)
|
|
578
|
+
putDouble(
|
|
579
|
+
"refreshTokenExpiresAt",
|
|
580
|
+
token.refreshTokenExpiresAt.unix.toDouble(),
|
|
581
|
+
)
|
|
582
|
+
putDouble(
|
|
583
|
+
"accessTokenExpiresIn",
|
|
584
|
+
RNCKakaoUtil.diffSec(token.accessTokenExpiresAt, Date()).toDouble(),
|
|
585
|
+
)
|
|
586
|
+
putDouble(
|
|
587
|
+
"refreshTokenExpiresIn",
|
|
588
|
+
RNCKakaoUtil.diffSec(token.refreshTokenExpiresAt, Date()).toDouble(),
|
|
589
|
+
)
|
|
590
|
+
putArray(
|
|
591
|
+
"scopes",
|
|
592
|
+
argArr().apply {
|
|
593
|
+
pushStringList(token.scopes ?: listOf())
|
|
594
|
+
},
|
|
595
|
+
)
|
|
596
|
+
},
|
|
597
|
+
)
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
private fun loginPrompts(prompts: ReadableArray?): List<Prompt>? =
|
|
602
|
+
prompts
|
|
603
|
+
?.filterIsInstance<String>()
|
|
604
|
+
?.mapNotNull {
|
|
605
|
+
when (it) {
|
|
606
|
+
"Login" -> LOGIN
|
|
607
|
+
"Create" -> CREATE
|
|
608
|
+
"Cert" -> CERT
|
|
609
|
+
"SelectAccount" -> SELECT_ACCOUNT
|
|
610
|
+
else -> null
|
|
611
|
+
}
|
|
612
|
+
}?.ifEmpty { null }
|
|
482
613
|
}
|
|
614
|
+
|
|
615
|
+
private fun AgeRange?.toBridgeValue(): String? =
|
|
616
|
+
when (this) {
|
|
617
|
+
AgeRange.AGE_0_9 -> "0~9"
|
|
618
|
+
AgeRange.AGE_10_14 -> "10~14"
|
|
619
|
+
AgeRange.AGE_15_19 -> "15~19"
|
|
620
|
+
AgeRange.AGE_20_29 -> "20~29"
|
|
621
|
+
AgeRange.AGE_30_39 -> "30~39"
|
|
622
|
+
AgeRange.AGE_40_49 -> "40~49"
|
|
623
|
+
AgeRange.AGE_50_59 -> "50~59"
|
|
624
|
+
AgeRange.AGE_60_69 -> "60~69"
|
|
625
|
+
AgeRange.AGE_70_79 -> "70~79"
|
|
626
|
+
AgeRange.AGE_80_89 -> "80~89"
|
|
627
|
+
AgeRange.AGE_90_ABOVE -> "90~"
|
|
628
|
+
AgeRange.UNKNOWN, null -> null
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
private fun Gender?.toBridgeValue(): String? =
|
|
632
|
+
when (this) {
|
|
633
|
+
Gender.FEMALE -> "female"
|
|
634
|
+
Gender.MALE -> "male"
|
|
635
|
+
Gender.UNKNOWN, null -> null
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
private fun BirthdayType?.toBridgeValue(): String? =
|
|
639
|
+
when (this) {
|
|
640
|
+
BirthdayType.SOLAR -> "SOLAR"
|
|
641
|
+
BirthdayType.LUNAR -> "LUNAR"
|
|
642
|
+
BirthdayType.UNKNOWN, null -> null
|
|
643
|
+
}
|
package/ios/RNCKakaoUser.mm
CHANGED
|
@@ -17,19 +17,65 @@ RCT_EXPORT_METHOD(isKakaoTalkLoginAvailable : (RCTPromiseResolveBlock)
|
|
|
17
17
|
resolve reject : (RCTPromiseRejectBlock)reject) {
|
|
18
18
|
[[self manager] isKakaoTalkLoginAvailable:resolve reject:reject];
|
|
19
19
|
}
|
|
20
|
-
RCT_EXPORT_METHOD(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
RCT_EXPORT_METHOD(
|
|
21
|
+
login : (NSArray*)serviceTerms prompts : (NSArray*)prompts useKakaoAccountLogin : (BOOL)
|
|
22
|
+
useKakaoAccountLogin scopes : (NSArray*)scopes nonce : (NSString*)
|
|
23
|
+
nonce loginHint : (NSString*)loginHint channelPublicIds : (NSArray*)
|
|
24
|
+
channelPublicIds androidRequestCode : (NSNumber*)androidRequestCode resolve : (
|
|
25
|
+
RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject) {
|
|
24
26
|
[[self manager] login:serviceTerms
|
|
25
27
|
prompts:prompts
|
|
26
28
|
useKakaoAccountLogin:useKakaoAccountLogin
|
|
27
29
|
scopes:scopes
|
|
28
30
|
nonce:nonce
|
|
31
|
+
loginHint:loginHint
|
|
32
|
+
channelPublicIds:channelPublicIds
|
|
29
33
|
resolve:resolve
|
|
30
34
|
reject:reject];
|
|
31
35
|
}
|
|
32
36
|
|
|
37
|
+
RCT_EXPORT_METHOD(signup : (NSDictionary*)properties resolve : (RCTPromiseResolveBlock)
|
|
38
|
+
resolve reject : (RCTPromiseRejectBlock)reject) {
|
|
39
|
+
[[self manager] signup:properties resolve:resolve reject:reject];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
RCT_EXPORT_METHOD(loginWithKakao : (NSString*)uiMode orientation : (NSString*)
|
|
43
|
+
orientation launchMethod : (NSString*)launchMethod prompts : (NSArray*)
|
|
44
|
+
prompts loginHint : (NSString*)loginHint nonce : (NSString*)
|
|
45
|
+
nonce channelPublicIds : (NSArray*)channelPublicIds serviceTerms : (
|
|
46
|
+
NSArray*)serviceTerms resolve : (RCTPromiseResolveBlock)
|
|
47
|
+
resolve reject : (RCTPromiseRejectBlock)reject) {
|
|
48
|
+
[[self manager] loginWithKakao:uiMode
|
|
49
|
+
orientation:orientation
|
|
50
|
+
launchMethod:launchMethod
|
|
51
|
+
prompts:prompts
|
|
52
|
+
loginHint:loginHint
|
|
53
|
+
nonce:nonce
|
|
54
|
+
channelPublicIds:channelPublicIds
|
|
55
|
+
serviceTerms:serviceTerms
|
|
56
|
+
resolve:resolve
|
|
57
|
+
reject:reject];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
RCT_EXPORT_METHOD(issueAccessTokenWithCode : (NSString*)code codeVerifier : (
|
|
61
|
+
NSString*)codeVerifier redirectUri : (NSString*)redirectUri resolve : (RCTPromiseResolveBlock)
|
|
62
|
+
resolve reject : (RCTPromiseRejectBlock)reject) {
|
|
63
|
+
[[self manager] issueAccessTokenWithCode:code
|
|
64
|
+
codeVerifier:codeVerifier
|
|
65
|
+
redirectUri:redirectUri
|
|
66
|
+
resolve:resolve
|
|
67
|
+
reject:reject];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
RCT_EXPORT_METHOD(refreshToken : (NSDictionary*)token iosLoggingEnabled : (NSNumber*)
|
|
71
|
+
iosLoggingEnabled resolve : (RCTPromiseResolveBlock)
|
|
72
|
+
resolve reject : (RCTPromiseRejectBlock)reject) {
|
|
73
|
+
[[self manager] refreshToken:token
|
|
74
|
+
loggingEnabled:iosLoggingEnabled
|
|
75
|
+
resolve:resolve
|
|
76
|
+
reject:reject];
|
|
77
|
+
}
|
|
78
|
+
|
|
33
79
|
RCT_EXPORT_METHOD(logout : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject) {
|
|
34
80
|
[[self manager] logout:resolve reject:reject];
|
|
35
81
|
}
|
|
@@ -78,8 +124,14 @@ RCT_EXPORT_METHOD(revokeServiceTerms : (NSArray*)tags resolve : (RCTPromiseResol
|
|
|
78
124
|
[[self manager] revokeServiceTerms:tags resolve:resolve reject:reject];
|
|
79
125
|
}
|
|
80
126
|
|
|
81
|
-
RCT_EXPORT_METHOD(
|
|
82
|
-
|
|
127
|
+
RCT_EXPORT_METHOD(updateProfile : (NSDictionary*)properties resolve : (RCTPromiseResolveBlock)
|
|
128
|
+
resolve reject : (RCTPromiseRejectBlock)reject) {
|
|
129
|
+
[[self manager] updateProfile:properties resolve:resolve reject:reject];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
RCT_EXPORT_METHOD(me : (NSNumber*)secureResource resolve : (RCTPromiseResolveBlock)
|
|
133
|
+
resolve reject : (RCTPromiseRejectBlock)reject) {
|
|
134
|
+
[[self manager] me:secureResource resolve:resolve reject:reject];
|
|
83
135
|
}
|
|
84
136
|
|
|
85
137
|
RCT_EXPORT_METHOD(selectShippingAddress : (RCTPromiseResolveBlock)
|