private void sendMessageToTarget( final CampaignDeliverMessage campaignDeliverMessage, final PlayerTarget playerTarget, final Map<String, String> personalisedContent) { AmazonDeviceMessage message = new AmazonDeviceMessage( playerTarget.getPlayerId(), playerTarget.getTargetToken(), personalisedContent.get(MessageContentType.TITLE.getKey()), personalisedContent.get(MessageContentType.TITLE.getKey()), personalisedContent.get(MessageContentType.MESSAGE.getKey()), "notify", campaignDeliverMessage.getCampaignRunId()); pushNotificationPublisher.sendPushNotification(message); }
@Override public void sendMessageToPlayers(CampaignDeliverMessage campaignDeliverMessage) { LOG.debug("sending ADM Campaign"); List<PlayerTarget> playersList = getEligiblePlayerTargets(campaignDeliverMessage); final Map<String, String> campaignContent = getCampaignContent(campaignDeliverMessage); final Map<NotificationChannelConfigType, String> campaignChannelConfig = getChannelCampaignConfig(campaignDeliverMessage); for (PlayerTarget playerTarget : playersList) { if (isAllowedGameType(getGameTypesForCampaign(campaignChannelConfig), playerTarget)) { Map<String, String> personalisedContent = campaignContentService.getPersonalisedContent(campaignContent, playerTarget); sendMessageToTarget(campaignDeliverMessage, playerTarget, personalisedContent); } else { LOG.debug( "Skipping message as not in game_type list gameType={}", playerTarget.getGameType()); } } }
private boolean isAllowedGameType( final Set<String> allowedGameTypes, final PlayerTarget playerTarget) { return allowedGameTypes.isEmpty() || allowedGameTypes.contains(playerTarget.getGameType()); }