Skip to content

Commit b54ebd9

Browse files
authored
Merge pull request #632 from AppsFlyerSDK/releases/6.x.x/6.17.x/6.17.0-rc1
Releases/6.x.x/6.17.x/6.17.0 rc1
2 parents ee53114 + 949be37 commit b54ebd9

75 files changed

Lines changed: 154086 additions & 602 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/unit-tests-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v2
1717
- name: Install modules
18-
run: npm install
18+
run: npm install --legacy-peer-deps
1919
- name: Run jest tests
2020
run: npm run test

.gitignore

Lines changed: 4 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,7 @@ 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
72+
73+
.cursor/*

Docs/RN_PurchaseConnector.md

Lines changed: 541 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class AppsFlyerConstants {
2+
// Adding method constants
3+
static readonly SUBSCRIPTION_VALIDATION_SUCCESS: string = 'subscriptionValidationSuccess';
4+
static readonly SUBSCRIPTION_VALIDATION_FAILURE: string = 'subscriptionValidationFailure';
5+
static readonly IN_APP_PURCHASE_VALIDATION_SUCCESS: string = 'inAppPurchaseValidationSuccess';
6+
static readonly IN_APP_PURCHASE_VALIDATION_FAILURE: string = 'inAppPurchaseValidationFailure';
7+
static readonly DID_RECEIVE_PURCHASE_REVENUE_VALIDATION_INFO: string =
8+
"onDidReceivePurchaseRevenueValidationInfo";
9+
10+
// Adding key constants
11+
static readonly RESULT: string = "result";
12+
static readonly ERROR: string = "error";
13+
}
14+
15+
export default AppsFlyerConstants;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { SubscriptionItemPriceChangeDetailsJson, SubscriptionItemPriceChangeDetails } from "./subscription_item_price_change_details";
2+
3+
export type AutoRenewingPlanJson = {
4+
autoRenewEnabled?: boolean;
5+
priceChangeDetails?: SubscriptionItemPriceChangeDetailsJson;
6+
};
7+
8+
export class AutoRenewingPlan {
9+
autoRenewEnabled?: boolean;
10+
priceChangeDetails?: SubscriptionItemPriceChangeDetails;
11+
12+
constructor(
13+
autoRenewEnabled?: boolean,
14+
priceChangeDetails?: SubscriptionItemPriceChangeDetails
15+
) {
16+
this.autoRenewEnabled = autoRenewEnabled;
17+
this.priceChangeDetails = priceChangeDetails;
18+
}
19+
20+
static fromJson(json: AutoRenewingPlanJson): AutoRenewingPlan {
21+
return new AutoRenewingPlan(
22+
json.autoRenewEnabled,
23+
json.priceChangeDetails &&
24+
SubscriptionItemPriceChangeDetails.fromJson(json.priceChangeDetails)
25+
);
26+
}
27+
28+
toJson(): AutoRenewingPlanJson {
29+
return {
30+
autoRenewEnabled: this.autoRenewEnabled,
31+
priceChangeDetails: this.priceChangeDetails?.toJson(),
32+
};
33+
}
34+
}
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
export class CanceledStateContext {
2+
developerInitiatedCancellation?: DeveloperInitiatedCancellation;
3+
replacementCancellation?: ReplacementCancellation;
4+
systemInitiatedCancellation?: SystemInitiatedCancellation;
5+
userInitiatedCancellation?: UserInitiatedCancellation;
6+
7+
constructor(
8+
developerInitiatedCancellation?: DeveloperInitiatedCancellation,
9+
replacementCancellation?: ReplacementCancellation,
10+
systemInitiatedCancellation?: SystemInitiatedCancellation,
11+
userInitiatedCancellation?: UserInitiatedCancellation
12+
) {
13+
this.developerInitiatedCancellation = developerInitiatedCancellation;
14+
this.replacementCancellation = replacementCancellation;
15+
this.systemInitiatedCancellation = systemInitiatedCancellation;
16+
this.userInitiatedCancellation = userInitiatedCancellation;
17+
}
18+
19+
static fromJson(json: any): CanceledStateContext {
20+
return new CanceledStateContext(
21+
json.developerInitiatedCancellation != null
22+
? DeveloperInitiatedCancellation.fromJson(
23+
json.developerInitiatedCancellation
24+
)
25+
: undefined,
26+
json.replacementCancellation != null
27+
? ReplacementCancellation.fromJson(json.replacementCancellation)
28+
: undefined,
29+
json.systemInitiatedCancellation != null
30+
? SystemInitiatedCancellation.fromJson(json.systemInitiatedCancellation)
31+
: undefined,
32+
json.userInitiatedCancellation != null
33+
? UserInitiatedCancellation.fromJson(json.userInitiatedCancellation)
34+
: undefined
35+
);
36+
}
37+
38+
toJson(): Record<string, any> {
39+
return {
40+
developerInitiatedCancellation:
41+
this.developerInitiatedCancellation?.toJson(),
42+
replacementCancellation: this.replacementCancellation?.toJson(),
43+
systemInitiatedCancellation: this.systemInitiatedCancellation?.toJson(),
44+
userInitiatedCancellation: this.userInitiatedCancellation?.toJson(),
45+
};
46+
}
47+
}
48+
49+
/**
50+
* TODO: Need to check each state context further...
51+
*/
52+
class DeveloperInitiatedCancellation {
53+
constructor() {}
54+
55+
static fromJson(json: any): DeveloperInitiatedCancellation {
56+
// Here you would implement the conversion from JSON to DeveloperInitiatedCancellation instance
57+
return new DeveloperInitiatedCancellation();
58+
}
59+
60+
toJson(): Record<string, unknown> {
61+
// Here you would implement the conversion from DeveloperInitiatedCancellation instance to JSON
62+
return {};
63+
}
64+
}
65+
66+
class ReplacementCancellation {
67+
constructor() {}
68+
69+
static fromJson(json: any): ReplacementCancellation {
70+
// Here you would implement the conversion from JSON to ReplacementCancellation instance
71+
return new ReplacementCancellation();
72+
}
73+
74+
toJson(): Record<string, unknown> {
75+
return {};
76+
}
77+
}
78+
79+
class SystemInitiatedCancellation {
80+
constructor() {}
81+
82+
static fromJson(json: any): SystemInitiatedCancellation {
83+
// Here you would implement the conversion from JSON to SystemInitiatedCancellation instance
84+
return new SystemInitiatedCancellation();
85+
}
86+
87+
toJson(): Record<string, unknown> {
88+
// Here you would implement the conversion from SystemInitiatedCancellation instance to JSON
89+
return {};
90+
}
91+
}
92+
93+
class UserInitiatedCancellation {
94+
cancelSurveyResult?: CancelSurveyResult; // Made optional as per Dart's CancelSurveyResult? declaration
95+
cancelTime: string;
96+
97+
constructor(
98+
cancelSurveyResult: CancelSurveyResult | undefined,
99+
cancelTime: string
100+
) {
101+
this.cancelSurveyResult = cancelSurveyResult;
102+
this.cancelTime = cancelTime;
103+
}
104+
105+
static fromJson(json: any): UserInitiatedCancellation {
106+
return new UserInitiatedCancellation(
107+
json.cancelSurveyResult != null
108+
? CancelSurveyResult.fromJson(json.cancelSurveyResult)
109+
: undefined,
110+
json.cancelTime
111+
);
112+
}
113+
114+
toJson(): Record<string, unknown> {
115+
return {
116+
cancelSurveyResult: this.cancelSurveyResult?.toJson(),
117+
cancelTime: this.cancelTime,
118+
};
119+
}
120+
}
121+
122+
class CancelSurveyResult {
123+
reason: string;
124+
reasonUserInput: string;
125+
126+
constructor(reason: string, reasonUserInput: string) {
127+
this.reason = reason;
128+
this.reasonUserInput = reasonUserInput;
129+
}
130+
131+
static fromJson(json: any): CancelSurveyResult {
132+
return new CancelSurveyResult(json.reason, json.reasonUserInput);
133+
}
134+
135+
toJson(): Record<string, string> {
136+
return {
137+
reason: this.reason,
138+
reasonUserInput: this.reasonUserInput,
139+
};
140+
}
141+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export type DeferredItemReplacementJson = {
2+
productId: string;
3+
};
4+
5+
export class DeferredItemReplacement {
6+
productId: string;
7+
8+
constructor(productId: string) {
9+
this.productId = productId;
10+
}
11+
12+
static fromJson(json: DeferredItemReplacementJson): DeferredItemReplacement {
13+
return new DeferredItemReplacement(json.productId);
14+
}
15+
16+
toJson(): DeferredItemReplacementJson {
17+
return {
18+
productId: this.productId,
19+
};
20+
}
21+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
export type ExternalAccountIdentifiersJson = {
2+
externalAccountId: string;
3+
obfuscatedExternalAccountId: string;
4+
obfuscatedExternalProfileId: string;
5+
};
6+
7+
export class ExternalAccountIdentifiers {
8+
externalAccountId: string;
9+
obfuscatedExternalAccountId: string;
10+
obfuscatedExternalProfileId: string;
11+
12+
constructor(
13+
externalAccountId: string,
14+
obfuscatedExternalAccountId: string,
15+
obfuscatedExternalProfileId: string
16+
) {
17+
this.externalAccountId = externalAccountId;
18+
this.obfuscatedExternalAccountId = obfuscatedExternalAccountId;
19+
this.obfuscatedExternalProfileId = obfuscatedExternalProfileId;
20+
}
21+
22+
static fromJson(
23+
json: ExternalAccountIdentifiersJson
24+
): ExternalAccountIdentifiers {
25+
return new ExternalAccountIdentifiers(
26+
json.externalAccountId,
27+
json.obfuscatedExternalAccountId,
28+
json.obfuscatedExternalProfileId
29+
);
30+
}
31+
32+
toJson(): ExternalAccountIdentifiersJson {
33+
return {
34+
externalAccountId: this.externalAccountId,
35+
obfuscatedExternalAccountId: this.obfuscatedExternalAccountId,
36+
obfuscatedExternalProfileId: this.obfuscatedExternalProfileId,
37+
};
38+
}
39+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { ProductPurchase } from "./product_purchase";
2+
import { ValidationFailureDataJson } from "./validation_failure_data";
3+
4+
export default class InAppPurchaseValidationResult {
5+
success: boolean;
6+
productPurchase?: ProductPurchase;
7+
failureData?: ValidationFailureDataJson;
8+
9+
constructor(
10+
success: boolean,
11+
productPurchase?: ProductPurchase,
12+
failureData?: ValidationFailureDataJson
13+
) {
14+
this.success = success;
15+
this.productPurchase = productPurchase;
16+
this.failureData = failureData;
17+
}
18+
19+
static fromJson(json: any): InAppPurchaseValidationResult {
20+
return new InAppPurchaseValidationResult(
21+
json.success,
22+
json.productPurchase,
23+
json.failureData
24+
);
25+
}
26+
27+
toJson(): any {
28+
return {
29+
success: this.success,
30+
productPurchase: this.productPurchase,
31+
failureData: this.failureData,
32+
};
33+
}
34+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// TypeScript class for IOS Error
2+
export class IosError {
3+
localizedDescription: string;
4+
domain: string;
5+
code: number;
6+
7+
constructor(localizedDescription: string, domain: string, code: number) {
8+
this.localizedDescription = localizedDescription;
9+
this.domain = domain;
10+
this.code = code;
11+
}
12+
13+
// Converts the class instance to a JSON object
14+
toJson(): object {
15+
return {
16+
localizedDescription: this.localizedDescription,
17+
domain: this.domain,
18+
code: this.code,
19+
};
20+
}
21+
22+
// Creates an instance of the class from a JSON object
23+
static fromJson(json: any): IosError {
24+
return new IosError(json.localizedDescription, json.domain, json.code);
25+
}
26+
}
27+
28+
/**
29+
* Usage example:
30+
* // Creating an instance of IosError
31+
* const iosError = new IosError('An error occurred.', 'com.example.domain', 100);
32+
*
33+
* // Display information about the IOS error
34+
* console.log(iosError.localizedDescription); // Outputs: An error occurred.
35+
* console.log(iosError.domain); // Outputs: com.example.domain
36+
* console.log(iosError.code); // Outputs: 100
37+
*
38+
* // Serializing IosError instance to a JSON object
39+
* const iosErrorJson = iosError.toJson();
40+
* console.log(iosErrorJson); // Outputs: { localizedDescription: 'An error occurred.', domain: 'com.example.domain', code: 100 }
41+
*
42+
* // Sample JSON objects
43+
* const iosErrorData = {
44+
* localizedDescription: 'A network error occurred.',
45+
* domain: 'com.example.network',
46+
* code: 404
47+
* };
48+
*
49+
* // Deserializing the parsed JSON into instance of IosError
50+
* const deserializedIosError = IosError.fromJson(iosErrorData);
51+
* console.log(deserializedIosError);
52+
*/

0 commit comments

Comments
 (0)