mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Hide native notification details on lock screen.
This commit is contained in:
@@ -727,10 +727,6 @@ bool SkipFlashBounce() {
|
||||
return Inhibited();
|
||||
}
|
||||
|
||||
bool HideDetails() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Supported() {
|
||||
return ServiceRegistered;
|
||||
}
|
||||
|
@@ -159,10 +159,6 @@ bool SkipFlashBounce() {
|
||||
return SkipAudio();
|
||||
}
|
||||
|
||||
bool HideDetails() {
|
||||
return Global::ScreenIsLocked();
|
||||
}
|
||||
|
||||
bool Supported() {
|
||||
return Platform::IsMac10_8OrGreater();
|
||||
}
|
||||
|
@@ -15,7 +15,6 @@ namespace Notifications {
|
||||
[[nodiscard]] bool SkipAudio();
|
||||
[[nodiscard]] bool SkipToast();
|
||||
[[nodiscard]] bool SkipFlashBounce();
|
||||
[[nodiscard]] bool HideDetails();
|
||||
|
||||
[[nodiscard]] bool Supported();
|
||||
[[nodiscard]] bool Enforced();
|
||||
|
@@ -823,9 +823,5 @@ bool SkipFlashBounce() {
|
||||
return SkipToast();
|
||||
}
|
||||
|
||||
bool HideDetails() {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Notifications
|
||||
} // namespace Platform
|
||||
|
@@ -576,9 +576,10 @@ void System::updateAll() {
|
||||
}
|
||||
}
|
||||
|
||||
Manager::DisplayOptions Manager::GetNotificationOptions(HistoryItem *item) {
|
||||
Manager::DisplayOptions Manager::getNotificationOptions(
|
||||
HistoryItem *item) const {
|
||||
const auto hideEverything = Core::App().passcodeLocked()
|
||||
|| Platform::Notifications::HideDetails();
|
||||
|| forceHideDetails();
|
||||
|
||||
const auto view = Core::App().settings().notifyView();
|
||||
DisplayOptions result;
|
||||
@@ -696,7 +697,7 @@ void Manager::notificationReplied(
|
||||
void NativeManager::doShowNotification(
|
||||
not_null<HistoryItem*> item,
|
||||
int forwardedCount) {
|
||||
const auto options = GetNotificationOptions(item);
|
||||
const auto options = getNotificationOptions(item);
|
||||
|
||||
const auto peer = item->history()->peer;
|
||||
const auto scheduled = !options.hideNameAndPhoto
|
||||
@@ -732,6 +733,10 @@ void NativeManager::doShowNotification(
|
||||
options.hideReplyButton);
|
||||
}
|
||||
|
||||
bool NativeManager::forceHideDetails() const {
|
||||
return Global::ScreenIsLocked();
|
||||
}
|
||||
|
||||
System::~System() = default;
|
||||
|
||||
QString WrapFromScheduled(const QString &text) {
|
||||
|
@@ -193,8 +193,8 @@ public:
|
||||
bool hideMessageText = false;
|
||||
bool hideReplyButton = false;
|
||||
};
|
||||
[[nodiscard]] static DisplayOptions GetNotificationOptions(
|
||||
HistoryItem *item);
|
||||
[[nodiscard]] DisplayOptions getNotificationOptions(
|
||||
HistoryItem *item) const;
|
||||
|
||||
[[nodiscard]] QString addTargetAccountName(
|
||||
const QString &title,
|
||||
@@ -218,6 +218,9 @@ protected:
|
||||
virtual void doClearFromItem(not_null<HistoryItem*> item) = 0;
|
||||
virtual void doClearFromHistory(not_null<History*> history) = 0;
|
||||
virtual void doClearFromSession(not_null<Main::Session*> session) = 0;
|
||||
[[nodiscard]] virtual bool forceHideDetails() const {
|
||||
return false;
|
||||
}
|
||||
virtual void onBeforeNotificationActivated(NotificationId id) {
|
||||
}
|
||||
virtual void onAfterNotificationActivated(
|
||||
@@ -256,6 +259,8 @@ protected:
|
||||
not_null<HistoryItem*> item,
|
||||
int forwardedCount) override;
|
||||
|
||||
bool forceHideDetails() const override;
|
||||
|
||||
virtual void doShowNativeNotification(
|
||||
not_null<PeerData*> peer,
|
||||
std::shared_ptr<Data::CloudImageView> &userpicView,
|
||||
|
@@ -725,7 +725,7 @@ void Notification::actionsOpacityCallback() {
|
||||
void Notification::updateNotifyDisplay() {
|
||||
if (!_history || (!_item && _forwardedCount < 2)) return;
|
||||
|
||||
const auto options = Manager::GetNotificationOptions(_item);
|
||||
const auto options = manager()->getNotificationOptions(_item);
|
||||
_hideReplyButton = options.hideReplyButton;
|
||||
|
||||
int32 w = width(), h = height();
|
||||
|
Reference in New Issue
Block a user