Skip to content

Commit

Permalink
Show a toast notification when changing security profiles
Browse files Browse the repository at this point in the history
For wasm builds only. "Page will automatically reload in 5 seconds"
Part of #1881
  • Loading branch information
DanielMcInnes committed Feb 24, 2025
1 parent e9ba767 commit ca9740c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pages/settings/PageSettingsAccessAndSecurity.qml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ Page {
// This guards the wasm version to trigger a reload even if the reply isn't received.
BackendConnection.securityProtocolChanged()
Global.pageManager.popPage()
if (Qt.platform.os === "wasm" && !BackendConnection.vrm) {
Global.showToastNotification(VenusOS.Notification_Info,
//% "Page will automatically reload in 5 seconds"
qsTrId("access_and_security_page_will_reload"),
3000)
}
}
dialogDoneOptions: VenusOS.ModalDialog_DoneOptions_OkAndCancel
height: securityProfile.pendingProfile === VenusOS.Security_Profile_Secured
Expand Down
4 changes: 4 additions & 0 deletions src/backendconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ void BackendConnection::onReloadPageTimerExpired()
// that fails and still triggers a reload (albeit a bit later).
void BackendConnection::securityProtocolChanged()
{
if (isVrm())
{
return;
}
QTimer *timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, &BackendConnection::onReloadPageTimerExpired);
connect(timer, &QTimer::timeout, timer, &QObject::deleteLater);
Expand Down
1 change: 0 additions & 1 deletion wasm/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
status.innerHTML = 'Loading...';

const instance = await qtLoad({
arguments: ['--mqtt', (location.protocol === 'https:' ? 'wss://' : 'ws://') + document.location.host + '/websocket-mqtt'], // delete this line to run wasm builds on the desktop
qt: {
onLoaded: () => showUi(screen),
onExit: exitData =>
Expand Down

0 comments on commit ca9740c

Please sign in to comment.