2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 08:55:59 +00:00

Respecting Quite Hours in Windows.

Also closing current chat on window close or passcode lock.
This commit is contained in:
John Preston
2016-10-17 13:55:17 +03:00
parent cf247384d3
commit 0902741b85
16 changed files with 121 additions and 56 deletions

View File

@@ -44,6 +44,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "apiwrap.h"
#include "settings/settings_widget.h"
#include "window/notifications_manager.h"
#include "platform/platform_notifications_manager.h"
ConnectingWidget::ConnectingWidget(QWidget *parent, const QString &text, const QString &reconnect) : QWidget(parent)
, _shadow(st::boxShadow)
@@ -1120,11 +1121,10 @@ void MainWindow::notifySchedule(History *history, HistoryItem *item) {
} else if (cOtherOnline() >= t) {
delay = Global::NotifyDefaultDelay();
}
// LOG(("Is online: %1, otherOnline: %2, currentTime: %3, otherNotOld: %4, otherLaterThanMe: %5").arg(Logs::b(isOnline)).arg(cOtherOnline()).arg(t).arg(Logs::b(otherNotOld)).arg(Logs::b(otherLaterThanMe)));
uint64 when = ms + delay;
_notifyWhenAlerts[history].insert(when, notifyByFrom);
if (Global::DesktopNotify() && !psSkipDesktopNotify()) {
if (Global::DesktopNotify() && !Platform::Notifications::skipToast()) {
NotifyWhenMaps::iterator i = _notifyWhenMaps.find(history);
if (i == _notifyWhenMaps.end()) {
i = _notifyWhenMaps.insert(history, NotifyWhenMap());
@@ -1254,7 +1254,7 @@ void MainWindow::notifyShowNext() {
App::playSound();
}
if (_notifyWaiters.isEmpty() || !Global::DesktopNotify() || psSkipDesktopNotify()) {
if (_notifyWaiters.isEmpty() || !Global::DesktopNotify() || Platform::Notifications::skipToast()) {
if (nextAlert) {
_notifyWaitTimer.start(nextAlert - ms);
}