-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[in_app_purchase] Federated Android implementation #3841
Changes from 1 commit
4f16c51
e3e40c3
20c7b0a
ccbee7a
9b8db74
65fc01d
68dac7f
77bdca3
a150317
4418ec8
b65ed69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import '../../billing_client_wrappers.dart'; | ||
| import 'types.dart'; | ||
|
|
||
| /// This parameter object for upgrading or downgrading an existing subscription. | ||
| class ChangeSubscriptionParam { | ||
| /// Creates a new change subscription param object with given data | ||
| ChangeSubscriptionParam({ | ||
| required this.oldPurchaseDetails, | ||
| this.prorationMode, | ||
| }); | ||
|
|
||
| /// The purchase object of the existing subscription that the user needs to | ||
| /// upgrade/downgrade from. | ||
| final GooglePlayPurchaseDetails oldPurchaseDetails; | ||
|
|
||
| /// The proration mode. | ||
| /// | ||
| /// This is an optional parameter that indicates how to handle the existing | ||
| /// subscription when the new subscription comes into effect. | ||
| final ProrationMode? prorationMode; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart'; | ||
|
|
||
| import '../../in_app_purchase_android.dart'; | ||
|
|
||
| /// Google Play specific parameter object for generating a purchase. | ||
| class GooglePlayPurchaseParam extends PurchaseParam { | ||
| /// Creates a new [GooglePlayPurchaseParam] object with the given data. | ||
| GooglePlayPurchaseParam({ | ||
| required ProductDetails productDetails, | ||
| String? applicationUserName, | ||
| this.changeSubscriptionParam, | ||
| }) : super( | ||
| productDetails: productDetails, | ||
| applicationUserName: applicationUserName, | ||
| ); | ||
|
|
||
| /// The 'changeSubscriptionParam' containing information for upgrading or | ||
| /// downgrading an existing subscription. | ||
| final ChangeSubscriptionParam? changeSubscriptionParam; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /// Thrown to indicate that an action failed while interacting with the | ||
| /// in_app_purchase plugin. | ||
| class InAppPurchaseException implements Exception { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this android only? Does it make sense to be in the platform_interface?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the moment it is only used in the Android package. On iOS we don't need this specific exception. However I can imagine the exception to be useful on other platforms in the future. So I wasn't sure to add it now to the platform_interface or later if we really need it on multiple platform (by that time we might have forgotten that there is a similar class in the Android implementation).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think it belongs to the platform_interface
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I created a separate PR (#3852) which adds the |
||
| /// Creates a [InAppPurchaseException] with the specified source and error | ||
| /// [code] and optional [message]. | ||
| InAppPurchaseException({ | ||
| required this.source, | ||
| required this.code, | ||
| this.message, | ||
| }) : assert(code != null); | ||
|
|
||
| /// An error code. | ||
| final String code; | ||
|
|
||
| /// A human-readable error message, possibly null. | ||
| final String? message; | ||
|
|
||
| /// Which source is the error on. | ||
| final String source; | ||
|
|
||
| @override | ||
| String toString() => 'InAppPurchaseException($code, $message, $source)'; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.