public static SwrveEmbeddedCampaign LoadFromJSON(Dictionary <string, object> campaignData, DateTime initialisedTime, List <SwrveQaUserCampaignInfo> qaUserCampaignInfoList) { SwrveEmbeddedCampaign campaign = new SwrveEmbeddedCampaign(initialisedTime); campaign.Message = SwrveEmbeddedMessage.LoadFromJSON(campaign, (Dictionary <string, object>)campaignData ["embedded_message"]); return(campaign); }
public static SwrveEmbeddedMessage LoadFromJSON(SwrveEmbeddedCampaign campaign, Dictionary <string, object> messageData) { SwrveEmbeddedMessage message = new SwrveEmbeddedMessage(); message.Campaign = campaign; if (messageData.ContainsKey("priority")) { message.Priority = MiniJsonHelper.GetInt(messageData, "priority"); } if (messageData.ContainsKey("id")) { message.Id = MiniJsonHelper.GetInt(messageData, "id"); } if (messageData.ContainsKey("type")) { string typeString = MiniJsonHelper.GetString(messageData, "type"); message.setType(typeString); } if (messageData.ContainsKey("buttons")) { List <object> jsonButtons = (List <object>)messageData ["buttons"]; if (jsonButtons.Count > 0) { message.buttons = new List <string>(); } for (int i = 0; i < jsonButtons.Count; i++) { string buttonName = (string)jsonButtons[i]; message.buttons.Add(buttonName); } } if (messageData.ContainsKey("data")) { message.data = MiniJsonHelper.GetString(messageData, "data"); } return(message); }
private SwrveEmbeddedCampaign(DateTime initialisedTime) : base(initialisedTime) { this.Message = null; }