diff --git a/app/src/main/java/com/termux/app/fragments/settings/DebuggingPreferencesFragment.java b/app/src/main/java/com/termux/app/fragments/settings/DebuggingPreferencesFragment.java index d8841eb477..61f99156b4 100644 --- a/app/src/main/java/com/termux/app/fragments/settings/DebuggingPreferencesFragment.java +++ b/app/src/main/java/com/termux/app/fragments/settings/DebuggingPreferencesFragment.java @@ -111,6 +111,9 @@ public void putBoolean(String key, boolean value) { case "plugin_error_notifications_enabled": mPreferences.setPluginErrorNotificationsEnabled(value); break; + case "crash_report_notifications_enabled": + mPreferences.setCrashReportNotificationsEnabled(value); + break; default: break; } @@ -123,6 +126,8 @@ public boolean getBoolean(String key, boolean defValue) { return mPreferences.getTerminalViewKeyLoggingEnabled(); case "plugin_error_notifications_enabled": return mPreferences.getPluginErrorNotificationsEnabled(); + case "crash_report_notifications_enabled": + return mPreferences.getCrashReportNotificationsEnabled(); default: return false; } diff --git a/app/src/main/java/com/termux/app/settings/preferences/TermuxAppSharedPreferences.java b/app/src/main/java/com/termux/app/settings/preferences/TermuxAppSharedPreferences.java index 2d7db91596..ba2b37a2f4 100644 --- a/app/src/main/java/com/termux/app/settings/preferences/TermuxAppSharedPreferences.java +++ b/app/src/main/java/com/termux/app/settings/preferences/TermuxAppSharedPreferences.java @@ -161,4 +161,14 @@ public void setPluginErrorNotificationsEnabled(boolean value) { SharedPreferenceUtils.setBoolean(mSharedPreferences, TERMUX_APP.KEY_PLUGIN_ERROR_NOTIFICATIONS_ENABLED, value, false); } + + + public boolean getCrashReportNotificationsEnabled() { + return SharedPreferenceUtils.getBoolean(mSharedPreferences, TERMUX_APP.KEY_CRASH_REPORT_NOTIFICATIONS_ENABLED, TERMUX_APP.DEFAULT_VALUE_CRASH_REPORT_NOTIFICATIONS_ENABLED); + } + + public void setCrashReportNotificationsEnabled(boolean value) { + SharedPreferenceUtils.setBoolean(mSharedPreferences, TERMUX_APP.KEY_CRASH_REPORT_NOTIFICATIONS_ENABLED, value, false); + } + } diff --git a/app/src/main/java/com/termux/app/settings/preferences/TermuxPreferenceConstants.java b/app/src/main/java/com/termux/app/settings/preferences/TermuxPreferenceConstants.java index fd4aef0722..2d3afd6e73 100644 --- a/app/src/main/java/com/termux/app/settings/preferences/TermuxPreferenceConstants.java +++ b/app/src/main/java/com/termux/app/settings/preferences/TermuxPreferenceConstants.java @@ -1,7 +1,7 @@ package com.termux.app.settings.preferences; /* - * Version: v0.7.0 + * Version: v0.8.0 * * Changelog * @@ -33,6 +33,10 @@ * - 0.7.0 (2021-03-27) * - Added following to `TERMUX_APP`: * `KEY_SOFT_KEYBOARD_ENABLED` and `DEFAULT_VALUE_KEY_SOFT_KEYBOARD_ENABLED`. + * + * - 0.8.0 (2021-04-06) + * - Added following to `TERMUX_APP`: + * `KEY_CRASH_REPORT_NOTIFICATIONS_ENABLED` and `DEFAULT_VALUE_CRASH_REPORT_NOTIFICATIONS_ENABLED`. */ /** @@ -108,6 +112,12 @@ public static final class TERMUX_APP { public static final String KEY_PLUGIN_ERROR_NOTIFICATIONS_ENABLED = "plugin_error_notifications_enabled"; public static final boolean DEFAULT_VALUE_PLUGIN_ERROR_NOTIFICATIONS_ENABLED = true; + /** + * Defines the key for whether notifications for crash reports are enabled or not. + */ + public static final String KEY_CRASH_REPORT_NOTIFICATIONS_ENABLED = "crash_report_notifications_enabled"; + public static final boolean DEFAULT_VALUE_CRASH_REPORT_NOTIFICATIONS_ENABLED = true; + } /** diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2afc8a7dfc..c3a127581c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -201,6 +201,11 @@ Disable flashes and notifications for plugin errors. Show flashes and notifications for plugin errors. (Default) + + Crash Report Notifications + Disable notifications for crash reports. + Show notifications for crash reports. (Default) + Terminal I/O diff --git a/app/src/main/res/xml/debugging_preferences.xml b/app/src/main/res/xml/debugging_preferences.xml index af126ff38f..48e44f98d1 100644 --- a/app/src/main/res/xml/debugging_preferences.xml +++ b/app/src/main/res/xml/debugging_preferences.xml @@ -22,6 +22,12 @@ app:summaryOn="@string/plugin_error_notifications_on" app:title="@string/plugin_error_notifications_title" /> + +