@Test public void logDismiss_doesNothingIfDataCollectionIsDisabled() { when(dataCollectionHelper.isAutomaticDataCollectionEnabled()).thenReturn(false); displayCallbacksImpl.messageDismissed(InAppMessagingDismissType.SWIPE); verify(metricsLoggerClient, times(0)) .logDismiss(BANNER_MESSAGE_MODEL, InAppMessagingDismissType.SWIPE); }
@Override public Task<Void> messageDismissed(InAppMessagingDismissType dismissType) { 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(); }
DisplayCallbacksImpl implements FirebaseInAppMessagingDisplayCallbacks { @Override public Task<Void> messageDismissed(InAppMessagingDismissType dismissType) { 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(); } }
DisplayCallbacksImpl implements FirebaseInAppMessagingDisplayCallbacks { @Override public Task<Void> messageDismissed(InAppMessagingDismissType dismissType) { 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); }
DisplayCallbacksImpl implements FirebaseInAppMessagingDisplayCallbacks { @Override public Task<Void> messageDismissed(InAppMessagingDismissType dismissType) { 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); @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> messageDismissed(InAppMessagingDismissType dismissType) { 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); @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);  }