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