Merge PR #498: Fixes for push notifications
This commit is contained in:
commit
22229b5ea8
@ -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
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user