@react-native-kakao/user 1.0.3 → 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 +305 -251
- 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/ios/RNCKakaoUserManager.swift +192 -170
- package/package.json +4 -4
|
@@ -18,311 +18,365 @@ import net.mjstudio.rnkakao.core.util.RNCKakaoUtil
|
|
|
18
18
|
import net.mjstudio.rnkakao.core.util.argArr
|
|
19
19
|
import net.mjstudio.rnkakao.core.util.argMap
|
|
20
20
|
import net.mjstudio.rnkakao.core.util.filterIsInstance
|
|
21
|
+
import net.mjstudio.rnkakao.core.util.onMain
|
|
21
22
|
import net.mjstudio.rnkakao.core.util.pushMapList
|
|
22
23
|
import net.mjstudio.rnkakao.core.util.pushStringList
|
|
23
24
|
import net.mjstudio.rnkakao.core.util.putBooleanIfNotNull
|
|
24
25
|
import net.mjstudio.rnkakao.core.util.putDoubleIfNotNull
|
|
25
26
|
import net.mjstudio.rnkakao.core.util.putIntIfNotNull
|
|
26
27
|
import net.mjstudio.rnkakao.core.util.rejectWith
|
|
27
|
-
import java.util
|
|
28
|
+
import java.util.Date
|
|
28
29
|
|
|
29
30
|
class RNCKakaoUserModule internal constructor(context: ReactApplicationContext) :
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
KakaoUserSpec(context) {
|
|
32
32
|
override fun getName(): String {
|
|
33
|
-
|
|
33
|
+
return NAME
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
@ReactMethod
|
|
37
37
|
override fun login(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} else {
|
|
55
|
-
promise.resolve(argMap().apply {
|
|
56
|
-
putString("accessToken", token.accessToken)
|
|
57
|
-
putString("refreshToken", token.refreshToken)
|
|
58
|
-
putString("tokenType", null)
|
|
59
|
-
putString("idToken", token.idToken)
|
|
60
|
-
putDouble(
|
|
61
|
-
"accessTokenExpiresAt", token.accessTokenExpiresAt.time.toDouble()
|
|
62
|
-
)
|
|
63
|
-
putDouble(
|
|
64
|
-
"refreshTokenExpiresAt", token.refreshTokenExpiresAt.time.toDouble()
|
|
65
|
-
)
|
|
66
|
-
putDouble(
|
|
67
|
-
"accessTokenExpiresIn",
|
|
68
|
-
RNCKakaoUtil.diffSec(token.accessTokenExpiresAt, Date()).toDouble()
|
|
69
|
-
)
|
|
70
|
-
putDouble(
|
|
71
|
-
"refreshTokenExpiresIn",
|
|
72
|
-
RNCKakaoUtil.diffSec(token.refreshTokenExpiresAt, Date()).toDouble()
|
|
73
|
-
)
|
|
74
|
-
putArray("scopes", argArr().apply {
|
|
75
|
-
pushStringList(token.scopes ?: listOf())
|
|
76
|
-
})
|
|
77
|
-
})
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (scopes?.filterIsInstance<String>()?.isEmpty() == false) {
|
|
82
|
-
UserApiClient.instance.loginWithNewScopes(
|
|
83
|
-
context, scopes = scopes.filterIsInstance<String>(), callback = callback
|
|
84
|
-
)
|
|
85
|
-
} else if (UserApiClient.instance.isKakaoTalkLoginAvailable(context) && !useKakaoAccountLogin && scopes?.filterIsInstance<String>()
|
|
86
|
-
?.isEmpty() == true
|
|
87
|
-
) {
|
|
88
|
-
UserApiClient.instance.loginWithKakaoTalk(
|
|
89
|
-
context,
|
|
90
|
-
serviceTerms = serviceTerms?.filterIsInstance<String>()?.ifEmpty { null },
|
|
91
|
-
callback = callback
|
|
92
|
-
)
|
|
38
|
+
serviceTerms: ReadableArray?,
|
|
39
|
+
prompts: ReadableArray?,
|
|
40
|
+
useKakaoAccountLogin: Boolean,
|
|
41
|
+
scopes: ReadableArray?,
|
|
42
|
+
promise: Promise,
|
|
43
|
+
) = onMain {
|
|
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")
|
|
93
54
|
} else {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
+
)
|
|
109
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
|
+
}
|
|
110
120
|
}
|
|
111
121
|
|
|
112
122
|
@ReactMethod
|
|
113
|
-
override fun isKakaoTalkLoginAvailable(promise: Promise)
|
|
123
|
+
override fun isKakaoTalkLoginAvailable(promise: Promise) =
|
|
124
|
+
onMain {
|
|
114
125
|
promise.resolve(UserApiClient.instance.isKakaoTalkLoginAvailable(reactApplicationContext))
|
|
115
|
-
|
|
126
|
+
}
|
|
116
127
|
|
|
117
128
|
@ReactMethod
|
|
118
|
-
override fun logout(promise: Promise)
|
|
129
|
+
override fun logout(promise: Promise) =
|
|
130
|
+
onMain {
|
|
119
131
|
UserApiClient.instance.logout {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
132
|
+
if (it != null) {
|
|
133
|
+
promise.rejectWith(it)
|
|
134
|
+
} else {
|
|
135
|
+
promise.resolve(42)
|
|
136
|
+
}
|
|
125
137
|
}
|
|
126
|
-
|
|
138
|
+
}
|
|
127
139
|
|
|
128
140
|
@ReactMethod
|
|
129
|
-
override fun unlink(promise: Promise)
|
|
141
|
+
override fun unlink(promise: Promise) =
|
|
142
|
+
onMain {
|
|
130
143
|
UserApiClient.instance.unlink {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
144
|
+
if (it != null) {
|
|
145
|
+
promise.rejectWith(it)
|
|
146
|
+
} else {
|
|
147
|
+
promise.resolve(42)
|
|
148
|
+
}
|
|
136
149
|
}
|
|
137
|
-
|
|
150
|
+
}
|
|
138
151
|
|
|
139
152
|
@ReactMethod
|
|
140
|
-
override fun isLogined(promise: Promise)
|
|
153
|
+
override fun isLogined(promise: Promise) =
|
|
154
|
+
onMain {
|
|
141
155
|
if (AuthApiClient.instance.hasToken()) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
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)
|
|
152
165
|
}
|
|
166
|
+
}
|
|
153
167
|
} else {
|
|
154
|
-
|
|
168
|
+
promise.resolve(false)
|
|
155
169
|
}
|
|
156
|
-
|
|
170
|
+
}
|
|
157
171
|
|
|
158
172
|
@ReactMethod
|
|
159
|
-
override fun scopes(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
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
|
+
)
|
|
180
200
|
}
|
|
201
|
+
}
|
|
181
202
|
}
|
|
182
203
|
|
|
183
204
|
@ReactMethod
|
|
184
|
-
override fun revokeScopes(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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)
|
|
195
218
|
}
|
|
219
|
+
}
|
|
196
220
|
}
|
|
197
221
|
|
|
198
222
|
@ReactMethod
|
|
199
|
-
override fun serviceTerms(promise: Promise)
|
|
223
|
+
override fun serviceTerms(promise: Promise) =
|
|
224
|
+
onMain {
|
|
200
225
|
UserApiClient.instance.serviceTerms { serviceTerms, error ->
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
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
|
+
}
|
|
217
249
|
}
|
|
218
|
-
|
|
250
|
+
}
|
|
219
251
|
|
|
220
252
|
@ReactMethod
|
|
221
|
-
override fun shippingAddresses(promise: Promise)
|
|
253
|
+
override fun shippingAddresses(promise: Promise) =
|
|
254
|
+
onMain {
|
|
222
255
|
UserApiClient.instance.shippingAddresses { addrs, error ->
|
|
223
|
-
|
|
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
|
-
|
|
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
|
+
}
|
|
251
291
|
}
|
|
252
|
-
|
|
292
|
+
}
|
|
253
293
|
|
|
254
294
|
@ReactMethod
|
|
255
|
-
override fun me(promise: Promise)
|
|
295
|
+
override fun me(promise: Promise) =
|
|
296
|
+
onMain {
|
|
256
297
|
UserApiClient.instance.me { user, error ->
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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)
|
|
265
307
|
|
|
266
|
-
|
|
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
|
-
|
|
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
|
+
}
|
|
322
376
|
}
|
|
323
|
-
|
|
377
|
+
}
|
|
324
378
|
|
|
325
379
|
companion object {
|
|
326
|
-
|
|
380
|
+
const val NAME = "RNCKakaoUser"
|
|
327
381
|
}
|
|
328
|
-
}
|
|
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
|
+
}
|
|
@@ -22,7 +22,9 @@ import RNCKakaoCore
|
|
|
22
22
|
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
23
23
|
reject: @escaping RCTPromiseRejectBlock
|
|
24
24
|
) {
|
|
25
|
-
|
|
25
|
+
onMain {
|
|
26
|
+
resolve(UserApi.isKakaoTalkLoginAvailable())
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
@objc public func login(
|
|
@@ -33,49 +35,51 @@ import RNCKakaoCore
|
|
|
33
35
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
34
36
|
reject: @escaping RCTPromiseRejectBlock
|
|
35
37
|
) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
onMain { [self] in
|
|
39
|
+
guard let _ = try? KakaoSDK.shared.appKey() else {
|
|
40
|
+
RNCKakaoUtil.reject(reject, "KakaoSdk is not initialized")
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
let callback = { (token: OAuthToken?, error: Error?) in
|
|
44
|
+
if let error {
|
|
45
|
+
RNCKakaoUtil.reject(reject, error)
|
|
46
|
+
} else if let token {
|
|
47
|
+
resolve([
|
|
48
|
+
"accessToken": token.accessToken,
|
|
49
|
+
"refreshToken": token.refreshToken,
|
|
50
|
+
"tokenType": token.tokenType,
|
|
51
|
+
"idToken": token.idToken as Any,
|
|
52
|
+
"accessTokenExpiresAt": token.expiredAt.timeIntervalSince1970,
|
|
53
|
+
"refreshTokenExpiresAt": token.refreshTokenExpiredAt.timeIntervalSince1970,
|
|
54
|
+
"accessTokenExpiresIn": token.expiresIn,
|
|
55
|
+
"refreshTokenExpiresIn": token.refreshTokenExpiresIn,
|
|
56
|
+
"scopes": token.scopes ?? []
|
|
57
|
+
])
|
|
58
|
+
} else {
|
|
59
|
+
RNCKakaoUtil.reject(reject, "token not found")
|
|
60
|
+
}
|
|
57
61
|
}
|
|
58
|
-
}
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
if !scopes.isEmpty {
|
|
64
|
+
UserApi.shared.loginWithKakaoAccount(scopes: scopes, completion: callback)
|
|
65
|
+
} else if UserApi.isKakaoTalkLoginAvailable(), !useKakaoAccountLogin {
|
|
66
|
+
UserApi.shared
|
|
67
|
+
.loginWithKakaoTalk(serviceTerms: emptyArrayToNil(serviceTerms), completion: callback)
|
|
68
|
+
} else {
|
|
69
|
+
var _prompts: [Prompt] = []
|
|
70
|
+
prompts.forEach { p in
|
|
71
|
+
if p == "Login" { _prompts.append(.Login) }
|
|
72
|
+
if p == "Cert" { _prompts.append(.Cert) }
|
|
73
|
+
if p == "Create" { _prompts.append(.Create) }
|
|
74
|
+
if p == "UnifyDaum" { _prompts.append(.UnifyDaum) }
|
|
75
|
+
}
|
|
76
|
+
UserApi.shared
|
|
77
|
+
.loginWithKakaoAccount(
|
|
78
|
+
prompts: emptyArrayToNil(_prompts),
|
|
79
|
+
serviceTerms: emptyArrayToNil(serviceTerms),
|
|
80
|
+
completion: callback
|
|
81
|
+
)
|
|
72
82
|
}
|
|
73
|
-
UserApi.shared
|
|
74
|
-
.loginWithKakaoAccount(
|
|
75
|
-
prompts: emptyArrayToNil(_prompts),
|
|
76
|
-
serviceTerms: emptyArrayToNil(serviceTerms),
|
|
77
|
-
completion: callback
|
|
78
|
-
)
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
85
|
|
|
@@ -83,11 +87,13 @@ import RNCKakaoCore
|
|
|
83
87
|
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
84
88
|
reject: @escaping RCTPromiseRejectBlock
|
|
85
89
|
) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
onMain {
|
|
91
|
+
UserApi.shared.logout { error in
|
|
92
|
+
if let error {
|
|
93
|
+
RNCKakaoUtil.reject(reject, error)
|
|
94
|
+
} else {
|
|
95
|
+
resolve(42)
|
|
96
|
+
}
|
|
91
97
|
}
|
|
92
98
|
}
|
|
93
99
|
}
|
|
@@ -96,11 +102,13 @@ import RNCKakaoCore
|
|
|
96
102
|
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
97
103
|
reject: @escaping RCTPromiseRejectBlock
|
|
98
104
|
) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
onMain {
|
|
106
|
+
UserApi.shared.unlink { error in
|
|
107
|
+
if let error {
|
|
108
|
+
RNCKakaoUtil.reject(reject, error)
|
|
109
|
+
} else {
|
|
110
|
+
resolve(nil)
|
|
111
|
+
}
|
|
104
112
|
}
|
|
105
113
|
}
|
|
106
114
|
}
|
|
@@ -109,20 +117,22 @@ import RNCKakaoCore
|
|
|
109
117
|
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
110
118
|
reject: @escaping RCTPromiseRejectBlock
|
|
111
119
|
) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if let
|
|
116
|
-
|
|
120
|
+
onMain {
|
|
121
|
+
if AuthApi.hasToken() {
|
|
122
|
+
UserApi.shared.accessTokenInfo { _, error in
|
|
123
|
+
if let error {
|
|
124
|
+
if let sdkError = error as? SdkError, sdkError.isInvalidTokenError() == true {
|
|
125
|
+
resolve(false)
|
|
126
|
+
} else {
|
|
127
|
+
RNCKakaoUtil.reject(reject, error)
|
|
128
|
+
}
|
|
117
129
|
} else {
|
|
118
|
-
|
|
130
|
+
resolve(true)
|
|
119
131
|
}
|
|
120
|
-
} else {
|
|
121
|
-
resolve(true)
|
|
122
132
|
}
|
|
133
|
+
} else {
|
|
134
|
+
resolve(false)
|
|
123
135
|
}
|
|
124
|
-
} else {
|
|
125
|
-
resolve(false)
|
|
126
136
|
}
|
|
127
137
|
}
|
|
128
138
|
|
|
@@ -131,23 +141,25 @@ import RNCKakaoCore
|
|
|
131
141
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
132
142
|
reject: @escaping RCTPromiseRejectBlock
|
|
133
143
|
) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
144
|
+
onMain { [self] in
|
|
145
|
+
UserApi.shared.scopes(scopes: emptyArrayToNil(scopes)) { scopeInfo, error in
|
|
146
|
+
if let error {
|
|
147
|
+
RNCKakaoUtil.reject(reject, error)
|
|
148
|
+
} else if let scopes = scopeInfo?.scopes {
|
|
149
|
+
resolve(scopes.map { s in
|
|
150
|
+
[
|
|
151
|
+
"id": s.id,
|
|
152
|
+
"displayName": s.displayName,
|
|
153
|
+
"type": s.type.rawValue,
|
|
154
|
+
"using": s.using,
|
|
155
|
+
"delegated": s.delegated as Any,
|
|
156
|
+
"agreed": s.agreed,
|
|
157
|
+
"revocable": s.revocable as Any
|
|
158
|
+
]
|
|
159
|
+
})
|
|
160
|
+
} else {
|
|
161
|
+
RNCKakaoUtil.reject(reject, "scopes not found")
|
|
162
|
+
}
|
|
151
163
|
}
|
|
152
164
|
}
|
|
153
165
|
}
|
|
@@ -157,13 +169,15 @@ import RNCKakaoCore
|
|
|
157
169
|
resolve: @escaping RCTPromiseResolveBlock,
|
|
158
170
|
reject: @escaping RCTPromiseRejectBlock
|
|
159
171
|
) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
172
|
+
onMain {
|
|
173
|
+
UserApi.shared.revokeScopes(scopes: scopes) { info, error in
|
|
174
|
+
if let error {
|
|
175
|
+
RNCKakaoUtil.reject(reject, error)
|
|
176
|
+
} else if info != nil {
|
|
177
|
+
resolve(42)
|
|
178
|
+
} else {
|
|
179
|
+
RNCKakaoUtil.reject(reject, "scopeInfo not found")
|
|
180
|
+
}
|
|
167
181
|
}
|
|
168
182
|
}
|
|
169
183
|
}
|
|
@@ -172,29 +186,31 @@ import RNCKakaoCore
|
|
|
172
186
|
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
173
187
|
reject: @escaping RCTPromiseRejectBlock
|
|
174
188
|
) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
189
|
+
onMain {
|
|
190
|
+
UserApi.shared.serviceTerms { serviceTerms, error in
|
|
191
|
+
if let error {
|
|
192
|
+
RNCKakaoUtil.reject(reject, error)
|
|
193
|
+
} else if let serviceTerms {
|
|
194
|
+
resolve(
|
|
195
|
+
[
|
|
196
|
+
"allowedServiceTerms": serviceTerms.allowedServiceTerms?.map {
|
|
197
|
+
[
|
|
198
|
+
"tag": $0.tag,
|
|
199
|
+
"agreedAt": $0.agreedAt.timeIntervalSince1970
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
"appServiceTerms": serviceTerms.appServiceTerms?.map {
|
|
203
|
+
[
|
|
204
|
+
"tag": $0.tag,
|
|
205
|
+
"createdAt": $0.createdAt.timeIntervalSince1970,
|
|
206
|
+
"updatedAt": $0.updatedAt.timeIntervalSince1970
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
)
|
|
211
|
+
} else {
|
|
212
|
+
RNCKakaoUtil.reject(reject, "serviceTerms not found")
|
|
213
|
+
}
|
|
198
214
|
}
|
|
199
215
|
}
|
|
200
216
|
}
|
|
@@ -203,32 +219,34 @@ import RNCKakaoCore
|
|
|
203
219
|
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
204
220
|
reject: @escaping RCTPromiseRejectBlock
|
|
205
221
|
) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
222
|
+
onMain {
|
|
223
|
+
UserApi.shared.shippingAddresses { s, error in
|
|
224
|
+
if let error {
|
|
225
|
+
RNCKakaoUtil.reject(reject, error)
|
|
226
|
+
} else if let s {
|
|
227
|
+
resolve([
|
|
228
|
+
"userId": s.userId as Any,
|
|
229
|
+
"needsAgreement": s.needsAgreement as Any,
|
|
230
|
+
"shippingAddresses": s.shippingAddresses?.map {
|
|
231
|
+
[
|
|
232
|
+
"id": $0.id,
|
|
233
|
+
"name": $0.name as Any,
|
|
234
|
+
"isDefault": $0.isDefault,
|
|
235
|
+
"updatedAt": $0.updatedAt?.timeIntervalSince1970 as Any,
|
|
236
|
+
"type": $0.type?.rawValue as Any,
|
|
237
|
+
"baseAddress": $0.baseAddress as Any,
|
|
238
|
+
"detailAddress": $0.detailAddress as Any,
|
|
239
|
+
"receiverName": $0.receiverName as Any,
|
|
240
|
+
"receiverPhoneNumber1": $0.receiverPhoneNumber1 as Any,
|
|
241
|
+
"receiverPhoneNumber2": $0.receiverPhoneNumber2 as Any,
|
|
242
|
+
"zoneNumber": $0.zoneNumber as Any,
|
|
243
|
+
"zipCode": $0.zipCode as Any
|
|
244
|
+
]
|
|
245
|
+
} ?? []
|
|
246
|
+
])
|
|
247
|
+
} else {
|
|
248
|
+
RNCKakaoUtil.reject(reject, "shipping addresses not found")
|
|
249
|
+
}
|
|
232
250
|
}
|
|
233
251
|
}
|
|
234
252
|
}
|
|
@@ -237,42 +255,46 @@ import RNCKakaoCore
|
|
|
237
255
|
_ resolve: @escaping RCTPromiseResolveBlock,
|
|
238
256
|
reject: @escaping RCTPromiseRejectBlock
|
|
239
257
|
) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
258
|
+
onMain {
|
|
259
|
+
UserApi.shared.me { user, error in
|
|
260
|
+
if let error {
|
|
261
|
+
RNCKakaoUtil.reject(reject, error)
|
|
262
|
+
} else if let user {
|
|
263
|
+
resolve([
|
|
264
|
+
"id": user.id as Any,
|
|
265
|
+
"name": user.kakaoAccount?.name as Any,
|
|
266
|
+
"email": user.kakaoAccount?.email as Any,
|
|
267
|
+
"nickname": user.kakaoAccount?.profile?.nickname as Any,
|
|
268
|
+
"profileImageUrl": user.kakaoAccount?.profile?.profileImageUrl?.absoluteString as Any,
|
|
269
|
+
"thumbnailImageUrl": user.kakaoAccount?.profile?.thumbnailImageUrl?
|
|
270
|
+
.absoluteString as Any,
|
|
271
|
+
"phoneNumber": user.kakaoAccount?.phoneNumber as Any,
|
|
272
|
+
"ageRange": user.kakaoAccount?.ageRange?.rawValue as Any,
|
|
273
|
+
"birthday": user.kakaoAccount?.birthday as Any,
|
|
274
|
+
"birthdayType": user.kakaoAccount?.birthdayType as Any,
|
|
275
|
+
"birthyear": user.kakaoAccount?.birthyear as Any,
|
|
276
|
+
"gender": user.kakaoAccount?.gender?.rawValue as Any,
|
|
277
|
+
"isEmailValid": user.kakaoAccount?.isEmailValid as Any,
|
|
278
|
+
"isEmailVerified": user.kakaoAccount?.isEmailVerified as Any,
|
|
279
|
+
"isKorean": user.kakaoAccount?.isKorean as Any,
|
|
280
|
+
"ageRangeNeedsAgreement": user.kakaoAccount?.ageRangeNeedsAgreement as Any,
|
|
281
|
+
"birthdayNeedsAgreement": user.kakaoAccount?.birthdayNeedsAgreement as Any,
|
|
282
|
+
"birthyearNeedsAgreement": user.kakaoAccount?.birthyearNeedsAgreement as Any,
|
|
283
|
+
"emailNeedsAgreement": user.kakaoAccount?.emailNeedsAgreement as Any,
|
|
284
|
+
"genderNeedsAgreement": user.kakaoAccount?.genderNeedsAgreement as Any,
|
|
285
|
+
"isKoreanNeedsAgreement": user.kakaoAccount?.isKoreanNeedsAgreement as Any,
|
|
286
|
+
"phoneNumberNeedsAgreement": user.kakaoAccount?.phoneNumberNeedsAgreement as Any,
|
|
287
|
+
"profileNeedsAgreement": user.kakaoAccount?.profileNeedsAgreement as Any,
|
|
288
|
+
"ciNeedsAgreement": user.kakaoAccount?.ciNeedsAgreement as Any,
|
|
289
|
+
"nameNeedsAgreement": user.kakaoAccount?.nameNeedsAgreement as Any,
|
|
290
|
+
"profileImageNeedsAgreement": user.kakaoAccount?.profileImageNeedsAgreement as Any,
|
|
291
|
+
"profileNicknameNeedsAgreement": user.kakaoAccount?
|
|
292
|
+
.profileNicknameNeedsAgreement as Any,
|
|
293
|
+
"legalBirthDateNeedsAgreement": user.kakaoAccount?.legalBirthDateNeedsAgreement as Any
|
|
294
|
+
])
|
|
295
|
+
} else {
|
|
296
|
+
RNCKakaoUtil.reject(reject, "user not found")
|
|
297
|
+
}
|
|
276
298
|
}
|
|
277
299
|
}
|
|
278
300
|
}
|
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
|
}
|