Adjust lounge notification

This commit is contained in:
Brahim Hadriche committed 2024-02-21 19:27:54 -05:00
1 parent b52cd6f01b
commit 37dde57c67
3 files changed
+20 -14

No files matched your search

@@ -367,12 +367,10 @@ class LoungeApi
m.loungeServiceNode.devices = devices m.loungeServiceNode.devices = devices
userName = newDevice.user userName = newDevice.user
if StringUtils.IsNullOrEmpty(userName) deviceName = newDevice.name
userName = newDevice.name
end if
userAvatarUri = newDevice.userAvatarUri userAvatarUri = newDevice.userAvatarUri
LoungeDeviceConnected.ShowNotifcation(m.notificationsNode, userName, userAvatarUri) LoungeDeviceConnected.ShowNotifcation(m.notificationsNode, deviceName, userName, userAvatarUri)
end function end function
function HandleRemoteDisconnected(commandId as integer, commandType as string, commandArgs as object, messagesToSend as object) as void function HandleRemoteDisconnected(commandId as integer, commandType as string, commandArgs as object, messagesToSend as object) as void
@@ -2,6 +2,7 @@
<interface> <interface>
<field id="thumbnail" type="uri" alias="thumbnailPoster.uri" /> <field id="thumbnail" type="uri" alias="thumbnailPoster.uri" />
<field id="line1" type="string" alias="line1Label.text" /> <field id="line1" type="string" alias="line1Label.text" />
<field id="line2" type="string" alias="line2Label.text" />
<field id="show" type="boolean" alwaysNotify="true" onChange="OnShow" /> <field id="show" type="boolean" alwaysNotify="true" onChange="OnShow" />
</interface> </interface>
<children> <children>
@@ -20,18 +21,22 @@
translation="[10,10]" /> translation="[10,10]" />
<LayoutGroup <LayoutGroup
itemSpacings="[10]" itemSpacings="[5,5]"
translation="[100,10]"> translation="[100,15]">
<Label <Label
width="230" width="230"
font="font:SmallestBoldSystemFont" font="font:SmallestBoldSystemFont"
horizAlign="center" horizAlign="center"
text="Device connected"> text="Device connected">
<Font role="font" uri="font:BoldSystemFontFile" size="22" />
</Label> </Label>
<Label <Label
id="line1Label" id="line1Label"
width="230" width="230"
font="font:SmallestBoldSystemFont"
horizAlign="center" />
<Label
id="line2Label"
width="230"
font="font:SmallestSystemFont" font="font:SmallestSystemFont"
horizAlign="center" /> horizAlign="center" />
</LayoutGroup> </LayoutGroup>
@@ -1,20 +1,23 @@
namespace LoungeDeviceConnected namespace LoungeDeviceConnected
const NOTIFICATION_NODE_ID = "DeviceConnectedNotification" const NOTIFICATION_NODE_ID = "DeviceConnectedNotification"
function ShowNotifcation(notifications as object, name as dynamic, thumbnail as dynamic) as void function ShowNotifcation(notifications as object, deviceName as dynamic, userName as dynamic, userAvatarUri as dynamic) as void
notification = notifications.findNode(NOTIFICATION_NODE_ID) notification = notifications.findNode(NOTIFICATION_NODE_ID)
if notification = invalid if notification = invalid
notification = notifications.createChild("DeviceConnectedNotification") notification = notifications.createChild("DeviceConnectedNotification")
notification.id = NOTIFICATION_NODE_ID notification.id = NOTIFICATION_NODE_ID
end if end if
if StringUtils.IsNullOrEmpty(name)
name = "Device" if StringUtils.IsNullOrEmpty(deviceName)
deviceName = "Device"
end if end if
notification.line1 = name if StringUtils.IsNullOrEmpty(userAvatarUri)
if StringUtils.IsNullOrEmpty(thumbnail) userAvatarUri = "pkg:/images/icons/user.png"
thumbnail = "pkg:/images/icons/user.png"
end if end if
notification.thumbnail = thumbnail
notification.line1 = deviceName
notification.line2 = userName
notification.thumbnail = userAvatarUri
notification.show = true notification.show = true
end function end function