Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support repurchasing of consumables in paywalls #2005

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ data class Transaction(
)
val productId: String,
val purchaseDate: Date,
var shouldConsume: Boolean,
) : Parcelable {

internal constructor(productId: String, jsonObject: JSONObject) : this(
Expand All @@ -29,5 +30,6 @@ data class Transaction(
productIdentifier = productId,
productId = productId,
purchaseDate = jsonObject.getDate("purchase_date"),
shouldConsume = jsonObject.optBoolean("play_iap_should_consume", true),
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ internal class PaywallViewModelImpl(
variableDataProvider = variableDataProvider,
activelySubscribedProductIdentifiers = customerInfo.activeSubscriptions,
nonSubscriptionProductIdentifiers = customerInfo.nonSubscriptionTransactions
// Filter out consumables so they don't get checked in valiation
.filter { !it.shouldConsume }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I'm honestly wondering if we should just remove the validation for repurchasing any product and just leave it to google to display a "Already purchased product" if the customer is already subscribed/has a non-consumed product...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we have this conversation already on my prototype of this from months ago? Because this feels awkwardly familiar? 🤔

.map { it.productIdentifier }
.toSet(),
mode = mode,
Expand Down