@react-native-kakao/user 1.0.4 → 1.2.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.
@@ -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
- KakaoUserSpec(context) {
32
-
31
+ KakaoUserSpec(context) {
33
32
  override fun getName(): String {
34
- return NAME
33
+ return NAME
35
34
  }
36
35
 
37
36
  @ReactMethod
38
37
  override fun login(
39
- serviceTerms: ReadableArray?,
40
- prompts: ReadableArray?,
41
- useKakaoAccountLogin: Boolean,
42
- scopes: ReadableArray?,
43
- promise: Promise
38
+ serviceTerms: ReadableArray?,
39
+ prompts: ReadableArray?,
40
+ useKakaoAccountLogin: Boolean,
41
+ scopes: ReadableArray?,
42
+ promise: Promise,
44
43
  ) = onMain {
45
- val context = currentActivity
46
- if (context == null) {
47
- promise.rejectWith(ActivityNotFoundException())
48
- return@onMain
49
- }
50
- val callback: (OAuthToken?, Throwable?) -> Unit = { token, error ->
51
- if (error != null) {
52
- promise.rejectWith(error)
53
- } else if (token == null) {
54
- promise.rejectWith("token not found")
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
- UserApiClient.instance.loginWithKakaoAccount(
96
- context,
97
- prompts = prompts?.filterIsInstance<String>()?.mapNotNull {
98
- when (it) {
99
- "Login" -> LOGIN
100
- "Create" -> CREATE
101
- "Cert" -> CERT
102
- "UnifyDaum" -> UNIFY_DAUM
103
- "SelectAccount" -> SELECT_ACCOUNT
104
- else -> null
105
- }
106
- }?.ifEmpty { null },
107
- serviceTerms = serviceTerms?.filterIsInstance<String>()?.ifEmpty { null },
108
- callback = callback
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) = onMain {
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) = onMain {
129
+ override fun logout(promise: Promise) =
130
+ onMain {
120
131
  UserApiClient.instance.logout {
121
- if (it != null) {
122
- promise.rejectWith(it)
123
- } else {
124
- promise.resolve(42)
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) = onMain {
141
+ override fun unlink(promise: Promise) =
142
+ onMain {
131
143
  UserApiClient.instance.unlink {
132
- if (it != null) {
133
- promise.rejectWith(it)
134
- } else {
135
- promise.resolve(42)
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) = onMain {
153
+ override fun isLogined(promise: Promise) =
154
+ onMain {
142
155
  if (AuthApiClient.instance.hasToken()) {
143
- UserApiClient.instance.accessTokenInfo { _, error ->
144
- if (error != null) {
145
- if (error is KakaoSdkError && error.isInvalidTokenError()) {
146
- promise.resolve(false)
147
- } else {
148
- promise.rejectWith(error)
149
- }
150
- } else {
151
- promise.resolve(true)
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
- promise.resolve(false)
168
+ promise.resolve(false)
156
169
  }
157
- }
170
+ }
158
171
 
159
172
  @ReactMethod
160
- override fun scopes(scopes: ReadableArray?, promise: Promise) = onMain {
161
- UserApiClient.instance.scopes { scopeInfo, error ->
162
- if (error != null) {
163
- promise.rejectWith(error)
164
- } else if (scopeInfo?.scopes == null) {
165
- promise.rejectWith("scopes not found")
166
- } else {
167
- promise.resolve(argArr().also { arr ->
168
- scopeInfo.scopes!!.forEach { scope ->
169
- arr.pushMap(argMap().also { map ->
170
- map.putString("id", scope.id)
171
- map.putString("displayName", scope.displayName)
172
- map.putString("type", scope.type.name)
173
- map.putBoolean("using", scope.using)
174
- map.putBooleanIfNotNull("delegated", scope.delegated)
175
- map.putBoolean("agreed", scope.agreed)
176
- map.putBooleanIfNotNull("revocable", scope.revocable)
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(scopes: ReadableArray, promise: Promise) = onMain {
186
- UserApiClient.instance.revokeScopes(
187
- scopes = scopes.filterIsInstance<String>()
188
- ) { scopeInfo, error ->
189
- if (error != null) {
190
- promise.rejectWith(error)
191
- } else if (scopeInfo == null) {
192
- promise.rejectWith("scopeInfo not found")
193
- } else {
194
- promise.resolve(42)
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) = onMain {
223
+ override fun serviceTerms(promise: Promise) =
224
+ onMain {
201
225
  UserApiClient.instance.serviceTerms { serviceTerms, error ->
202
- if (error != null) {
203
- promise.rejectWith(error)
204
- } else if (serviceTerms?.serviceTerms == null) {
205
- promise.rejectWith("serviceTerms not found")
206
- } else {
207
- promise.resolve(argMap().apply {
208
- putArray("allowedServiceTerms", argArr().apply {
209
- serviceTerms.serviceTerms?.forEach { term ->
210
- pushMap(argMap().apply {
211
- putString("tag", term.tag)
212
- putDoubleIfNotNull("agreedAt", term.agreedAt?.time?.toDouble())
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) = onMain {
253
+ override fun shippingAddresses(promise: Promise) =
254
+ onMain {
223
255
  UserApiClient.instance.shippingAddresses { addrs, error ->
224
- if (error != null) {
225
- promise.rejectWith(error)
226
- } else if (addrs == null) {
227
- promise.rejectWith("shipping addresses not found")
228
- } else {
229
- promise.resolve(argMap().apply {
230
- putIntIfNotNull("userId", addrs.userId?.toInt())
231
- putBooleanIfNotNull("needsAgreement", addrs.needsAgreement)
232
- putArray("shippingAddresses", argArr().apply {
233
- pushMapList(addrs.shippingAddresses?.map { addr ->
234
- argMap().apply {
235
- putInt("id", addr.id.toInt())
236
- putString("name", addr.name)
237
- putBoolean("isDefault", addr.isDefault)
238
- putDoubleIfNotNull("updatedAt", addr.updatedAt?.time?.toDouble())
239
- putString("type", addr.type?.name)
240
- putString("baseAddress", addr.baseAddress)
241
- putString("detailAddress", addr.detailAddress)
242
- putString("receiverName", addr.receiverName)
243
- putString("receiverPhoneNumber1", addr.receiverPhoneNumber1)
244
- putString("receiverPhoneNumber2", addr.receiverPhoneNumber2)
245
- putString("zoneNumber", addr.zoneNumber)
246
- putString("zipCode", addr.zipCode)
247
- }
248
- } ?: listOf())
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) = onMain {
295
+ override fun me(promise: Promise) =
296
+ onMain {
257
297
  UserApiClient.instance.me { user, error ->
258
- if (error != null) {
259
- promise.rejectWith(error)
260
- } else if (user == null) {
261
- promise.rejectWith("user not found")
262
- } else {
263
- promise.resolve(argMap().apply {
264
- putIntIfNotNull("id", user.id?.toInt())
265
- putString("name", user.kakaoAccount?.name)
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
- putString("email", user.kakaoAccount?.email)
268
- putString("nickname", user.kakaoAccount?.profile?.nickname)
269
- putString("profileImageUrl", user.kakaoAccount?.profile?.profileImageUrl)
270
- putString("thumbnailImageUrl", user.kakaoAccount?.profile?.thumbnailImageUrl)
271
- putString("phoneNumber", user.kakaoAccount?.phoneNumber)
272
- putString("ageRange", user.kakaoAccount?.ageRange?.name)
273
- putString("birthday", user.kakaoAccount?.birthday)
274
- putString("birthdayType", user.kakaoAccount?.birthdayType?.name)
275
- putString("birthyear", user.kakaoAccount?.birthyear)
276
- putString("gender", user.kakaoAccount?.gender?.name)
277
- putBooleanIfNotNull("isEmailValid", user.kakaoAccount?.isEmailValid)
278
- putBooleanIfNotNull("isEmailVerified", user.kakaoAccount?.isEmailVerified)
279
- putBooleanIfNotNull("isKorean", user.kakaoAccount?.isKorean)
280
- putBooleanIfNotNull(
281
- "ageRangeNeedsAgreement", user.kakaoAccount?.ageRangeNeedsAgreement
282
- )
283
- putBooleanIfNotNull(
284
- "birthdayNeedsAgreement", user.kakaoAccount?.birthdayNeedsAgreement
285
- )
286
- putBooleanIfNotNull(
287
- "birthyearNeedsAgreement", user.kakaoAccount?.birthyearNeedsAgreement
288
- )
289
- putBooleanIfNotNull(
290
- "emailNeedsAgreement", user.kakaoAccount?.emailNeedsAgreement
291
- )
292
- putBooleanIfNotNull(
293
- "genderNeedsAgreement", user.kakaoAccount?.genderNeedsAgreement
294
- )
295
- putBooleanIfNotNull(
296
- "isKoreanNeedsAgreement", user.kakaoAccount?.isKoreanNeedsAgreement
297
- )
298
- putBooleanIfNotNull(
299
- "phoneNumberNeedsAgreement", user.kakaoAccount?.phoneNumberNeedsAgreement
300
- )
301
- putBooleanIfNotNull(
302
- "profileNeedsAgreement", user.kakaoAccount?.profileNeedsAgreement
303
- )
304
- putBooleanIfNotNull(
305
- "ciNeedsAgreement", user.kakaoAccount?.ciNeedsAgreement
306
- )
307
- putBooleanIfNotNull(
308
- "nameNeedsAgreement", user.kakaoAccount?.nameNeedsAgreement
309
- )
310
- putBooleanIfNotNull(
311
- "profileImageNeedsAgreement", user.kakaoAccount?.profileImageNeedsAgreement
312
- )
313
- putBooleanIfNotNull(
314
- "profileNicknameNeedsAgreement",
315
- user.kakaoAccount?.profileNicknameNeedsAgreement
316
- )
317
- putBooleanIfNotNull(
318
- "legalBirthDateNeedsAgreement",
319
- user.kakaoAccount?.legalBirthDateNeedsAgreement
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
- const val NAME = "RNCKakaoUser"
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
- override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
11
- return if (name == RNCKakaoUserModule.NAME) {
12
- RNCKakaoUserModule(reactContext)
13
- } else {
14
- null
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
- override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
19
- return ReactModuleInfoProvider {
20
- val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
21
- val isTurboModule: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
22
- moduleInfos[RNCKakaoUserModule.NAME] = ReactModuleInfo(
23
- RNCKakaoUserModule.NAME,
24
- RNCKakaoUserModule.NAME,
25
- false, // canOverrideExistingModule
26
- false, // needsEagerInit
27
- true, // hasConstants
28
- false, // isCxxModule
29
- isTurboModule // isTurboModule
30
- )
31
- moduleInfos
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
- NativeKakaoUserSpec(context)
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
- ReactContextBaseJavaModule(context) {
9
+ ReactContextBaseJavaModule(context) {
10
10
  abstract fun login(
11
- serviceTerms: ReadableArray?,
12
- prompts: ReadableArray?,
13
- useKakaoAccountLogin: Boolean,
14
- scopes: ReadableArray?,
15
- promise: Promise
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(scopes: ReadableArray?, promise: Promise)
26
+ abstract fun scopes(
27
+ scopes: ReadableArray?,
28
+ promise: Promise,
29
+ )
27
30
 
28
- abstract fun revokeScopes(scopes: ReadableArray, promise: Promise)
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",
4
+ "version": "1.2.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.4",
65
+ "@react-native-kakao/core": "^1.2.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.4",
77
+ "@react-native-kakao/core": "^1.2.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": "e50a806a701e689981bde39e4429a17a923490da",
113
+ "gitHead": "f196422f4ce9641b65879f26b6ca0ccbbb7d8640",
114
114
  "dependencies": {
115
115
  "@mj-studio/js-util": "^1.0.34"
116
116
  }