diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java
index 3fe59d9e9..1c7626123 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java
@@ -264,6 +264,13 @@ public class ApplicationLoader extends Application {
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
boolean enablePushConnection = preferences.getBoolean("pushConnection", true);
+ if( preferences.getInt("notify2_"+MrMailbox.MR_CHAT_ID_STRANGERS, 666)==666 ) {
+ // make sure, the notifications for the "strangers" dialog are muted by default
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putInt("notify2_"+MrMailbox.MR_CHAT_ID_STRANGERS, 2);
+ editor.commit();
+ }
+
MessagesController.getInstance();
ConnectionsManager.getInstance().init(BuildVars.BUILD_VERSION, TLRPC.LAYER, BuildVars.APP_ID, deviceModel, systemVersion, appVersion, langCode, configPath, FileLog.getNetworkLogPath(), UserConfig.getClientUserId(), enablePushConnection);
if (UserConfig.getCurrentUser() != null) {
diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java
index 892791cbd..8e6ea0432 100644
--- a/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java
+++ b/TMessagesProj/src/main/java/org/telegram/messenger/NotificationsController.java
@@ -1838,7 +1838,10 @@ public class NotificationsController {
}
public static void updateServerNotificationsSettings(long dialog_id) {
+ // the following command is needed to reflect the changes in the GUI
NotificationCenter.getInstance().postNotificationName(NotificationCenter.notificationsSettingsUpdated);
+
+ /*
if ((int) dialog_id == 0) {
return;
}
@@ -1862,5 +1865,6 @@ public class NotificationsController {
}
});
+ */
}
}
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
index 69b5d67fa..7db36beb6 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
@@ -187,6 +187,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private StickersAdapter stickersAdapter;
private FrameLayout stickersPanel;
private TextView muteItem;
+ private boolean m_canMute;
private FrameLayout pagedownButton;
private boolean pagedownButtonShowedByScroll;
private TextView pagedownButtonCounter;
@@ -1026,7 +1027,18 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
*/
- muteItem = headerItem.addSubItem(mute, null, 0);
+
+ m_canMute = true;
+ if( MrMailbox.MrChatGetId(m_hChat)==MrMailbox.MR_CHAT_ID_STRANGERS
+ && MrMailbox.MrMailboxGetConfigInt(MrMailbox.hMailbox, "show_strangers", 0)==0 ) {
+ m_canMute = false;
+ }
+
+ if( m_canMute ) {
+ muteItem = headerItem.addSubItem(mute, null, 0);
+ }
+
+
/*
if (currentUser != null && currentEncryptedChat == null && currentUser.bot) {
headerItem.addSubItem(bot_settings, LocaleController.getString("BotSettings", R.string.BotSettings), 0);
@@ -3835,7 +3847,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
LocaleController.formatString("MuteFor", R.string.MuteFor, LocaleController.formatPluralString("Hours", 1)),
LocaleController.formatString("MuteFor", R.string.MuteFor, LocaleController.formatPluralString("Hours", 8)),
LocaleController.formatString("MuteFor", R.string.MuteFor, LocaleController.formatPluralString("Days", 2)),
- LocaleController.getString("MuteDisable", R.string.MuteDisable)
+ LocaleController.getString("MuteAlways", R.string.MuteAlways)
};
builder.setItems(items, new DialogInterface.OnClickListener() {
@Override
@@ -3848,23 +3860,20 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
- //long flags;
if (i == 3) {
editor.putInt("notify2_" + dialog_id, 2);
- //flags = 1;
} else {
editor.putInt("notify2_" + dialog_id, 3);
editor.putInt("notifyuntil_" + dialog_id, untilTime);
- //flags = ((long) untilTime << 32) | 1;
}
- NotificationsController.getInstance().removeNotificationsForDialog(dialog_id);
- //MessagesStorage.getInstance().setDialogFlags(dialog_id, flags);
editor.commit();
+ /*NotificationsController.getInstance().removeNotificationsForDialog(dialog_id);
TLRPC.TL_dialog dialog = MessagesController.getInstance().dialogs_dict.get(dialog_id);
if (dialog != null) {
dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
dialog.notify_settings.mute_until = untilTime;
}
+ */
NotificationsController.updateServerNotificationsSettings(dialog_id);
}
}
@@ -3875,12 +3884,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("notify2_" + dialog_id, 0);
- //MessagesStorage.getInstance().setDialogFlags(dialog_id, 0);
editor.commit();
- TLRPC.TL_dialog dialog = MessagesController.getInstance().dialogs_dict.get(dialog_id);
+ /*TLRPC.TL_dialog dialog = MessagesController.getInstance().dialogs_dict.get(dialog_id);
if (dialog != null) {
dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
}
+ */
NotificationsController.updateServerNotificationsSettings(dialog_id);
}
}
@@ -4400,12 +4409,19 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (avatarContainer == null) {
return;
}
- int rightIcon = MessagesController.getInstance().isDialogMuted(dialog_id) ? R.drawable.mute_fixed : 0;
+
+ int rightIcon = 0;
+ if( m_canMute && MessagesController.getInstance().isDialogMuted(dialog_id) ) {
+ rightIcon = R.drawable.mute_fixed;
+ }
+
avatarContainer.setTitleIcons(currentEncryptedChat != null ? R.drawable.ic_lock_header : 0, rightIcon);
- if (rightIcon != 0) {
- muteItem.setText(LocaleController.getString("UnmuteNotifications", R.string.UnmuteNotifications));
- } else {
- muteItem.setText(LocaleController.getString("MuteNotifications", R.string.MuteNotifications));
+ if( muteItem != null ) {
+ if (rightIcon != 0) {
+ muteItem.setText(LocaleController.getString("UnmuteNotifications", R.string.UnmuteNotifications));
+ } else {
+ muteItem.setText(LocaleController.getString("MuteNotifications", R.string.MuteNotifications));
+ }
}
}
@@ -6399,7 +6415,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (currentChat != null && (ChatObject.isNotInChat(currentChat) || !ChatObject.canWriteToChat(currentChat)) ||
currentUser != null && (UserObject.isDeleted(currentUser) || userBlocked)) {
bottomOverlayChat.setVisibility(View.VISIBLE);
- muteItem.setVisibility(View.GONE);
+ if (muteItem!=null){
+ muteItem.setVisibility(View.GONE);
+ }
chatActivityEnterView.setFieldFocused(false);
chatActivityEnterView.setVisibility(View.INVISIBLE);
} else {
@@ -6410,7 +6428,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatActivityEnterView.setVisibility(View.VISIBLE);
bottomOverlayChat.setVisibility(View.INVISIBLE);
}
- muteItem.setVisibility(View.VISIBLE);
+ if(muteItem!=null) {
+ muteItem.setVisibility(View.VISIBLE);
+ }
}
}
checkRaiseSensors();
diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java
index cd989c932..7f5fb5de0 100644
--- a/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java
+++ b/TMessagesProj/src/main/java/org/telegram/ui/PrivacySettingsActivity.java
@@ -10,6 +10,7 @@ package org.telegram.ui;
import android.app.Activity;
import android.content.Context;
+import android.content.SharedPreferences;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
@@ -232,6 +233,12 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(oldval == 0);
}
+
+ // if showing strangers is disabled, also disable notifications for this chat (cannot be displayed otherwise)
+ SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
+ SharedPreferences.Editor editor = preferences.edit();
+ editor.putInt("notify2_" + MrMailbox.MR_CHAT_ID_STRANGERS, oldval==1? 2 /*always muted*/ : 0);
+ editor.commit();
}
}
});
diff --git a/TMessagesProj/src/main/res/values-de/strings.xml b/TMessagesProj/src/main/res/values-de/strings.xml
index 55b0e10bd..472fe1c4f 100644
--- a/TMessagesProj/src/main/res/values-de/strings.xml
+++ b/TMessagesProj/src/main/res/values-de/strings.xml
@@ -919,4 +919,5 @@
Unbekannte Benutzer
Medien
Unbekannte Benutzer in Chatliste
+ Dauerhaft stumm
diff --git a/TMessagesProj/src/main/res/values-es/strings.xml b/TMessagesProj/src/main/res/values-es/strings.xml
index 23d86140f..bd21d07f5 100644
--- a/TMessagesProj/src/main/res/values-es/strings.xml
+++ b/TMessagesProj/src/main/res/values-es/strings.xml
@@ -57,7 +57,6 @@
Silenciar %1$s
No silenciar
En %1$s
- Desactivar
HASHTAGS
RECIENTES
CHATS
diff --git a/TMessagesProj/src/main/res/values-it/strings.xml b/TMessagesProj/src/main/res/values-it/strings.xml
index 7c929f7b9..cc71307d6 100644
--- a/TMessagesProj/src/main/res/values-it/strings.xml
+++ b/TMessagesProj/src/main/res/values-it/strings.xml
@@ -57,7 +57,6 @@
Silenzia per %1$s
Suona
Tra %1$s
- Disabilita
HASHTAG
RECENTI
CHAT
diff --git a/TMessagesProj/src/main/res/values-nl/strings.xml b/TMessagesProj/src/main/res/values-nl/strings.xml
index d579afb77..7e6e01ace 100644
--- a/TMessagesProj/src/main/res/values-nl/strings.xml
+++ b/TMessagesProj/src/main/res/values-nl/strings.xml
@@ -57,7 +57,6 @@
%1$s stil
Stil uitschakelen
Over %1$s
- Uitschakelen
HASHTAGS
RECENT
CHATS
diff --git a/TMessagesProj/src/main/res/values-pt/strings.xml b/TMessagesProj/src/main/res/values-pt/strings.xml
index 4be2c8797..9d305ae21 100644
--- a/TMessagesProj/src/main/res/values-pt/strings.xml
+++ b/TMessagesProj/src/main/res/values-pt/strings.xml
@@ -57,7 +57,6 @@
Silenciar por %1$s
Restaurar Som
Em %1$s
- Desativar
HASHTAGS
RECENTE
CONVERSAS
diff --git a/TMessagesProj/src/main/res/values/strings.xml b/TMessagesProj/src/main/res/values/strings.xml
index b86484511..07d277389 100644
--- a/TMessagesProj/src/main/res/values/strings.xml
+++ b/TMessagesProj/src/main/res/values/strings.xml
@@ -57,7 +57,7 @@
Mute for %1$s
Unmute
In %1$s
- Disable
+ Always muted
HASHTAGS
RECENT
CHATS
@@ -919,4 +919,5 @@
Unknown users
Media
Show unknown users in chatlist
+ Always muted