Files
playlet-piped/playlet-lib/src/components/Services/LoungeService/Notifications/DeviceConnectedNotificationUtils.bs
T

39 lines
1.4 KiB
Plaintext

namespace LoungeDeviceConnected
const NOTIFICATION_NODE_ID = "DeviceConnectedNotification"
function ShowNotifcation(notifications as object, deviceName as dynamic, userName as dynamic, userAvatarUri as dynamic) as void
notification = notifications.findNode(NOTIFICATION_NODE_ID)
if notification = invalid
notification = notifications.createChild("DeviceConnectedNotification")
notification.id = NOTIFICATION_NODE_ID
end if
if StringUtils.IsNullOrEmpty(deviceName)
deviceName = "Device"
end if
if StringUtils.IsNullOrEmpty(userAvatarUri)
userAvatarUri = "pkg:/images/icons/user.png"
end if
notification.line1 = deviceName
notification.line2 = userName
notification.thumbnail = userAvatarUri
notification.show = true
end function
function RemoveNotifcation(notifications as object) as void
notification = notifications.findNode(NOTIFICATION_NODE_ID)
if notification <> invalid
notifications.RemoveChild(notification)
end if
end function
function SetVisible(notifications as object, visible as boolean)
notification = notifications.findNode(NOTIFICATION_NODE_ID)
if notification <> invalid
notification.visible = visible
end if
end function
end namespace