Skip to content

Commit 5abddd2

Browse files
committed
add module
1 parent bc14b00 commit 5abddd2

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

crates/detect/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
mod app;
22
mod browser;
3+
mod mic;
34
mod utils;
45

56
pub use app::*;
67
pub use browser::*;
8+
pub use mic::*;
9+
710
use utils::*;
811

912
pub type DetectCallback = std::sync::Arc<dyn Fn(String) + Send + Sync + 'static>;
@@ -24,6 +27,7 @@ trait Observer: Send + Sync {
2427
pub struct Detector {
2528
app_detector: AppDetector,
2629
browser_detector: BrowserDetector,
30+
mic_detector: MicDetector,
2731
}
2832

2933
impl Detector {

crates/detect/src/mic/macos.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#[derive(Default)]
2+
pub struct Detector {}
3+
4+
impl crate::Observer for Detector {
5+
fn start(&mut self, f: crate::DetectCallback) {}
6+
fn stop(&mut self) {}
7+
}

crates/detect/src/mic/mod.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#[cfg(target_os = "macos")]
2+
mod macos;
3+
#[cfg(target_os = "macos")]
4+
type PlatformDetector = macos::Detector;
5+
6+
#[cfg(target_os = "windows")]
7+
mod windows;
8+
#[cfg(target_os = "windows")]
9+
type PlatformDetector = windows::Detector;
10+
11+
#[derive(Default)]
12+
pub struct MicDetector {
13+
inner: PlatformDetector,
14+
}
15+
16+
impl crate::Observer for MicDetector {
17+
fn start(&mut self, f: crate::DetectCallback) {
18+
self.inner.start(f);
19+
}
20+
fn stop(&mut self) {
21+
self.inner.stop();
22+
}
23+
}

crates/detect/src/mic/windows.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#[derive(Default)]
2+
pub struct Detector {}
3+
4+
impl crate::Observer for Detector {
5+
fn start(&mut self, f: crate::DetectCallback) {}
6+
fn stop(&mut self) {}
7+
}

0 commit comments

Comments
 (0)