diff --git a/CHANGELOG.md b/CHANGELOG.md index e33b3536..8fa5efe0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing worth mentioning yet. +### Fixed + +- `Device connected` notification showing repeatedly ## [0.20.0] - 2024-02-21 diff --git a/playlet-lib/src/components/Services/LoungeService/LoungeApi.bs b/playlet-lib/src/components/Services/LoungeService/LoungeApi.bs index 116497c9..8215cf1c 100644 --- a/playlet-lib/src/components/Services/LoungeService/LoungeApi.bs +++ b/playlet-lib/src/components/Services/LoungeService/LoungeApi.bs @@ -339,6 +339,9 @@ class LoungeApi end if for each device in devices + if m.devices.DoesExist(device.id) + device.lastConnectEventType = m.devices[device.id].lastConnectEventType + end if m.devices[device.id] = device end for end function @@ -359,6 +362,12 @@ class LoungeApi m.devices[id] = newDevice + if ValidString(newDevice.lastConnectEventType) = commandType + return + end if + + newDevice.lastConnectEventType = commandType + userName = newDevice.user deviceName = newDevice.name userAvatarUri = newDevice.userAvatarUri @@ -368,6 +377,17 @@ class LoungeApi function HandleRemoteDisconnected(commandId as integer, commandType as string, commandArgs as object, messagesToSend as object) as void LogInfo(commandType, FormatJson(commandArgs)) + newDevice = commandArgs + id = newDevice.id + if StringUtils.IsNullOrEmpty(id) + return + end if + + if not m.devices.DoesExist(id) + return + end if + + m.devices[id].lastConnectEventType = commandType end function function HandleSetVolume(commandId as integer, commandType as string, commandArgs as object, messagesToSend as object) as void