-
- All Implemented Interfaces:
-
com.appsflyer.internal.migraton.BranchMigrationManager
public final class BranchMigrationManagerImpl implements BranchMigrationManager
-
-
Constructor Summary
Constructors Constructor Description BranchMigrationManagerImpl(IdProvider idProvider, ReferrersManager referrersManager)
-
Method Summary
Modifier and Type Method Description UnitaddLatdDataToConversion(AFEvent conversionEvent)Adds LATD data to a Conversion Event if available. UnitaddLatdDataToAttr(AFEvent attrEvent)Adds LATD to the given Attr event if available. UnittriggerAttrIfNeeded(SendLaunchTask finishedTask, Function0<Unit> triggerAttrCallback)Triggers an attribution (Attr) event if specific conditions are met. BooleanhasLatdDataBeenAddedToConversionPayload()BooleanshouldAddBranchDeepLinkDataToLaunch()Unitreset()Sets the shouldAddBranchDeepLinkDataflag false.UnitcheckIfShouldAddBranchDeeplinkData(Intent intent, AFDeepLinkManager deeplinkManager)Determines whether Branch deeplink data should be collected for the next launch event based on the incoming Intent's Uri. UnitaddBranchDeeplinkDataToLaunch(AFEvent launchEvent)Adds Branch's DeeplinkingData to the given launch event if data is available. -
-
Constructor Detail
-
BranchMigrationManagerImpl
BranchMigrationManagerImpl(IdProvider idProvider, ReferrersManager referrersManager)
-
-
Method Detail
-
addLatdDataToConversion
Unit addLatdDataToConversion(AFEvent conversionEvent)
Adds LATD data to a Conversion Event if available. Assigns the
trueresult to thehasLatdDataBeenAddedToConversionEventproperty. This allows further use of the fetched LATD data, such as determining whether to trigger an Attr event.- Parameters:
conversionEvent- the Conversion event to which LATD data will be added.
-
addLatdDataToAttr
Unit addLatdDataToAttr(AFEvent attrEvent)
Adds LATD to the given Attr event if available.
This function performs the following:
If
attrLatdDatais not null, it indicates that LATD data was already fetched whentriggerAttrIfNeededwas called earlier. In this case, the data is directly added to the event.If
attrLatdDatais null, it attempts to fetch LATD data within a 3-second timeout (FETCH_LATD_TIMEOUT). If data is successfully fetched and is not null, it is added to the event.
- Parameters:
attrEvent- the Attr event (AFEvent) to which LATD data will be added if available.
-
triggerAttrIfNeeded
Unit triggerAttrIfNeeded(SendLaunchTask finishedTask, Function0<Unit> triggerAttrCallback)
Triggers an attribution (Attr) event if specific conditions are met.
This method evaluates the following conditions to determine if the Attr event should be triggered:
The current launch is the first launch (launchCounter equals 1).
The provided task (
finishedTask) is of typeCONVERSION.All referrers have been collected (as indicated by the
referrersManager.hasStartedReferrers()check returningfalse).LATD data has not already been added to Conversion Event (
hasLatdDataBeenAddedToConversionPayload()returnsfalse).
If all conditions are satisfied, the method waits for LATD data to be fetched within a specified timeout (
FETCH_LATD_TIMEOUT). If LATD data is received and is not null, the data is assigned tolatdData, and thetriggerAttrCallbackfunction is invoked.- Parameters:
finishedTask- the completed task to evaluate.triggerAttrCallback- a callback function to be executed if the Attr event is triggered.
-
hasLatdDataBeenAddedToConversionPayload
Boolean hasLatdDataBeenAddedToConversionPayload()
-
shouldAddBranchDeepLinkDataToLaunch
Boolean shouldAddBranchDeepLinkDataToLaunch()
-
reset
Unit reset()
Sets the
shouldAddBranchDeepLinkDataflag false. Also clears collected data in Migration helper. Should be called when apponBecameBackground().
-
checkIfShouldAddBranchDeeplinkData
Unit checkIfShouldAddBranchDeeplinkData(Intent intent, AFDeepLinkManager deeplinkManager)
Determines whether Branch deeplink data should be collected for the next launch event based on the incoming Intent's Uri.
If Migration helper already has deeplinkg data - shouldAddBranchDeepLinkData will be set to
true.If intent.data is
null, this method immediately returns and Branch deeplink data will not be collected.If intent.data is non-null, the URI is checked against OneLinkValidator. If it’s identified as a branded (customDomain) or OneLink (
isOneLink == trueORisBranded == true), Branch data is not collected. Otherwise, shouldAddBranchDeepLinkData is set totrue.
As long as the final Activity receives a non-null URI that isn’t recognized as a OneLink or customDomain (Branded), Branch data collection is enabled. If the URI is
null, we skip collecting Branch data entirely.- Parameters:
intent- The Intent that may carry a deeplink Uri.deeplinkManager- Reference to the AppsFlyer deep link manager, used by OneLinkValidator.
-
addBranchDeeplinkDataToLaunch
Unit addBranchDeeplinkDataToLaunch(AFEvent launchEvent)
Adds Branch's DeeplinkingData to the given launch event if data is available.
- Parameters:
launchEvent- the launch event to which the data will be added.
-
-
-
-