void ContentCardsReceivedCallback(string message) { Debug.Log("ContentCardsReceivedCallback message: " + message); AppboyBinding.LogContentCardsDisplayed(); try { JSONClass json = (JSONClass)JSON.Parse(message); if (json["mContentCards"] != null) { JSONArray jsonArray = (JSONArray)JSON.Parse(json["mContentCards"].ToString()); Debug.Log(String.Format("Parsing Content Cards array of size {0}", jsonArray.Count)); for (int i = 0; i < jsonArray.Count; i++) { JSONClass cardJson = jsonArray[i].AsObject; try { ContentCard card = new ContentCard(cardJson); Debug.Log(String.Format("Created card object for card: {0}", card)); card.LogImpression(); card.LogClick(); } catch { Debug.Log(String.Format("Unable to create and log analytics for card {0}", cardJson)); } } } } catch { throw new ArgumentException("Could not parse content card JSON message."); } }
void OnGUI() { if (GUI.Button(new Rect(10, 10, 100, 25), "Static Cards")) { LoadStaticCards(); } if (GUI.Button(new Rect(120, 10, 100, 25), "Request Feed")) { AppboyBinding.RequestFeedRefreshFromCache(); } GUI.SelectionGrid(new Rect(10, 45, 210, 400), 0, cards, 1); }