Skip to content

Commit

Permalink
Merge pull request #404 from squidowl/fix/iced-upgrade-part2
Browse files Browse the repository at this point in the history
Fix macos build error after iced update
  • Loading branch information
casperstorm authored Jun 21, 2024
2 parents 0a242b3 + 9c9571c commit fb52571
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use iced::{self, Subscription};
#[cfg(target_os = "macos")]
pub fn listen() -> Subscription<String> {
use futures::stream::StreamExt;
use iced::event::{self, Event};
use iced::advanced::graphics::futures::subscription::{Event, MacOS, PlatformSpecific};

struct OnUrl;

Expand All @@ -24,15 +24,19 @@ pub fn listen() -> Subscription<String> {
input: subscription::EventStream,
) -> BoxStream<'static, Self::Output> {
input
.filter_map(move |(event, status)| {
if let event::Status::Captured = status {
return futures::future::ready(None);
.filter_map(move |event| {
if let Event::Interaction { status, .. } = &event {
if *status == iced::event::Status::Captured {
return futures::future::ready(None);
}
}

let result = match event {
Event::PlatformSpecific(event::PlatformSpecific::MacOS(
event::MacOS::ReceivedUrl(url),
)) => Some(url),
Event::PlatformSpecific(event) => match event {
PlatformSpecific::MacOS(macos) => match macos {
MacOS::ReceivedUrl(url) => Some(url),
},
},
_ => None,
};

Expand Down

0 comments on commit fb52571

Please sign in to comment.