Skip to content

Commit

Permalink
Merge pull request #29 from Joshuarox100/1.3.x
Browse files Browse the repository at this point in the history
v1.3.3 fix.
  • Loading branch information
Joshuarox100 authored May 19, 2022
2 parents ca0e489 + f291374 commit b6ef636
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 13 deletions.
6 changes: 4 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# v1.3.2
Minor update for the code to use the value given by the VRCSDK for max parameter space. Also ceased reliance on the SDK's controller templates and instead refer to included ones for the future.
# v1.3.3
Important bug-fix for the auto-updater so it receives new versions correctly. If you are currently on v1.3.2, you will not receive automatic updates because of it. Sincerest apologies for the inconvenience.

## Fixes
### v1.3.3
- Fixed a *bit* of an oversight with the updater changes.
### v1.3.2
- Added preliminary support for arbitrary parameter space in the UI.
- Default controller templates and animations are now included in II.
Expand Down
2 changes: 1 addition & 1 deletion Editor/VERSION
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
v1.3.2
v1.3.3
2019.4
55 changes: 45 additions & 10 deletions Engine/Scripts/AutoUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static void OnInit()
public class Updater : UnityEngine.Object
{
// MonoBehaviour for running network coroutines.
private class NetworkManager : MonoBehaviour
private class NetworkManager : MonoBehaviour
{
// Gets a desired request from the internet
public static IEnumerator GetFileRequest(string url, string filePath, Action<UnityWebRequest> callback)
Expand All @@ -61,8 +61,7 @@ public static IEnumerator GetText(string url, Action<string> result)

if (www.isNetworkError || www.isHttpError)
{
if (!www.error.Contains("404"))
Debug.LogError(www.error);
Debug.LogError(www.error);
result?.Invoke("");
}
else
Expand Down Expand Up @@ -133,26 +132,62 @@ public static bool CheckForUpdates(bool auto = false)

// Run a coroutine to retrieve the GitHub data.
NetworkManager manager = temp.AddComponent<NetworkManager>();
manager.StartCoroutine(NetworkManager.GetText("https://raw.githubusercontent.com/Joshuarox100/VRC-Inventory-Inventor/master/Editor/VPM", latestVersion =>
{
manager.StartCoroutine(NetworkManager.GetText("https://raw.githubusercontent.com/Joshuarox100/VRC-Inventory-Inventor/master/Editor/VERSION", latestVersion => {
string[] decodedVersion = latestVersion.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
string latestBuild = "";
string latestUnity = "";
if (decodedVersion.Length > 0)
latestBuild = decodedVersion[0];
if (decodedVersion.Length > 1)
latestUnity = decodedVersion[1];

string vpmBuild = "";
string vpmUnity = "";
if (decodedVersion.Length > 4)
vpmBuild = decodedVersion[4];
if (decodedVersion.Length > 5)
vpmUnity = decodedVersion[5];

// Network Error.
if (latestVersion == "" && !auto)
{
EditorUtility.DisplayDialog("Inventory Inventor", "You are using the latest version.", "Close");
EditorUtility.DisplayDialog("Inventory Inventor", "Failed to fetch the latest version.\n(Check console for details.)", "Close");
}
// VPM is now required.
else if (vpmBuild != "")
{
if (EditorUtility.DisplayDialog("Inventory Inventor", "A newer version (" + vpmBuild + ") is available, but it is only usable if you migrate your project to use the VRChat Creator Companion.\nOpen GitHub to Download the Package?" + (auto ? "\n(You can disable update checks within Project Settings)" : ""), "Yes", "No"))
Application.OpenURL("https://github.com/Joshuarox100/VRC-Inventory-Inventor");
}
// VERSION file missing.
else if (buildVersion == "" && !auto)
{
EditorUtility.DisplayDialog("Inventory Inventor", "Failed to identify installed version.\n(VERSION file was not found.)", "Close");
}
// Project has been archived.
else if (latestVersion == "RIP" && !auto)
{
EditorUtility.DisplayDialog("Inventory Inventor", "Project has been put on hold indefinitely.", "Close");
}
// An update is available.
else if (latestVersion != "")
else if (buildVersion != "" && buildVersion != latestBuild)
{
if (EditorUtility.DisplayDialog("Inventory Inventor", "A newer version is available, but it is only usable if you migrate your project to use the VRChat Creator Companion.\nOpen GitHub to Download the Package?" + (auto ? "\n(You can disable update checks within Project Settings)" : ""), "Yes", "No"))
if ((unityVersion != latestUnity && EditorUtility.DisplayDialog("Inventory Inventor", "A new update is available, but for a newer version of Unity (" + latestUnity + ").\nInstall anyway? (Only do this before migrating!)" + (auto ? "\n(You can disable update checks within Project Settings)" : ""), "Yes", "No"))
|| (unityVersion == latestUnity && EditorUtility.DisplayDialog("Inventory Inventor", "A new update is available! (" + latestBuild + ")\nDownload and install from GitHub?" + (auto ? "\n(You can disable update checks within Project Settings)" : ""), "Yes", "No")))
{
Application.OpenURL("https://github.com/Joshuarox100/VRC-Inventory-Inventor");
// Download the update.
DownloadUpdate(latestBuild);
updated = true;
}
}
// Using latest version.
else if (!auto)
{
EditorUtility.DisplayDialog("Inventory Inventor", "You are using the latest version.", "Close");
}
DestroyImmediate(temp);
}));
return false;
return updated;
}

// Downloads and installs a given version of the package.
Expand Down

0 comments on commit b6ef636

Please sign in to comment.