Skip to content

Commit

Permalink
IAP: Add support for "SKU_SERIALIZED_DOCID_LIST" (#2509)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaVinci9196 authored Sep 28, 2024
1 parent f2479fe commit bbe2fdc
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,41 +47,55 @@ class IAPCore(
val multiOfferSkuDetailTemp: MutableList<MultiOfferSkuDetail> = mutableListOf()
params.multiOfferSkuDetail.forEach {
multiOfferSkuDetailTemp.add(
when (val value = it.value) {
is Boolean -> {
val multiOfferSkuDetailBuilder = MultiOfferSkuDetail.Builder()
if (it.key == "SKU_SERIALIZED_DOCID_LIST") {
val multiOfferSkuDetailBuilder = MultiOfferSkuDetail.Builder()
val skuSerializedDocIdList = SkuSerializedDocIds.Builder()
val docIdList = params.multiOfferSkuDetail["SKU_SERIALIZED_DOCID_LIST"]
if (docIdList != null) {
skuSerializedDocIdList.docIds(docIdList as List<String>)
multiOfferSkuDetailBuilder.apply {
key = it.key
bv = value
skuSerializedDocIds = skuSerializedDocIdList.build()
}
multiOfferSkuDetailBuilder.build()
}
multiOfferSkuDetailBuilder.build()
} else {
when (val value = it.value) {
is Boolean -> {
val multiOfferSkuDetailBuilder = MultiOfferSkuDetail.Builder()
multiOfferSkuDetailBuilder.apply {
key = it.key
bv = value
}
multiOfferSkuDetailBuilder.build()
}

is Long -> {
val multiOfferSkuDetailBuilder = MultiOfferSkuDetail.Builder()
multiOfferSkuDetailBuilder.apply {
key = it.key
iv = value
is Long -> {
val multiOfferSkuDetailBuilder = MultiOfferSkuDetail.Builder()
multiOfferSkuDetailBuilder.apply {
key = it.key
iv = value
}
multiOfferSkuDetailBuilder.build()
}
multiOfferSkuDetailBuilder.build()
}

is Int -> {
val multiOfferSkuDetailBuilder = MultiOfferSkuDetail.Builder()
multiOfferSkuDetailBuilder.apply {
key = it.key
iv = value.toLong()
is Int -> {
val multiOfferSkuDetailBuilder = MultiOfferSkuDetail.Builder()
multiOfferSkuDetailBuilder.apply {
key = it.key
iv = value.toLong()
}
multiOfferSkuDetailBuilder.build()
}
multiOfferSkuDetailBuilder.build()
}

else -> {
val multiOfferSkuDetailBuilder = MultiOfferSkuDetail.Builder()
multiOfferSkuDetailBuilder.apply {
key = it.key
sv = value.toString()
else -> {
val multiOfferSkuDetailBuilder = MultiOfferSkuDetail.Builder()
multiOfferSkuDetailBuilder.apply {
key = it.key
sv = value.toString()
}
multiOfferSkuDetailBuilder.build()
}
multiOfferSkuDetailBuilder.build()
}
}
)
Expand Down
5 changes: 5 additions & 0 deletions vending-app/src/main/proto/GooglePlay.proto
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,14 @@ message MultiOfferSkuDetail {
string sv = 2;
bool bv = 3;
int64 iv = 4;
SkuSerializedDocIds skuSerializedDocIds = 5;
}
}

message SkuSerializedDocIds {
repeated string docIds = 1;
}

message OfferSku {
string unknown1 = 1;
string unknown2 = 2;
Expand Down

0 comments on commit bbe2fdc

Please sign in to comment.