iOS build fixes
This commit is contained in:
parent
bf8b3c3b2f
commit
9e0fd7d51e
3 changed files with 12 additions and 7 deletions
|
@ -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 \
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef IOSNOTIFICATIONHANDLER_H
|
||||
#define IOSNOTIFICATIONHANDLER_H
|
||||
|
||||
#include "notificationhandler.h"
|
||||
#include "ui/notificationhandler.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -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 <UserNotifications/UserNotifications.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
@ -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];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue