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
Add ownershipType to entitlementInfo #278
Conversation
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.
Thanks so much for opening this. I am not sure how it happened that we released 3.7.0 without the actual Dart changes 🤦
CHANGELOG.md
Outdated
@@ -1,3 +1,5 @@ | |||
- Adds ownershipType to the EntitlementInfo wrapper | |||
|
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.
Thanks for adding this here. We can take care of the Changelog when releasing the newer version, so no need to add this in the Changelog for now 😄
lib/entitlement_info_wrapper.dart
Outdated
case "PURCHASED": | ||
ownershipType = OwnershipType.purchased; | ||
break; | ||
case "FAMILY_SHARING": |
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.
This should be FAMILY_SHARED
as commented in the android PR
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.
Fixed
lib/entitlement_info_wrapper.dart
Outdated
purchased, | ||
|
||
/// For ownership when a user has been shared the purchase via family sharing | ||
familySharing, |
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.
This should be familyShared
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.
Fixed
/// Enum of ownership types | ||
enum OwnershipType { | ||
/// For ownership when a user made the purchase themselves | ||
purchased, |
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.
These docs look great, but maybe we can reuse the docs in the iOS enum? https://github.com/RevenueCat/purchases-ios/blob/main/Purchases/Public/PurchaseOwnershipType.swift#L20
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.
Used the iOS docs and also updated the purchases-android
ones to match. I included the UNKNOWN because it looks like the linter wants all public fields documented.
entitlementInfo = EntitlementInfo.fromJson(entitlementInfoJson); | ||
|
||
expect(entitlementInfo.ownershipType, OwnershipType.unknown); | ||
}); |
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.
Amazing! Thanks so much for writing tests!
Thank you @daentech! |
Description:
This PR exposes
ownershipType
onEntitlementInfo
as, while it had been added topurchases-hybrid-common
, it was unavailable in the flutter SDK itself.purchases-android
PR: RevenueCat/purchases-android#382purchases-hybrid-common
PR: RevenueCat/purchases-hybrid-common#103Related to Zendesk ticket: 12668