fix(control): adjust pause logic to ensure correct state updates and notification behavior
fix(traymenu): update tray menu label from "Secured" to "unknown" fix(notifications): log error when notification is clicked without an associated action
This commit is contained in:
@@ -134,8 +134,10 @@ pub async fn show_notification(cli: &PortAPI, key: String, n: Notification) {
|
|||||||
))
|
))
|
||||||
.await;
|
.await;
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
error!("Notification clicked but no action associated.");
|
||||||
|
// TODO(vladimir): If Action is None, the user clicked on the notification. Focus on the UI.
|
||||||
}
|
}
|
||||||
// TODO(vladimir): If Action is None, the user clicked on the notification. Focus on the UI.
|
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ fn build_tray_menu(
|
|||||||
pub fn setup_tray_menu(
|
pub fn setup_tray_menu(
|
||||||
app: &mut tauri::App,
|
app: &mut tauri::App,
|
||||||
) -> core::result::Result<AppIcon, Box<dyn std::error::Error>> {
|
) -> core::result::Result<AppIcon, Box<dyn std::error::Error>> {
|
||||||
let menu = build_tray_menu(app.handle(), "Secured", "disabled", &system_status_types::PauseInfo::default())?;
|
let menu = build_tray_menu(app.handle(), "unknown", "disabled", &system_status_types::PauseInfo::default())?;
|
||||||
|
|
||||||
let icon = TrayIconBuilder::with_id(PM_TRAY_ICON_ID)
|
let icon = TrayIconBuilder::with_id(PM_TRAY_ICON_ID)
|
||||||
.icon(Image::from_bytes(get_red_icon()).unwrap())
|
.icon(Image::from_bytes(get_red_icon()).unwrap())
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ func (c *Control) pause(duration time.Duration, onlySPN bool) (retErr error) {
|
|||||||
// E.g. SPN enabled -> pause SPN -> restart PC/Portmaster -> SPN should be enabled again.
|
// E.g. SPN enabled -> pause SPN -> restart PC/Portmaster -> SPN should be enabled again.
|
||||||
config.SetConfigOption("spn/enable", false)
|
config.SetConfigOption("spn/enable", false)
|
||||||
c.mgr.Info("SPN paused")
|
c.mgr.Info("SPN paused")
|
||||||
|
c.pauseInfo.SPN = true
|
||||||
}
|
}
|
||||||
c.pauseInfo.SPN = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if onlySPN {
|
if onlySPN {
|
||||||
@@ -192,7 +192,7 @@ func (c *Control) updateStatesAndNotify() {
|
|||||||
Type: nType,
|
Type: nType,
|
||||||
Title: title,
|
Title: title,
|
||||||
Message: message,
|
Message: message,
|
||||||
ShowOnSystem: true,
|
ShowOnSystem: false, // TODO: Before enabling, ensure that UI client (Tauri implementation) supports ActionTypeWebhook.
|
||||||
EventData: &c.pauseInfo,
|
EventData: &c.pauseInfo,
|
||||||
AvailableActions: []*notifications.Action{
|
AvailableActions: []*notifications.Action{
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user