From 5531f49c3e72ceed1a366adfe9291f722cd01cca Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 9 Jan 2016 21:00:50 +0800 Subject: [PATCH] moved instance id to Global namespace, 0.9.19 dev version --- Telegram/SourceFiles/pspecific_mac_p.mm | 10 +++++----- Telegram/SourceFiles/settings.cpp | 1 - Telegram/SourceFiles/settings.h | 2 -- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/pspecific_mac_p.mm b/Telegram/SourceFiles/pspecific_mac_p.mm index edcf51948..f5013dd78 100644 --- a/Telegram/SourceFiles/pspecific_mac_p.mm +++ b/Telegram/SourceFiles/pspecific_mac_p.mm @@ -208,10 +208,10 @@ public: } - (void) userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification { - NSNumber *instObj = [[notification userInfo] objectForKey:@"inst"]; + NSNumber *instObj = [[notification userInfo] objectForKey:@"launch"]; unsigned long long instLong = instObj ? [instObj unsignedLongLongValue] : 0; DEBUG_LOG(("Received notification with instance %1").arg(instLong)); - if (instLong != cInstance()) { // other app instance notification + if (instLong != Global::LaunchId()) { // other app instance notification return; } if (notification.activationType == NSUserNotificationActivationTypeReplied) { @@ -283,8 +283,8 @@ void PsMacWindowPrivate::showNotify(uint64 peer, int32 msgId, const QPixmap &pix NSUserNotification *notification = [[NSUserNotification alloc] init]; NSImage *img = qt_mac_create_nsimage(pix); - DEBUG_LOG(("Sending notification with userinfo: peer %1, msgId %2 and instance %3").arg(peer).arg(msgId).arg(cInstance())); - [notification setUserInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedLongLong:peer],@"peer",[NSNumber numberWithInt:msgId],@"msgid",[NSNumber numberWithUnsignedLongLong:cInstance()],@"inst",nil]]; + DEBUG_LOG(("Sending notification with userinfo: peer %1, msgId %2 and instance %3").arg(peer).arg(msgId).arg(Global::LaunchId())); + [notification setUserInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedLongLong:peer],@"peer",[NSNumber numberWithInt:msgId],@"msgid",[NSNumber numberWithUnsignedLongLong:Global::LaunchId()],@"launch",nil]]; [notification setTitle:QNSString(title).s()]; [notification setSubtitle:QNSString(subtitle).s()]; @@ -352,7 +352,7 @@ void PsMacWindowPrivate::clearNotifies(unsigned long long peer) { NSArray *notifies = [center deliveredNotifications]; for (id notify in notifies) { NSDictionary *dict = [notify userInfo]; - if ([[dict objectForKey:@"peer"] unsignedLongLongValue] == peer && [[dict objectForKey:@"inst"] unsignedLongLongValue] == cInstance()) { + if ([[dict objectForKey:@"peer"] unsignedLongLongValue] == peer && [[dict objectForKey:@"launch"] unsignedLongLongValue] == Global::LaunchId()) { [center removeDeliveredNotification:notify]; } } diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp index b5d400977..6860e244a 100644 --- a/Telegram/SourceFiles/settings.cpp +++ b/Telegram/SourceFiles/settings.cpp @@ -134,7 +134,6 @@ bool gRetina = false; float64 gRetinaFactor = 1.; int32 gIntRetinaFactor = 1; bool gCustomNotifies = true; -uint64 gInstance = 0.; #ifdef Q_OS_WIN DBIPlatform gPlatform = dbipWindows; diff --git a/Telegram/SourceFiles/settings.h b/Telegram/SourceFiles/settings.h index 561de9062..e14f92ddc 100644 --- a/Telegram/SourceFiles/settings.h +++ b/Telegram/SourceFiles/settings.h @@ -309,8 +309,6 @@ DeclareSetting(float64, RetinaFactor); DeclareSetting(int32, IntRetinaFactor); DeclareSetting(bool, CustomNotifies); -DeclareReadSetting(uint64, Instance); - DeclareReadSetting(DBIPlatform, Platform); DeclareReadSetting(bool, IsElCapitan); DeclareReadSetting(QUrl, UpdateURL);