mark silent notifications as local only

this will prevent silent notifications (for example those supressed by grace
period) showing up on my smart watch
This commit is contained in:
Daniel Gultsch 2019-11-01 11:03:54 +01:00
parent ecad9cbe3c
commit adfbe59e57
2 changed files with 5 additions and 0 deletions

View File

@ -827,6 +827,9 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
final Jid sender = InvalidJid.getNullForInvalid(displayed.getAttributeAsJid("sender"));
if (packet.fromAccount(account) && !selfAddressed) {
dismissNotification(account, counterpart, query);
if (query == null) {
activateGracePeriod(account);
}
} else if (isTypeGroupChat) {
Conversation conversation = mXmppConnectionService.find(account, counterpart.asBareJid());
if (conversation != null && id != null && sender != null) {

View File

@ -442,6 +442,8 @@ public class NotificationService {
} catch (SecurityException e) {
Log.d(Config.LOGTAG, "unable to use custom notification sound " + uri.toString());
}
} else {
mBuilder.setLocalOnly(true);
}
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mBuilder.setCategory(Notification.CATEGORY_MESSAGE);