neiam
/koco
public · Issues · Pulls · Labels · Forks · Compare · Actions failure · Badges · Packages
⭐
Log in to mark this repository.
clippy
fb115f1 · gmorell · 2026-01-12 02:44
Files changed
modified
src/main.rs
+4
−6
@@ -861,8 +861,8 @@ impl Koco {
| 861 | 861 | if let Some(msg) = msg_opt { |
| 862 | 862 | info!("Received MQTT message: {}", msg.payload_str()); |
| 863 | 863 | // Parse the theme payload |
| 864 | − if let Ok(payload) = serde_json::from_str::<serde_json::Value>(&msg.payload_str()) { | |
| 865 | − if let Some(theme_name) = payload.get("theme").and_then(|t| t.as_str()) { | |
| 864 | + if let Ok(payload) = serde_json::from_str::<serde_json::Value>(&msg.payload_str()) | |
| 865 | + && let Some(theme_name) = payload.get("theme").and_then(|t| t.as_str()) { | |
| 866 | 866 | info!("Received theme update: {}", theme_name); |
| 867 | 867 | |
| 868 | 868 | // Update config with new theme |
@@ -891,7 +891,6 @@ impl Koco {
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | 893 | } |
| 894 | − } | |
| 895 | 894 | } |
| 896 | 895 | } |
| 897 | 896 |
@@ -1255,8 +1254,8 @@ impl Koco {
| 1255 | 1254 | impl eframe::App for Koco { |
| 1256 | 1255 | fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { |
| 1257 | 1256 | // Check if theme was changed via MQTT and reload config + apply theme |
| 1258 | − if let Ok(mut changed) = self.theme_changed.lock() { | |
| 1259 | − if *changed { | |
| 1257 | + if let Ok(mut changed) = self.theme_changed.lock() | |
| 1258 | + && *changed { | |
| 1260 | 1259 | *changed = false; |
| 1261 | 1260 | // Reload config from disk |
| 1262 | 1261 | self.config = KocoConfig::load(); |
@@ -1267,7 +1266,6 @@ impl eframe::App for Koco {
| 1267 | 1266 | // Request repaint to apply visual changes |
| 1268 | 1267 | ctx.request_repaint(); |
| 1269 | 1268 | } |
| 1270 | − } | |
| 1271 | 1269 | |
| 1272 | 1270 | // Request periodic repaints to check for MQTT theme updates |
| 1273 | 1271 | if self.config.mqtt_enabled { |
Parents: 6b0f8c2