diff options
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt index 4206f7f..eb6989d 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/StatusActivity.kt | |||
@@ -146,7 +146,7 @@ class StatusActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRef | |||
146 | } | 146 | } |
147 | 147 | ||
148 | private fun updateNodeList() { | 148 | private fun updateNodeList() { |
149 | getNodeNames().whenComplete { nodeList, _ -> runOnUiThread { writeNodeList(nodeList) } } | 149 | getNodeNames().thenAccept { nodeList -> runOnUiThread { writeNodeList(nodeList) } } |
150 | } | 150 | } |
151 | 151 | ||
152 | private fun updateView() = when { | 152 | private fun updateView() = when { |
@@ -163,11 +163,8 @@ class StatusActivity : BaseActivity(), AdapterView.OnItemClickListener, SwipeRef | |||
163 | private const val REFRESH_RATE = 5000L | 163 | private const val REFRESH_RATE = 5000L |
164 | private const val NOW = 0L | 164 | private const val NOW = 0L |
165 | 165 | ||
166 | fun getNodeNames(): CompletableFuture<List<String>> = when { | 166 | fun getNodeNames(): CompletableFuture<List<String>> = TincVpnService.getCurrentNetName()?.let { netName -> |
167 | TincVpnService.isConnected() -> | 167 | Tinc.dumpNodes(netName).thenApply<List<String>> { it.map { it.substringBefore(' ') } } |
168 | Tinc.dumpNodes(TincVpnService.getCurrentNetName()!!).thenApply<List<String>> { it.map { it.substringBefore(' ') } } | 168 | } ?: Executor.supplyAsyncTask<List<String>> { emptyList() } |
169 | else -> | ||
170 | Executor.supplyAsyncTask<List<String>> { emptyList() } | ||
171 | } | ||
172 | } | 169 | } |
173 | } | 170 | } |