From e8ab16747de01cef9b27543f9d1a1d510d78a664 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 21 Nov 2022 14:09:10 +0100 Subject: [PATCH] Fix issue #500 - Crash due to proxy - Disable DNS check --- app/src/main/java/app/fedilab/android/helper/Helper.java | 2 +- .../fedilab/android/ui/fragment/login/FragmentLoginMain.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/helper/Helper.java b/app/src/main/java/app/fedilab/android/helper/Helper.java index 7a34d668..5277dbb7 100644 --- a/app/src/main/java/app/fedilab/android/helper/Helper.java +++ b/app/src/main/java/app/fedilab/android/helper/Helper.java @@ -1190,7 +1190,7 @@ public class Helper { return null; } Proxy proxy = new Proxy(type == 0 ? Proxy.Type.HTTP : Proxy.Type.SOCKS, - new InetSocketAddress(hostVal, portVal)); + InetSocketAddress.createUnresolved(hostVal, portVal)); Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/login/FragmentLoginMain.java b/app/src/main/java/app/fedilab/android/ui/fragment/login/FragmentLoginMain.java index c193b1aa..6ec7e0da 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/login/FragmentLoginMain.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/login/FragmentLoginMain.java @@ -75,7 +75,7 @@ public class FragmentLoginMain extends Fragment { binding = FragmentLoginMainBinding.inflate(inflater, container, false); View root = binding.getRoot(); - + InstanceSocialVM instanceSocialVM = new ViewModelProvider(FragmentLoginMain.this).get(InstanceSocialVM.class); binding.menuIcon.setOnClickListener(this::showMenu); binding.loginInstance.setOnItemClickListener((parent, view, position, id) -> oldSearch = parent.getItemAtPosition(position).toString().trim()); binding.loginInstance.addTextChangedListener(new TextWatcher() { @@ -101,7 +101,7 @@ public class FragmentLoginMain extends Fragment { } if (oldSearch == null || !oldSearch.equals(s.toString().trim())) { searchInstanceRunning = true; - InstanceSocialVM instanceSocialVM = new ViewModelProvider(FragmentLoginMain.this).get(InstanceSocialVM.class); + instanceSocialVM.getInstances(query).observe(requireActivity(), instanceSocialList -> { binding.loginInstance.setAdapter(null); if (instanceSocialList.instances.isEmpty()) {