Skip to content

Commit dd0624b

Browse files
committed
Fixed minor changes
1 parent 593d755 commit dd0624b

File tree

21 files changed

+306
-358
lines changed

21 files changed

+306
-358
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ android/gradlew.bat
3838
android/gradle
3939
android/gradlew
4040
android/.project
41+
android/.settings
4142

4243
# node.js
4344
#
@@ -66,4 +67,5 @@ demos/appsflyer-expo-app/.expo
6667
demos/appsflyer-expo-app/node_modules
6768
demos/appsflyer-expo-app/yarn.lock
6869

70+
demos/appsflyer-react-native-app/ios/.xcode.env
6971
demos/appsflyer-react-native-app/ios/AppsFlyerExample.xcodeproj/project.pbxproj

Docs/RN_PurchaseConnector.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ For more information please check the following pages:
55
* [Android Purchase Connector](https://dev.appsflyer.com/hc/docs/purchase-connector-android)
66
* [iOS Purchase Connector](https://dev.appsflyer.com/hc/docs/purchase-connector-ios)
77

8-
🛠 In order for us to provide optimal support, we would kindly ask you to submit any issues to
9-
8+
🛠 You can contact AppsFlyer support through the Customer Assistant Chatbot for assistance with troubleshooting issues or product guidance. To do so, please follow this article: https://support.appsflyer.com/hc/en-us/articles/23583984402193-Using-the-Customer-Assistant-Chatbot.
109

1110
> *When submitting an issue please specify your AppsFlyer sign-up (account) email , your app ID , production steps, logs, code snippets and any additional relevant information.*
1211
@@ -205,7 +204,7 @@ You can register listeners to get the validation results once getting a response
205204

206205
The AppsFlyer SDK React Native plugin acts as a bridge between your React Native app and the underlying native SDKs provided by AppsFlyer. It's crucial to understand that the native infrastructure of iOS and Android is quite different, and so is the AppsFlyer SDK built on top of them. These differences are reflected in how you would handle callbacks separately for each platform.
207206

208-
In the iOS environment, there is a single callback method `didReceivePurchaseRevenueValidationInfo` to handle both subscriptions and in-app purchases. You set this callback using `onReceivePurchaseRevenueValidationInfo`.
207+
In the iOS environment, there is a single callback method `didReceivePurchaseRevenueValidationInfo` to handle both subscriptions and in-app purchases. You set this callback using `OnReceivePurchaseRevenueValidationInfo`.
209208

210209
On the other hand, Android segregates callbacks for subscriptions and in-app purchases. It provides two separate listener methods - `onSubscriptionValidationResultSuccess` and `onSubscriptionValidationResultFailure` for subscriptions and `onInAppValidationResultSuccess` and `onInAppValidationResultFailure` for in-app purchases. These listener methods register callback handlers for `OnResponse` (executed when a successful response is received) and `OnFailure` (executed when a failure occurs, including due to a network exception or non-200/OK response from the server).
211210

@@ -267,7 +266,7 @@ const handleOnReceivePurchaseRevenueValidationInfo = (validationResult) => {
267266
let purchaseRevenueValidationListener;
268267

269268
if (Platform.OS === 'ios') {
270-
purchaseRevenueValidationListener = AppsFlyerPurchaseConnector.onReceivePurchaseRevenueValidationInfo(handleOnReceivePurchaseRevenueValidationInfo);
269+
purchaseRevenueValidationListener = AppsFlyerPurchaseConnector.OnReceivePurchaseRevenueValidationInfo(handleOnReceivePurchaseRevenueValidationInfo);
271270
}
272271
};
273272
}, []);
@@ -351,7 +350,7 @@ const handleValidationSuccess = (validationResult) => {
351350
subscriptionValidationFailureListener = AppsFlyerPurchaseConnector.onSubscriptionValidationResultFailure(handleSubscriptionValidationFailure);
352351
} else {
353352
console.log('>> Creating purchaseRevenueValidationListener ');
354-
purchaseRevenueValidationListener = AppsFlyerPurchaseConnector.onReceivePurchaseRevenueValidationInfo(handleOnReceivePurchaseRevenueValidationInfo);
353+
purchaseRevenueValidationListener = AppsFlyerPurchaseConnector.OnReceivePurchaseRevenueValidationInfo(handleOnReceivePurchaseRevenueValidationInfo);
355354
}
356355

