Skip to content

Commit 1200702

Browse files
committed
Additional bug fixes
- iOS: Fixing a conflict with the 'SUCCESS' symbol declared in another third-party library. [Related to newArch and RN 0.76] - iOS: Update import typo - iOS: Fixing other booleans to pass by value and not by reference
1 parent 7301115 commit 1200702

File tree

4 files changed

+27
-22
lines changed

4 files changed

+27
-22
lines changed

demos/appsflyer-react-native-app/components/AppsFlyer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ const initOptions = {
2121
export function AFInit() {
2222
if (Platform.OS == 'ios') {
2323
appsFlyer.setCurrentDeviceLanguage("EN");
24+
appsFlyer.disableSKAD(true);
2425
}
26+
27+
appsFlyer.anonymizeUser(true);
28+
appsFlyer.enableTCFDataCollection(true);
29+
2530
appsFlyer.setAppInviteOneLinkID('oW4R');
2631
appsFlyer.initSdk(initOptions, null, null);
2732
}

ios/AppsFlyerLib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#import <AppsFlyerLib/AppsFlyerDeepLinkResult.h>
1414
#import <AppsFlyerLib/AppsFlyerDeepLink.h>
1515
#import <AppsFlyerLib/AppsFlyerConsent.h>
16-
#import <AppsFlyerLib/AppsFlyerAdRevenueData.h>
16+
#import <AppsFlyerLib/AFAdRevenueData.h>
1717

1818
NS_ASSUME_NONNULL_BEGIN
1919

ios/RNAppsFlyer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static NSString *const NO_DEVKEY_FOUND = @"No 'devKey' found or its
2727
static NSString *const NO_APPID_FOUND = @"No 'appId' found or its empty";
2828
static NSString *const NO_EVENT_NAME_FOUND = @"No 'eventName' found or its empty";
2929
static NSString *const EMPTY_OR_CORRUPTED_LIST = @"No arguments found or list is corrupted";
30-
static NSString *const SUCCESS = @"Success";
30+
static NSString *const AF_SUCCESS = @"Success";
3131
static NSString *const INVALID_URI = @"Invalid URI";
3232
static NSString *const IOS_14_ONLY = @"Feature only supported on iOS 14 and above";
3333

ios/RNAppsFlyer.m

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ @implementation RNAppsFlyer
1414
NSError* error = nil;
1515
error = [self callSdkInternal:initSdkOptions];
1616
if (error == nil){
17-
successCallback(@[SUCCESS]);
17+
successCallback(@[AF_SUCCESS]);
1818
}else{
1919
errorCallback(error);
2020
}
@@ -27,7 +27,7 @@ @implementation RNAppsFlyer
2727
NSError* error = nil;
2828
error = [self callSdkInternal:initSdkOptions];
2929
if (error == nil){
30-
resolve(@[SUCCESS]);
30+
resolve(@[AF_SUCCESS]);
3131
}else{
3232
reject([NSString stringWithFormat: @"%ld", (long)error.code], error.domain, error); }
3333
}
@@ -141,7 +141,7 @@ -(NSError *) callSdkInternal:(NSDictionary*)initSdkOptions {
141141
errorCallback(@[error.localizedDescription]);
142142
return;
143143
}
144-
successCallback(@[SUCCESS]);
144+
successCallback(@[AF_SUCCESS]);
145145
}];
146146
}
147147

@@ -159,7 +159,7 @@ -(NSError *) callSdkInternal:(NSDictionary*)initSdkOptions {
159159
reject([NSString stringWithFormat: @"%ld", (long)error.code], error.domain, error);
160160
return;
161161
}
162-
resolve(@[SUCCESS]);
162+
resolve(@[AF_SUCCESS]);
163163
}];
164164
}
165165

