Example #1
0
        public static NotificationCustomization WithBackgroundImageConfiguration(string backgroundImageConfiguration)
        {
            var customization = new NotificationCustomization();

            customization.BackgroundImageConfiguration = backgroundImageConfiguration;
            return(customization);
        }
Example #2
0
        public static NotificationCustomization FromRpcModel(
            this THNotificationTemplateMedia thNotificationTemplateMedia)
        {
            if (thNotificationTemplateMedia == null)
            {
                return(null);
            }

            var backgroundImageConfiguration = thNotificationTemplateMedia.BackgroundImage;
            var titleColor = thNotificationTemplateMedia.TitleColor;
            var textColor  = thNotificationTemplateMedia.TextColor;

            return(NotificationCustomization.WithBackgroundImageConfiguration(backgroundImageConfiguration)
                   .WithTextColor(textColor)
                   .WithTitleColor(titleColor));
        }
#pragma warning disable 0618
        internal Notification(string id, GetSocialAction notificationAction, Type action, string status, string notificationType, long createdAt, string title, string text, string imageUrl, string videoUrl, UserReference sender, List <ActionButton> actionButtons, NotificationCustomization customization)
        {
#pragma warning restore 0618
            this.Id = id;
            this.NotificationAction = notificationAction;
#pragma warning disable 0618
            this.Action = action;
#pragma warning restore 0618
            this.ActionButtons    = actionButtons;
            this.Status           = status;
            this.NotificationType = notificationType;
            this.CreatedAt        = createdAt;
            this.Title            = title;
            this.Text             = text;
            this.ImageUrl         = imageUrl;
            this.VideoUrl         = videoUrl;
            this.Sender           = sender;
            this.Customization    = customization;
        }
        public Notification ParseFromJson(Dictionary <string, object> dictionary)
        {
            Title              = dictionary["Title"] as string;
            Id                 = dictionary["Id"] as string;
            Status             = dictionary["Status"] as string;
            CreatedAt          = (long)dictionary["CreatedAt"];
            Text               = dictionary["Text"] as string;
            ImageUrl           = dictionary["ImageUrl"] as string;
            VideoUrl           = dictionary["VideoUrl"] as string;
            NotificationAction =
                new GetSocialAction().ParseFromJson(dictionary["Action"] as Dictionary <string, object>);
            ActionButtons = ((List <object>)dictionary["ActionButtons"]).ConvertAll(item =>
                                                                                    new ActionButton().ParseFromJson((Dictionary <string, object>)item));
            NotificationType = dictionary["Type"] as string;
#pragma warning disable 618
            Action = (Type)(long)dictionary["OldAction"];
#pragma warning restore 618
            Sender        = new UserReference().ParseFromJson(dictionary["Sender"] as Dictionary <string, object>);
            Customization = new NotificationCustomization().ParseFromJson(dictionary["Customization"] as Dictionary <string, object>);
            return(this);
        }
        public Notification ParseFromAJO(AndroidJavaObject ajo)
        {
            Id               = ajo.CallStr("getId");
            Status           = ajo.CallStr("getStatus");
            NotificationType = ajo.CallStr("getType");
#pragma warning disable 618
            Action = (Type)ajo.CallInt("getActionType");
#pragma warning restore 618
            CreatedAt          = ajo.CallLong("getCreatedAt");
            Title              = ajo.CallStr("getTitle");
            Text               = ajo.CallStr("getText");
            NotificationAction = new GetSocialAction().ParseFromAJO(ajo.CallAJO("getAction"));
            ActionButtons      = ajo.CallAJO("getActionButtons").FromJavaList().ConvertAll(item => {
                using (item) {
                    return(new ActionButton().ParseFromAJO(item));
                }
            });
            ImageUrl      = ajo.CallStr("getImageUrl");
            VideoUrl      = ajo.CallStr("getVideoUrl");
            Sender        = new UserReference().ParseFromAJO(ajo.CallAJO("getSender"));
            Customization = new NotificationCustomization().ParseFromAJO(ajo.CallAJO("getCustomization"));
            return(this);
        }
Example #6
0
 /// <summary>
 /// Customize notification, like change background image, title and text color.
 /// Supported only on Android.
 /// </summary>
 /// <param name="customization">customization parameters.</param>
 /// <returns>notification content for methods chaining</returns>
 public NotificationContent WithCustomization(NotificationCustomization customization)
 {
     _customization = customization;
     return(this);
 }