Don't mark messages as read when screen is locked.

This commit is contained in:
John Preston 2021-04-27 12:46:51 +04:00
parent da1168fb00
commit 819ce06dfb
12 changed files with 79 additions and 23 deletions

View file

@ -208,6 +208,55 @@ callRemoteAudioMute: FlatLabel(callStatus) {
}
callRemoteAudioMuteSkip: 12px;
callMuteMainBlobMinRadius: 57px;
callMuteMainBlobMaxRadius: 63px;
callMuteMinorBlobMinRadius: 64px;
callMuteMinorBlobMaxRadius: 74px;
callMuteMajorBlobMinRadius: 67px;
callMuteMajorBlobMaxRadius: 77px;
callMuteButtonActiveInner: IconButton {
width: 136px;
height: 165px;
}
callMuteButtonLabel: FlatLabel(defaultFlatLabel) {
textFg: groupCallMembersFg;
style: TextStyle(defaultTextStyle) {
font: font(14px);
linkFont: font(14px);
linkFontOver: font(14px underline);
}
}
callMuteButtonSublabel: FlatLabel(defaultFlatLabel) {
textFg: groupCallMemberNotJoinedStatus;
}
callMuteButtonLabelsSkip: 5px;
callMuteButtonSublabelSkip: 19px;
callMuteButtonActive: CallButton {
button: callMuteButtonActiveInner;
bg: groupCallLive1;
bgSize: 100px;
bgPosition: point(18px, 18px);
outerRadius: 18px;
outerBg: callAnswerBgOuter;
label: callMuteButtonLabel;
}
callMuteButtonMuted: CallButton(callMuteButtonActive) {
bg: groupCallMuted1;
label: callMuteButtonLabel;
}
callMuteButtonConnecting: CallButton(callMuteButtonMuted) {
bg: callIconBg;
label: callMuteButtonLabel;
}
callMuteButtonLabelAdditional: 5px;
callConnectingRadial: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) {
color: lightButtonFg;
thickness: 4px;
size: size(100px, 100px);
}
callBarHeight: 38px;
callBarMuteToggle: IconButton {
width: 41px;

View file

@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "main/main_app_config.h"
#include "mainwindow.h"
#include "facades.h" // Global::ScreenIsLocked.
namespace Core {
namespace {
@ -112,6 +113,10 @@ void UiIntegration::activationFromTopPanel() {
Platform::IgnoreApplicationActivationRightNow();
}
bool UiIntegration::screenIsLocked() {
return Global::ScreenIsLocked();
}
QString UiIntegration::timeFormat() {
return cTimeFormat();
}

View file

@ -41,6 +41,7 @@ public:
void textActionsUpdated() override;
void activationFromTopPanel() override;
bool screenIsLocked() override;
QString timeFormat() override;
std::shared_ptr<ClickHandler> createLinkHandler(

View file

@ -727,6 +727,10 @@ bool SkipFlashBounce() {
return Inhibited();
}
bool HideDetails() {
return false;
}
bool Supported() {
return ServiceRegistered;
}

View file

@ -159,6 +159,10 @@ bool SkipFlashBounce() {
return SkipAudio();
}
bool HideDetails() {
return Global::ScreenIsLocked();
}
bool Supported() {
return Platform::IsMac10_8OrGreater();
}

View file

@ -15,6 +15,7 @@ namespace Notifications {
[[nodiscard]] bool SkipAudio();
[[nodiscard]] bool SkipToast();
[[nodiscard]] bool SkipFlashBounce();
[[nodiscard]] bool HideDetails();
[[nodiscard]] bool Supported();
[[nodiscard]] bool Enforced();

View file

@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/core_settings.h"
#include "main/main_session.h"
#include "mainwindow.h"
#include "facades.h" // Global::ScreenIsLocked.
#include "windows_quiethours_h.h"
#include <Shobjidl.h>
@ -798,14 +799,10 @@ bool SkipAudio() {
if (UserNotificationState == QUNS_NOT_PRESENT
|| UserNotificationState == QUNS_PRESENTATION_MODE
|| QuietHoursEnabled
|| FocusAssistBlocks) {
|| FocusAssistBlocks
|| Global::ScreenIsLocked()) {
return true;
}
if (const auto filter = EventFilter::GetInstance()) {
if (filter->sessionLoggedOff()) {
return true;
}
}
return false;
}
@ -826,5 +823,9 @@ bool SkipFlashBounce() {
return SkipToast();
}
bool HideDetails() {
return false;
}
} // namespace Notifications
} // namespace Platform

View file

@ -93,10 +93,6 @@ EventFilter *EventFilter::CreateInstance(not_null<MainWindow*> window) {
return (instance = new EventFilter(window));
}
EventFilter *EventFilter::GetInstance() {
return instance;
}
void EventFilter::Destroy() {
Expects(instance != nullptr);
@ -240,9 +236,9 @@ bool EventFilter::mainWindowEvent(
case WM_WTSSESSION_CHANGE: {
if (wParam == WTS_SESSION_LOGOFF || wParam == WTS_SESSION_LOCK) {
setSessionLoggedOff(true);
Global::SetScreenIsLocked(true);
} else if (wParam == WTS_SESSION_LOGON || wParam == WTS_SESSION_UNLOCK) {
setSessionLoggedOff(false);
Global::SetScreenIsLocked(false);
}
} return false;

View file

@ -20,15 +20,7 @@ public:
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result);
bool mainWindowEvent(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result);
bool sessionLoggedOff() const {
return _sessionLoggedOff;
}
void setSessionLoggedOff(bool loggedOff) {
_sessionLoggedOff = loggedOff;
}
static EventFilter *CreateInstance(not_null<MainWindow*> window);
static EventFilter *GetInstance();
static void Destroy();
private:
@ -42,7 +34,6 @@ private:
LRESULT *result);
not_null<MainWindow*> _window;
bool _sessionLoggedOff = false;
};

View file

@ -13,6 +13,10 @@
#include "ui/effects/radial_animation.h"
#include "lottie/lottie_icon.h"
namespace st {
extern const style::InfiniteRadialAnimation &callConnectingRadial;
} // namespace st
namespace Ui {
class BlobsWidget;

View file

@ -578,7 +578,7 @@ void System::updateAll() {
Manager::DisplayOptions Manager::GetNotificationOptions(HistoryItem *item) {
const auto hideEverything = Core::App().passcodeLocked()
|| Global::ScreenIsLocked();
|| Platform::Notifications::HideDetails();
const auto view = Core::App().settings().notifyView();
DisplayOptions result;

@ -1 +1 @@
Subproject commit eb768c8c4b5bf09e6b6598728333fb99d65486e7
Subproject commit 14c67cf724a572186455a8c0639f037ae26cc762