Skip to content

Commit

Permalink
wait showTime before clearing alert
Browse files Browse the repository at this point in the history
  • Loading branch information
stCarolas committed Feb 6, 2024
1 parent b7d1c05 commit 6ad3590
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/logic/alert/AlertController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,25 @@ export class AlertController {
data,
() =>
this.voiceController?.pronounceMessage(alert, data, () => {
const showTime = this.findSetting(
alert.properties,
"imageShowTime",
null,
);
log.debug("clearing alert");
this.clear();
this.resumePlayer();
ackFunction();
this.sendEndNotification();
if (showTime) {
setTimeout(() => {
this.clear();
this.resumePlayer();
ackFunction();
this.sendEndNotification();
}, showTime * 1000);
} else {
this.clear();
this.resumePlayer();
ackFunction();
this.sendEndNotification();
}
}),
);
});
Expand Down Expand Up @@ -202,9 +216,9 @@ export class AlertController {
const showTime = this.findSetting(alert.properties, "imageShowTime", null);
this.alertImageRenderers.forEach((renderer) => {
console.log(alert.properties);
renderer.setImage(
`${process.env.REACT_APP_FILE_API_ENDPOINT}/files/${alert.image}`,
);
renderer.setImage(
`${process.env.REACT_APP_FILE_API_ENDPOINT}/files/${alert.image}`,
);
if (showTime) {
setTimeout(() => renderer.setImage(null), showTime * 1000);
}
Expand Down

0 comments on commit 6ad3590

Please sign in to comment.