From af74c3604cbcb0e67af56980f14e81eef9ad388d Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 18 Sep 2019 11:04:36 +0200 Subject: [PATCH] fixed R8 weirdness --- proguard-rules.pro | 3 +++ .../conversations/http/services/MuclumbusService.java | 3 +-- .../conversations/services/ChannelDiscoveryService.java | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/proguard-rules.pro b/proguard-rules.pro index e3858fc38..78cc2a0f9 100644 --- a/proguard-rules.pro +++ b/proguard-rules.pro @@ -21,6 +21,9 @@ -dontwarn java.lang.** -dontwarn javax.lang.** +-keepclassmembers class eu.siacs.conversations.http.services.** { + !transient ; +} # Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and # EnclosingMethod is required to use InnerClasses. diff --git a/src/main/java/eu/siacs/conversations/http/services/MuclumbusService.java b/src/main/java/eu/siacs/conversations/http/services/MuclumbusService.java index 4f2b8f533..89a8e0ec4 100644 --- a/src/main/java/eu/siacs/conversations/http/services/MuclumbusService.java +++ b/src/main/java/eu/siacs/conversations/http/services/MuclumbusService.java @@ -4,7 +4,6 @@ import com.google.common.base.Objects; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Set; import eu.siacs.conversations.services.AvatarService; @@ -83,7 +82,7 @@ public interface MuclumbusService { class SearchRequest { - public Set keywords; + public final Set keywords; public SearchRequest(String keyword) { this.keywords = Collections.singleton(keyword); diff --git a/src/main/java/eu/siacs/conversations/services/ChannelDiscoveryService.java b/src/main/java/eu/siacs/conversations/services/ChannelDiscoveryService.java index 680c3af4e..f5dd08485 100644 --- a/src/main/java/eu/siacs/conversations/services/ChannelDiscoveryService.java +++ b/src/main/java/eu/siacs/conversations/services/ChannelDiscoveryService.java @@ -38,7 +38,8 @@ public class ChannelDiscoveryService { } void initializeMuclumbusService() { - OkHttpClient.Builder builder = new OkHttpClient.Builder(); + final OkHttpClient.Builder builder = new OkHttpClient.Builder(); + if (service.useTorToConnect()) { try { builder.proxy(HttpConnectionManager.getProxy()); @@ -57,7 +58,6 @@ public class ChannelDiscoveryService { void discover(String query, OnChannelSearchResultsFound onChannelSearchResultsFound) { final boolean all = query == null || query.trim().isEmpty(); - Log.d(Config.LOGTAG, "discover channels. query=" + query); List result = cache.getIfPresent(all ? "" : query); if (result != null) { onChannelSearchResultsFound.onChannelSearchResultsFound(result); @@ -98,7 +98,8 @@ public class ChannelDiscoveryService { } private void discoverChannels(final String query, OnChannelSearchResultsFound listener) { - Call searchResultCall = muclumbusService.search(new MuclumbusService.SearchRequest(query)); + MuclumbusService.SearchRequest searchRequest = new MuclumbusService.SearchRequest(query); + Call searchResultCall = muclumbusService.search(searchRequest); searchResultCall.enqueue(new Callback() { @Override