Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JSON namespace/class ambiguity #65

Merged
merged 3 commits into from
Jan 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Assets/Tests/Play/VimeoRecorderPlayTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private void FolderCheckUploadComplete()

private void GetFoldersComplete(string resp)
{
JSONNode json = JSON.Parse(resp);
JSONNode json = JSONNode.Parse(resp);
Assert.AreEqual(recorder.publisher.video.uri, json["data"][0]["uri"].Value);
finished = true;
}
Expand Down Expand Up @@ -191,7 +191,7 @@ private void SecondUploadComplete()
private void CheckRecentVideos(string resp)
{
Debug.Log("[TEST] CheckRecentVideos " + resp);
JSONNode json = JSON.Parse(resp);
JSONNode json = JSONNode.Parse(resp);

Assert.AreEqual(json["data"][0]["name"].Value, "Multi Upload Test #2 " + version);
Assert.AreEqual(json["data"][1]["name"].Value, "Multi Upload Test #1 " + version);
Expand Down
2 changes: 1 addition & 1 deletion Assets/Tests/Play/VimeoUploaderPlayTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void UploadComplete(string status)

public void UploadInit(string response)
{
VimeoVideo video = new VimeoVideo(JSON.Parse(response));
VimeoVideo video = new VimeoVideo(JSONNode.Parse(response));
uploader.SetVideoViewPrivacy(VimeoApi.PrivacyModeDisplay.OnlyPeopleWithPrivateLink);
uploader.SetVideoName("Large file test (" + Application.platform + " " + Application.unityVersion + ")");
uploader.SaveVideo(video);
Expand Down
13 changes: 8 additions & 5 deletions Assets/Tests/Unit/VimeoVideoTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class VimeoVideoTest : TestConfig
public void _Before()
{

video = new VimeoVideo(JSON.Parse(mockDevelopmentJson));
video = new VimeoVideo(JSONNode.Parse(mockDevelopmentJson));
}

[Test]
Expand Down Expand Up @@ -89,7 +89,7 @@ public void GetVideoFileByResolution_Uses_Selected_Resolution()
public void GetVideoFileByResolution_Uses_Selected_Resolution_For_Files_Response()
{
UnityEngine.TestTools.LogAssert.NoUnexpectedReceived();
video = new VimeoVideo(JSON.Parse(mockProductionJson));
video = new VimeoVideo(JSONNode.Parse(mockProductionJson));
JSONNode file = video.GetVideoFileByResolution(Vimeo.Player.StreamingResolution.x720p_HD);
Assert.AreEqual(file["height"].Value, "720");
}
Expand All @@ -114,6 +114,7 @@ public void GetDashUrl_Works_For_Play_Response()

[Test]
// TODO somehow test different application platforms
// Note: this fails (correctly) when testing on Mac
public void GetAdaptiveVideoFileURL_Returns_Dash_By_Default()
{
Assert.AreEqual(video.GetAdaptiveVideoFileURL(), video.getDashUrl());
Expand All @@ -123,22 +124,24 @@ public void GetAdaptiveVideoFileURL_Returns_Dash_By_Default()
public void GetHlsUrl_Works_For_Files_Response()
{
UnityEngine.TestTools.LogAssert.NoUnexpectedReceived();
video = new VimeoVideo(JSON.Parse(mockProductionJson));
video = new VimeoVideo(JSONNode.Parse(mockProductionJson));
Assert.AreEqual(video.getHlsUrl(), "https://player.vimeo.com/external/xxx.m3u8?s=edab7a40157183128871d34b0794feb5f1534501&oauth2_token_id=...");
}

[Test]
public void GetDashUrl_Returns_Null_For_Files_Response()
{
video = new VimeoVideo(JSON.Parse(mockProductionJson));
video = new VimeoVideo(JSONNode.Parse(mockProductionJson));
Assert.AreEqual(video.getDashUrl(), null);
}

[Test]
// TODO somehow test different application platforms
// Note: this fails (correctly) when testing on Mac
public void GetAdaptiveVideoFileURL_Defaults_To_Hls_For_Files_Response()
{
UnityEngine.TestTools.LogAssert.Expect(LogType.Warning, "[Vimeo] No DASH manfiest found. Defaulting to HLS.");
video = new VimeoVideo(JSON.Parse(mockProductionJson));
video = new VimeoVideo(JSONNode.Parse(mockProductionJson));
Assert.AreEqual(video.GetAdaptiveVideoFileURL(), video.getHlsUrl());
}
#endregion
Expand Down
2 changes: 1 addition & 1 deletion Assets/Vimeo/Scripts/Config/VimeoVideo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public JSONNode GetJsonFromString(string content)
}

try {
return JSON.Parse(matches[0].Value);
return JSONNode.Parse(matches[0].Value);
}
catch (System.Exception e) {
Debug.LogError("[Vimeo] There was a problem parsing the JSON. " + e);
Expand Down
4 changes: 2 additions & 2 deletions Assets/Vimeo/Scripts/Editor/BaseEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private void GetVideosComplete(string response)
DestroyImmediate(settings.gameObject.GetComponent<VimeoApi>());
}

var json = JSON.Parse(response);
var json = JSONNode.Parse(response);
JSONNode videoData = json["data"];

if (videoData.Count == 0) {
Expand Down Expand Up @@ -118,7 +118,7 @@ private void GetFoldersComplete(string response)
DestroyImmediate(settings.gameObject.GetComponent<VimeoApi>());
}

var json = JSON.Parse(response);
var json = JSONNode.Parse(response);
var folderData = json["data"];

string folder_prefix = "";
Expand Down
2 changes: 1 addition & 1 deletion Assets/Vimeo/Scripts/Editor/VimeoPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public enum AvailablePluginType {

public class VimeoPlugin
{
public const string Version = "0.9.4";
public const string Version = "0.9.5";
public const string AVPRO_VIDEO_DEFINE = "VIMEO_AVPRO_VIDEO_SUPPORT";
public const string AVPRO_CAPTURE_DEFINE = "VIMEO_AVPRO_CAPTURE_SUPPORT";
public const string DEPTHKIT_DEFINE = "VIMEO_DEPTHKIT_SUPPORT";
Expand Down
2 changes: 1 addition & 1 deletion Assets/Vimeo/Scripts/Player/VimeoPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ private void VideoMetadataLoad(string response)
{
loadingVideoMetadata = false;

JSONNode json = JSON.Parse(response);
JSONNode json = JSONNode.Parse(response);
api.OnRequestComplete -= VideoMetadataLoad;

if (json["error"] == null) {
Expand Down
6 changes: 3 additions & 3 deletions Assets/Vimeo/Scripts/Recorder/VimeoPublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void OnUploadInit(string response)
m_vimeoUploader.OnRequestComplete -= OnUploadInit;
m_vimeoUploader.OnRequestComplete += OnVideoUpdated;

JSONNode jsonResponse = JSON.Parse(response);
JSONNode jsonResponse = JSONNode.Parse(response);
video = new VimeoVideo(jsonResponse);

#if UNITY_2018_1_OR_NEWER
Expand Down Expand Up @@ -126,7 +126,7 @@ private void OnVideoUpdated(string response)
{
m_vimeoUploader.OnRequestComplete -= OnVideoUpdated;

JSONNode json = JSON.Parse(response);
JSONNode json = JSONNode.Parse(response);
recorder.videoPermalink = json["link"];
recorder.videoReviewPermalink = json["review_link"];

Expand All @@ -144,7 +144,7 @@ private void NetworkError(string error_message)

private void ApiError(string response)
{
JSONNode json = JSON.Parse(response);
JSONNode json = JSONNode.Parse(response);

if (json["invalid_parameters"] != null) {
for (int i = 0; i < json["invalid_parameters"].Count; i++) {
Expand Down
2 changes: 1 addition & 1 deletion Assets/Vimeo/Scripts/Services/VimeoUploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private void RequestComplete(string response)
{
OnRequestComplete -= RequestComplete;

JSONNode rawJSON = JSON.Parse(response);
JSONNode rawJSON = JSONNode.Parse(response);

string tusUploadLink = rawJSON["upload"]["upload_link"].Value;
m_vimeoUrl = rawJSON["link"].Value;
Expand Down
10 changes: 0 additions & 10 deletions Assets/Vimeo/Scripts/Utils/SimpleJSON.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1421,14 +1421,4 @@ public override string ToString(string aPrefix)
return "";
}
}

// End of JSONLazyCreator

public static class JSON
{
public static JSONNode Parse(string jsonString)
{
return JSONNode.Parse(jsonString);
}
}
}