Skip to content

Commit

Permalink
Flush Events if AEM campaign id is found
Browse files Browse the repository at this point in the history
Summary: We'd like to flush events if AEM campaign id is found

Reviewed By: wx0165927473

Differential Revision: D44314208

fbshipit-source-id: 35a570ce4b5b32df16cfdca3ab5e8192dc260246
  • Loading branch information
KylinChang authored and facebook-github-bot committed Mar 22, 2023
1 parent 014f33b commit 97a160e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions FBSDKCoreKit/FBSDKCoreKit/AppEvents/FBSDKAppEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,11 @@ - (void) logEvent:(FBSDKAppEventName)eventName
}

[self checkPersistedEvents];

if (nil != [self.appEventsUtility getCampaignIDs]) {
[self flushForReason:FBSDKAppEventsFlushReasonEagerlyFlushingEvent];
return;
}

if (self.appEventsState.events.count > NUM_LOG_EVENTS_TO_TRY_TO_FLUSH_AFTER
&& self.flushBehavior != FBSDKAppEventsFlushBehaviorExplicitOnly) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ NS_SWIFT_NAME(_AppEventsUtilityProtocol)
loggingOverrideAppID:(nullable NSString *)loggingOverrideAppID;
- (NSString *)flushReasonToString:(FBSDKAppEventsFlushReason)flushReason;
- (void)saveCampaignIDs:(NSURL *)url;
- (nullable NSString *)getCampaignIDs;

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ final class TestAppEventsUtility: NSObject, _AppEventDropDetermining, _AppEventP
func logAndNotify(_ message: String, allowLogAsDeveloperError: Bool) {}

func saveCampaignIDs(_ url: URL) {}

func getCampaignIDs() -> String? {
nil
}
}

0 comments on commit 97a160e

Please sign in to comment.