@@ -238,18 +238,18 @@ -(NSError *) callSdkInternal:(NSDictionary*)initSdkOptions {
238238

239239
RCT_EXPORT_METHOD(setCustomerUserId: (NSString *)userId callback:(RCTResponseSenderBlock)callback) {
240240
[[AppsFlyerLib shared] setCustomerUserID:userId];
241-
callback(@[SUCCESS]);
241+
callback(@[AF_SUCCESS]);
242242
}
243243

244244
RCT_EXPORT_METHOD(stop: (BOOL)isStopped callback:(RCTResponseSenderBlock)callback) {
245245
[AppsFlyerLib shared].isStopped = isStopped;
246-
callback(@[SUCCESS]);
246+
callback(@[AF_SUCCESS]);
247247
}
248248

249249
RCT_EXPORT_METHOD(logLocation: (double)longitude latitude:(double)latitude callback:(RCTResponseSenderBlock)callback) {
250250
[[AppsFlyerLib shared] logLocation:longitude latitude:latitude];
251251
NSArray *events = @[[NSNumber numberWithDouble:longitude], [NSNumber numberWithDouble:latitude]];
252-
callback(@[SUCCESS, events]);
252+
callback(@[AF_SUCCESS, events]);
253253
}
254254

255255
RCT_EXPORT_METHOD(setUserEmails: (NSDictionary*)options
@@ -288,7 +288,7 @@ -(NSError *) callSdkInternal:(NSDictionary*)initSdkOptions {
288288
}
289289
else{
290290
[[AppsFlyerLib shared] setUserEmails:emails withCryptType:emailsCryptType];
291-
successCallback(@[SUCCESS]);
291+
successCallback(@[AF_SUCCESS]);
292292
}
293293
}
294294

@@ -301,19 +301,19 @@ -(void)sendLaunch:(UIApplication *)application {
301301

302302
RCT_EXPORT_METHOD(setAdditionalData: (NSDictionary *)additionalData callback:(RCTResponseSenderBlock)callback) {
303303
[[AppsFlyerLib shared] setAdditionalData:additionalData];
304-
callback(@[SUCCESS]);
304+
callback(@[AF_SUCCESS]);
305305
}
306306

307307
//USER INVITES
308308

309309
RCT_EXPORT_METHOD(setAppInviteOneLinkID: (NSString *)oneLinkID callback:(RCTResponseSenderBlock)callback) {
310310
[AppsFlyerLib shared].appInviteOneLinkID = oneLinkID;
311-
callback(@[SUCCESS]);
311+
callback(@[AF_SUCCESS]);
312312
}
313313

314314
RCT_EXPORT_METHOD(setCurrencyCode: (NSString *)currencyCode callback:(RCTResponseSenderBlock)callback) {
315315
[[AppsFlyerLib shared] setCurrencyCode:currencyCode];
316-
callback(@[SUCCESS]);
316+
callback(@[AF_SUCCESS]);
317317
}
318318

319319
RCT_EXPORT_METHOD(generateInviteLink: (NSDictionary *)inviteLinkOptions
@@ -501,7 +501,7 @@ - (BOOL)isExpoApp {
501501

502502
RCT_EXPORT_METHOD(anonymizeUser: (BOOL)b callback:(RCTResponseSenderBlock)callback) {
503503
[AppsFlyerLib shared].anonymizeUser = b;
504-
callback(@[SUCCESS]);
504+
callback(@[AF_SUCCESS]);
505505
}
506506

507507
RCT_EXPORT_METHOD(updateServerUninstallToken: (NSString *)deviceToken callback:(RCTResponseSenderBlock)callback) {
@@ -517,21 +517,21 @@ - (BOOL)isExpoApp {
517517
[deviceTokenData appendBytes:&whole_byte length:1];
518518
}
519519
[[AppsFlyerLib shared] registerUninstall:deviceTokenData];
520-
callback(@[SUCCESS]);
520+
callback(@[AF_SUCCESS]);
521521
}
522522

523523
RCT_EXPORT_METHOD(setOneLinkCustomDomains:(NSArray *) domains
524524
successCallback :(RCTResponseSenderBlock)successCallback
525525
errorCallback:(RCTResponseErrorBlock)errorCallback) {
526526
[[AppsFlyerLib shared] setOneLinkCustomDomains:domains];
527-
successCallback(@[SUCCESS]);
527+
successCallback(@[AF_SUCCESS]);
528528
}
529529

530530
RCT_EXPORT_METHOD(setResolveDeepLinkURLs:(NSArray *) urls
531531
successCallback :(RCTResponseSenderBlock)successCallback
532532
errorCallback:(RCTResponseErrorBlock)errorCallback) {
533533
[[AppsFlyerLib shared] setResolveDeepLinkURLs:urls];
534-
successCallback(@[SUCCESS]);
534+
successCallback(@[AF_SUCCESS]);
535535
}
536536

537537
RCT_EXPORT_METHOD(performOnAppAttribution:(NSString *) urlString
@@ -543,7 +543,7 @@ - (BOOL)isExpoApp {
543543
errorCallback(error);
544544
} else {
545545
[[AppsFlyerLib shared] performOnAppAttributionWithURL:url];
546-
successCallback(@[SUCCESS]);
546+
successCallback(@[AF_SUCCESS]);
547547
}
548548
}
549549

@@ -606,16 +606,16 @@ - (BOOL)isExpoApp {
606606

607607
RCT_EXPORT_METHOD(setHost: (NSString*)hostPrefix hostName: (NSString*)hostName successCallback :(RCTResponseSenderBlock)successCallback) {
608608
[[AppsFlyerLib shared] setHost:hostName withHostPrefix:hostPrefix];
609-
successCallback(@[SUCCESS]);
609+
successCallback(@[AF_SUCCESS]);
610610
}
611611

612612
RCT_EXPORT_METHOD(addPushNotificationDeepLinkPath: (NSArray*)path successCallback :(RCTResponseSenderBlock)successCallback
613613
errorCallback:(RCTResponseErrorBlock)errorCallback) {
614614
[[AppsFlyerLib shared] addPushNotificationDeepLinkPath: path];
615-
successCallback(@[SUCCESS]);
615+
successCallback(@[AF_SUCCESS]);
616616
}
617617

618-
RCT_EXPORT_METHOD(disableSKAD: (BOOL *)b ) {
618+
RCT_EXPORT_METHOD(disableSKAD: (BOOL)b ) {
619619
[AppsFlyerLib shared].disableSKAdNetwork = b;
620620
if (b){
621621
NSLog(@"[DEBUG] AppsFlyer: SKADNetwork is disabled");
@@ -636,7 +636,7 @@ - (BOOL)isExpoApp {
636636
[[AppsFlyerLib shared] appendParametersToDeepLinkingURLWithString:contains parameters:parameters];
637637
}
638638

639-
RCT_EXPORT_METHOD(enableTCFDataCollection:(BOOL *)enabled) {
639+
RCT_EXPORT_METHOD(enableTCFDataCollection:(BOOL)enabled) {
640640
[[AppsFlyerLib shared] enableTCFDataCollection:enabled];
641641
}
642642

0 commit comments

Comments
 (0)