1package eu.siacs.conversations.ui.fragment.settings;
2
3import android.os.Bundle;
4
5import androidx.annotation.NonNull;
6import androidx.annotation.Nullable;
7
8import eu.siacs.conversations.AppSettings;
9import eu.siacs.conversations.R;
10
11public class PrivacySettingsFragment extends XmppPreferenceFragment {
12
13 @Override
14 public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) {
15 setPreferencesFromResource(R.xml.preferences_privacy, rootKey);
16 try {
17 Class.forName("io.sentry.Sentry");
18 final var neverSend = findPreference("send_crash_reports");
19 neverSend.setVisible(false);
20 final var appCat = findPreference("category_application");
21 appCat.setVisible(false);
22 } catch (final ClassNotFoundException e) { }
23 }
24
25 @Override
26 protected void onSharedPreferenceChanged(@NonNull String key) {
27 super.onSharedPreferenceChanged(key);
28 switch (key) {
29 case AppSettings.AWAY_WHEN_SCREEN_IS_OFF, AppSettings.MANUALLY_CHANGE_PRESENCE -> {
30 requireService().toggleScreenEventReceiver();
31 requireService().refreshAllPresences();
32 }
33 case AppSettings.CONFIRM_MESSAGES,
34 AppSettings.BROADCAST_LAST_ACTIVITY,
35 AppSettings.ALLOW_MESSAGE_CORRECTION,
36 AppSettings.DND_ON_SILENT_MODE,
37 AppSettings.TREAT_VIBRATE_AS_SILENT -> {
38 requireService().refreshAllPresences();
39 }
40 }
41 }
42
43 @Override
44 public void onStart() {
45 super.onStart();
46 requireActivity().setTitle(R.string.pref_privacy);
47 }
48}