Skip to content

Commit 69dc5f8

Browse files
Merge pull request #52 from AppsFlyerSDK/dev/DELIVERY-99951/update-to-6.17.7
Dev/delivery 99951/update to 6.17.7
2 parents 0fa9bf9 + 2881334 commit 69dc5f8

25 files changed

+255
-144
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ proj.win32/Release.*/
109109

110110
# others
111111
cocos2d
112+
Build-ios
112113

113114
.vscode/
115+
.lsp/
116+
.clj-kondo/
117+
.idea/
114118

115119
proj.android-studio/.idea/

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Versions
1+
# Versions
22

33
## 6.10.3
44
- update Android SDK to 6.10.3

CMakeLists.txt

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525

2626
cmake_minimum_required(VERSION 3.6)
2727

28-
set(APP_NAME MyGame)
28+
set(APP_NAME AppsFlyerCocos2dX)
2929

3030
project(${APP_NAME})
31+
set(CMAKE_XCODE_GENERATE_SCHEME TRUE)
3132

3233
set(COCOS2DX_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cocos2d)
3334
set(CMAKE_MODULE_PATH ${COCOS2DX_ROOT_PATH}/cmake/Modules/)
@@ -55,17 +56,35 @@ endif()
5556

5657
# add cross-platforms source files and header files
5758
list(APPEND GAME_SOURCE
58-
Classes/AppsFlyer/AppsFlyerX.cpp
5959
Classes/AppDelegate.cpp
6060
Classes/HelloWorldScene.cpp
61+
Classes/AppsFlyer/AFSDKXPurchaseDetails.cpp
62+
Classes/AppsFlyer/AFSDKXValidateAndLogResult.cpp
63+
Classes/AppsFlyer/AFXAdRevenueData.cpp
64+
Classes/AppsFlyer/AppsFlyerX.cpp
65+
Classes/AppsFlyer/AppsFlyerXApple.mm
66+
Classes/AppsFlyer/AppsFlyerXAppleDeepLinkDelegate.mm
67+
Classes/AppsFlyer/AppsFlyerXAppleDelegate.mm
68+
Classes/AppsFlyer/AppsFlyerXAppleHelper.mm
69+
Classes/AppsFlyer/AppsFlyerXConsent.cpp
6170
Classes/AppsFlyer/AppsFlyerXDeepLinkResult.cpp
62-
)
71+
)
72+
6373
list(APPEND GAME_HEADER
64-
Classes/AppsFlyer/AppsFlyerX.h
6574
Classes/AppDelegate.h
6675
Classes/HelloWorldScene.h
76+
Classes/AppsFlyer/AFSDKXPurchaseDetails.h
77+
Classes/AppsFlyer/AFSDKXValidateAndLogResult.h
78+
Classes/AppsFlyer/AFXAdRevenueData.h
79+
Classes/AppsFlyer/AppsFlyerX.h
80+
Classes/AppsFlyer/AppsFlyerXApple.h
81+
Classes/AppsFlyer/AppsFlyerXAppleDeepLinkDelegate.h
82+
Classes/AppsFlyer/AppsFlyerXAppleDelegate.h
83+
Classes/AppsFlyer/AppsFlyerXAppleHelper.h
6784
Classes/AppsFlyer/AppsFlyerXDeepLinkResult.h
68-
)
85+
Classes/AppsFlyer/AppsFlyerXMacro.h
86+
Classes/AppsFlyer/EmailCryptTypeX.h
87+
)
6988

7089
if(ANDROID)
7190
list(APPEND GAME_SOURCE
@@ -79,7 +98,7 @@ if(ANDROID)
7998
)
8099

81100
# change APP_NAME to the share library name for Android, it's value depend on AndroidManifest.xml
82-
set(APP_NAME MyGame)
101+
set(APP_NAME AppsFlyerCocos2dX)
83102
list(APPEND GAME_SOURCE
84103
proj.android-studio/app/jni/hellocpp/main.cpp
85104
)
@@ -149,20 +168,49 @@ target_include_directories(${APP_NAME}
149168
PRIVATE Classes
150169
PRIVATE ${COCOS2DX_ROOT_PATH}/cocos/audio/include/
151170
)
171+
if(APPLE AND IOS)
172+
string(FIND "${CMAKE_OSX_SYSROOT}" "iPhoneSimulator" _is_simulator_sysroot)
173+
if(_is_simulator_sysroot GREATER -1)
174+
set(_swift_platform_folder "iphonesimulator")
175+
else()
176+
set(_swift_platform_folder "iphoneos")
177+
endif()
178+
179+
if(NOT DEFINED APPLE_DEVELOPER_ROOT)
180+
execute_process(COMMAND xcode-select -p OUTPUT_VARIABLE APPLE_DEVELOPER_ROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
181+
endif()
182+
set(_swift_lib_root "${APPLE_DEVELOPER_ROOT}/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/${_swift_platform_folder}")
183+
184+
foreach(_swift_lib swiftCompatibility50 swiftCompatibility51 swiftCompatibilityConcurrency swiftCompatibilityDynamicReplacements)
185+
string(TOUPPER "${_swift_lib}" _swift_lib_upper)
186+
set(_swift_var "SWIFT_LIB_${_swift_lib_upper}")
187+
find_library(${_swift_var} ${_swift_lib} HINTS "${_swift_lib_root}" NO_DEFAULT_PATH)
188+
if(${_swift_var})
189+
target_link_libraries(${APP_NAME} "${${_swift_var}}")
190+
else()
191+
message(WARNING "Could not locate ${_swift_lib} inside ${_swift_lib_root}")
192+
endif()
193+
endforeach()
194+
endif()
152195

153196
# mark app resources
154197
setup_cocos_app_config(${APP_NAME})
155198
if(APPLE)
199+
if(IOS)
200+
# Force DerivedData into the build tree so sandboxed environments can write to it
201+
set(CMAKE_XCODE_ATTRIBUTE_DERIVED_DATA_PATH "${PROJECT_BINARY_DIR}/DerivedData")
202+
endif()
156203
set_target_properties(${APP_NAME} PROPERTIES RESOURCE "${APP_UI_RES}")
157204
if(MACOSX)
158205
set_target_properties(${APP_NAME} PROPERTIES
159206
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/proj.ios_mac/mac/Info.plist"
160207
)
161208
elseif(IOS)
162-
cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in")
209+
#cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in")
163210
# set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon")
164211
set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "")
165212
set_xcode_property(${APP_NAME} CODE_SIGN_IDENTITY "iPhone Developer")
213+
set_xcode_property(${APP_NAME} PRODUCT_BUNDLE_IDENTIFIER "com.appsflyer.AppsFlyerCocos2dX")
166214
endif()
167215
elseif(WINDOWS)
168216
cocos_copy_target_dll(${APP_NAME})

Classes/AppsFlyer/AppsFlyerXApple.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@
270270

271271
[[AppsFlyerLib shared] validateAndLogInAppPurchase:afPurchaseDetails extraEventValues:lParams completionHandler:^(AFSDKValidateAndLogResult * _Nullable result) {
272272
// TODO: - add result to completionHandler
273-
NSLog(@"[ValidateAndLog] Result: %@", result);
273+
NSLog(@"[ValidateAndLog] Result: %@", result.error);
274+
NSLog(@"[ValidateAndLog] Result: %@", result.errorData);
274275
AFSDKXValidateAndLogStatus status = AFSDKXValidateAndLogResult::objcEnumToCppEnum(result.status);
275276
cocos2d::ValueMap resultX = AppsFlyerXAppleHelper::nsDictionary2ValueMap(result.result);
276277
cocos2d::ValueMap errorData = AppsFlyerXAppleHelper::nsDictionary2ValueMap(result.errorData);

Classes/AppsFlyer/libAppsFlyer/AFSDKPurchaseDetails.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@
55
// Created by Moris Gateno on 13/03/2024.
66
//
77

8+
#import "AFSDKPurchaseType.h"
9+
810
@interface AFSDKPurchaseDetails : NSObject
911

10-
- (nonnull instancetype)init NS_UNAVAILABLE;
11-
+ (nonnull instancetype)new NS_UNAVAILABLE;
12+
- (instancetype)init NS_UNAVAILABLE;
13+
+ (instancetype)new NS_UNAVAILABLE;
1214

13-
@property (strong, nullable, nonatomic) NSString *productId;
14-
@property (strong, nullable, nonatomic) NSString *price;
15-
@property (strong, nullable, nonatomic) NSString *currency;
16-
@property (strong, nullable, nonatomic) NSString *transactionId;
15+
@property (nonatomic, copy, readonly) NSString *productId;
16+
@property (nonatomic, copy, readonly) NSString *transactionId;
17+
@property (nonatomic, assign, readonly) AFSDKPurchaseType purchaseType;
1718

18-
- (instancetype _Nonnull )initWithProductId:(NSString *_Nullable)productId
19-
price:(NSString *_Nullable)price
20-
currency:(NSString *_Nullable)currency
21-
transactionId:(NSString *_Nullable)transactionId;
19+
// Designated initializer for VAL2-compliant purchase object
20+
- (instancetype)initWithProductId:(NSString *)productId
21+
transactionId:(NSString *)transactionId
22+
purchaseType:(AFSDKPurchaseType)purchaseType NS_DESIGNATED_INITIALIZER;
2223

2324
@end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// AFSDKPurchaseType.h
3+
// AppsFlyerLib
4+
//
5+
// Created by Amit Levy on 13/05/2025.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
10+
typedef NS_CLOSED_ENUM(NSUInteger, AFSDKPurchaseType) {
11+
AFSDKPurchaseTypeSubscription,
12+
AFSDKPurchaseTypeOneTimePurchase
13+
} NS_SWIFT_NAME(AFSDKPurchaseType);
14+
15+
// Helper to get string route name
16+
FOUNDATION_EXPORT NSString *StringFromAFSDKPurchaseType(AFSDKPurchaseType type);

Classes/AppsFlyer/libAppsFlyer/AFSDKValidateAndLogResult.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
typedef NS_CLOSED_ENUM(NSUInteger, AFSDKValidateAndLogStatus) {
1010
AFSDKValidateAndLogStatusSuccess,
1111
AFSDKValidateAndLogStatusFailure,
12-
AFSDKValidateAndLogStatusError
12+
AFSDKValidateAndLogStatusError
1313
} NS_SWIFT_NAME(ValidateAndLogStatus);
1414

1515
NS_SWIFT_NAME(ValidateAndLogResult)
16-
@interface AFSDKValidateAndLogResult: NSObject
17-
16+
@interface AFSDKValidateAndLogResult : NSObject
17+
1818
- (nonnull instancetype)init NS_UNAVAILABLE;
1919
+ (nonnull instancetype)new NS_UNAVAILABLE;
2020

Classes/AppsFlyer/libAppsFlyer/AppsFlyerConsent.h

Lines changed: 0 additions & 26 deletions
This file was deleted.

Classes/AppsFlyer/libAppsFlyer/AppsFlyerLib-Swift.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#if 0
22
#elif defined(__arm64__) && __arm64__
3-
// Generated by Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)
3+
// Generated by Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
44
#ifndef APPSFLYERLIB_SWIFT_H
55
#define APPSFLYERLIB_SWIFT_H
66
#pragma clang diagnostic push
@@ -277,6 +277,8 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
277277
#if __has_warning("-Watimport-in-framework-header")
278278
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
279279
#endif
280+
@import Foundation;
281+
@import ObjectiveC;
280282
#endif
281283

282284
#endif
@@ -297,6 +299,24 @@ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
297299
#endif
298300

299301
#if defined(__OBJC__)
302+
@class NSNumber;
303+
@class NSCoder;
304+
305+
SWIFT_CLASS_NAMED("AppsFlyerConsent")
306+
@interface AppsFlyerConsent : NSObject <NSCoding>
307+
@property (nonatomic, readonly) BOOL isUserSubjectToGDPR;
308+
@property (nonatomic, readonly) BOOL hasConsentForDataUsage;
309+
@property (nonatomic, readonly) BOOL hasConsentForAdsPersonalization;
310+
@property (nonatomic, readonly, strong) NSNumber * _Nullable hasConsentForAdStorage;
311+
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
312+
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
313+
- (nonnull instancetype)initWithNonGDPRUser SWIFT_DEPRECATED_MSG("Use init(isUserSubjectToGDPR:, hasConsentForDataUsage:, hasConsentForAdsPersonalization:, hasConsentForAdStorage:) instead");
314+
- (nonnull instancetype)initWithIsUserSubjectToGDPR:(NSNumber * _Nullable)isUserSubjectToGDPR hasConsentForDataUsage:(NSNumber * _Nullable)hasConsentForDataUsage hasConsentForAdsPersonalization:(NSNumber * _Nullable)hasConsentForAdsPersonalization hasConsentForAdStorage:(NSNumber * _Nullable)hasConsentForAdStorage;
315+
- (nonnull instancetype)initForGDPRUserWithHasConsentForDataUsage:(BOOL)forGDPRUserWithHasConsentForDataUsage hasConsentForAdsPersonalization:(BOOL)hasConsentForAdsPersonalization SWIFT_DEPRECATED_MSG("Use init(isUserSubjectToGDPR:, hasConsentForDataUsage:, hasConsentForAdsPersonalization:, hasConsentForAdStorage:) instead");
316+
- (void)encodeWithCoder:(NSCoder * _Nonnull)coder;
317+
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder;
318+
@end
319+
300320
#endif
301321
#if __has_attribute(external_source_symbol)
302322
# pragma clang attribute pop

Classes/AppsFlyer/libAppsFlyer/AppsFlyerLib.h

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// AppsFlyerLib.h
33
// AppsFlyerLib
44
//
5-
// AppsFlyer iOS SDK 6.15.3 (217)
5+
// AppsFlyer iOS SDK 6.12.2 (999)
66
// Copyright (c) 2012-2023 AppsFlyer Ltd. All rights reserved.
77
//
88

@@ -12,11 +12,12 @@
1212
#import "AppsFlyerShareInviteHelper.h"
1313
#import "AppsFlyerDeepLinkResult.h"
1414
#import "AppsFlyerDeepLink.h"
15-
#import "AppsFlyerConsent.h"
1615
#import "AFSDKPurchaseDetails.h"
16+
#import "AFSDKPurchaseType.h"
1717
#import "AFSDKValidateAndLogResult.h"
1818
#import "AFAdRevenueData.h"
1919

20+
2021
NS_ASSUME_NONNULL_BEGIN
2122

2223
// In app event names constants
@@ -129,13 +130,8 @@ NS_ASSUME_NONNULL_BEGIN
129130
#define AFEventParamPreferredNeighborhoods @"af_preferred_neighborhoods" //array of string
130131
#define AFEventParamPreferredNumStops @"af_preferred_num_stops"
131132

132-
#define AFEventParamAdRevenueAdType @"af_adrev_ad_type"
133-
#define AFEventParamAdRevenueNetworkName @"af_adrev_network_name"
134-
#define AFEventParamAdRevenuePlacementId @"af_adrev_placement_id"
135-
#define AFEventParamAdRevenueAdSize @"af_adrev_ad_size"
136-
#define AFEventParamAdRevenueMediatedNetworkName @"af_adrev_mediated_network_name"
137-
138133

134+
@class AppsFlyerConsent;
139135
/// Mail hashing type
140136
typedef enum {
141137
/// None
@@ -496,16 +492,28 @@ NS_SWIFT_NAME(logEvent(name:values:completionHandler:));
496492
typedef void (^AFSDKValidateAndLogCompletion)(AFSDKValidateAndLogResult * _Nullable result);
497493

498494
/**
499-
To log and validate in app purchases you can call this method from the completeTransaction: method on
500-
your `SKPaymentTransactionObserver`.
495+
Validates and logs an in-app purchase using the updated VAL V2 flow.
496+
497+
This method should be called after a successful transaction, typically from:
498+
- `paymentQueue:updatedTransactions:` in your `SKPaymentTransactionObserver` (StoreKit 1)
499+
- `transaction.listener` or `.finishTransaction()` or `VerificationResult<SignedType>` in StoreKit 2 (iOS 15+)
500+
501+
@param purchaseDetails a `AFSDKPurchaseDetails` object. Must include:
502+
- `productId` (non-empty)
503+
- `transactionId` (non-empty)
504+
- `purchaseType` ( `.subscription`, `.oneTimePurchase`)
501505
502-
@param details The product details
503-
@param extraEventValues The additional param, which you want to receive it in the raw reports
504-
@param completionHandler The callback
506+
@param purchaseAdditionalDetails Optional metadata associated with the purchase
507+
(previously known as `extraEventValues`). This can include custom app-level context.
508+
509+
@param completion Completion block with either a response dictionary or an NSError.
510+
On success: `response` contains a parsed result.
511+
On failure: `error` describes the reason (validation failure, networking issue...)
505512
*/
506-
- (void)validateAndLogInAppPurchase:(AFSDKPurchaseDetails *)details
507-
extraEventValues:(NSDictionary * _Nullable)extraEventValues
508-
completionHandler:(AFSDKValidateAndLogCompletion)completionHandler NS_AVAILABLE(10_7, 7_0);
513+
- (void)validateAndLogInAppPurchase:(AFSDKPurchaseDetails *)purchaseDetails
514+
purchaseAdditionalDetails:(NSDictionary * _Nullable)purchaseAdditionalDetails
515+
completion:(void (^)(NSDictionary * _Nullable response, NSError * _Nullable error))completion
516+
NS_SWIFT_NAME(validateAndLogInAppPurchase(purchaseDetails:purchaseAdditionalDetails:completion:));
509517

510518
/**
511519
An API to provide the data from the impression payload to AdRevenue.
@@ -695,6 +703,14 @@ typedef void (^AFSDKValidateAndLogCompletion)(AFSDKValidateAndLogResult * _Nulla
695703
- (void)setSharingFilterForPartners:(NSArray<NSString *> * _Nullable)sharingFilter;
696704

697705

706+
/**
707+
Sets Custom Install Id - this overrides the default AppsFlyer Install ID.
708+
Only effective if Info.plist has `AppsFlyerAllowCustomInstallId=YES`
709+
* Must be called before calling set appsFlyerDevKey and appleAppID
710+
@param customID the customId.
711+
*/
712+
- (void)setInstallId:(NSString *)customID;
713+
698714
/**
699715
Sets or updates the user consent data related to GDPR and DMA regulations for advertising and data usage
700716
purposes within the application. This method must be invoked with the user's current consent status each

0 commit comments

Comments
 (0)