mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
use is_muted config, migrate old preference value
This commit is contained in:
@@ -237,11 +237,11 @@ public class DcContext {
|
||||
}
|
||||
|
||||
public boolean isMuted() {
|
||||
return getConfigInt("ui.muted") == 1;
|
||||
return getConfigInt("is_muted") == 1;
|
||||
}
|
||||
|
||||
public void setMuted(boolean muted) {
|
||||
setConfigInt("ui.muted", muted? 1 : 0);
|
||||
setConfigInt("is_muted", muted? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -40,7 +40,6 @@ public class Prefs {
|
||||
public static final String RINGTONE_PREF = "pref_key_ringtone";
|
||||
private static final String VIBRATE_PREF = "pref_key_vibrate";
|
||||
private static final String CHAT_VIBRATE = "pref_chat_vibrate_"; // followed by chat-id
|
||||
private static final String NOTIFICATION_PREF = "pref_key_enable_notifications";
|
||||
public static final String LED_COLOR_PREF = "pref_led_color";
|
||||
private static final String CHAT_RINGTONE = "pref_chat_ringtone_"; // followed by chat-id
|
||||
public static final String SCREEN_SECURITY_PREF = "pref_screen_security";
|
||||
@@ -322,7 +321,7 @@ public class Prefs {
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putLong(key, value).apply();
|
||||
}
|
||||
|
||||
private static void removePreference(Context context, String key) {
|
||||
public static void removePreference(Context context, String key) {
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().remove(key).apply();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user