This commit is contained in:
Patrick Kitchens 2018-04-26 10:59:14 -05:00
parent a50979a502
commit 9e847cb658
8 changed files with 36 additions and 20 deletions

View file

@ -1,6 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
<<<<<<< Updated upstream
guid: 80685d60eb42cd340a5c76d410187801 guid: 80685d60eb42cd340a5c76d410187801
timeCreated: 1524716619 timeCreated: 1524716619
=======
guid: 1d9a971c325c98e4a81ea4ec2e52aed6
timeCreated: 1524756178
>>>>>>> Stashed changes
licenseType: Free licenseType: Free
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}

View file

@ -42,7 +42,7 @@ namespace Assets.Scripts.Fitbit
private OAuth2AccessToken _oAuth2 = new OAuth2AccessToken(); private OAuth2AccessToken _oAuth2 = new OAuth2AccessToken();
public FitbitData _fitbitData = new FitbitData(); public FitbitData _fitbitData = new FitbitData();
private string _statusMessage; private string _statusMessage;
private string CallBackUrl private string CallBackUrl
@ -67,7 +67,6 @@ namespace Assets.Scripts.Fitbit
{ {
DontDestroyOnLoad(this); DontDestroyOnLoad(this);
} }
private void OnGUI() private void OnGUI()
{ {
if (!_bGotTheData && !string.IsNullOrEmpty(_statusMessage) && _bFirstFire) if (!_bGotTheData && !string.IsNullOrEmpty(_statusMessage) && _bFirstFire)
@ -124,7 +123,6 @@ namespace Assets.Scripts.Fitbit
_wwwRequest = new WWW(_tokenUrl, form.data, headers); _wwwRequest = new WWW(_tokenUrl, form.data, headers);
StartCoroutine(WaitForAccess(_wwwRequest)); StartCoroutine(WaitForAccess(_wwwRequest));
while (!_wwwRequest.isDone) while (!_wwwRequest.isDone)
{ {
@ -136,7 +134,6 @@ namespace Assets.Scripts.Fitbit
var parsed = new JSONObject(_wwwRequest.text); var parsed = new JSONObject(_wwwRequest.text);
ParseAccessToken(parsed); ParseAccessToken(parsed);
Debug.Log("\nParsed Token: " + _oAuth2.Token); Debug.Log("\nParsed Token: " + _oAuth2.Token);
GetAllData(); GetAllData();
Debug.Log("Steps from Fitbit: " + _fitbitData.CurrentSteps); Debug.Log("Steps from Fitbit: " + _fitbitData.CurrentSteps);
_bGotTheData = true; _bGotTheData = true;
@ -157,7 +154,6 @@ namespace Assets.Scripts.Fitbit
_wwwRequest = new WWW(_tokenUrl, form.data, headers); _wwwRequest = new WWW(_tokenUrl, form.data, headers);
StartCoroutine(WaitForAccess(_wwwRequest)); StartCoroutine(WaitForAccess(_wwwRequest));
while (!_wwwRequest.isDone) while (!_wwwRequest.isDone)
{ {
} }
@ -185,7 +181,6 @@ namespace Assets.Scripts.Fitbit
return; return;
_returnCode = code.Substring(CustomAndroidScheme.Length + 6); _returnCode = code.Substring(CustomAndroidScheme.Length + 6);
Debug.Log("Return Code is: " + _returnCode); Debug.Log("Return Code is: " + _returnCode);
UseReturnCode(); UseReturnCode();
} }
@ -197,9 +192,6 @@ namespace Assets.Scripts.Fitbit
_returnCode = code; _returnCode = code;
UseReturnCode(); UseReturnCode();
} }
public void GetAllData() public void GetAllData()
{ {
@ -229,7 +221,7 @@ namespace Assets.Scripts.Fitbit
_wwwRequest = new WWW(_profileUrl, null, headers); _wwwRequest = new WWW(_profileUrl, null, headers);
Debug.Log("Doing GET Request"); Debug.Log("Doing GET Request");
StartCoroutine(WaitForAccess(_wwwRequest)); StartCoroutine(WaitForAccess(_wwwRequest));
while (!_wwwRequest.isDone) while (!_wwwRequest.isDone)
{ {
} }
@ -247,7 +239,7 @@ namespace Assets.Scripts.Fitbit
_wwwRequest = new WWW(_caloriesUrl, null, headers); _wwwRequest = new WWW(_caloriesUrl, null, headers);
Debug.Log("Doing Calories GET Request"); Debug.Log("Doing Calories GET Request");
StartCoroutine(WaitForAccess(_wwwRequest)); StartCoroutine(WaitForAccess(_wwwRequest));
while (!_wwwRequest.isDone) while (!_wwwRequest.isDone)
{ {
} }
@ -263,8 +255,7 @@ namespace Assets.Scripts.Fitbit
_wwwRequest = new WWW(_distanceUrl, null, headers); _wwwRequest = new WWW(_distanceUrl, null, headers);
Debug.Log("Doing Distance GET Request"); Debug.Log("Doing Distance GET Request");
StartCoroutine(WaitForAccess(_wwwRequest)); StartCoroutine(WaitForAccess(_wwwRequest));
while (!_wwwRequest.isDone) while (!_wwwRequest.isDone)
{ {
} }
@ -281,7 +272,7 @@ namespace Assets.Scripts.Fitbit
_wwwRequest = new WWW(_stepsUrl, null, headers); _wwwRequest = new WWW(_stepsUrl, null, headers);
Debug.Log("Doing Steps GET Request"); Debug.Log("Doing Steps GET Request");
StartCoroutine(WaitForAccess(_wwwRequest)); StartCoroutine(WaitForAccess(_wwwRequest));
while (!_wwwRequest.isDone) while (!_wwwRequest.isDone)
{ {
} }
@ -324,14 +315,13 @@ namespace Assets.Scripts.Fitbit
{ {
if (kvp.Key == "avatar") if (kvp.Key == "avatar")
continue; continue;
//put a space between the camelCase //put a space between the camelCase
var tempKey = Regex.Replace(kvp.Key, "(\\B[A-Z])", " $1"); var tempKey = Regex.Replace(kvp.Key, "(\\B[A-Z])", " $1");
//then capitalize the first letter //then capitalize the first letter
UppercaseFirst(tempKey); UppercaseFirst(tempKey);
} }
} }
_bGotTheData = true; _bGotTheData = true;
} }
#endregion #endregion
@ -406,7 +396,6 @@ namespace Assets.Scripts.Fitbit
XDocument doc = XDocument.Parse(json.InnerXml); XDocument doc = XDocument.Parse(json.InnerXml);
var root = doc.Descendants("value").FirstOrDefault(); var root = doc.Descendants("value").FirstOrDefault();
_fitbitData.CurrentSteps = ToInt(root.Value); _fitbitData.CurrentSteps = ToInt(root.Value);
Debug.Log("Steps from Fitbit: " + _fitbitData.CurrentSteps); Debug.Log("Steps from Fitbit: " + _fitbitData.CurrentSteps);
} }
@ -480,7 +469,6 @@ namespace Assets.Scripts.Fitbit
Debug.Log(www.error); Debug.Log(www.error);
} }
Debug.Log("end of WaitForAccess \n"); Debug.Log("end of WaitForAccess \n");
} }
//just a utility function to get the correct date format for activity calls that require one //just a utility function to get the correct date format for activity calls that require one
@ -509,8 +497,6 @@ namespace Assets.Scripts.Fitbit
return date; return date;
} }
private int ToInt(string thing) private int ToInt(string thing)
{ {
var temp = 0; var temp = 0;

View file

@ -1,6 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
<<<<<<< Updated upstream
guid: aa5e856e9b878764db7c192f3aa20277 guid: aa5e856e9b878764db7c192f3aa20277
timeCreated: 1524716713 timeCreated: 1524716713
=======
guid: 849590d4a954ae445aa5db73d734450c
timeCreated: 1524756213
>>>>>>> Stashed changes
licenseType: Free licenseType: Free
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}

View file

@ -1,6 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
<<<<<<< Updated upstream
guid: 36444c03eedb84147a326a329de30d0e guid: 36444c03eedb84147a326a329de30d0e
timeCreated: 1524716713 timeCreated: 1524716713
=======
guid: 80ba6a52e9d55564fbe8130844b17f29
timeCreated: 1524756213
>>>>>>> Stashed changes
licenseType: Free licenseType: Free
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}

