public static NotificationFormatting <LocalizedText> MergedWith(this NotificationFormatting <LocalizedText> source, NotificationFormatting <LocalizedText>?other) { return(new NotificationFormatting <LocalizedText> { Body = Merged(source.Body, other?.Body), ConfirmMode = source.ConfirmMode ?? other?.ConfirmMode, ConfirmText = Merged(source.ConfirmText, other?.ConfirmText), ImageLarge = Merged(source.ImageLarge, other?.ImageLarge), ImageSmall = Merged(source.ImageSmall, other?.ImageSmall), LinkText = Merged(source.LinkText, other?.LinkText), LinkUrl = Merged(source.LinkUrl, other?.LinkUrl), Subject = Merged(source.Subject, other?.Subject) ! });
public static NotificationFormatting <string> Clone(this NotificationFormatting <string> source) { return(new NotificationFormatting <string> { Body = source.Body, ConfirmMode = source.ConfirmMode, ConfirmText = source.ConfirmText, ImageLarge = source.ImageLarge, ImageSmall = source.ImageSmall, LinkText = source.LinkText, LinkUrl = source.LinkUrl, Subject = source.Subject }); }
private static NotificationFormatting <TOut> Transform <TIn, TOut>(this NotificationFormatting <TIn> formatting, Func <TIn?, TOut> transform) where TIn : class where TOut : class { Guard.NotNull(transform, nameof(transform)); var result = new NotificationFormatting <TOut> { Body = transform(formatting.Body), ConfirmMode = formatting.ConfirmMode, ConfirmText = transform(formatting.ConfirmText), ImageLarge = transform(formatting.ImageLarge), ImageSmall = transform(formatting.ImageSmall), LinkText = transform(formatting.LinkText), LinkUrl = transform(formatting.LinkUrl), Subject = transform(formatting.Subject) }; return(result); }
public static bool HasSubject(this NotificationFormatting <LocalizedText> formatting) { return(formatting.Subject?.Values.Any(x => !string.IsNullOrWhiteSpace(x)) == true); }
public static bool HasSubject(this NotificationFormatting <string> formatting) { return(!string.IsNullOrWhiteSpace(formatting.Subject)); }
public static NotificationFormatting <LocalizedText> Format(this NotificationFormatting <LocalizedText> source, NotificationProperties?properties) { return(source.Transform(FormatText(properties))); }
public static NotificationFormatting <string> SelectText(this NotificationFormatting <LocalizedText> source, string language) { return(source.Transform(SelectText(language))); }
public static string ToDebugString(this NotificationFormatting <LocalizedText> source) { var subject = source.Subject; return(subject.GetOrDefault("en").OrDefault(subject.Values.FirstOrDefault() ?? string.Empty)); }