update method

  1. @override
void update(
  1. Map<String, dynamic> settings,
  2. ContextUpdateType type
)
override

Implementation

@override
void update(Map<String, dynamic> settings, ContextUpdateType type) {
  final appsflyerSettingsJson = settings["AppsFlyer"];

  if (appsflyerSettingsJson == null) {
    return;
  }
  final clientConfig = analytics!.state.configuration.state;

  appsFlyerSettings = AppsFlyerSettings.fromJson(appsflyerSettingsJson);

  if (!hasInitialized) {
    AppsFlyerOptions appsFlyerOptions = AppsFlyerOptions(
        afDevKey: appsFlyerSettings!.appsFlyerDevKey,
        appId: appsFlyerSettings!.appleAppID ?? "",
        showDebug: Analytics.debug,
        timeToWaitForATTUserAuthorization: 50); // for iOS 14.5
    appsFlyer = AppsflyerSdk(appsFlyerOptions);
    appsFlyer!.initSdk(
        registerConversionDataCallback:
            appsFlyerSettings!.trackAttributionData,
        registerOnDeepLinkingCallback: clientConfig.trackDeeplinks == true);
    hasInitialized = true;
  }

  if (appsFlyerSettings!.trackAttributionData &&
      !hasRegisteredInstallCallback) {
    registerConversionCallback();
    hasRegisteredInstallCallback = true;
  }

  if (clientConfig.trackDeeplinks == true && !hasRegisteredDeepLinkCallback) {
    registerDeepLinkCallback();
    hasRegisteredDeepLinkCallback = true;
  }
}