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
|
#elif defined Q_OS_IOS
|
||||||
return "FB-APNs";
|
return "FB-APNs";
|
||||||
#elif defined UBPORTS
|
#elif defined UBPORTS
|
||||||
return "ubports";
|
return "UBPorts";
|
||||||
#endif
|
#endif
|
||||||
return QString();
|
return "None";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PushNotifications::clientId() const
|
QString PushNotifications::clientId() const
|
||||||
@ -148,7 +148,7 @@ void PushNotifications::OnTokenReceived(const char *token)
|
|||||||
// On Android, both, core and cloud use the same token
|
// On Android, both, core and cloud use the same token
|
||||||
m_coreToken = QString(token);
|
m_coreToken = QString(token);
|
||||||
emit coreTokenChanged();
|
emit coreTokenChanged();
|
||||||
m_cloudToken = m_cloudToken;
|
m_cloudToken = m_coreToken;
|
||||||
emit cloudTokenChanged();
|
emit cloudTokenChanged();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -283,15 +283,10 @@ Item {
|
|||||||
PlatformHelper.requestPermissions();
|
PlatformHelper.requestPermissions();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var clientId = PlatformHelper.deviceSerial + "+io.guh.nymeaapp";
|
|
||||||
if ("branding" in app) {
|
|
||||||
clientId += "-" + app.branding;
|
|
||||||
}
|
|
||||||
|
|
||||||
AWSClient.registerPushNotificationEndpoint(
|
AWSClient.registerPushNotificationEndpoint(
|
||||||
PushNotifications.cloudToken,
|
PushNotifications.cloudToken,
|
||||||
PlatformHelper.machineHostname,
|
PlatformHelper.machineHostname,
|
||||||
clientId,
|
PushNotifications.clientId,
|
||||||
PlatformHelper.deviceManufacturer,
|
PlatformHelper.deviceManufacturer,
|
||||||
PlatformHelper.deviceModel);
|
PlatformHelper.deviceModel);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -136,12 +136,12 @@ DevicePageBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GenericTypeLogView {
|
ListView {
|
||||||
id: logView
|
id: logView
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
logsModel: LogsModel {
|
model: LogsModel {
|
||||||
id: logsModel
|
id: logsModel
|
||||||
thingId: root.device.id
|
thingId: root.device.id
|
||||||
engine: _engine
|
engine: _engine
|
||||||
|
|||||||
@ -58,7 +58,7 @@
|
|||||||
// qDebug() << "Registering for remote notifications";
|
// qDebug() << "Registering for remote notifications";
|
||||||
// qDebug() << "Token description:" << QString::fromNSString(deviceToken.description);
|
// qDebug() << "Token description:" << QString::fromNSString(deviceToken.description);
|
||||||
// qDebug() << "Parsed token:" << QString::fromNSString(tokenStr);
|
// 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 {
|
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
|
||||||
@ -82,7 +82,7 @@
|
|||||||
- (void)tokenRefreshNotification:(NSNotification *)notification {
|
- (void)tokenRefreshNotification:(NSNotification *)notification {
|
||||||
NSLog(@"instanceId_notification=>%@",[notification object]);
|
NSLog(@"instanceId_notification=>%@",[notification object]);
|
||||||
NSString *InstanceID = [NSString stringWithFormat:@"%@",[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:
|
[[NSNotificationCenter defaultCenter] postNotificationName:
|
||||||
@"FCMToken" object:nil userInfo:dataDict];
|
@"FCMToken" object:nil userInfo:dataDict];
|
||||||
// Note: This callback is fired at each app startup and whenever a new token is generated.
|
// Note: This callback is fired at each app startup and whenever a new token is generated.
|
||||||
qDebug() << "Firebase token received:" << QString::fromNSString(fcmToken);
|
//qDebug() << "Firebase token received:" << QString::fromNSString(fcmToken);
|
||||||
PushNotifications::instance()->setAPNSRegistrationToken(QString::fromNSString(fcmToken));
|
PushNotifications::instance()->setFirebaseRegistrationToken(QString::fromNSString(fcmToken));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user