public void TalkSession(Dictionary <int, string> campaignsDownloaded) { try { if (CanMakeSessionRequest()) { lastSessionRequestTime = SwrveHelper.GetMilliseconds(); String endpoint = getEndpoint("talk/game/" + swrve.ApiKey + "/user/" + swrve.UserId + "/session"); Dictionary <string, object> talkSessionJson = new Dictionary <string, object> (); // Add campaigns (downloaded or not) to request IList <object> campaignsJson = new List <object> (); Dictionary <int, string> .Enumerator campaignIt = campaignsDownloaded.GetEnumerator(); while (campaignIt.MoveNext()) { int id = campaignIt.Current.Key; string reason = campaignIt.Current.Value; Dictionary <string, object> campaignInfo = new Dictionary <string, object> (); campaignInfo.Add("id", id); campaignInfo.Add("reason", (reason == null) ? string.Empty : reason); campaignInfo.Add("loaded", (reason == null)); campaignsJson.Add(campaignInfo); } talkSessionJson.Add("campaigns", campaignsJson); // Add device info to request Dictionary <string, string> deviceJson = swrve.GetDeviceInfo(); talkSessionJson.Add("device", deviceJson); MakeRequest(endpoint, talkSessionJson); } } catch (Exception exp) { SwrveLog.LogError("QA request talk session failed: " + exp.ToString()); } }
public void TalkSession(Dictionary <int, string> campaignsDownloaded) { try { if (CanMakeSessionRequest()) { lastSessionRequestTime = SwrveHelper.GetMilliseconds(); string endpoint = getEndpoint("talk/game/" + swrve.ApiKey + "/user/" + swrve.UserId + "/session"); Dictionary <string, object> dictionary = new Dictionary <string, object>(); IList <object> list = new List <object>(); Dictionary <int, string> .Enumerator enumerator = campaignsDownloaded.GetEnumerator(); while (enumerator.MoveNext()) { int key = enumerator.Current.Key; string value = enumerator.Current.Value; Dictionary <string, object> dictionary2 = new Dictionary <string, object>(); dictionary2.Add("id", key); dictionary2.Add("reason", (value == null) ? string.Empty : value); dictionary2.Add("loaded", value == null); list.Add(dictionary2); } dictionary.Add("campaigns", list); Dictionary <string, string> deviceInfo = swrve.GetDeviceInfo(); dictionary.Add("device", deviceInfo); MakeRequest(endpoint, dictionary); } } catch (Exception ex) { SwrveLog.LogError("QA request talk session failed: " + ex.ToString()); } }
public Dictionary <string, string> GetDeviceInfo() { return(sdk.GetDeviceInfo()); }