mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-06 02:35:19 +08:00
Add crash_report_notifications_enabled shared preferences
This will allow users to control if a notification should be shown with the crash info when app is restarted after a crash The `TermuxPreferenceConstants` classes has been updated to `v0.8.0`. Check its Changelog section for info on changes.
This commit is contained in:
@@ -111,6 +111,9 @@ class DebuggingPreferencesDataStore extends PreferenceDataStore {
|
||||
case "plugin_error_notifications_enabled":
|
||||
mPreferences.setPluginErrorNotificationsEnabled(value);
|
||||
break;
|
||||
case "crash_report_notifications_enabled":
|
||||
mPreferences.setCrashReportNotificationsEnabled(value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -123,6 +126,8 @@ class DebuggingPreferencesDataStore extends PreferenceDataStore {
|
||||
return mPreferences.getTerminalViewKeyLoggingEnabled();
|
||||
case "plugin_error_notifications_enabled":
|
||||
return mPreferences.getPluginErrorNotificationsEnabled();
|
||||
case "crash_report_notifications_enabled":
|
||||
return mPreferences.getCrashReportNotificationsEnabled();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@@ -161,4 +161,14 @@ public class TermuxAppSharedPreferences {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package com.termux.app.settings.preferences;
|
||||
|
||||
/*
|
||||
* Version: v0.7.0
|
||||
* Version: v0.8.0
|
||||
*
|
||||
* Changelog
|
||||
*
|
||||
@@ -33,6 +33,10 @@ package com.termux.app.settings.preferences;
|
||||
* - 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 final class TermuxPreferenceConstants {
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -201,6 +201,11 @@
|
||||
<string name="plugin_error_notifications_off">Disable flashes and notifications for plugin errors.</string>
|
||||
<string name="plugin_error_notifications_on">Show flashes and notifications for plugin errors. (Default)</string>
|
||||
|
||||
<!-- Crash Report Notifications -->
|
||||
<string name="crash_report_notifications_title">Crash Report Notifications</string>
|
||||
<string name="crash_report_notifications_off">Disable notifications for crash reports.</string>
|
||||
<string name="crash_report_notifications_on">Show notifications for crash reports. (Default)</string>
|
||||
|
||||
|
||||
<!-- Terminal IO Preferences -->
|
||||
<string name="terminal_io_preferences">Terminal I/O</string>
|
||||
|
@@ -22,6 +22,12 @@
|
||||
app:summaryOn="@string/plugin_error_notifications_on"
|
||||
app:title="@string/plugin_error_notifications_title" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:key="crash_report_notifications_enabled"
|
||||
app:summaryOff="@string/crash_report_notifications_off"
|
||||
app:summaryOn="@string/crash_report_notifications_on"
|
||||
app:title="@string/crash_report_notifications_title" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
Reference in New Issue
Block a user