From 28ab96812ef848677445116f2ec2cebf924f2bdf Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 8 Jan 2021 20:52:43 +0100 Subject: [PATCH 1/3] Fixes for new push notifications --- nymea-app/pushnotifications.cpp | 4 ++-- nymea-app/ui/devicepages/NotificationsDevicePage.qml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nymea-app/pushnotifications.cpp b/nymea-app/pushnotifications.cpp index 1fb71631..77b9b2d6 100644 --- a/nymea-app/pushnotifications.cpp +++ b/nymea-app/pushnotifications.cpp @@ -98,9 +98,9 @@ QString PushNotifications::service() const #elif defined Q_OS_IOS return "FB-APNs"; #elif defined UBPORTS - return "ubports"; + return "UBPorts"; #endif - return QString(); + return "None"; } QString PushNotifications::clientId() const diff --git a/nymea-app/ui/devicepages/NotificationsDevicePage.qml b/nymea-app/ui/devicepages/NotificationsDevicePage.qml index 3d3e797e..9a6566a5 100644 --- a/nymea-app/ui/devicepages/NotificationsDevicePage.qml +++ b/nymea-app/ui/devicepages/NotificationsDevicePage.qml @@ -136,12 +136,12 @@ DevicePageBase { } - GenericTypeLogView { + ListView { id: logView Layout.fillHeight: true Layout.fillWidth: true - logsModel: LogsModel { + model: LogsModel { id: logsModel thingId: root.device.id engine: _engine From 2ad3d8f74ce4cde04a32b391dc2e29d4a8137d66 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 8 Jan 2021 21:48:40 +0100 Subject: [PATCH 2/3] fixes on iOS --- nymea-app/ui/RootItem.qml | 7 +------ packaging/ios/pushnotifications.mm | 8 ++++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/nymea-app/ui/RootItem.qml b/nymea-app/ui/RootItem.qml index a8fb5a0b..0b39375e 100644 --- a/nymea-app/ui/RootItem.qml +++ b/nymea-app/ui/RootItem.qml @@ -283,15 +283,10 @@ Item { PlatformHelper.requestPermissions(); } } else { - var clientId = PlatformHelper.deviceSerial + "+io.guh.nymeaapp"; - if ("branding" in app) { - clientId += "-" + app.branding; - } - AWSClient.registerPushNotificationEndpoint( PushNotifications.cloudToken, PlatformHelper.machineHostname, - clientId, + PushNotifications.clientId, PlatformHelper.deviceManufacturer, PlatformHelper.deviceModel); } diff --git a/packaging/ios/pushnotifications.mm b/packaging/ios/pushnotifications.mm index 794595ad..753506e8 100644 --- a/packaging/ios/pushnotifications.mm +++ b/packaging/ios/pushnotifications.mm @@ -58,7 +58,7 @@ // qDebug() << "Registering for remote notifications"; // qDebug() << "Token description:" << QString::fromNSString(deviceToken.description); // qDebug() << "Parsed token:" << QString::fromNSString(tokenStr); -// PushNotifications::instance()->setAPNSRegistrationToken(QString::fromNSString(tokenStr)); + PushNotifications::instance()->setAPNSRegistrationToken(QString::fromNSString(tokenStr)); } - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { @@ -82,7 +82,7 @@ - (void)tokenRefreshNotification:(NSNotification *)notification { NSLog(@"instanceId_notification=>%@",[notification object]); NSString *InstanceID = [NSString stringWithFormat:@"%@",[notification object]]; - qDebug() << "Firebase token:" << QString::fromNSString(InstanceID); + qDebug() << "Notifation:" << QString::fromNSString(InstanceID); } @@ -93,8 +93,8 @@ [[NSNotificationCenter defaultCenter] postNotificationName: @"FCMToken" object:nil userInfo:dataDict]; // Note: This callback is fired at each app startup and whenever a new token is generated. - qDebug() << "Firebase token received:" << QString::fromNSString(fcmToken); - PushNotifications::instance()->setAPNSRegistrationToken(QString::fromNSString(fcmToken)); + //qDebug() << "Firebase token received:" << QString::fromNSString(fcmToken); + PushNotifications::instance()->setFirebaseRegistrationToken(QString::fromNSString(fcmToken)); } From 95e9d7d0f481c5786441ed4608847701ee88289e Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 8 Jan 2021 22:07:34 +0100 Subject: [PATCH 3/3] fix cloudToken --- nymea-app/pushnotifications.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nymea-app/pushnotifications.cpp b/nymea-app/pushnotifications.cpp index 77b9b2d6..7af41878 100644 --- a/nymea-app/pushnotifications.cpp +++ b/nymea-app/pushnotifications.cpp @@ -148,7 +148,7 @@ void PushNotifications::OnTokenReceived(const char *token) // On Android, both, core and cloud use the same token m_coreToken = QString(token); emit coreTokenChanged(); - m_cloudToken = m_cloudToken; + m_cloudToken = m_coreToken; emit cloudTokenChanged(); } #endif