class DisplayCallbacksImpl implements FirebaseInAppMessagingDisplayCallbacks {

  @Override
  public Task<Void> messageDismissed(InAppMessagingDismissType dismissType) {

    /**
     * NOTE: While the api is passing us the campaign id via the FIAM, we pull the campaignId from
     * the cache to ensure that we're only logging events for campaigns that we've fetched - to
     * avoid implicitly trusting an id that is provided through the app
     */
    String MESSAGE_DISMISSAL = "message dismissal to metrics logger";
    if (shouldLog()) {
      Logging.logd("Attempting to record: " + MESSAGE_DISMISSAL);
      Completable completable =
          Completable.fromAction(() -> metricsLoggerClient.logDismiss(inAppMessage, dismissType));

      return logImpressionIfNeeded(completable);
    }
    logActionNotTaken(MESSAGE_DISMISSAL);
    return new TaskCompletionSource<Void>().getTask();
  }

  @VisibleForTesting  DisplayCallbacksImpl(
      ImpressionStorageClient impressionStorageClient,
      Clock clock,
      Schedulers schedulers,
      RateLimiterClient rateLimiterClient,
      CampaignCacheClient campaignCacheClient,
      RateLimit appForegroundRateLimit,
      MetricsLoggerClient metricsLoggerClient,
      DataCollectionHelper dataCollectionHelper,
      InAppMessage inAppMessage,
      String triggeringEvent);

}