import "pkg:/source/utils/Locale.bs" import "pkg:/source/utils/StringUtils.bs" 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 = Tr(Locale.LoungeNotification.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