Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5be7c0a
Intial add of country code, no tests
reidbaker Jan 19, 2024
5d6f1cc
Add tests for getBillingConfig
reidbaker Jan 19, 2024
e19b644
Formating
reidbaker Jan 19, 2024
3f5a4e3
Manipulate data in translator class instead of impl
reidbaker Jan 24, 2024
337a7d7
Add dart side code to call getBillingConfig and conversion tests
reidbaker Jan 24, 2024
99af529
Correct null test to include empty country code, fix non null billing…
reidbaker Jan 25, 2024
fdc42cd
move buildBillingConfigMap to the class that uses it
reidbaker Jan 25, 2024
88ccd2a
Merge branch 'main' into i141627-country-code-api
reidbaker Jan 25, 2024
036e2f2
Write documentation and remove todos, remove unused import
reidbaker Jan 25, 2024
91950f3
Analyzer warnings
reidbaker Jan 25, 2024
7d4af42
Merge branch 'main' into i141627-country-code-api
reidbaker Jan 25, 2024
5cd0acb
java format warnings
reidbaker Jan 25, 2024
894473c
Version code change
reidbaker Jan 25, 2024
e33f22c
Restore in app purchase instructions in example readme from bad PR ht…
reidbaker Jan 26, 2024
1dc004b
Update packages/in_app_purchase/in_app_purchase_android/android/src/m…
reidbaker Jan 26, 2024
319ffe7
Add example app code that shows country code in UI rename addition ap…
reidbaker Jan 26, 2024
28e95ad
Remove "Demonstrates how to use" verbiage since that is confusing whi…
reidbaker Jan 29, 2024
3c263a8
Merge branch 'main' into i141627-country-code-api
reidbaker Jan 29, 2024
4cd74ec
Merge branch 'main' into i141627-country-code-api
reidbaker Jan 30, 2024
d7934fc
Remove changes to ios readme
reidbaker Jan 30, 2024
5252d6e
Readme link to signing docs and changelog verbiage update
reidbaker Jan 30, 2024
5e363fc
Restore getCountryCode tests
reidbaker Jan 30, 2024
62477c4
Use run with client since BillingConfigWrapper uses a billing result
reidbaker Jan 30, 2024
a514dc1
Merge branch 'main' into i141627-country-code-api
reidbaker Jan 30, 2024
f047aac
Use run with client since BillingConfigWrapper uses a billing result
reidbaker Jan 30, 2024
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
Prev Previous commit
Next Next commit
Write documentation and remove todos, remove unused import
  • Loading branch information
reidbaker committed Jan 25, 2024
commit 036e2f24f23494b4e824fa50929c2ea7a6492d1b
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,15 @@ class BillingClient {
return result ?? false;
}

/// TODO
/// BillingConfig method channel string identifier.
//
// Must match the value of GET_BILLING_CONFIG in
// ../../../android/src/main/java/io/flutter/plugins/inapppurchase/MethodCallHandlerImpl.java
@visibleForTesting
final String getBillingConfigMethodString =
'BillingClient#getBillingConfig()';

/// TODO
/// Fetches billing config info into a [BillingConfigWrapper] object.
Future<BillingConfigWrapper> getBillingConfig() async {
return BillingConfigWrapper.fromJson((await channel
.invokeMapMethod<String, dynamic>(getBillingConfigMethodString)) ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const String kInvalidBillingConfigErrorMessage =
@immutable
class BillingConfigWrapper implements HasBillingResponse {
/// Constructs the object with [responseCode] and [debugMessage].
const BillingConfigWrapper({required this.responseCode, this.debugMessage, this.countryCode});
const BillingConfigWrapper({required this.responseCode, this.debugMessage, this.countryCode = ''});

/// Constructs an instance of this from a key value map of data.
///
Expand Down Expand Up @@ -55,7 +55,7 @@ class BillingConfigWrapper implements HasBillingResponse {

/// https://developer.android.com/reference/com/android/billingclient/api/BillingConfig#getCountryCode()
@JsonKey(defaultValue: '')
final String? countryCode;
final String countryCode;

@override
bool operator ==(Object other) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,13 @@ class InAppPurchaseAndroidPlatformAddition
);
}

/// TODO
Future<BillingConfigWrapper> getBillingConfig() async {
/// Returns Play billing country code based on ISO-3166-1 alpha2 format.
///
/// See: https://developer.android.com/reference/com/android/billingclient/api/BillingConfig
/// See: https://unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html
Future<String> getBillingConfig() async {
return _billingClientManager.runWithClientNonRetryable(
Copy link
Member

Choose a reason for hiding this comment

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

Should this return a BillingConfigWrapper and then be also be retryable, as it returns a subclass of HasBillingResponse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to keep the exposed api as small as possible so I thought the country code was the right level to expose. I didnt even think about if it should be retryable I just mirrored the other commands. Let me look at what that does and make a call.

Copy link
Member

Choose a reason for hiding this comment

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

I think this comment still applies

(BillingClient client) => client.getBillingConfig(),
(BillingClient client) async => (await client.getBillingConfig()).countryCode,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import 'package:in_app_purchase_android/billing_client_wrappers.dart';
import 'package:in_app_purchase_android/in_app_purchase_android.dart';
import 'package:in_app_purchase_android/src/billing_client_wrappers/billing_config_wrapper.dart';
import 'package:test/test.dart';

const PurchaseWrapper dummyPurchase = PurchaseWrapper(
Expand Down