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

Purchase Connector React Native #582

Open
wants to merge 20 commits into
base: development
Choose a base branch
from

Conversation

al-af
Copy link
Contributor

@al-af al-af commented Oct 1, 2024

No description provided.


// Perform a check to ensure that we do not reconfigure an existing connector.
if (connector != nil) {
reject(@"401", @"Connector already configured", nil);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we use status codes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed status code and used the error messages

export type PurchaseConnectorListener = (data: any) => void;

// Type definition for a listener which gets called when the `PurchaseConnectorImpl` receives purchase revenue validation info for iOS.
export type DidReceivePurchaseRevenueValidationInfo = (validationInfo?: Map<string, any>, error?: IosError) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

In react native we usually use 'on' for prefix in callback names (onSuccess, onClick, onSubmit..).
'did' is usually for obj-c projects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to onReceivePurchaseRevenueValidationInfo!

index.js Outdated
Comment on lines 55 to 66
function setInAppValidationResultListener(onResponse, onFailure) {
const inAppValidationListener = purchaseConnectorEventEmitter.addListener(
AppsFlyerConstants.IN_APP_VALIDATION_RESULT_LISTENER,
(result) => {
try {
const validationResult = JSON.parse(result);
onResponse(validationResult);
} catch (error) {
onFailure("Failed to parse in-app purchase validation result", error);
}
}
);
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to be consistent with how we write our code and how we want the plugin to behave. The onGCD callback we have 2 "setters": 1 for success and 1 for failure. So here we should do the same Link

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Separated to 2 setters and followed the old convention as you mentioned in the link

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For subscription and for in apps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants