Improvements again
This commit is contained in:
@@ -289,28 +289,17 @@ public class ProfileMenu : MonoBehaviour
|
||||
request.SetRequestHeader("ClientVersion", Application.version);
|
||||
request.SetRequestHeader("ClientPlatform", Application.platform.ToString());
|
||||
await request.SendWebRequest();
|
||||
if (request.downloadHandler.text == null)
|
||||
if (request.downloadHandler.text == null) return;
|
||||
var jsonResponse = JObject.Parse(request.downloadHandler.text);
|
||||
if ((bool)jsonResponse["success"])
|
||||
{
|
||||
return;
|
||||
}
|
||||
string response = request.downloadHandler.text;
|
||||
try
|
||||
{
|
||||
var jsonResponse = JObject.Parse(response);
|
||||
if ((bool)jsonResponse["success"])
|
||||
{
|
||||
BigInteger likes = BigInteger.Parse((string)jsonResponse["data"]["likes"]);
|
||||
entryLikesCount.text = Tools.FormatWithCommas(likes);
|
||||
entryLikesTexture.text = likes < 0 ? "\\uf165" : "\\uf164";
|
||||
entryLikesTexture.color = likes < 0 ? new Color(1f, 0f, 0.5f) : new Color(1f, 1f, 0f);
|
||||
var likedPosts = BazookaManager.Instance.GetLikedPosts();
|
||||
likedPosts.Add(postId.ToString());
|
||||
BazookaManager.Instance.SetLikedPosts(likedPosts);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.LogError("Failed to proccess vote");
|
||||
BigInteger likes = BigInteger.Parse((string)jsonResponse["data"]["likes"]);
|
||||
entryLikesCount.text = Tools.FormatWithCommas(likes);
|
||||
entryLikesTexture.text = likes < 0 ? "\\uf165" : "\\uf164";
|
||||
entryLikesTexture.color = likes < 0 ? new Color(1f, 0f, 0.5f) : new Color(1f, 1f, 0f);
|
||||
var likedPosts = BazookaManager.Instance.GetLikedPosts();
|
||||
likedPosts.Add(postId.ToString());
|
||||
BazookaManager.Instance.SetLikedPosts(likedPosts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user