2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Clear macOS notifications in a separate thread.

Sometimes NSUserNotificationCenter -deliveredNotifications method call
freezes for a long time, so now we use it only in a separate thread and
we group all the requests for clearing while another clearing is done.
This commit is contained in:
John Preston
2017-04-12 15:50:35 +03:00
parent 50ea4e316e
commit 1725927aea
3 changed files with 96 additions and 38 deletions

View File

@@ -587,7 +587,6 @@ namespace Global {
namespace internal {
struct Data {
uint64 LaunchId = 0;
SingleQueuedInvokation HandleHistoryUpdate = { [] { App::app()->call_handleHistoryUpdate(); } };
SingleQueuedInvokation HandleUnreadCounterUpdate = { [] { App::app()->call_handleUnreadCounterUpdate(); } };
SingleQueuedInvokation HandleDelayedPeerUpdates = { [] { App::app()->call_handleDelayedPeerUpdates(); } };
@@ -697,8 +696,6 @@ bool started() {
void start() {
GlobalData = new internal::Data();
memset_rand(&GlobalData->LaunchId, sizeof(GlobalData->LaunchId));
}
void finish() {
@@ -706,7 +703,6 @@ void finish() {
GlobalData = nullptr;
}
DefineReadOnlyVar(Global, uint64, LaunchId);
DefineRefVar(Global, SingleQueuedInvokation, HandleHistoryUpdate);
DefineRefVar(Global, SingleQueuedInvokation, HandleUnreadCounterUpdate);
DefineRefVar(Global, SingleQueuedInvokation, HandleDelayedPeerUpdates);