@react-native-kakao/user 2.2.4 → 2.2.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.
- package/android/src/main/java/net/mjstudio/rnkakao/user/RNCKakaoUserModule.kt +318 -314
- package/android/src/main/java/net/mjstudio/rnkakao/user/RNCKakaoUserPackage.kt +4 -6
- package/android/src/newarch/KakaoUserSpec.kt +3 -2
- package/android/src/oldarch/KakaoUserSpec.kt +27 -26
- package/package.json +4 -4
|
@@ -29,83 +29,87 @@ import net.mjstudio.rnkakao.core.util.rejectWith
|
|
|
29
29
|
import net.mjstudio.rnkakao.core.util.unix
|
|
30
30
|
import java.util.Date
|
|
31
31
|
|
|
32
|
-
class RNCKakaoUserModule internal constructor(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
32
|
+
class RNCKakaoUserModule internal constructor(
|
|
33
|
+
context: ReactApplicationContext,
|
|
34
|
+
) : KakaoUserSpec(context) {
|
|
35
|
+
override fun getName(): String = NAME
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
val callback: (OAuthToken?, Throwable?) -> Unit = { token, error ->
|
|
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
|
-
}
|
|
37
|
+
@ReactMethod
|
|
38
|
+
override fun login(
|
|
39
|
+
serviceTerms: ReadableArray?,
|
|
40
|
+
prompts: ReadableArray?,
|
|
41
|
+
useKakaoAccountLogin: Boolean,
|
|
42
|
+
scopes: ReadableArray?,
|
|
43
|
+
promise: Promise,
|
|
44
|
+
) = onMain {
|
|
45
|
+
val context =
|
|
46
|
+
currentActivity ?: run {
|
|
47
|
+
promise.rejectWith(ActivityNotFoundException())
|
|
48
|
+
return@onMain
|
|
88
49
|
}
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
callback = callback,
|
|
95
|
-
)
|
|
96
|
-
} else if (UserApiClient.instance.isKakaoTalkLoginAvailable(context) && !useKakaoAccountLogin && scopes?.filterIsInstance<String>()
|
|
97
|
-
?.isEmpty() == true
|
|
98
|
-
) {
|
|
99
|
-
UserApiClient.instance.loginWithKakaoTalk(
|
|
100
|
-
context,
|
|
101
|
-
serviceTerms = serviceTerms?.filterIsInstance<String>()?.ifEmpty { null },
|
|
102
|
-
callback = callback,
|
|
103
|
-
)
|
|
50
|
+
val callback: (OAuthToken?, Throwable?) -> Unit = { token, error ->
|
|
51
|
+
if (error != null) {
|
|
52
|
+
promise.rejectWith(error)
|
|
53
|
+
} else if (token == null) {
|
|
54
|
+
promise.rejectWith(RNCKakaoResponseNotFoundException("token"))
|
|
104
55
|
} else {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
56
|
+
promise.resolve(
|
|
57
|
+
argMap().apply {
|
|
58
|
+
putString("accessToken", token.accessToken)
|
|
59
|
+
putString("refreshToken", token.refreshToken)
|
|
60
|
+
putString("tokenType", null)
|
|
61
|
+
putString("idToken", token.idToken)
|
|
62
|
+
putDouble(
|
|
63
|
+
"accessTokenExpiresAt",
|
|
64
|
+
token.accessTokenExpiresAt.unix.toDouble(),
|
|
65
|
+
)
|
|
66
|
+
putDouble(
|
|
67
|
+
"refreshTokenExpiresAt",
|
|
68
|
+
token.refreshTokenExpiresAt.unix.toDouble(),
|
|
69
|
+
)
|
|
70
|
+
putDouble(
|
|
71
|
+
"accessTokenExpiresIn",
|
|
72
|
+
RNCKakaoUtil.diffSec(token.accessTokenExpiresAt, Date()).toDouble(),
|
|
73
|
+
)
|
|
74
|
+
putDouble(
|
|
75
|
+
"refreshTokenExpiresIn",
|
|
76
|
+
RNCKakaoUtil.diffSec(token.refreshTokenExpiresAt, Date()).toDouble(),
|
|
77
|
+
)
|
|
78
|
+
putArray(
|
|
79
|
+
"scopes",
|
|
80
|
+
argArr().apply {
|
|
81
|
+
pushStringList(token.scopes ?: listOf())
|
|
82
|
+
},
|
|
83
|
+
)
|
|
84
|
+
},
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (scopes?.filterIsInstance<String>()?.isEmpty() == false) {
|
|
90
|
+
UserApiClient.instance.loginWithNewScopes(
|
|
91
|
+
context,
|
|
92
|
+
scopes = scopes.filterIsInstance<String>(),
|
|
93
|
+
callback = callback,
|
|
94
|
+
)
|
|
95
|
+
} else if (UserApiClient.instance.isKakaoTalkLoginAvailable(context) &&
|
|
96
|
+
!useKakaoAccountLogin &&
|
|
97
|
+
scopes
|
|
98
|
+
?.filterIsInstance<String>()
|
|
99
|
+
?.isEmpty() == true
|
|
100
|
+
) {
|
|
101
|
+
UserApiClient.instance.loginWithKakaoTalk(
|
|
102
|
+
context,
|
|
103
|
+
serviceTerms = serviceTerms?.filterIsInstance<String>()?.ifEmpty { null },
|
|
104
|
+
callback = callback,
|
|
105
|
+
)
|
|
106
|
+
} else {
|
|
107
|
+
UserApiClient.instance.loginWithKakaoAccount(
|
|
108
|
+
context,
|
|
109
|
+
prompts =
|
|
110
|
+
prompts
|
|
111
|
+
?.filterIsInstance<String>()
|
|
112
|
+
?.mapNotNull {
|
|
109
113
|
when (it) {
|
|
110
114
|
"Login" -> LOGIN
|
|
111
115
|
"Create" -> CREATE
|
|
@@ -115,282 +119,282 @@ class RNCKakaoUserModule internal constructor(context: ReactApplicationContext)
|
|
|
115
119
|
else -> null
|
|
116
120
|
}
|
|
117
121
|
}?.ifEmpty { null },
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
serviceTerms = serviceTerms?.filterIsInstance<String>()?.ifEmpty { null },
|
|
123
|
+
callback = callback,
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@ReactMethod
|
|
129
|
+
override fun isKakaoTalkLoginAvailable(promise: Promise) =
|
|
130
|
+
onMain {
|
|
131
|
+
promise.resolve(UserApiClient.instance.isKakaoTalkLoginAvailable(reactApplicationContext))
|
|
122
132
|
}
|
|
123
133
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
134
|
+
@ReactMethod
|
|
135
|
+
override fun logout(promise: Promise) =
|
|
136
|
+
onMain {
|
|
137
|
+
UserApiClient.instance.logout {
|
|
138
|
+
if (it != null) {
|
|
139
|
+
promise.rejectWith(it)
|
|
140
|
+
} else {
|
|
141
|
+
promise.resolve(42)
|
|
142
|
+
}
|
|
128
143
|
}
|
|
144
|
+
}
|
|
129
145
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
146
|
+
@ReactMethod
|
|
147
|
+
override fun unlink(promise: Promise) =
|
|
148
|
+
onMain {
|
|
149
|
+
UserApiClient.instance.unlink {
|
|
150
|
+
if (it != null) {
|
|
151
|
+
promise.rejectWith(it)
|
|
152
|
+
} else {
|
|
153
|
+
promise.resolve(42)
|
|
139
154
|
}
|
|
140
155
|
}
|
|
156
|
+
}
|
|
141
157
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
158
|
+
@ReactMethod
|
|
159
|
+
override fun isLogined(promise: Promise) =
|
|
160
|
+
onMain {
|
|
161
|
+
if (AuthApiClient.instance.hasToken()) {
|
|
162
|
+
UserApiClient.instance.accessTokenInfo { _, error ->
|
|
163
|
+
if (error != null) {
|
|
164
|
+
promise.rejectWith(error)
|
|
148
165
|
} else {
|
|
149
|
-
promise.resolve(
|
|
166
|
+
promise.resolve(true)
|
|
150
167
|
}
|
|
151
168
|
}
|
|
169
|
+
} else {
|
|
170
|
+
promise.resolve(false)
|
|
152
171
|
}
|
|
172
|
+
}
|
|
153
173
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
174
|
+
@ReactMethod
|
|
175
|
+
override fun scopes(
|
|
176
|
+
scopes: ReadableArray?,
|
|
177
|
+
promise: Promise,
|
|
178
|
+
) = onMain {
|
|
179
|
+
UserApiClient.instance.scopes { scopeInfo, error ->
|
|
180
|
+
if (error != null) {
|
|
181
|
+
promise.rejectWith(error)
|
|
182
|
+
} else if (scopeInfo?.scopes == null) {
|
|
183
|
+
promise.rejectWith(RNCKakaoResponseNotFoundException("scopes"))
|
|
184
|
+
} else {
|
|
185
|
+
promise.resolve(
|
|
186
|
+
argArr().also { arr ->
|
|
187
|
+
scopeInfo.scopes!!.forEach { scope ->
|
|
188
|
+
arr.pushMap(
|
|
189
|
+
argMap().also { map ->
|
|
190
|
+
map.putString("id", scope.id)
|
|
191
|
+
map.putString("displayName", scope.displayName)
|
|
192
|
+
map.putString("type", scope.type.name)
|
|
193
|
+
map.putBoolean("using", scope.using)
|
|
194
|
+
map.putB("delegated", scope.delegated)
|
|
195
|
+
map.putBoolean("agreed", scope.agreed)
|
|
196
|
+
map.putB("revocable", scope.revocable)
|
|
197
|
+
},
|
|
198
|
+
)
|
|
163
199
|
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
promise.resolve(false)
|
|
167
|
-
}
|
|
200
|
+
},
|
|
201
|
+
)
|
|
168
202
|
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
169
205
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
206
|
+
@ReactMethod
|
|
207
|
+
override fun revokeScopes(
|
|
208
|
+
scopes: ReadableArray,
|
|
209
|
+
promise: Promise,
|
|
210
|
+
) = onMain {
|
|
211
|
+
UserApiClient.instance.revokeScopes(
|
|
212
|
+
scopes = scopes.filterIsInstance<String>(),
|
|
213
|
+
) { scopeInfo, error ->
|
|
214
|
+
if (error != null) {
|
|
215
|
+
promise.rejectWith(error)
|
|
216
|
+
} else if (scopeInfo == null) {
|
|
217
|
+
promise.rejectWith(RNCKakaoResponseNotFoundException("scopeInfo"))
|
|
218
|
+
} else {
|
|
219
|
+
promise.resolve(42)
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@ReactMethod
|
|
225
|
+
override fun serviceTerms(promise: Promise) =
|
|
226
|
+
onMain {
|
|
227
|
+
UserApiClient.instance.serviceTerms { serviceTerms, error ->
|
|
176
228
|
if (error != null) {
|
|
177
229
|
promise.rejectWith(error)
|
|
178
|
-
} else if (
|
|
179
|
-
promise.rejectWith(RNCKakaoResponseNotFoundException("
|
|
230
|
+
} else if (serviceTerms?.serviceTerms == null) {
|
|
231
|
+
promise.rejectWith(RNCKakaoResponseNotFoundException("serviceTerms"))
|
|
180
232
|
} else {
|
|
181
233
|
promise.resolve(
|
|
182
|
-
argArr().
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
},
|
|
194
|
-
)
|
|
195
|
-
}
|
|
196
|
-
},
|
|
234
|
+
argArr().pushMapList(
|
|
235
|
+
serviceTerms.serviceTerms?.map { term ->
|
|
236
|
+
argMap().apply {
|
|
237
|
+
putString("tag", term.tag)
|
|
238
|
+
putD("agreedAt", term.agreedAt?.unix?.toDouble())
|
|
239
|
+
putBoolean("agreed", term.agreed)
|
|
240
|
+
putBoolean("required", term.required)
|
|
241
|
+
putBoolean("revocable", term.revocable)
|
|
242
|
+
}
|
|
243
|
+
} ?: listOf(),
|
|
244
|
+
),
|
|
197
245
|
)
|
|
198
246
|
}
|
|
199
247
|
}
|
|
200
248
|
}
|
|
201
249
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
) = onMain {
|
|
207
|
-
UserApiClient.instance.revokeScopes(
|
|
208
|
-
scopes = scopes.filterIsInstance<String>(),
|
|
209
|
-
) { scopeInfo, error ->
|
|
250
|
+
@ReactMethod
|
|
251
|
+
override fun shippingAddresses(promise: Promise) =
|
|
252
|
+
onMain {
|
|
253
|
+
UserApiClient.instance.shippingAddresses { addrs, error ->
|
|
210
254
|
if (error != null) {
|
|
211
255
|
promise.rejectWith(error)
|
|
212
|
-
} else if (
|
|
213
|
-
promise.rejectWith(RNCKakaoResponseNotFoundException("
|
|
256
|
+
} else if (addrs == null) {
|
|
257
|
+
promise.rejectWith(RNCKakaoResponseNotFoundException("shippingAddresses"))
|
|
214
258
|
} else {
|
|
215
|
-
promise.resolve(
|
|
259
|
+
promise.resolve(
|
|
260
|
+
argMap().apply {
|
|
261
|
+
putD("userId", addrs.userId?.toDouble())
|
|
262
|
+
putB("needsAgreement", addrs.needsAgreement)
|
|
263
|
+
putArray(
|
|
264
|
+
"shippingAddresses",
|
|
265
|
+
argArr().apply {
|
|
266
|
+
pushMapList(
|
|
267
|
+
addrs.shippingAddresses?.map { addr ->
|
|
268
|
+
argMap().apply {
|
|
269
|
+
putDouble("id", addr.id.toDouble())
|
|
270
|
+
putString("name", addr.name)
|
|
271
|
+
putBoolean("isDefault", addr.isDefault)
|
|
272
|
+
putD("updatedAt", addr.updatedAt?.unix?.toDouble())
|
|
273
|
+
putString("type", addr.type?.name)
|
|
274
|
+
putString("baseAddress", addr.baseAddress)
|
|
275
|
+
putString("detailAddress", addr.detailAddress)
|
|
276
|
+
putString("receiverName", addr.receiverName)
|
|
277
|
+
putString("receiverPhoneNumber1", addr.receiverPhoneNumber1)
|
|
278
|
+
putString("receiverPhoneNumber2", addr.receiverPhoneNumber2)
|
|
279
|
+
putString("zoneNumber", addr.zoneNumber)
|
|
280
|
+
putString("zipCode", addr.zipCode)
|
|
281
|
+
}
|
|
282
|
+
} ?: listOf(),
|
|
283
|
+
)
|
|
284
|
+
},
|
|
285
|
+
)
|
|
286
|
+
},
|
|
287
|
+
)
|
|
216
288
|
}
|
|
217
289
|
}
|
|
218
290
|
}
|
|
219
291
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
putString("tag", term.tag)
|
|
234
|
-
putD("agreedAt", term.agreedAt?.unix?.toDouble())
|
|
235
|
-
putBoolean("agreed", term.agreed)
|
|
236
|
-
putBoolean("required", term.required)
|
|
237
|
-
putBoolean("revocable", term.revocable)
|
|
238
|
-
}
|
|
239
|
-
} ?: listOf(),
|
|
240
|
-
),
|
|
241
|
-
)
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
@ReactMethod
|
|
247
|
-
override fun shippingAddresses(promise: Promise) =
|
|
248
|
-
onMain {
|
|
249
|
-
UserApiClient.instance.shippingAddresses { addrs, error ->
|
|
250
|
-
if (error != null) {
|
|
251
|
-
promise.rejectWith(error)
|
|
252
|
-
} else if (addrs == null) {
|
|
253
|
-
promise.rejectWith(RNCKakaoResponseNotFoundException("shippingAddresses"))
|
|
254
|
-
} else {
|
|
255
|
-
promise.resolve(
|
|
256
|
-
argMap().apply {
|
|
257
|
-
putD("userId", addrs.userId?.toDouble())
|
|
258
|
-
putB("needsAgreement", addrs.needsAgreement)
|
|
259
|
-
putArray(
|
|
260
|
-
"shippingAddresses",
|
|
261
|
-
argArr().apply {
|
|
262
|
-
pushMapList(
|
|
263
|
-
addrs.shippingAddresses?.map { addr ->
|
|
264
|
-
argMap().apply {
|
|
265
|
-
putDouble("id", addr.id.toDouble())
|
|
266
|
-
putString("name", addr.name)
|
|
267
|
-
putBoolean("isDefault", addr.isDefault)
|
|
268
|
-
putD("updatedAt", addr.updatedAt?.unix?.toDouble())
|
|
269
|
-
putString("type", addr.type?.name)
|
|
270
|
-
putString("baseAddress", addr.baseAddress)
|
|
271
|
-
putString("detailAddress", addr.detailAddress)
|
|
272
|
-
putString("receiverName", addr.receiverName)
|
|
273
|
-
putString("receiverPhoneNumber1", addr.receiverPhoneNumber1)
|
|
274
|
-
putString("receiverPhoneNumber2", addr.receiverPhoneNumber2)
|
|
275
|
-
putString("zoneNumber", addr.zoneNumber)
|
|
276
|
-
putString("zipCode", addr.zipCode)
|
|
277
|
-
}
|
|
278
|
-
} ?: listOf(),
|
|
279
|
-
)
|
|
280
|
-
},
|
|
281
|
-
)
|
|
282
|
-
},
|
|
283
|
-
)
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
@ReactMethod
|
|
289
|
-
override fun me(promise: Promise) =
|
|
290
|
-
onMain {
|
|
291
|
-
UserApiClient.instance.me { user, error ->
|
|
292
|
-
if (error != null) {
|
|
293
|
-
promise.rejectWith(error)
|
|
294
|
-
} else if (user == null) {
|
|
295
|
-
promise.rejectWith(RNCKakaoResponseNotFoundException("user"))
|
|
296
|
-
} else {
|
|
297
|
-
promise.resolve(
|
|
298
|
-
argMap().apply {
|
|
299
|
-
putD("id", user.id?.toDouble())
|
|
300
|
-
putString("name", user.kakaoAccount?.name)
|
|
292
|
+
@ReactMethod
|
|
293
|
+
override fun me(promise: Promise) =
|
|
294
|
+
onMain {
|
|
295
|
+
UserApiClient.instance.me { user, error ->
|
|
296
|
+
if (error != null) {
|
|
297
|
+
promise.rejectWith(error)
|
|
298
|
+
} else if (user == null) {
|
|
299
|
+
promise.rejectWith(RNCKakaoResponseNotFoundException("user"))
|
|
300
|
+
} else {
|
|
301
|
+
promise.resolve(
|
|
302
|
+
argMap().apply {
|
|
303
|
+
putD("id", user.id?.toDouble())
|
|
304
|
+
putString("name", user.kakaoAccount?.name)
|
|
301
305
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
306
|
+
putString("email", user.kakaoAccount?.email)
|
|
307
|
+
putString("nickname", user.kakaoAccount?.profile?.nickname)
|
|
308
|
+
putString("profileImageUrl", user.kakaoAccount?.profile?.profileImageUrl)
|
|
309
|
+
putString("thumbnailImageUrl", user.kakaoAccount?.profile?.thumbnailImageUrl)
|
|
310
|
+
putString("phoneNumber", user.kakaoAccount?.phoneNumber)
|
|
311
|
+
putString("ageRange", user.kakaoAccount?.ageRange?.name)
|
|
312
|
+
putString("birthday", user.kakaoAccount?.birthday)
|
|
313
|
+
putString("birthdayType", user.kakaoAccount?.birthdayType?.name)
|
|
314
|
+
putString("birthyear", user.kakaoAccount?.birthyear)
|
|
315
|
+
putString("gender", user.kakaoAccount?.gender?.name)
|
|
316
|
+
putB("isEmailValid", user.kakaoAccount?.isEmailValid)
|
|
317
|
+
putB("isEmailVerified", user.kakaoAccount?.isEmailVerified)
|
|
318
|
+
putB("isKorean", user.kakaoAccount?.isKorean)
|
|
319
|
+
putB(
|
|
320
|
+
"ageRangeNeedsAgreement",
|
|
321
|
+
user.kakaoAccount?.ageRangeNeedsAgreement,
|
|
322
|
+
)
|
|
323
|
+
putB(
|
|
324
|
+
"birthdayNeedsAgreement",
|
|
325
|
+
user.kakaoAccount?.birthdayNeedsAgreement,
|
|
326
|
+
)
|
|
327
|
+
putB(
|
|
328
|
+
"birthyearNeedsAgreement",
|
|
329
|
+
user.kakaoAccount?.birthyearNeedsAgreement,
|
|
330
|
+
)
|
|
331
|
+
putB(
|
|
332
|
+
"emailNeedsAgreement",
|
|
333
|
+
user.kakaoAccount?.emailNeedsAgreement,
|
|
334
|
+
)
|
|
335
|
+
putB(
|
|
336
|
+
"genderNeedsAgreement",
|
|
337
|
+
user.kakaoAccount?.genderNeedsAgreement,
|
|
338
|
+
)
|
|
339
|
+
putB(
|
|
340
|
+
"isKoreanNeedsAgreement",
|
|
341
|
+
user.kakaoAccount?.isKoreanNeedsAgreement,
|
|
342
|
+
)
|
|
343
|
+
putB(
|
|
344
|
+
"phoneNumberNeedsAgreement",
|
|
345
|
+
user.kakaoAccount?.phoneNumberNeedsAgreement,
|
|
346
|
+
)
|
|
347
|
+
putB(
|
|
348
|
+
"profileNeedsAgreement",
|
|
349
|
+
user.kakaoAccount?.profileNeedsAgreement,
|
|
350
|
+
)
|
|
351
|
+
putB(
|
|
352
|
+
"ciNeedsAgreement",
|
|
353
|
+
user.kakaoAccount?.ciNeedsAgreement,
|
|
354
|
+
)
|
|
355
|
+
putB(
|
|
356
|
+
"nameNeedsAgreement",
|
|
357
|
+
user.kakaoAccount?.nameNeedsAgreement,
|
|
358
|
+
)
|
|
359
|
+
putB(
|
|
360
|
+
"profileImageNeedsAgreement",
|
|
361
|
+
user.kakaoAccount?.profileImageNeedsAgreement,
|
|
362
|
+
)
|
|
363
|
+
putB(
|
|
364
|
+
"profileNicknameNeedsAgreement",
|
|
365
|
+
user.kakaoAccount?.profileNicknameNeedsAgreement,
|
|
366
|
+
)
|
|
367
|
+
putB(
|
|
368
|
+
"legalBirthDateNeedsAgreement",
|
|
369
|
+
user.kakaoAccount?.legalBirthDateNeedsAgreement,
|
|
370
|
+
)
|
|
371
|
+
},
|
|
372
|
+
)
|
|
370
373
|
}
|
|
371
374
|
}
|
|
375
|
+
}
|
|
372
376
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}
|
|
377
|
+
@ReactMethod
|
|
378
|
+
override fun getAccessToken(promise: Promise) =
|
|
379
|
+
onMain {
|
|
380
|
+
UserApiClient.instance.accessTokenInfo { accessTokenInfo, error ->
|
|
381
|
+
if (error != null) {
|
|
382
|
+
promise.rejectWith(error)
|
|
383
|
+
} else if (accessTokenInfo == null) {
|
|
384
|
+
promise.rejectWith(RNCKakaoResponseNotFoundException("accessTokenInfo"))
|
|
385
|
+
} else {
|
|
386
|
+
promise.resolve(
|
|
387
|
+
argMap().apply {
|
|
388
|
+
putL("id", accessTokenInfo.id)
|
|
389
|
+
putL("expiresIn", accessTokenInfo.expiresIn)
|
|
390
|
+
putI("appID", accessTokenInfo.appId)
|
|
391
|
+
},
|
|
392
|
+
)
|
|
390
393
|
}
|
|
391
394
|
}
|
|
392
|
-
|
|
393
|
-
companion object {
|
|
394
|
-
const val NAME = "RNCKakaoUser"
|
|
395
395
|
}
|
|
396
|
+
|
|
397
|
+
companion object {
|
|
398
|
+
const val NAME = "RNCKakaoUser"
|
|
396
399
|
}
|
|
400
|
+
}
|
|
@@ -10,16 +10,15 @@ class RNCKakaoUserPackage : TurboReactPackage() {
|
|
|
10
10
|
override fun getModule(
|
|
11
11
|
name: String,
|
|
12
12
|
reactContext: ReactApplicationContext,
|
|
13
|
-
): NativeModule?
|
|
14
|
-
|
|
13
|
+
): NativeModule? =
|
|
14
|
+
if (name == RNCKakaoUserModule.NAME) {
|
|
15
15
|
RNCKakaoUserModule(reactContext)
|
|
16
16
|
} else {
|
|
17
17
|
null
|
|
18
18
|
}
|
|
19
|
-
}
|
|
20
19
|
|
|
21
|
-
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider
|
|
22
|
-
|
|
20
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider =
|
|
21
|
+
ReactModuleInfoProvider {
|
|
23
22
|
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
24
23
|
val isTurboModule: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
|
|
25
24
|
moduleInfos[RNCKakaoUserModule.NAME] =
|
|
@@ -33,5 +32,4 @@ class RNCKakaoUserPackage : TurboReactPackage() {
|
|
|
33
32
|
)
|
|
34
33
|
moduleInfos
|
|
35
34
|
}
|
|
36
|
-
}
|
|
37
35
|
}
|
|
@@ -2,5 +2,6 @@ package net.mjstudio.rnkakao.user
|
|
|
2
2
|
|
|
3
3
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
4
|
|
|
5
|
-
abstract class KakaoUserSpec internal constructor(
|
|
6
|
-
|
|
5
|
+
abstract class KakaoUserSpec internal constructor(
|
|
6
|
+
context: ReactApplicationContext,
|
|
7
|
+
) : NativeKakaoUserSpec(context)
|
|
@@ -5,39 +5,40 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
5
5
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
6
6
|
import com.facebook.react.bridge.ReadableArray
|
|
7
7
|
|
|
8
|
-
abstract class KakaoUserSpec internal constructor(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
abstract class KakaoUserSpec internal constructor(
|
|
9
|
+
context: ReactApplicationContext,
|
|
10
|
+
) : ReactContextBaseJavaModule(context) {
|
|
11
|
+
abstract fun login(
|
|
12
|
+
serviceTerms: ReadableArray?,
|
|
13
|
+
prompts: ReadableArray?,
|
|
14
|
+
useKakaoAccountLogin: Boolean,
|
|
15
|
+
scopes: ReadableArray?,
|
|
16
|
+
promise: Promise,
|
|
17
|
+
)
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
abstract fun isKakaoTalkLoginAvailable(promise: Promise)
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
abstract fun logout(promise: Promise)
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
abstract fun unlink(promise: Promise)
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
abstract fun isLogined(promise: Promise)
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
abstract fun scopes(
|
|
28
|
+
scopes: ReadableArray?,
|
|
29
|
+
promise: Promise,
|
|
30
|
+
)
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
abstract fun revokeScopes(
|
|
33
|
+
scopes: ReadableArray,
|
|
34
|
+
promise: Promise,
|
|
35
|
+
)
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
abstract fun serviceTerms(promise: Promise)
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
abstract fun shippingAddresses(promise: Promise)
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
abstract fun me(promise: Promise)
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
abstract fun getAccessToken(promise: Promise)
|
|
44
|
+
}
|
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.2.
|
|
4
|
+
"version": "2.2.6",
|
|
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": "2.2.
|
|
65
|
+
"@react-native-kakao/core": "2.2.6",
|
|
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": "2.2.
|
|
77
|
+
"@react-native-kakao/core": "2.2.6",
|
|
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": "
|
|
113
|
+
"gitHead": "9cf3261d166cf28f784a168a56f10301a6324f06",
|
|
114
114
|
"dependencies": {
|
|
115
115
|
"@mj-studio/js-util": "1.1.3"
|
|
116
116
|
}
|