From d83b3689f5313d83923a6e59888d7a4094950f30 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Fri, 16 Dec 2022 10:24:32 -0600 Subject: [PATCH] Simplify screen reader detection code to use `Tts` APIs. --- Cargo.toml | 5 +---- src/lib.rs | 12 ++---------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f655490..3670773 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,4 @@ crate-type = ["staticlib", "cdylib"] [dependencies] env_logger = "0.10" gdnative = "0.11" -tts = { version = "0.25", features = ["tolk"] } - -[target.'cfg(windows)'.dependencies] -tolk = { version = "0.5", optional = true } +tts = { version = "0.25", features = ["tolk"] } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 59800b1..992d584 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -127,19 +127,11 @@ impl TTS { .done(); builder .property("can_detect_screen_reader") - .with_getter(|_: &TTS, _| cfg!(all(windows, features = "tolk"))) + .with_getter(|_: &TTS, _| cfg!(windows)) .done(); - #[allow(unreachable_code)] builder .property("has_screen_reader") - .with_getter(|_: &TTS, _| { - #[cfg(all(windows, features = "tolk"))] - { - let tolk = tolk::Tolk::new(); - return tolk.detect_screen_reader().is_some(); - } - false - }) + .with_getter(|_, _| Tts::screen_reader_available()) .done(); builder .property("can_detect_is_speaking")