private void BuildInstallationTemplate(Installation installation, string templateId, string templateBody, Guid userId, string deviceIdentifier) { if (templateBody == null) { return; } var fullTemplateId = $"template:{templateId}"; var template = new InstallationTemplate { Body = templateBody, Tags = new List <string> { fullTemplateId, $"{fullTemplateId}_userId:{userId}" } }; if (!string.IsNullOrWhiteSpace(deviceIdentifier)) { template.Tags.Add($"{fullTemplateId}_deviceIdentifier:{deviceIdentifier}"); } installation.Templates.Add(fullTemplateId, template); }
internal static InstallationTemplate CreateInstallationTemplate(NotificationTemplate notificationTemplate, NotificationPlatform platform) { if (notificationTemplate != null) { InstallationTemplate installationTemplate = new InstallationTemplate(); installationTemplate.Body = notificationTemplate.Body; if (platform == NotificationPlatform.Wns) { installationTemplate.Headers = notificationTemplate.Headers; } else { // Headers is not meaningful for all other platforms installationTemplate.Headers = null; } return(installationTemplate); } return(null); }
internal static InstallationTemplate CreateInstallationTemplate(NotificationTemplate notificationTemplate, NotificationPlatform platform) { if (notificationTemplate != null) { InstallationTemplate installationTemplate = new InstallationTemplate(); // strip tags installationTemplate.Tags = new List<string>(); installationTemplate.Body = notificationTemplate.Body; if (platform == NotificationPlatform.Wns) { installationTemplate.Headers = notificationTemplate.Headers; } else { // Headers is not meaningful for all other platforms installationTemplate.Headers = null; } return installationTemplate; } return null; }