Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.

Commit ba25d04

Browse files
committed
fix: changes to phone media detection
1 parent a876553 commit ba25d04

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/iap2_wrapper.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,25 @@ async fn handle_connection_event(
632632
}
633633
}
634634

635+
let incoming_title = update
636+
.media_item
637+
.as_ref()
638+
.and_then(|m| m.title.as_ref())
639+
.map(|t| t.trim().to_string());
640+
let title_changed = match (&incoming_title, &now_playing_state.title) {
641+
(Some(new_title), Some(old_title)) => {
642+
!new_title.is_empty() && new_title != old_title.trim()
643+
}
644+
_ => false,
645+
};
646+
647+
if title_changed {
648+
now_playing_state.album = None;
649+
now_playing_state.duration_ms = None;
650+
now_playing_state.app_name = None;
651+
now_playing_state.elapsed_ms = None;
652+
}
653+
635654
if let Some(ref media) = update.media_item {
636655
if let Some(ref title) = media.title {
637656
now_playing_state.title = Some(title.clone());

0 commit comments

Comments
 (0)