From 9e0fd7d51e771c71d202e7b453980ac8a1931d0c Mon Sep 17 00:00:00 2001 From: pokamest Date: Tue, 30 Nov 2021 12:53:12 -0800 Subject: [PATCH] iOS build fixes --- client/client.pro | 2 ++ client/platforms/ios/iosnotificationhandler.h | 7 ++++--- client/platforms/ios/iosnotificationhandler.mm | 10 ++++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/client/client.pro b/client/client.pro index 91109890..c503ed2a 100644 --- a/client/client.pro +++ b/client/client.pro @@ -280,6 +280,7 @@ ios { HEADERS += \ protocols/ios_vpnprotocol.h \ + platforms/ios/iosnotificationhandler.h \ platforms/ios/json.h \ platforms/ios/bigint.h \ platforms/ios/bigintipv6addr.h \ @@ -288,6 +289,7 @@ ios { SOURCES += \ protocols/ios_vpnprotocol.mm \ + platforms/ios/iosnotificationhandler.mm \ platforms/ios/json.cpp \ platforms/ios/iosglue.mm \ platforms/ios/ipaddress.cpp \ diff --git a/client/platforms/ios/iosnotificationhandler.h b/client/platforms/ios/iosnotificationhandler.h index 4895e626..2845016a 100644 --- a/client/platforms/ios/iosnotificationhandler.h +++ b/client/platforms/ios/iosnotificationhandler.h @@ -5,7 +5,7 @@ #ifndef IOSNOTIFICATIONHANDLER_H #define IOSNOTIFICATIONHANDLER_H -#include "notificationhandler.h" +#include "ui/notificationhandler.h" #include @@ -17,11 +17,12 @@ class IOSNotificationHandler final : public NotificationHandler { ~IOSNotificationHandler(); protected: - void notify(const QString& title, const QString& message, - int timerSec) override; + void notify(Message type, const QString& title, const QString& message, + int timerMsec) override; private: void* m_delegate = nullptr; }; + #endif // IOSNOTIFICATIONHANDLER_H diff --git a/client/platforms/ios/iosnotificationhandler.mm b/client/platforms/ios/iosnotificationhandler.mm index b9b1e387..a83cd70b 100644 --- a/client/platforms/ios/iosnotificationhandler.mm +++ b/client/platforms/ios/iosnotificationhandler.mm @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "platforms/ios/iosnotificationhandler.h" -#include "leakdetector.h" #import #import @@ -43,7 +42,6 @@ @end IOSNotificationHandler::IOSNotificationHandler(QObject* parent) : NotificationHandler(parent) { - MVPN_COUNT_CTOR(IOSNotificationHandler); UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter]; [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | @@ -56,9 +54,12 @@ IOSNotificationHandler::IOSNotificationHandler(QObject* parent) : NotificationHa }]; } -IOSNotificationHandler::~IOSNotificationHandler() { MVPN_COUNT_DTOR(IOSNotificationHandler); } +IOSNotificationHandler::~IOSNotificationHandler() { } + +void IOSNotificationHandler::notify(NotificationHandler::Message type, const QString& title, + const QString& message, int timerMsec) { + Q_UNUSED(type); -void IOSNotificationHandler::notify(const QString& title, const QString& message, int timerSec) { if (!m_delegate) { return; } @@ -68,6 +69,7 @@ void IOSNotificationHandler::notify(const QString& title, const QString& message content.body = message.toNSString(); content.sound = [UNNotificationSound defaultSound]; + int timerSec = timerMsec / 1000; UNTimeIntervalNotificationTrigger* trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:timerSec repeats:NO];