2024-08-01 14:32:53 +08:00
|
|
|
import { t } from "../../services/i18n.js";
|
2021-05-24 22:29:49 +02:00
|
|
|
import protectedSessionHolder from "../../services/protected_session_holder.js";
|
2022-12-02 16:46:14 +01:00
|
|
|
import CommandButtonWidget from "./command_button.js";
|
2021-05-18 22:14:35 +02:00
|
|
|
|
2022-12-02 16:46:14 +01:00
|
|
|
export default class ProtectedSessionStatusWidget extends CommandButtonWidget {
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
2021-05-18 22:14:35 +02:00
|
|
|
|
2022-12-11 13:20:37 +01:00
|
|
|
this.class("launcher-button");
|
|
|
|
|
|
2025-01-09 18:07:02 +02:00
|
|
|
this.settings.icon = () => (protectedSessionHolder.isProtectedSessionAvailable() ? "bx-check-shield" : "bx-shield-quarter");
|
2021-05-18 22:14:35 +02:00
|
|
|
|
2025-01-09 18:07:02 +02:00
|
|
|
this.settings.title = () => (protectedSessionHolder.isProtectedSessionAvailable() ? t("protected_session_status.active") : t("protected_session_status.inactive"));
|
2021-05-18 22:14:35 +02:00
|
|
|
|
2025-01-09 18:07:02 +02:00
|
|
|
this.settings.command = () => (protectedSessionHolder.isProtectedSessionAvailable() ? "leaveProtectedSession" : "enterProtectedSession");
|
2021-05-18 22:14:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protectedSessionStartedEvent() {
|
|
|
|
|
this.refreshIcon();
|
|
|
|
|
}
|
|
|
|
|
}
|