From 4df0cc3657b40c077403cf8befe4e8e976457b1f Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 26 Oct 2018 19:08:09 +0200 Subject: [PATCH] do not offer tor or extended connection settings for quicksy --- .../conversations/services/QuickConversationsService.java | 4 ++++ src/main/java/eu/siacs/conversations/Config.java | 1 - .../siacs/conversations/services/XmppConnectionService.java | 4 ++-- .../java/eu/siacs/conversations/ui/EditAccountActivity.java | 6 +++--- .../java/eu/siacs/conversations/ui/LocationActivity.java | 3 ++- .../java/eu/siacs/conversations/ui/SettingsActivity.java | 3 ++- .../siacs/conversations/ui/StartConversationActivity.java | 2 +- .../conversations/services/QuickConversationsService.java | 4 ++++ 8 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/full/java/eu/siacs/conversations/services/QuickConversationsService.java b/src/full/java/eu/siacs/conversations/services/QuickConversationsService.java index aacf9f23b..9ba02a556 100644 --- a/src/full/java/eu/siacs/conversations/services/QuickConversationsService.java +++ b/src/full/java/eu/siacs/conversations/services/QuickConversationsService.java @@ -11,4 +11,8 @@ public class QuickConversationsService { public static boolean isQuicksy() { return false; } + + public static boolean isFull() { + return true; + } } \ No newline at end of file diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 66d0ffef4..c09937442 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -47,7 +47,6 @@ public final class Config { public static final boolean USE_RANDOM_RESOURCE_ON_EVERY_BIND = false; public static final boolean ALLOW_NON_TLS_CONNECTIONS = false; //very dangerous. you should have a good reason to set this to true - public static final boolean FORCE_ORBOT = false; // always use TOR //Notification settings diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 0d5b075cf..16cd2fa0f 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -3332,11 +3332,11 @@ public class XmppConnectionService extends Service { } public boolean useTorToConnect() { - return Config.FORCE_ORBOT || getBooleanPreference("use_tor", R.bool.use_tor); + return QuickConversationsService.isFull() && getBooleanPreference("use_tor", R.bool.use_tor); } public boolean showExtendedConnectionOptions() { - return getBooleanPreference("show_connection_options", R.bool.show_connection_options); + return QuickConversationsService.isFull() && getBooleanPreference("show_connection_options", R.bool.show_connection_options); } public boolean broadcastLastActivity() { diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 50942476c..1085f32d1 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -623,8 +623,8 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } } SharedPreferences preferences = getPreferences(); - mUseTor = Config.FORCE_ORBOT || preferences.getBoolean("use_tor", false); - this.mShowOptions = mUseTor || preferences.getBoolean("show_connection_options", false); + mUseTor = QuickConversationsService.isFull() && preferences.getBoolean("use_tor", getResources().getBoolean(R.bool.use_tor)); + this.mShowOptions = mUseTor || (QuickConversationsService.isFull() && preferences.getBoolean("show_connection_options", getResources().getBoolean(R.bool.show_connection_options))); this.binding.namePort.setVisibility(mShowOptions ? View.VISIBLE : View.GONE); } @@ -888,7 +888,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } - final boolean editable = !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY) && !QuickConversationsService.isQuicksy(); + final boolean editable = !mAccount.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY) && QuickConversationsService.isFull(); this.binding.accountJid.setEnabled(editable); this.binding.accountJid.setFocusable(editable); this.binding.accountJid.setFocusableInTouchMode(editable); diff --git a/src/main/java/eu/siacs/conversations/ui/LocationActivity.java b/src/main/java/eu/siacs/conversations/ui/LocationActivity.java index 63f7393d7..51ae9399c 100644 --- a/src/main/java/eu/siacs/conversations/ui/LocationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/LocationActivity.java @@ -36,6 +36,7 @@ import eu.siacs.conversations.BuildConfig; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.http.HttpConnectionManager; +import eu.siacs.conversations.services.QuickConversationsService; import eu.siacs.conversations.ui.util.LocationHelper; import eu.siacs.conversations.ui.widget.Marker; import eu.siacs.conversations.ui.widget.MyLocation; @@ -103,7 +104,7 @@ public abstract class LocationActivity extends ActionBarActivity implements Loca final IConfigurationProvider config = Configuration.getInstance(); config.load(ctx, getPreferences()); config.setUserAgentValue(BuildConfig.APPLICATION_ID + "_" + BuildConfig.VERSION_CODE); - if (Config.FORCE_ORBOT || getBooleanPreference("use_tor", R.bool.use_tor)) { + if (QuickConversationsService.isFull() && getBooleanPreference("use_tor", R.bool.use_tor)) { try { config.setHttpProxy(HttpConnectionManager.getProxy()); } catch (IOException e) { diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java index a6ebacf47..43fc763ad 100644 --- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java @@ -38,6 +38,7 @@ import eu.siacs.conversations.crypto.OmemoSetting; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.services.ExportLogsService; import eu.siacs.conversations.services.MemorizingTrustManager; +import eu.siacs.conversations.services.QuickConversationsService; import eu.siacs.conversations.ui.util.StyledAttributes; import eu.siacs.conversations.utils.GeoHelper; import eu.siacs.conversations.utils.TimeframeUtils; @@ -91,7 +92,7 @@ public class SettingsActivity extends XmppActivity implements changeOmemoSettingSummary(); - if (Config.FORCE_ORBOT) { + if (QuickConversationsService.isQuicksy()) { PreferenceCategory connectionOptions = (PreferenceCategory) mSettingsFragment.findPreference("connection_options"); PreferenceScreen expert = (PreferenceScreen) mSettingsFragment.findPreference("expert"); if (connectionOptions != null) { diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 13c3b38e1..2f125340d 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -296,7 +296,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne final SharedPreferences preferences = getPreferences(); - this.mHideOfflineContacts = !QuickConversationsService.isQuicksy() && preferences.getBoolean("hide_offline", false); + this.mHideOfflineContacts = QuickConversationsService.isFull() && preferences.getBoolean("hide_offline", false); final boolean startSearching = preferences.getBoolean("start_searching",getResources().getBoolean(R.bool.start_searching)); diff --git a/src/quick/java/eu/siacs/conversations/services/QuickConversationsService.java b/src/quick/java/eu/siacs/conversations/services/QuickConversationsService.java index a1aee5795..5cfb048a8 100644 --- a/src/quick/java/eu/siacs/conversations/services/QuickConversationsService.java +++ b/src/quick/java/eu/siacs/conversations/services/QuickConversationsService.java @@ -260,6 +260,10 @@ public class QuickConversationsService { return true; } + public static boolean isFull() { + return false; + } + public interface OnVerificationRequested { void onVerificationRequestFailed(int code);