diff --git a/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java b/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java index 93ddcc32..0bca1bd7 100644 --- a/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java +++ b/app/src/main/java/com/wireguard/android/backend/WgQuickBackend.java @@ -35,8 +35,6 @@ public final class WgQuickBackend implements Backend { } private static State resolveState(final State currentState, State requestedState) { - if (requestedState == State.UNKNOWN) - throw new IllegalArgumentException("Requested unknown state"); if (requestedState == State.TOGGLE) requestedState = currentState == State.UP ? State.DOWN : State.UP; return requestedState; diff --git a/app/src/main/java/com/wireguard/android/model/Tunnel.java b/app/src/main/java/com/wireguard/android/model/Tunnel.java index 9cdcf71f..6edb6acd 100644 --- a/app/src/main/java/com/wireguard/android/model/Tunnel.java +++ b/app/src/main/java/com/wireguard/android/model/Tunnel.java @@ -69,15 +69,11 @@ public class Tunnel extends BaseObservable implements Keyed { @Bindable public State getState() { - if (state == State.UNKNOWN) - manager.getTunnelState(this).whenComplete(ExceptionLoggers.E); return state; } public CompletionStage getStateAsync() { - if (state == State.UNKNOWN) - return manager.getTunnelState(this); - return CompletableFuture.completedFuture(state); + return manager.getTunnelState(this); } @Bindable @@ -133,7 +129,6 @@ public class Tunnel extends BaseObservable implements Keyed { public enum State { DOWN, TOGGLE, - UNKNOWN, UP } diff --git a/app/src/main/res/layout/tunnel_detail_fragment.xml b/app/src/main/res/layout/tunnel_detail_fragment.xml index 5a30e8dd..4487c9cc 100644 --- a/app/src/main/res/layout/tunnel_detail_fragment.xml +++ b/app/src/main/res/layout/tunnel_detail_fragment.xml @@ -51,7 +51,6 @@ android:layout_height="wrap_content" android:layout_alignBaseline="@+id/interface_title" android:layout_alignParentEnd="true" - android:enabled="@{tunnel.state != State.UNKNOWN}" app:checked="@{tunnel.state == State.UP}" app:onBeforeCheckedChanged="@{() -> tunnel.setState(State.TOGGLE)}" /> diff --git a/app/src/main/res/layout/tunnel_list_item.xml b/app/src/main/res/layout/tunnel_list_item.xml index 8de2b3c2..1ed157e9 100644 --- a/app/src/main/res/layout/tunnel_list_item.xml +++ b/app/src/main/res/layout/tunnel_list_item.xml @@ -46,7 +46,6 @@ android:layout_height="wrap_content" android:layout_alignBaseline="@+id/tunnel_name" android:layout_alignParentEnd="true" - android:enabled="@{item.state != State.UNKNOWN}" app:checked="@{item.state == State.UP}" app:onBeforeCheckedChanged="@{() -> item.setState(State.TOGGLE)}" />