Fix setup for push notifications
This commit is contained in:
parent
d929bb3c7f
commit
6ab0f64685
@ -362,7 +362,8 @@ Page {
|
||||
|
||||
TextField {
|
||||
id: nameTextField
|
||||
text: d.thingName ? d.thingName : root.thingClass.displayName
|
||||
text: (d.thingName ? d.thingName : root.thingClass.displayName)
|
||||
+ (root.thingClass.id.toString().match(/\{?f0dd4c03-0aca-42cc-8f34-9902457b05de\}?/) ? " (" + PlatformHelper.machineHostname + ")" : "")
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: app.margins
|
||||
Layout.rightMargin: app.margins
|
||||
@ -381,9 +382,29 @@ Page {
|
||||
Layout.fillWidth: true
|
||||
enabled: !model.readOnly
|
||||
paramType: root.thingClass.paramTypes.get(index)
|
||||
value: d.thingDescriptor && d.thingDescriptor.params.getParam(paramType.id) ?
|
||||
d.thingDescriptor.params.getParam(paramType.id).value :
|
||||
root.thingClass.paramTypes.get(index).defaultValue
|
||||
value: {
|
||||
// Discovery, use params from discovered descriptor
|
||||
if (d.thingDescriptor && d.thingDescriptor.params.getParam(paramType.id)) {
|
||||
return d.thingDescriptor.params.getParam(paramType.id).value
|
||||
}
|
||||
|
||||
// Special hook for push notifications as we need to provide the token etc implicitly
|
||||
print("Setting up params for thing class:", root.thingClass.id, root.thingClass.name)
|
||||
if (root.thingClass.id.toString().match(/\{?f0dd4c03-0aca-42cc-8f34-9902457b05de\}?/)) {
|
||||
if (paramType.id.toString().match(/\{?3cb8e30e-2ec5-4b4b-8c8c-03eaf7876839\}?/)) {
|
||||
return PushNotifications.service;
|
||||
}
|
||||
if (paramType.id.toString().match(/\{?12ec06b2-44e7-486a-9169-31c684b91c8f\}?/)) {
|
||||
return PushNotifications.coreToken;
|
||||
}
|
||||
if (paramType.id.toString().match(/\{?d76da367-64e3-4b7d-aa84-c96b3acfb65e\}?/)) {
|
||||
return PushNotifications.clientId;
|
||||
}
|
||||
}
|
||||
|
||||
// Manual setup, use default value from thing class
|
||||
return root.thingClass.paramTypes.get(index).defaultValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user