Exemplo n.º 1
0
 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) !
     });
Exemplo n.º 2
0
 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
     });
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 public static bool HasSubject(this NotificationFormatting <LocalizedText> formatting)
 {
     return(formatting.Subject?.Values.Any(x => !string.IsNullOrWhiteSpace(x)) == true);
 }
Exemplo n.º 5
0
 public static bool HasSubject(this NotificationFormatting <string> formatting)
 {
     return(!string.IsNullOrWhiteSpace(formatting.Subject));
 }
Exemplo n.º 6
0
 public static NotificationFormatting <LocalizedText> Format(this NotificationFormatting <LocalizedText> source, NotificationProperties?properties)
 {
     return(source.Transform(FormatText(properties)));
 }
Exemplo n.º 7
0
 public static NotificationFormatting <string> SelectText(this NotificationFormatting <LocalizedText> source, string language)
 {
     return(source.Transform(SelectText(language)));
 }
Exemplo n.º 8
0
        public static string ToDebugString(this NotificationFormatting <LocalizedText> source)
        {
            var subject = source.Subject;

            return(subject.GetOrDefault("en").OrDefault(subject.Values.FirstOrDefault() ?? string.Empty));
        }