Skip to content

Commit

Permalink
prevent sending start on BG/FG
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-kremer93 committed Aug 25, 2022
1 parent 762c206 commit 29aae99
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions ios/RNAppsFlyer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


@interface RNAppsFlyer: RCTEventEmitter <RCTBridgeModule, AppsFlyerLibDelegate, AppsFlyerDeepLinkDelegate>
@property (readwrite, nonatomic) BOOL isManualStart;
@end


Expand Down
8 changes: 6 additions & 2 deletions ios/RNAppsFlyer.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ -(NSError *) callSdkInternal:(NSDictionary*)initSdkOptions {
devKey = (NSString*)[initSdkOptions objectForKey: afDevKey];
appId = (NSString*)[initSdkOptions objectForKey: afAppId];
interval = (NSNumber*)[initSdkOptions objectForKey: timeToWaitForATTUserAuthorization];
isManualStart = initSdkOptions[@"manualStart"];
isManualStart = [[initSdkOptions objectForKey:@"manualStart"] boolValue];
[self setIsManualStart:isManualStart];

isDebugValue = [initSdkOptions objectForKey: afIsDebug];
if ([isDebugValue isKindOfClass:[NSNumber class]]) {
Expand Down Expand Up @@ -113,6 +114,7 @@ -(NSError *) callSdkInternal:(NSDictionary*)initSdkOptions {
}

RCT_EXPORT_METHOD(startSdk) {
[self setIsManualStart:NO];
[[AppsFlyerLib shared] start];
}

Expand Down Expand Up @@ -221,7 +223,9 @@ -(NSError *) callSdkInternal:(NSDictionary*)initSdkOptions {

-(void)sendLaunch:(UIApplication *)application {
[[NSNotificationCenter defaultCenter] postNotificationName:RNAFBridgeInitializedNotification object:self];
[[AppsFlyerLib shared] start];
if (![self isManualStart]) {
[[AppsFlyerLib shared] start];
}
}

RCT_EXPORT_METHOD(setAdditionalData: (NSDictionary *)additionalData callback:(RCTResponseSenderBlock)callback) {
Expand Down

0 comments on commit 29aae99

Please sign in to comment.