mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-22 02:01:08 +07:00
iOS build fixes
This commit is contained in:
@@ -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];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user