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

Adds management URL to PurchaserInfo #67

Merged
merged 1 commit into from
Jun 17, 2020
Merged
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
12 changes: 10 additions & 2 deletions lib/purchaser_info_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ class PurchaserInfo {
/// in Android
final String originalApplicationVersion;

/// URL to manage the active subscription of the user. If this user has an active iOS
/// subscription, this will point to the App Store, if the user has an active Play Store subscription
/// it will point there. If there are no active subscriptions it will be null.
/// If there are multiple for different platforms, it will point to the device store.
final String managementURL;

PurchaserInfo.fromJson(Map<dynamic, dynamic> map)
: entitlements = EntitlementInfos.fromJson(
map["entitlements"] as Map<dynamic, dynamic>),
Expand All @@ -61,7 +67,8 @@ class PurchaserInfo {
allPurchaseDates = (map["allPurchaseDates"] as Map<dynamic, dynamic>)
.map((key, value) => MapEntry(key as String, value as String)),
originalApplicationVersion = map["originalApplicationVersion"],
originalPurchaseDate = map["originalPurchaseDate"];
originalPurchaseDate = map["originalPurchaseDate"],
managementURL = map["managementURL"];

@override
String toString() {
Expand All @@ -76,6 +83,7 @@ class PurchaserInfo {
'originalAppUserId: $originalAppUserId, '
'requestDate: $requestDate, '
'originalApplicationVersion: $originalApplicationVersion, '
'originalPurchaseDate: $originalPurchaseDate}';
'originalPurchaseDate: $originalPurchaseDate, '
'managementURL: $managementURL}';
}
}
2 changes: 1 addition & 1 deletion lib/purchases_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class Purchases {
return await _channel
.invokeMethod('setProxyURLString', {'proxyURLString': url});
}

/// Gets current purchaser info, which will normally be cached.
static Future<PurchaserInfo> getPurchaserInfo() async {
Map<dynamic, dynamic> result =
Expand Down