357356
// Cleanup function
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
class AppsFlyerConstants {
2-
static readonly RE_CONFIGURE_ERROR_MSG: string = "[PurchaseConnector] Re configure instance is not permitted. Returned the existing instance";
3-
static readonly MISSING_CONFIGURATION_EXCEPTION_MSG: string = "Could not create an instance without configuration";
4-
52
// Adding method constants
63
static readonly SUBSCRIPTION_VALIDATION_SUCCESS: string = 'subscriptionValidationSuccess';
74
static readonly SUBSCRIPTION_VALIDATION_FAILURE: string = 'subscriptionValidationFailure';
@@ -13,11 +10,6 @@ class AppsFlyerConstants {
1310
// Adding key constants
1411
static readonly RESULT: string = "result";
1512
static readonly ERROR: string = "error";
16-
static readonly VALIDATION_INFO: string = "validationInfo";
17-
static readonly CONFIGURE_KEY: string = "configure";
18-
static readonly LOG_SUBS_KEY: string = "logSubscriptions";
19-
static readonly LOG_IN_APP_KEY: string = "logInApps";
20-
static readonly SANDBOX_KEY: string = "sandbox";
2113
}
2214

2315
export default AppsFlyerConstants;

PurchaseConnector/utils/connector_callbacks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { IosError, JVMThrowable } from "../models";
44
export type PurchaseConnectorListener = (data: any) => void;
55

66
// Type definition for a listener which gets called when the `PurchaseConnectorImpl` receives purchase revenue validation info for iOS.
7-
export type onReceivePurchaseRevenueValidationInfo = (validationInfo?: Map<string, any>, error?: IosError) => void;
7+
export type OnReceivePurchaseRevenueValidationInfo = (validationInfo?: Map<string, any>, error?: IosError) => void;
88

99
// Invoked when a 200 OK response is received from the server.
1010
// Note: An INVALID purchase is considered to be a successful response and will also be returned by this callback.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-9.39 KB
Binary file not shown.

android/build.gradle

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ buildscript {
1313

1414
dependencies {
1515
classpath 'com.android.tools.build:gradle:7.2.2'
16+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10" // Kotlin plugin
1617
}
1718
}
1819

19-
2020
apply plugin: 'com.android.library'
21+
apply plugin: 'kotlin-android' // Apply Kotlin Android plugin
2122

2223
def includeConnector = project.hasProperty('appsflyer.enable_purchase_connector') ? project.property('appsflyer.enable_purchase_connector').toBoolean() : false // Moved outside of android block
2324

@@ -32,20 +33,18 @@ android {
3233
versionName "1.0"
3334
ndk {
3435
abiFilters "armeabi-v7a", "x86"
35-
00
3636
}
3737

3838
buildConfigField 'boolean', 'INCLUDE_CONNECTOR', includeConnector.toString()
3939
}
4040

4141
sourceSets {
4242
main {
43-
java.srcDirs = ['src/main/java']
43+
java.srcDirs = ['src/main/java', 'src/main/kotlin'] // Add Kotlin source directory
4444
java.srcDirs += includeConnector ? ['src/main/includeConnector'] : ['src/main/excludeConnector']
4545
}
46-
includeConnector ? ['src/main/includeConnector'] : ['src/main/excludeConnector']
4746
}
48-
47+
4948
lintOptions {
5049
warning 'InvalidPackage'
5150
}
@@ -57,6 +56,9 @@ android {
5756
sourceCompatibility JavaVersion.VERSION_1_8
5857
targetCompatibility JavaVersion.VERSION_1_8
5958
}
59+
kotlinOptions { // Configure Kotlin-specific options
60+
jvmTarget = "1.8"
61+
}
6062
}
6163

6264
repositories {
@@ -65,10 +67,11 @@ repositories {
6567
}
6668

6769
dependencies {
70+
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.7.10" // Add Kotlin standard library
6871
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
6972
api "com.appsflyer:af-android-sdk:${safeExtGet('appsflyerVersion', '6.15.1')}"
7073
implementation "com.android.installreferrer:installreferrer:${safeExtGet('installReferrerVersion', '2.2')}"
7174
if (includeConnector){
7275
implementation 'com.appsflyer:purchase-connector:2.0.1'
7376
}
74-
}
77+
}

android/src/main/excludeConnector/com/appsflyer/reactnative/PCAppsFlyerModule.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,8 @@
1111

1212
public class PCAppsFlyerModule extends ReactContextBaseJavaModule {
1313

14-
private ReactApplicationContext reactContext;
15-
private Application application;
16-
1714
public PCAppsFlyerModule(ReactApplicationContext reactContext) {
1815
super(reactContext);
19-
this.reactContext = reactContext;
20-
this.application = (Application) reactContext.getApplicationContext();
2116
Log.d("AppsFlyer", "PurchaseConnector inclusion status: " + BuildConfig.INCLUDE_CONNECTOR);
2217
}
2318

0 commit comments

Comments
 (0)