com.andysu.unity 0.0.0-stage → 0.1.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md.meta +7 -0
- package/Runtime/AndySU.cs +57 -0
- package/Runtime/AndySU.cs.meta +11 -0
- package/Runtime/com.andysu.unity.asmdef +1 -0
- package/Runtime/com.andysu.unity.asmdef.meta +7 -0
- package/Runtime.meta +8 -0
- package/package.json +22 -4
- package/package.json.meta +7 -0
- package/README.md +0 -3
package/README.md.meta
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// AndySU for Unity (Android). Talks to the host's com.andysu.api.Host over JNI; on other
|
|
2
|
+
// platforms and without an AndySU host every call returns neutral values.
|
|
3
|
+
using System;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
namespace AndySU
|
|
7
|
+
{
|
|
8
|
+
public enum ApplyPolicy { Live, Restart, NextStart }
|
|
9
|
+
|
|
10
|
+
public static class Updates
|
|
11
|
+
{
|
|
12
|
+
#if UNITY_ANDROID && !UNITY_EDITOR
|
|
13
|
+
static AndroidJavaObject HostApi()
|
|
14
|
+
{
|
|
15
|
+
using (var host = new AndroidJavaClass("com.andysu.api.Host"))
|
|
16
|
+
return host.CallStatic<AndroidJavaObject>("current");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static AndroidJavaObject Client()
|
|
20
|
+
{
|
|
21
|
+
var h = HostApi();
|
|
22
|
+
return h?.Call<AndroidJavaObject>("updates");
|
|
23
|
+
}
|
|
24
|
+
#else
|
|
25
|
+
static AndroidJavaObject HostApi() => null;
|
|
26
|
+
static AndroidJavaObject Client() => null;
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
/// <summary>True when the game runs under an AndySU host.</summary>
|
|
30
|
+
public static bool IsPresent => HostApi() != null;
|
|
31
|
+
|
|
32
|
+
public static string Version => HostApi()?.Call<string>("version") ?? "";
|
|
33
|
+
|
|
34
|
+
/// <summary>Status as JSON, e.g. {"state":"staged","release":"1.4.0"}.</summary>
|
|
35
|
+
public static string StatusJson => Client()?.Call<string>("status") ?? "{\"state\":\"idle\"}";
|
|
36
|
+
|
|
37
|
+
public static void CheckNow() => Client()?.Call("checkNow");
|
|
38
|
+
public static void ApplyNow() => Client()?.Call("applyNow");
|
|
39
|
+
public static void RestartNow() => Client()?.Call("restartNow");
|
|
40
|
+
|
|
41
|
+
/// <summary>Commit this payload once the game is known to work.</summary>
|
|
42
|
+
public static void MarkHealthy() => HostApi()?.Call("markHealthy");
|
|
43
|
+
|
|
44
|
+
/// <summary>How staged updates apply on this install; null for the configured policy.</summary>
|
|
45
|
+
public static void SetApplyPolicy(ApplyPolicy? p)
|
|
46
|
+
{
|
|
47
|
+
string v = p switch
|
|
48
|
+
{
|
|
49
|
+
ApplyPolicy.Live => "live",
|
|
50
|
+
ApplyPolicy.Restart => "restart",
|
|
51
|
+
ApplyPolicy.NextStart => "next_start",
|
|
52
|
+
_ => null,
|
|
53
|
+
};
|
|
54
|
+
Client()?.Call("setApplyPolicy", v);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "name": "AndySU", "rootNamespace": "AndySU", "references": [], "includePlatforms": [], "excludePlatforms": [] }
|
package/Runtime.meta
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "com.andysu.unity",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.90",
|
|
4
|
+
"displayName": "AndySU",
|
|
5
|
+
"description": "Self-updates for Unity games on Android outside the stores: status, check, apply, apply policy.",
|
|
6
|
+
"unity": "2021.3",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "dixonSolutions",
|
|
10
|
+
"url": "https://github.com/dixonSolutions/AndySU"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"Runtime",
|
|
14
|
+
"package.json.meta",
|
|
15
|
+
"README.md",
|
|
16
|
+
"README.md.meta",
|
|
17
|
+
"Runtime.meta"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/dixonSolutions/AndySU",
|
|
22
|
+
"directory": "bindings/unity"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/README.md
DELETED