Commit 931f5425 authored by Grigory Fedorov's avatar Grigory Fedorov

New debug preference: show connection errors pop-ups (disabled by default).

parent 8e73e059
......@@ -450,6 +450,10 @@ public class SettingsManager implements OnInitializedListener,
return getBoolean(R.string.debug_log_key, R.bool.debug_log_default);
}
public static boolean showConnectionErrors() {
return getBoolean(R.string.debug_connection_errors_key, R.bool.debug_connection_errors_default);
}
public static InterfaceTheme interfaceTheme() {
String value = getString(R.string.interface_theme_key,
R.string.interface_theme_default);
......
......@@ -20,6 +20,7 @@ import com.xabber.android.R;
import com.xabber.android.data.Application;
import com.xabber.android.data.LogManager;
import com.xabber.android.data.NetworkException;
import com.xabber.android.data.SettingsManager;
import com.xabber.android.data.account.AccountItem;
import com.xabber.android.data.account.AccountProtocol;
import com.xabber.android.data.account.OAuthManager;
......@@ -533,15 +534,17 @@ public class ConnectionThread implements
if (checkForSeeOtherHost(e))
return;
if (SettingsManager.showConnectionErrors()) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(Application.getInstance(),
Application.getInstance().getString(R.string.CONNECTION_FAILED) + ": " + e.getMessage(),
Toast.LENGTH_LONG
Toast.LENGTH_SHORT
).show();
}
});
}
connectionClosed();
}
......
......@@ -78,4 +78,5 @@
<string name="connection_use_carbons">Carbon-copied mode\nMay be unstable! Will share sessions for the same account on this client. Disable to reduce traffic usage.</string>
<string name="events_phrases">Key phrases\nCreate custom notifications for received messages that contain specific phrases</string>
<string name="security_clear_certificate_warning">Do you really want to remove all ignored certificates?</string>
<string name="debug_connection_errors_title">Show connection errors\nDisplay connection exceptions pop-ups</string>
</resources>
......@@ -353,13 +353,15 @@
<string name="connection_use_carbons_key">connection_use_carbons</string>
<bool name="connection_use_carbons_default">false</bool>
<!-- preference_cache -->
<!-- preference_debug -->
<string name="cache_clear_key">cache_clear</string>
<!-- preference_debug -->
<string name="debug_log_key">debug_log</string>
<bool name="debug_log_default">true</bool>
<string name="debug_connection_errors_key">connection_errors</string>
<bool name="debug_connection_errors_default">false</bool>
<!-- preference_about -->
<string name="preference_about">@string/about_viewer</string>
<string name="preference_about_key">preference_about</string>
......
......@@ -9,4 +9,11 @@
android:title="@string/cache_clear"
android:key="@string/cache_clear_key"
android:dialogMessage="@string/cache_clear_warning"/>
<CheckBoxPreference
android:title="@string/debug_connection_errors_title"
android:key="@string/debug_connection_errors_key"
android:defaultValue="@bool/debug_connection_errors_default"
/>
</PreferenceScreen>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment