TunnelListFragment: cleanup list type

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-03-19 17:52:51 -06:00
parent 87c9efce4a
commit 90050a0008

View File

@ -316,10 +316,8 @@ class TunnelListFragment : BaseFragment() {
Application.getTunnelManager().tunnels.thenAccept { tunnels ->
val tunnelsToDelete = ArrayList<ObservableTunnel>()
for (position in copyCheckedItems) tunnelsToDelete.add(tunnels[position])
val futures = tunnelsToDelete
.map { obj -> obj.delete() }
.toTypedArray()
CompletableFuture.allOf(*futures as Array<out CompletableFuture<*>>)
val futures = tunnelsToDelete.map { it.delete().toCompletableFuture() }.toTypedArray()
CompletableFuture.allOf(*futures)
.thenApply { futures.size }
.whenComplete(this@TunnelListFragment::onTunnelDeletionFinished)
}