model: Proxy all async work through the TunnelManager

Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
Samuel Holland
2018-01-06 06:30:41 -06:00
parent 2315a699fb
commit 22bdffcecd
3 changed files with 69 additions and 70 deletions
@@ -198,7 +198,7 @@ public class TunnelListFragment extends BaseFragment {
case R.id.menu_action_delete:
final CompletableFuture[] futures = getCheckedPositions()
.mapToObj(pos -> (Tunnel) tunnelList.getItemAtPosition(pos))
.map(tunnelManager::delete)
.map(Tunnel::delete)
.toArray(CompletableFuture[]::new);
CompletableFuture.allOf(futures)
.thenApply(x -> futures.length)