Skip to content

Commit

Permalink
reorder and fix skus size check
Browse files Browse the repository at this point in the history
  • Loading branch information
vegaro committed Jan 31, 2022
1 parent 2cf7004 commit 17aeced
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ fun PurchaseHistoryRecord.toHumanReadableDescription() =
this.skus.joinToString(prefix = "[", postfix = "]")
}, purchaseTime: ${this.purchaseTime}, purchaseToken: ${this.purchaseToken}"

val PurchaseHistoryRecord.listOfSkus: ArrayList<String>
get() = this.skus

/**
* **Important**: until multi-line subscriptions are released,
* we assume that there will be only a single sku in the purchase.
* https://android-developers.googleblog.com/2021/05/whats-new-in-google-play-2021.html
*/
val PurchaseHistoryRecord.firstSku: String
get() = skus[0].also {
if (skus.size > 0) {
if (skus.size > 1) {
log(LogIntent.GOOGLE_WARNING, BillingStrings.BILLING_PURCHASE_HISTORY_RECORD_MORE_THAN_ONE_SKU)
}
}

val PurchaseHistoryRecord.listOfSkus: ArrayList<String>
get() = this.skus
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ fun PurchaseHistoryRecord.toHumanReadableDescription() =
this.sku
}, purchaseTime: ${this.purchaseTime}, purchaseToken: ${this.purchaseToken}"

val PurchaseHistoryRecord.listOfSkus: List<String>
get() = listOf(this.sku)

val PurchaseHistoryRecord.firstSku: String
get() = sku

val PurchaseHistoryRecord.listOfSkus: List<String>
get() = listOf(this.sku)

0 comments on commit 17aeced

Please sign in to comment.