Merge pull request #4405 from deltachat/adb/issue-4401

remove legacy options
This commit is contained in:
adb
2026-05-13 22:44:19 +02:00
committed by GitHub
8 changed files with 7 additions and 166 deletions
+1
View File
@@ -20,6 +20,7 @@
* Allow to disable incoming calls notifications
* Fix: do not accidentally set draft in chats that don't allow sending messages
* Fix swipe navigation between tabs in RTL languages
* Remove legacy option
## v2.49.0
2026-04
@@ -228,12 +228,6 @@ public class ApplicationContext extends MultiDexApplication {
// 2025-12-16: The setting was removed.
// Revert it to the default if it was changed in the past.
ac.setConfigInt("webxdc_realtime_enabled", 1);
// 2025-11-12: this is needed until core starts ignoring "delete_server_after" for
// chatmail
if (ac.isChatmail()) {
ac.setConfig("delete_server_after", null); // reset
}
}
if (allAccounts.length == 0) {
try {
@@ -48,10 +48,7 @@ public class DcHelper {
public static final String CONFIG_DISPLAY_NAME = "displayname";
public static final String CONFIG_SELF_STATUS = "selfstatus";
public static final String CONFIG_SELF_AVATAR = "selfavatar";
public static final String CONFIG_MVBOX_MOVE = "mvbox_move";
public static final String CONFIG_ONLY_FETCH_MVBOX = "only_fetch_mvbox";
public static final String CONFIG_BCC_SELF = "bcc_self";
public static final String CONFIG_SHOW_EMAILS = "show_emails";
public static final String CONFIG_MEDIA_QUALITY = "media_quality";
public static final String CONFIG_PROXY_ENABLED = "proxy_enabled";
public static final String CONFIG_PROXY_URL = "proxy_url";
@@ -3,9 +3,6 @@ package org.thoughtcrime.securesms.preferences;
import static android.app.Activity.RESULT_OK;
import static android.text.InputType.TYPE_TEXT_VARIATION_URI;
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_BCC_SELF;
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_MVBOX_MOVE;
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_ONLY_FETCH_MVBOX;
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_SHOW_EMAILS;
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_STATS_SENDING;
import android.content.Context;
@@ -23,7 +20,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.CheckBoxPreference;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import java.io.File;
import java.io.FileOutputStream;
@@ -41,17 +37,13 @@ import org.thoughtcrime.securesms.relay.RelayListActivity;
import org.thoughtcrime.securesms.util.Prefs;
import org.thoughtcrime.securesms.util.ScreenLockUtil;
import org.thoughtcrime.securesms.util.StreamUtil;
import org.thoughtcrime.securesms.util.Util;
public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
implements DcEventCenter.DcEventDelegate {
private static final String TAG = "AdvancedPreferenceFragment";
private ListPreference showEmails;
CheckBoxPreference selfReportingCheckbox;
CheckBoxPreference multiDeviceCheckbox;
CheckBoxPreference mvboxMoveCheckbox;
CheckBoxPreference onlyFetchMvboxCheckbox;
private ActivityResultLauncher<Intent> screenLockLauncher;
@Override
@@ -67,16 +59,6 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
}
});
showEmails = (ListPreference) this.findPreference("pref_show_emails");
if (showEmails != null) {
showEmails.setOnPreferenceChangeListener(
(preference, newValue) -> {
updateListSummary(preference, newValue);
dcContext.setConfigInt(CONFIG_SHOW_EMAILS, Util.objectToInt(newValue));
return true;
});
}
multiDeviceCheckbox = (CheckBoxPreference) this.findPreference("pref_bcc_self");
if (multiDeviceCheckbox != null) {
multiDeviceCheckbox.setOnPreferenceChangeListener(
@@ -101,40 +83,6 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
});
}
mvboxMoveCheckbox = (CheckBoxPreference) this.findPreference("pref_mvbox_move");
if (mvboxMoveCheckbox != null) {
mvboxMoveCheckbox.setOnPreferenceChangeListener(
(preference, newValue) -> {
boolean enabled = (Boolean) newValue;
dcContext.setConfigInt(CONFIG_MVBOX_MOVE, enabled ? 1 : 0);
return true;
});
}
onlyFetchMvboxCheckbox = this.findPreference("pref_only_fetch_mvbox");
if (onlyFetchMvboxCheckbox != null) {
onlyFetchMvboxCheckbox.setOnPreferenceChangeListener(
((preference, newValue) -> {
final boolean enabled = (Boolean) newValue;
if (enabled) {
new AlertDialog.Builder(requireContext())
.setMessage(R.string.pref_imap_folder_warn_disable_defaults)
.setPositiveButton(
R.string.ok,
(dialogInterface, i) -> {
dcContext.setConfigInt(CONFIG_ONLY_FETCH_MVBOX, 1);
((CheckBoxPreference) preference).setChecked(true);
})
.setNegativeButton(R.string.cancel, null)
.show();
return false;
} else {
dcContext.setConfigInt(CONFIG_ONLY_FETCH_MVBOX, 0);
return true;
}
}));
}
Preference screenSecurity = this.findPreference(Prefs.SCREEN_SECURITY_PREF);
if (screenSecurity != null) {
screenSecurity.setOnPreferenceChangeListener(new ScreenShotSecurityListener());
@@ -213,10 +161,6 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
return true;
}));
}
if (dcContext.isChatmail()) {
findPreference("pref_category_legacy").setVisible(false);
}
}
@Override
@@ -231,14 +175,8 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
((ApplicationPreferencesActivity) requireActivity()).getSupportActionBar())
.setTitle(R.string.menu_advanced);
String value = Integer.toString(dcContext.getConfigInt("show_emails"));
showEmails.setValue(value);
updateListSummary(showEmails, value);
selfReportingCheckbox.setChecked(0 != dcContext.getConfigInt(CONFIG_STATS_SENDING));
multiDeviceCheckbox.setChecked(0 != dcContext.getConfigInt(CONFIG_BCC_SELF));
mvboxMoveCheckbox.setChecked(0 != dcContext.getConfigInt(CONFIG_MVBOX_MOVE));
onlyFetchMvboxCheckbox.setChecked(0 != dcContext.getConfigInt(CONFIG_ONLY_FETCH_MVBOX));
}
protected File copyToCacheDir(Uri uri) throws IOException {
@@ -34,7 +34,6 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
private CheckBoxPreference readReceiptsCheckbox;
private ListPreference autoDelDevice;
private ListPreference autoDelServer;
@Override
public void onCreate(Bundle paramBundle) {
@@ -85,15 +84,7 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
autoDelDevice = findPreference("autodel_device");
if (autoDelDevice != null) {
autoDelDevice.setOnPreferenceChangeListener(new AutodelChangeListener("delete_device_after"));
}
autoDelServer = findPreference("autodel_server");
if (autoDelServer != null) {
autoDelServer.setOnPreferenceChangeListener(new AutodelChangeListener("delete_server_after"));
}
if (dcContext.isChatmail()) {
autoDelServer.setVisible(false);
autoDelDevice.setOnPreferenceChangeListener(new AutodelChangeListener());
}
}
@@ -124,16 +115,7 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
}
private void initAutodelFromCore() {
String value = Integer.toString(dcContext.getConfigInt("delete_server_after"));
autoDelServer.setValue(value);
updateListSummary(
autoDelServer,
value,
(value.equals("0") || dcContext.isChatmail())
? null
: getString(R.string.autodel_server_enabled_hint));
value = Integer.toString(dcContext.getConfigInt("delete_device_after"));
String value = Integer.toString(dcContext.getConfigInt("delete_device_after"));
autoDelDevice.setValue(value);
updateListSummary(autoDelDevice, value);
}
@@ -201,19 +183,14 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
}
private class AutodelChangeListener implements Preference.OnPreferenceChangeListener {
private final String coreKey;
AutodelChangeListener(String coreKey) {
this.coreKey = coreKey;
}
private final String coreKey = "delete_device_after";
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
int timeout = Util.objectToInt(newValue);
Context context = preference.getContext();
boolean fromServer = coreKey.equals("delete_server_after");
if (timeout > 0 && !(fromServer && dcContext.isChatmail())) {
int delCount = DcHelper.getContext(context).estimateDeletionCount(fromServer, timeout);
if (timeout > 0) {
int delCount = DcHelper.getContext(context).estimateDeletionCount(false, timeout);
View gl = View.inflate(getActivity(), R.layout.dialog_with_checkbox, null);
CheckBox confirmCheckbox = gl.findViewById(R.id.dialog_checkbox);
@@ -224,8 +201,7 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
// "OK" and "Cancel" buttons would not be show. So, put the message into our custom view:
msg.setText(
String.format(
context.getString(
fromServer ? R.string.autodel_server_ask : R.string.autodel_device_ask),
context.getString(R.string.autodel_device_ask),
delCount,
getSelectedSummary(preference, newValue)));
confirmCheckbox.setText(R.string.autodel_confirm);
@@ -250,23 +226,6 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
// :)
.setOnCancelListener(dialog -> initAutodelFromCore())
.show();
} else if (fromServer
&& timeout
== 1 /*at once, using a constant that cannot be used in .xml would weaken grep ability*/) {
new AlertDialog.Builder(context)
.setTitle(R.string.autodel_server_warn_multi_device_title)
.setMessage(R.string.autodel_server_warn_multi_device)
.setPositiveButton(
android.R.string.ok,
(dialog, whichButton) -> {
dcContext.setConfigInt(coreKey, timeout);
initAutodelFromCore();
})
.setNegativeButton(
android.R.string.cancel, (dialog, whichButton) -> initAutodelFromCore())
.setCancelable(true)
.setOnCancelListener(dialog -> initAutodelFromCore())
.show();
} else {
updateListSummary(preference, newValue);
dcContext.setConfigInt(coreKey, timeout);
-20
View File
@@ -100,26 +100,6 @@
<item>31536000</item>
</string-array>
<string-array name="autodel_server_durations">
<item>@string/never</item>
<item>@string/autodel_at_once</item>
<item>@string/autodel_after_1_hour</item>
<item>@string/autodel_after_1_day</item>
<item>@string/autodel_after_1_week</item>
<item>@string/after_5_weeks</item>
<item>@string/autodel_after_1_year</item>
</string-array>
<string-array name="autodel_server_values">
<item>0</item>
<item>1</item>
<item>3600</item>
<item>86400</item>
<item>604800</item>
<item>3024000</item>
<item>31536000</item>
</string-array>
<string-array name="share_location_durations">
<item>@string/share_location_for_30_minutes</item>
<item>@string/share_location_for_one_hour</item>
-22
View File
@@ -62,26 +62,4 @@
</PreferenceCategory>
<PreferenceCategory
android:key="pref_category_legacy"
android:title="Legacy">
<ListPreference
android:key="pref_show_emails"
android:title="@string/pref_show_emails"
android:entries="@array/pref_show_emails_entries"
android:entryValues="@array/pref_show_emails_values" />
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:defaultValue="true"
android:key="pref_mvbox_move"
android:title="@string/pref_auto_folder_moves" />
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:defaultValue="false"
android:key="pref_only_fetch_mvbox"
android:title="@string/pref_only_fetch_mvbox_title" />
</PreferenceCategory>
</PreferenceScreen>
-6
View File
@@ -38,12 +38,6 @@
android:title="@string/autodel_device_title"
android:entries="@array/autodel_device_durations"
android:entryValues="@array/autodel_device_values" />
<ListPreference
android:key="autodel_server"
android:title="@string/autodel_server_title"
android:entries="@array/autodel_server_durations"
android:entryValues="@array/autodel_server_values" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_backup">