View file

@ -1,6 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
<<<<<<< Updated upstream
guid: 7a928c029cb14204588724261a513ec1 guid: 7a928c029cb14204588724261a513ec1
timeCreated: 1524716713 timeCreated: 1524716713
=======
guid: 1d8622418b8bead4cad17658d650c6c2
timeCreated: 1524756213
>>>>>>> Stashed changes
licenseType: Free licenseType: Free
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}

View file

@ -1,6 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
<<<<<<< Updated upstream
guid: da64cad21a33a6444ac511376fcb771b guid: da64cad21a33a6444ac511376fcb771b
timeCreated: 1524716713 timeCreated: 1524716713
=======
guid: 9101b04121334074fb6e70fc34eeb3f9
timeCreated: 1524756213
>>>>>>> Stashed changes
licenseType: Free licenseType: Free
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}

View file

@ -1,6 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
<<<<<<< Updated upstream
guid: 2e4069fa83cbbb041aa91e83f7ece28e guid: 2e4069fa83cbbb041aa91e83f7ece28e
timeCreated: 1524716713 timeCreated: 1524716713
=======
guid: 1d4c10710438d404085599a6fe50d37b
timeCreated: 1524756213
>>>>>>> Stashed changes
licenseType: Free licenseType: Free
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}

BIN
MoCha/UpgradeLog.htm Normal file

Binary file not shown.