private IEnumerator GetShareLink(ISpray spray, String fileId) { if (spray.ShareSlug.Contains("http")) { //SHARE LINK HERE ------------------ ShareLink(spray.ShareSlug); // --------------------------------- if (SprayShared != null) { SprayShared(spray, false); } } else { string shareLink = String.Format(shareLinkFormat, fileId); Debug.Log("Spray drive fileId in unity land: " + fileId + " shareLink: " + shareLink); string hexHash; using (MD5 md5 = MD5.Create()) { string md5Source = Secrets.shareSecret + shareLink; byte[] encodedSource = Encoding.UTF8.GetBytes(md5Source); byte[] hashBytes = md5.ComputeHash(encodedSource); StringBuilder sb = new StringBuilder(); for (int i = 0; i < hashBytes.Length; i++) { sb.Append(hashBytes [i].ToString("x2")); // 2-digit hex per byte } hexHash = sb.ToString(); } // Get OAuth2 access token for google api string token = driveReceiver.GetAccessToken(); Debug.Log("hex hash for sig: " + hexHash); WWWForm f = new WWWForm(); f.AddField("url", shareLink); f.AddField("sig", hexHash); f.AddField("token", token); WWW w = new WWW(serviceUrl, f); yield return(w); if (string.IsNullOrEmpty(w.error) && !fakeLinkGenerationFailure) { Debug.Log(w.text); string shareUrl = w.text.Trim(); //SHARE LINK HERE ------------------ ShareLink(shareUrl); // --------------------------------- if (SprayShared != null) { SprayShared(spray, false); } spray.ShareSlug = shareUrl; if (linkShareBehaviour == LinkShareBehaviour.OpenBrowser) { viewManager.Back(); // pops off 'uploading view' viewManager.Back(); // pops off the share screen } } else { if (fakeLinkGenerationFailure) { Debug.LogError("Faking link generation failure"); } else { Debug.LogError(w.error); Debug.LogError(w.text); } viewManager.ShowUploadFailed(true); } } }