/// <summary> /// Initializes a new instance of the <see cref="T:KinveyXamarin.Client.Builder"/> class. /// </summary> /// <param name="appKey">App key from Kinvey</param> /// <param name="appSecret">App secret from Kinvey</param> protected Builder(string appKey, string appSecret, string filePath, Constants.DevicePlatform devicePlatform = Constants.DevicePlatform.PCL) : base(new HttpClient(), new KinveyClientRequestInitializer(appKey, appSecret, new KinveyHeaders(devicePlatform))) { FilePath = filePath; ssoGroupKey = appKey; instanceID = string.Empty; this.devicePlatform = devicePlatform; }
/// <summary> /// Initializes a new instance of the <see cref="KinveyHeaders"/> class. /// </summary> /// <param name="devicePlatform">Device platform.</param> public KinveyHeaders(Constants.DevicePlatform devicePlatform) { Add(new KeyValuePair <string, IEnumerable <string> >( userAgentKey, new List <string> { userAgent } )); Add(new KeyValuePair <string, IEnumerable <string> >( Constants.STR_REQUEST_HEADER_API_VERSION, new List <string> { kinveyApiVersion } )); JObject deviceInfo = new JObject(); // Set the X-Kinvey-Device-Info header version deviceInfo.Add(Constants.STR_DEVICE_INFO_HEADER_KEY, Constants.STR_DEVICE_INFO_HEADER_VALUE); // TODO // Set the device model deviceInfo.Add(Constants.STR_DEVICE_INFO_MODEL_KEY, string.Empty); // Set the device OS and platform switch (devicePlatform) { case Constants.DevicePlatform.Android: deviceInfo.Add(Constants.STR_DEVICE_INFO_OS_KEY, Constants.STR_DEVICE_INFO_OS_VALUE_ANDROID); deviceInfo.Add(Constants.STR_DEVICE_INFO_PLATFORM_KEY, Constants.STR_DEVICE_INFO_PLATFORM_VALUE_ANDROID); break; case Constants.DevicePlatform.iOS: deviceInfo.Add(Constants.STR_DEVICE_INFO_OS_KEY, Constants.STR_DEVICE_INFO_OS_VALUE_IOS); deviceInfo.Add(Constants.STR_DEVICE_INFO_PLATFORM_KEY, Constants.STR_DEVICE_INFO_PLATFORM_VALUE_IOS); break; case Constants.DevicePlatform.NET: deviceInfo.Add(Constants.STR_DEVICE_INFO_OS_KEY, Constants.STR_DEVICE_INFO_OS_VALUE_WINDOWS); deviceInfo.Add(Constants.STR_DEVICE_INFO_PLATFORM_KEY, Constants.STR_DEVICE_INFO_PLATFORM_VALUE_NET); break; case Constants.DevicePlatform.PCL: deviceInfo.Add(Constants.STR_DEVICE_INFO_OS_KEY, Constants.STR_DEVICE_INFO_OS_VALUE_UNKNOWN); deviceInfo.Add(Constants.STR_DEVICE_INFO_PLATFORM_KEY, Constants.STR_DEVICE_INFO_PLATFORM_VALUE_PCL); break; } // TODO // Set the device os version deviceInfo.Add(Constants.STR_DEVICE_INFO_OSVERSION_KEY, string.Empty); // Set the device platform version (SDK version) deviceInfo.Add(Constants.STR_DEVICE_INFO_PLATFORMVERSION_KEY, VERSION); // Set the device info header KinveyDeviceInfo = JsonConvert.SerializeObject(deviceInfo); Add(new KeyValuePair <string, IEnumerable <string> >( Constants.STR_REQUEST_HEADER_DEVICE_INFO, new List <string> { KinveyDeviceInfo } )); }