@Test public void extractAnalyticsEventNames_filtersOutFiamEvents() { FetchEligibleCampaignsResponse campaignsResponse = FetchEligibleCampaignsResponse.newBuilder() .setExpirationEpochTimestampMillis(FUTURE) .addMessages(ANALYTICS_EVENT_THICK_CONTENT_BUILDER) .addMessages(FOREGROUND_THICK_CONTENT_BUILDER) .build(); Set<String> eventNames = AnalyticsEventsManager.extractAnalyticsEventNames(campaignsResponse); assertThat(eventNames).containsExactly(ANALYTICS_EVENT_1); }
@VisibleForTesting static Set<String> extractAnalyticsEventNames(FetchEligibleCampaignsResponse response) { Set<String> analyticsEvents = new HashSet<>(); for (CampaignProto.ThickContent content : response.getMessagesList()) { for (CommonTypesProto.TriggeringCondition condition : content.getTriggeringConditionsList()) { if (!TextUtils.isEmpty(condition.getEvent().getName())) { analyticsEvents.add(condition.getEvent().getName()); } } } if (analyticsEvents.size() > AnalyticsConstants.MAX_REGISTERED_EVENTS) { Logging.logi(TOO_MANY_CONTEXTUAL_TRIGGERS_ERROR); } return analyticsEvents; }
AnalyticsEventsManager { @VisibleForTesting static Set<String> extractAnalyticsEventNames(FetchEligibleCampaignsResponse response) { Set<String> analyticsEvents = new HashSet<>(); for (CampaignProto.ThickContent content : response.getMessagesList()) { for (CommonTypesProto.TriggeringCondition condition : content.getTriggeringConditionsList()) { if (!TextUtils.isEmpty(condition.getEvent().getName())) { analyticsEvents.add(condition.getEvent().getName()); } } } if (analyticsEvents.size() > AnalyticsConstants.MAX_REGISTERED_EVENTS) { Logging.logi(TOO_MANY_CONTEXTUAL_TRIGGERS_ERROR); } return analyticsEvents; } }
AnalyticsEventsManager { @VisibleForTesting static Set<String> extractAnalyticsEventNames(FetchEligibleCampaignsResponse response) { Set<String> analyticsEvents = new HashSet<>(); for (CampaignProto.ThickContent content : response.getMessagesList()) { for (CommonTypesProto.TriggeringCondition condition : content.getTriggeringConditionsList()) { if (!TextUtils.isEmpty(condition.getEvent().getName())) { analyticsEvents.add(condition.getEvent().getName()); } } } if (analyticsEvents.size() > AnalyticsConstants.MAX_REGISTERED_EVENTS) { Logging.logi(TOO_MANY_CONTEXTUAL_TRIGGERS_ERROR); } return analyticsEvents; } AnalyticsEventsManager(AnalyticsConnector analyticsConnector); }
AnalyticsEventsManager { @VisibleForTesting static Set<String> extractAnalyticsEventNames(FetchEligibleCampaignsResponse response) { Set<String> analyticsEvents = new HashSet<>(); for (CampaignProto.ThickContent content : response.getMessagesList()) { for (CommonTypesProto.TriggeringCondition condition : content.getTriggeringConditionsList()) { if (!TextUtils.isEmpty(condition.getEvent().getName())) { analyticsEvents.add(condition.getEvent().getName()); } } } if (analyticsEvents.size() > AnalyticsConstants.MAX_REGISTERED_EVENTS) { Logging.logi(TOO_MANY_CONTEXTUAL_TRIGGERS_ERROR); } return analyticsEvents; } AnalyticsEventsManager(AnalyticsConnector analyticsConnector); @Nullable AnalyticsConnectorHandle getHandle(); ConnectableFlowable<String> getAnalyticsEventsFlowable(); void updateContextualTriggers(FetchEligibleCampaignsResponse serviceResponse); }
AnalyticsEventsManager { @VisibleForTesting static Set<String> extractAnalyticsEventNames(FetchEligibleCampaignsResponse response) { Set<String> analyticsEvents = new HashSet<>(); for (CampaignProto.ThickContent content : response.getMessagesList()) { for (CommonTypesProto.TriggeringCondition condition : content.getTriggeringConditionsList()) { if (!TextUtils.isEmpty(condition.getEvent().getName())) { analyticsEvents.add(condition.getEvent().getName()); } } } if (analyticsEvents.size() > AnalyticsConstants.MAX_REGISTERED_EVENTS) { Logging.logi(TOO_MANY_CONTEXTUAL_TRIGGERS_ERROR); } return analyticsEvents; } AnalyticsEventsManager(AnalyticsConnector analyticsConnector); @Nullable AnalyticsConnectorHandle getHandle(); ConnectableFlowable<String> getAnalyticsEventsFlowable(); void updateContextualTriggers(FetchEligibleCampaignsResponse serviceResponse);  }