From 483fce1c76b991d7ae1a5c2434876cb2fc90a98f Mon Sep 17 00:00:00 2001 From: cyBerta Date: Thu, 19 May 2022 12:22:51 +0200 Subject: implement method to determine if tor is currently running and not yet about to be shutdown --- app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/src/main') diff --git a/app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java b/app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java index c924caee..54868549 100644 --- a/app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java +++ b/app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java @@ -287,4 +287,9 @@ public class TorStatusObservable extends Observable { public static boolean isCancelled() { return getInstance().cancelled; } + + public static boolean isRunning() { + return !TorStatusObservable.isCancelled() && + TorStatusObservable.getStatus() != TorStatusObservable.TorStatus.OFF; + } } -- cgit v1.2.3