-
Notifications
You must be signed in to change notification settings - Fork 84
Virtual Currency Balances #2210
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
Virtual Currency Balances #2210
Conversation
📸 Snapshot Test262 unchanged
🛸 Powered by Emerge Tools |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## virtual-currency-dev #2210 +/- ##
========================================================
+ Coverage 80.42% 80.45% +0.02%
========================================================
Files 278 279 +1
Lines 9467 9490 +23
Branches 1336 1339 +3
========================================================
+ Hits 7614 7635 +21
Misses 1293 1293
- Partials 560 562 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
||
companion object { | ||
fun fromJson(json: JSONObject): VirtualCurrencyInfo { | ||
val balance = json.getLong("amount") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value returned by the server may change in the future to "balance" in the future - we'll update that in a follow-up PR if/when it happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly some questions but looking great!
purchases/src/main/kotlin/com/revenuecat/purchases/VirtualCurrencyInfo.kt
Show resolved
Hide resolved
purchases/src/main/kotlin/com/revenuecat/purchases/VirtualCurrencyInfo.kt
Outdated
Show resolved
Hide resolved
purchases/src/main/kotlin/com/revenuecat/purchases/VirtualCurrencyInfo.kt
Show resolved
Hide resolved
purchases/src/main/kotlin/com/revenuecat/purchases/VirtualCurrencyInfo.kt
Outdated
Show resolved
Hide resolved
purchases/src/main/kotlin/com/revenuecat/purchases/VirtualCurrencyInfo.kt
Outdated
Show resolved
Hide resolved
purchases/src/main/kotlin/com/revenuecat/purchases/VirtualCurrencyInfo.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff! No real comments besides Toni's.
purchases/src/main/kotlin/com/revenuecat/purchases/VirtualCurrencyInfo.kt
Show resolved
Hide resolved
purchases/src/main/kotlin/com/revenuecat/purchases/common/CustomerInfoFactory.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this look great! Great job on this!
@@ -50,6 +52,9 @@ data class CustomerInfo( | |||
val originalAppUserId: String, | |||
val managementURL: Uri?, | |||
val originalPurchaseDate: Date?, | |||
|
|||
@ExperimentalPreviewRevenueCatPurchasesAPI | |||
val virtualCurrencies: Map<String, VirtualCurrencyInfo>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the problems with data classes is that this modifies the constructor + copy constructor for CustomerInfo
, in case someone is using it... We could try to limit the breaking change by adding a deprecated constructor without the new param
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
api-tester/src/main/java/com/revenuecat/apitester/java/VirtualCurrencyInfoAPI.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: This has been merged. Some fields in the backend response have been renamed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! 💪 Avoiding the breaking constructor in CustomerInfo
might be nice, as Toni suggested. Then we at least remain source compatible.
Motivation
This PR allows developers to check the balances of their Virtual Currencies through the SDK's
CustomerInfo
object.Description
This PR allows developers to access the balances of their Virtual Currencies like so:
New APIs
It accomplishes this with a few API additions:
The
balance
property is aLong
becauseLong
s represent signed 64 bit integers, which is what is used in the iOS SDK and backend.Testing