use is_muted config, migrate old preference value

This commit is contained in:
adbenitez
2024-07-10 13:12:59 +02:00
parent 2f590871fe
commit 93a8e3bc0e
3 changed files with 10 additions and 10 deletions
@@ -131,15 +131,16 @@ public class ApplicationContext extends MultiDexApplication {
rpc.start();
// migrating chat backgrounds, added 04/10/23, can be removed after some versions
String backgroundImagePath = Prefs.getStringPreference(this, "pref_chat_background", "");
if (!backgroundImagePath.isEmpty()) {
// migrating global notifications pref. to per-account config, added 10/July/24
final String NOTIFICATION_PREF = "pref_key_enable_notifications";
boolean isMuted = !Prefs.getBooleanPreference(this, NOTIFICATION_PREF, true);
if (isMuted) {
for (int accId : dcAccounts.getAll()) {
Prefs.setBackgroundImagePath(this, accId, backgroundImagePath);
dcAccounts.getAccount(accId).setMuted(true);
}
Prefs.setStringPreference(this, "pref_chat_background", "");
Prefs.removePreference(this, NOTIFICATION_PREF);
}
// /migrating chat backgrounds
// /migrating global notifications
for (int accountId : allAccounts) {
dcAccounts.getAccount(accountId).setConfig(CONFIG_VERIFIED_ONE_ON_ONE_CHATS, "1");