@Test public void logImpression_forVanillaCampaign_completesTask() { Task<Void> logActionTask = displayCallbacksImpl.impressionDetected(); assertThat(logActionTask.isComplete()).isTrue(); }
@Override public Task<Void> impressionDetected() { String MESSAGE_IMPRESSION = "message impression to metrics logger"; if (shouldLog() && !wasImpressed) { Logging.logd("Attempting to record: " + MESSAGE_IMPRESSION); Completable logImpressionToMetricsLogger = Completable.fromAction(() -> metricsLoggerClient.logImpression(inAppMessage)); Completable logImpressionCompletable = logToImpressionStore() .andThen(logImpressionToMetricsLogger) .andThen(updateWasImpressed()); return maybeToTask(logImpressionCompletable.toMaybe(), schedulers.io()); } logActionNotTaken(MESSAGE_IMPRESSION); return new TaskCompletionSource<Void>().getTask(); }
DisplayCallbacksImpl implements FirebaseInAppMessagingDisplayCallbacks { @Override public Task<Void> impressionDetected() { String MESSAGE_IMPRESSION = "message impression to metrics logger"; if (shouldLog() && !wasImpressed) { Logging.logd("Attempting to record: " + MESSAGE_IMPRESSION); Completable logImpressionToMetricsLogger = Completable.fromAction(() -> metricsLoggerClient.logImpression(inAppMessage)); Completable logImpressionCompletable = logToImpressionStore() .andThen(logImpressionToMetricsLogger) .andThen(updateWasImpressed()); return maybeToTask(logImpressionCompletable.toMaybe(), schedulers.io()); } logActionNotTaken(MESSAGE_IMPRESSION); return new TaskCompletionSource<Void>().getTask(); } }
DisplayCallbacksImpl implements FirebaseInAppMessagingDisplayCallbacks { @Override public Task<Void> impressionDetected() { String MESSAGE_IMPRESSION = "message impression to metrics logger"; if (shouldLog() && !wasImpressed) { Logging.logd("Attempting to record: " + MESSAGE_IMPRESSION); Completable logImpressionToMetricsLogger = Completable.fromAction(() -> metricsLoggerClient.logImpression(inAppMessage)); Completable logImpressionCompletable = logToImpressionStore() .andThen(logImpressionToMetricsLogger) .andThen(updateWasImpressed()); return maybeToTask(logImpressionCompletable.toMaybe(), schedulers.io()); } logActionNotTaken(MESSAGE_IMPRESSION); 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); }
DisplayCallbacksImpl implements FirebaseInAppMessagingDisplayCallbacks { @Override public Task<Void> impressionDetected() { String MESSAGE_IMPRESSION = "message impression to metrics logger"; if (shouldLog() && !wasImpressed) { Logging.logd("Attempting to record: " + MESSAGE_IMPRESSION); Completable logImpressionToMetricsLogger = Completable.fromAction(() -> metricsLoggerClient.logImpression(inAppMessage)); Completable logImpressionCompletable = logToImpressionStore() .andThen(logImpressionToMetricsLogger) .andThen(updateWasImpressed()); return maybeToTask(logImpressionCompletable.toMaybe(), schedulers.io()); } logActionNotTaken(MESSAGE_IMPRESSION); 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); @Override Task<Void> impressionDetected(); @Override Task<Void> messageDismissed(InAppMessagingDismissType dismissType); @Deprecated Task<Void> messageClicked(); @Override Task<Void> messageClicked(Action action); @Override Task<Void> displayErrorEncountered(InAppMessagingErrorReason errorReason); }
DisplayCallbacksImpl implements FirebaseInAppMessagingDisplayCallbacks { @Override public Task<Void> impressionDetected() { String MESSAGE_IMPRESSION = "message impression to metrics logger"; if (shouldLog() && !wasImpressed) { Logging.logd("Attempting to record: " + MESSAGE_IMPRESSION); Completable logImpressionToMetricsLogger = Completable.fromAction(() -> metricsLoggerClient.logImpression(inAppMessage)); Completable logImpressionCompletable = logToImpressionStore() .andThen(logImpressionToMetricsLogger) .andThen(updateWasImpressed()); return maybeToTask(logImpressionCompletable.toMaybe(), schedulers.io()); } logActionNotTaken(MESSAGE_IMPRESSION); 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); @Override Task<Void> impressionDetected(); @Override Task<Void> messageDismissed(InAppMessagingDismissType dismissType); @Deprecated Task<Void> messageClicked(); @Override Task<Void> messageClicked(Action action); @Override Task<Void> displayErrorEncountered(InAppMessagingErrorReason errorReason);  }