From d1e85633fbe8d871355d2b9feb51e2c9983d8a21 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Wed, 5 Sep 2018 20:17:14 -0500 Subject: Remodel the Model - The configuration and crypto model is now entirely independent of Android classes other than Nullable and TextUtils. - Model classes are immutable and use builders that enforce the appropriate optional/required attributes. - The Android config proxies (for Parcelable and databinding) are moved to the Android side of the codebase, and are designed to be safe for two-way databinding. This allows proper observability in TunnelDetailFragment. - Various robustness fixes and documentation updates to helper classes. Signed-off-by: Jason A. Donenfeld --- .../com/wireguard/android/fragment/TunnelDetailFragment.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java') diff --git a/app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java b/app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java index fcc601f3..b4e7202f 100644 --- a/app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java +++ b/app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java @@ -16,7 +16,6 @@ import android.view.ViewGroup; import com.wireguard.android.R; import com.wireguard.android.databinding.TunnelDetailFragmentBinding; import com.wireguard.android.model.Tunnel; -import com.wireguard.config.Config; /** * Fragment that shows details about a specific tunnel. @@ -25,12 +24,6 @@ import com.wireguard.config.Config; public class TunnelDetailFragment extends BaseFragment { @Nullable private TunnelDetailFragmentBinding binding; - private void onConfigLoaded(final String name, final Config config) { - if (binding != null) { - binding.setConfig(new Config.Observable(config, name)); - } - } - @Override public void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -65,7 +58,7 @@ public class TunnelDetailFragment extends BaseFragment { if (newTunnel == null) binding.setConfig(null); else - newTunnel.getConfigAsync().thenAccept(a -> onConfigLoaded(newTunnel.getName(), a)); + newTunnel.getConfigAsync().thenAccept(binding::setConfig); } @Override -- cgit v1.2.3