Merge PR #704: Fix push notifications ids with branding
This commit is contained in:
commit
abc1b9424f
@ -105,11 +105,7 @@ QString PushNotifications::service() const
|
|||||||
|
|
||||||
QString PushNotifications::clientId() const
|
QString PushNotifications::clientId() const
|
||||||
{
|
{
|
||||||
QString branding;
|
return PlatformHelper::instance()->deviceSerial();
|
||||||
#if defined BRANDING
|
|
||||||
branding = QString("-%1").arg(BRANDING);
|
|
||||||
#endif
|
|
||||||
return PlatformHelper::instance()->deviceSerial() + "+io.guh.nymeaapp" + branding;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PushNotifications::coreToken() const
|
QString PushNotifications::coreToken() const
|
||||||
|
|||||||
@ -2,6 +2,11 @@ pragma Singleton
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
|
||||||
ConfigurationBase {
|
ConfigurationBase {
|
||||||
|
systemName: "nymea"
|
||||||
|
appName: "nymea:app"
|
||||||
|
appId: "io.guh.nymeaapp"
|
||||||
|
|
||||||
|
connectionWizard: "/ui/connection/NewConnectionWizard.qml"
|
||||||
|
|
||||||
showCommunityLinks: true
|
showCommunityLinks: true
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
property string systemName: "nymea"
|
property string systemName: ""
|
||||||
property string appName: "nymea:app"
|
property string appName: ""
|
||||||
|
property string appId: ""
|
||||||
|
|
||||||
property string connectionWizard: "/ui/connection/NewConnectionWizard.qml"
|
property string connectionWizard: ""
|
||||||
|
|
||||||
property bool showCommunityLinks: false
|
property bool showCommunityLinks: false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -263,11 +263,13 @@ Item {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var clientId = PushNotifications.clientId + "+" + Configuration.appId
|
||||||
print("Updating push notifications")
|
print("Updating push notifications")
|
||||||
print("Own push service:", PushNotifications.service);
|
print("Own push service:", PushNotifications.service);
|
||||||
print("Own client ID:", PushNotifications.clientId);
|
print("Own client ID:", clientId);
|
||||||
print("Current token:", PushNotifications.coreToken);
|
print("Current token:", PushNotifications.coreToken);
|
||||||
|
|
||||||
|
|
||||||
for (var i = 0; i < engine.thingManager.things.count; i++) {
|
for (var i = 0; i < engine.thingManager.things.count; i++) {
|
||||||
var thing = engine.thingManager.things.get(i);
|
var thing = engine.thingManager.things.get(i);
|
||||||
if (thing.thingClass.id.toString().match(/\{?f0dd4c03-0aca-42cc-8f34-9902457b05de\}?/)) {
|
if (thing.thingClass.id.toString().match(/\{?f0dd4c03-0aca-42cc-8f34-9902457b05de\}?/)) {
|
||||||
@ -275,11 +277,11 @@ Item {
|
|||||||
var clientIdParam = thing.paramByName("clientId")
|
var clientIdParam = thing.paramByName("clientId")
|
||||||
var tokenParam = thing.paramByName("token")
|
var tokenParam = thing.paramByName("token")
|
||||||
print("Found a push notification thing for client id:", clientIdParam.value)
|
print("Found a push notification thing for client id:", clientIdParam.value)
|
||||||
if (clientIdParam.value === PushNotifications.clientId) {
|
if (clientIdParam.value === clientId) {
|
||||||
if (tokenParam.value !== PushNotifications.coreToken) {
|
if (tokenParam.value !== PushNotifications.coreToken) {
|
||||||
var params = [
|
var params = [
|
||||||
{ "paramTypeId": serviceParam.paramTypeId, "value": PushNotifications.service },
|
{ "paramTypeId": serviceParam.paramTypeId, "value": PushNotifications.service },
|
||||||
{ "paramTypeId": clientIdParam.paramTypeId, "value": PushNotifications.clientId },
|
{ "paramTypeId": clientIdParam.paramTypeId, "value": clientId },
|
||||||
{ "paramTypeId": tokenParam.paramTypeId, "value": PushNotifications.coreToken }
|
{ "paramTypeId": tokenParam.paramTypeId, "value": PushNotifications.coreToken }
|
||||||
];
|
];
|
||||||
print("Reconfiguring PushNotifications for", thing.name)
|
print("Reconfiguring PushNotifications for", thing.name)
|
||||||
|
|||||||
@ -398,7 +398,7 @@ Page {
|
|||||||
return PushNotifications.coreToken;
|
return PushNotifications.coreToken;
|
||||||
}
|
}
|
||||||
if (paramType.id.toString().match(/\{?d76da367-64e3-4b7d-aa84-c96b3acfb65e\}?/)) {
|
if (paramType.id.toString().match(/\{?d76da367-64e3-4b7d-aa84-c96b3acfb65e\}?/)) {
|
||||||
return PushNotifications.clientId;
|
return PushNotifications.clientId + "+" + Configuration.appId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user