feat: add methods to retrieve current subscription details in PrfItem and refactor profile handling in IProfiles

This commit is contained in:
Tunglies
2025-11-04 12:01:22 +08:00
parent 0306f73841
commit 97769cf93a
6 changed files with 127 additions and 114 deletions

View File

@@ -455,7 +455,7 @@ impl Tray {
let profiles = Config::profiles().await;
let profiles = profiles.latest_arc();
if let Some(current_profile_uid) = profiles.get_current()
&& let Ok(profile) = profiles.get_item(&current_profile_uid)
&& let Ok(profile) = profiles.get_item(current_profile_uid)
{
current_profile_name = match &profile.name {
Some(profile_name) => profile_name.to_string(),
@@ -842,7 +842,7 @@ async fn create_tray_menu(
let profiles_ref = profiles_config.latest_arc();
profiles_ref
.get_current()
.and_then(|uid| profiles_ref.get_item(&uid).ok())
.and_then(|uid| profiles_ref.get_item(uid).ok())
.and_then(|profile| profile.selected.clone())
.unwrap_or_default()
};