Skip to content

Commit

Permalink
fix(user): fix integer overflows on kakao user ids
Browse files Browse the repository at this point in the history
  • Loading branch information
mym0404 committed Apr 30, 2024
1 parent 5b99864 commit 2658540
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import net.mjstudio.rnkakao.core.util.getIntElseNull
import net.mjstudio.rnkakao.core.util.onMain
import net.mjstudio.rnkakao.core.util.pushMapList
import net.mjstudio.rnkakao.core.util.putBooleanIfNotNull
import net.mjstudio.rnkakao.core.util.putDoubleIfNotNull
import net.mjstudio.rnkakao.core.util.putIntIfNotNull
import net.mjstudio.rnkakao.core.util.rejectWith

Expand Down Expand Up @@ -84,7 +85,7 @@ class RNCKakaoSocialModule internal constructor(context: ReactApplicationContext
users.users?.map {
argMap().apply {
putString("uuid", it.uuid)
putIntIfNotNull("id", it.id?.toInt())
putDoubleIfNotNull("id", it.id?.toDouble())
putBooleanIfNotNull("favorite", it.favorite)
putString("profileNickname", it.profileNickname)
putString("profileThumbnailImage", it.profileThumbnailImage)
Expand Down Expand Up @@ -171,7 +172,7 @@ class RNCKakaoSocialModule internal constructor(context: ReactApplicationContext
argArr().pushMapList(
friends.elements!!.map {
argMap().apply {
putIntIfNotNull("id", it.id?.toInt())
putDoubleIfNotNull("id", it.id?.toDouble())
putString("uuid", it.uuid)
putString("profileNickname", it.profileNickname)
putString("profileThumbnailImage", it.profileThumbnailImage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import net.mjstudio.rnkakao.core.util.pushMapList
import net.mjstudio.rnkakao.core.util.pushStringList
import net.mjstudio.rnkakao.core.util.putBooleanIfNotNull
import net.mjstudio.rnkakao.core.util.putDoubleIfNotNull
import net.mjstudio.rnkakao.core.util.putIntIfNotNull
import net.mjstudio.rnkakao.core.util.rejectWith
import net.mjstudio.rnkakao.core.util.unix
import java.util.Date
Expand Down Expand Up @@ -258,15 +257,15 @@ class RNCKakaoUserModule internal constructor(context: ReactApplicationContext)
} else {
promise.resolve(
argMap().apply {
putIntIfNotNull("userId", addrs.userId?.toInt())
putDoubleIfNotNull("userId", addrs.userId?.toDouble())
putBooleanIfNotNull("needsAgreement", addrs.needsAgreement)
putArray(
"shippingAddresses",
argArr().apply {
pushMapList(
addrs.shippingAddresses?.map { addr ->
argMap().apply {
putInt("id", addr.id.toInt())
putDouble("id", addr.id.toDouble())
putString("name", addr.name)
putBoolean("isDefault", addr.isDefault)
putDoubleIfNotNull("updatedAt", addr.updatedAt?.unix?.toDouble())
Expand Down

0 comments on commit 2658540

Please sign in to comment.