Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
953338a
Enable alternitive billing only available check, add test and code to…
reidbaker Feb 2, 2024
8ab32cc
Enable alternative billing only during client creation and tests cove…
reidbaker Feb 2, 2024
4d06253
ShowAlternativeBillingDialog android native method added
reidbaker Feb 2, 2024
8d95e87
Add tests for null activity behavior
reidbaker Feb 2, 2024
3878b4f
Remove not needed lines of code
reidbaker Feb 2, 2024
e516655
Add showAlternativeBillingOnlyInformationDialog and isAlternativeBill…
reidbaker Feb 5, 2024
c8efd99
test showAlternativeBillingOnlyInformationDialog and isAlternativeBil…
reidbaker Feb 5, 2024
3bd6a95
add alternative billing only reporting details implementation and tests
reidbaker Feb 5, 2024
3e77c14
formatting and generated code
reidbaker Feb 5, 2024
b77152b
Changelog and version bump added
reidbaker Feb 5, 2024
8cacaef
Formatting
reidbaker Feb 5, 2024
d4c4454
Merge branch 'main' into i142618-alternitive-billing-api-intro
reidbaker Feb 6, 2024
2f91615
Update to api 34 (required to test end to end, update dependencies, f…
reidbaker Feb 6, 2024
fe7a677
Use 0.3.1 instead of 0+19
reidbaker Feb 6, 2024
95214de
Expose country code as labled button
reidbaker Feb 7, 2024
fd506c2
Expose other alternative apis as buttons in their own section
reidbaker Feb 7, 2024
6415bee
formatting
reidbaker Feb 7, 2024
448dd2c
Add test for BillingClientManager alternative billing only
reidbaker Feb 8, 2024
1524fe0
Add platform addition tests
reidbaker Feb 8, 2024
7507f02
Show the dialog result code
reidbaker Feb 8, 2024
2ae9119
Set alternative billing only to true in example app
reidbaker Feb 8, 2024
99b3baf
Speling mistake fix
reidbaker Feb 9, 2024
b72cd39
Merge branch 'main' into i142618-alternitive-billing-api-intro
reidbaker Feb 9, 2024
240df4a
revert dependencies since they conflict with integration_test
reidbaker Feb 9, 2024
0723af9
changelog copy change
reidbaker Feb 9, 2024
16ce293
Migrate to enum for alternative billing only and play billing
reidbaker Feb 9, 2024
dfbb6b7
java formatting
reidbaker Feb 9, 2024
d073552
Include generated code change
reidbaker Feb 9, 2024
8e041af
Use json conversion for sending object over wire
reidbaker Feb 9, 2024
fe9d77e
Change button text
reidbaker Feb 9, 2024
31788de
Merge branch 'main' into i142618-alternitive-billing-api-intro
reidbaker Feb 9, 2024
31008fa
billingChoiceMode instead of enableAlternatitveBillingOnly
reidbaker Feb 9, 2024
b59c645
billing choice converstion to java
reidbaker Feb 10, 2024
7b6b7a2
Code review feedback, documentation, formatting, spelling
reidbaker Feb 12, 2024
b144067
Add alternative billing only reporting details example code
reidbaker Feb 12, 2024
8450aaa
Changlog formatting
reidbaker Feb 12, 2024
9730db3
Merge branch 'main' into i142618-alternitive-billing-api-intro
reidbaker Feb 12, 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
Add platform addition tests
  • Loading branch information
reidbaker committed Feb 8, 2024
commit 1524fe0f483c8853fcf3a5e04fdf9ca3edcb1f9c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ void main() {
const String startConnectionCall =
'BillingClient#startConnection(BillingClientStateListener)';
const String endConnectionCall = 'BillingClient#endConnection()';
const String onBillingServiceDisconnectedCallback =
'BillingClientStateListener#onBillingServiceDisconnected()';
late BillingClientManager manager;

setUpAll(() {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
Expand All @@ -39,8 +42,8 @@ void main() {
name: startConnectionCall,
value: buildBillingResultMap(expectedBillingResult));
stubPlatform.addResponse(name: endConnectionCall);
iapAndroidPlatformAddition =
InAppPurchaseAndroidPlatformAddition(BillingClientManager());
manager = BillingClientManager();
iapAndroidPlatformAddition = InAppPurchaseAndroidPlatformAddition(manager);
});

group('consume purchases', () {
Expand Down Expand Up @@ -82,6 +85,49 @@ void main() {
});
});

group('setAlternativeBillingOnlyState', () {
late Map<Object?, Object?> arguments;
test('setAlternativeBillingOnlyState true', () async {
stubPlatform.reset();
stubPlatform.addResponse(
name: startConnectionCall,
additionalStepBeforeReturn: (dynamic value) =>
arguments = value as Map<dynamic, dynamic>,
);
stubPlatform.addResponse(name: endConnectionCall);
await iapAndroidPlatformAddition.setAlternativeBillingOnlyState(true);

/// Fake the disconnect that we would expect from a endConnectionCall.
await manager.client.callHandler(
const MethodCall(onBillingServiceDisconnectedCallback,
<String, dynamic>{'handle': 0}),
);
// Verify that after connection ended reconnect was called.
expect(stubPlatform.countPreviousCalls(startConnectionCall), equals(1));
expect(arguments['enableAlternativeBillingOnly'], isTrue);
});

test('setAlternativeBillingOnlyState false', () async {
stubPlatform.reset();
stubPlatform.addResponse(
name: startConnectionCall,
additionalStepBeforeReturn: (dynamic value) =>
arguments = value as Map<dynamic, dynamic>,
);
stubPlatform.addResponse(name: endConnectionCall);
await iapAndroidPlatformAddition.setAlternativeBillingOnlyState(false);

/// Fake the disconnect that we would expect from a endConnectionCall.
await manager.client.callHandler(
const MethodCall(onBillingServiceDisconnectedCallback,
<String, dynamic>{'handle': 0}),
);
// Verify that after connection ended reconnect was called.
expect(stubPlatform.countPreviousCalls(startConnectionCall), equals(1));
expect(arguments['enableAlternativeBillingOnly'], isFalse);
});
});

group('isAlternativeBillingOnlyAvailable', () {
test('isAlternativeBillingOnlyAvailable success', () async {
const BillingResultWrapper expected = BillingResultWrapper(
Expand Down