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 -> Application.getTunnelManager().tunnels.thenAccept { tunnels ->
val tunnelsToDelete = ArrayList<ObservableTunnel>() val tunnelsToDelete = ArrayList<ObservableTunnel>()
for (position in copyCheckedItems) tunnelsToDelete.add(tunnels[position]) for (position in copyCheckedItems) tunnelsToDelete.add(tunnels[position])
val futures = tunnelsToDelete val futures = tunnelsToDelete.map { it.delete().toCompletableFuture() }.toTypedArray()
.map { obj -> obj.delete() } CompletableFuture.allOf(*futures)
.toTypedArray()
CompletableFuture.allOf(*futures as Array<out CompletableFuture<*>>)
.thenApply { futures.size } .thenApply { futures.size }
.whenComplete(this@TunnelListFragment::onTunnelDeletionFinished) .whenComplete(this@TunnelListFragment::onTunnelDeletionFinished)
} }