Added: Add multi process support in TermuxAppSharedPreferences since plugin apps may need to read values modified by termux app process

This commit is contained in:
agnostic-apollo
2022-03-16 20:59:48 +05:00
parent 621545dd0a
commit 4b07e4f4c0
4 changed files with 23 additions and 8 deletions

View File

@@ -648,7 +648,7 @@ public final class TermuxService extends Service implements AppShell.AppShellCli
} else {
TermuxAppSharedPreferences preferences = TermuxAppSharedPreferences.build(this);
if (preferences == null) return;
if (preferences.arePluginErrorNotificationsEnabled())
if (preferences.arePluginErrorNotificationsEnabled(false))
Logger.showToast(this, this.getString(R.string.error_display_over_other_apps_permission_not_granted), true);
}
}

View File

@@ -144,9 +144,9 @@ class DebuggingPreferencesDataStore extends PreferenceDataStore {
case "terminal_view_key_logging_enabled":
return mPreferences.isTerminalViewKeyLoggingEnabled();
case "plugin_error_notifications_enabled":
return mPreferences.arePluginErrorNotificationsEnabled();
return mPreferences.arePluginErrorNotificationsEnabled(false);
case "crash_report_notifications_enabled":
return mPreferences.areCrashReportNotificationsEnabled();
return mPreferences.areCrashReportNotificationsEnabled(false);
default:
return false;
}

View File

@@ -241,7 +241,7 @@ public class PluginUtils {
if (preferences == null) return;
// If user has disabled notifications for plugin commands, then just return
if (!preferences.arePluginErrorNotificationsEnabled() && !forceNotification)
if (!preferences.arePluginErrorNotificationsEnabled(true) && !forceNotification)
return;
logTag = DataUtils.getDefaultIfNull(logTag, LOG_TAG);