mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Switch to a less cpu intensive function to check if libsignal-client is available
This commit is contained in:
parent
8c6b909365
commit
73d44ba3fe
2 changed files with 8 additions and 1 deletions
|
@ -19,6 +19,10 @@
|
||||||
{"name":"loadClass","parameterTypes":["java.lang.String"] }
|
{"name":"loadClass","parameterTypes":["java.lang.String"] }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name":"java.lang.IllegalArgumentException",
|
||||||
|
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name":"java.lang.IllegalStateException",
|
"name":"java.lang.IllegalStateException",
|
||||||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
|
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
|
||||||
|
|
|
@ -47,7 +47,10 @@ public class ServiceConfig {
|
||||||
|
|
||||||
public static boolean isSignalClientAvailable() {
|
public static boolean isSignalClientAvailable() {
|
||||||
try {
|
try {
|
||||||
org.signal.client.internal.Native.DeviceTransfer_GeneratePrivateKey();
|
try {
|
||||||
|
org.signal.client.internal.Native.UuidCiphertext_CheckValidContents(new byte[0]);
|
||||||
|
} catch (IllegalArgumentException ignored) {
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
logger.warn("Failed to call libsignal-client: {}", e.getMessage());
|
logger.warn("Failed to call libsignal-client: {}", e.getMessage());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue