8bbb3140ef
Redesign login view with server card list, add/edit/delete modals, and per-server ping status display. Rename ProxyOverrides to ClientConfig, remove ConfigSystemInterface in favor of direct platform methods (load_config, load_username, set_default_username, load_server_url), remove SharedState threading in favor of global STATE, simplify network_loop and audio setup, update proxy endpoint from /overrides to /config, and clean up desktop launch configuration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
135 lines
3.1 KiB
Rust
135 lines
3.1 KiB
Rust
/// Stub implementation of the platform interface, so that we can
|
|
/// `cargo check` without any --feature flags.
|
|
use crate::effects::AudioProcessor;
|
|
use color_eyre::eyre::Error;
|
|
use dioxus::hooks::UnboundedReceiver;
|
|
use mumble_web2_common::{ClientConfig, ServerEntry, ServerStatus};
|
|
use std::future::Future;
|
|
|
|
pub struct StubPlatform;
|
|
|
|
impl super::PlatformInterface for StubPlatform {
|
|
type AudioSystem = StubAudioSystem;
|
|
|
|
fn init_logging() {
|
|
panic!("stubbed platform")
|
|
}
|
|
|
|
fn request_permissions() {
|
|
panic!("stubbed platform")
|
|
}
|
|
|
|
fn network_connect(
|
|
_address: String,
|
|
_username: String,
|
|
_event_rx: &mut UnboundedReceiver<crate::app::Command>,
|
|
_gui_config: &ClientConfig,
|
|
) -> impl Future<Output = Result<(), Error>> {
|
|
async { panic!("stubbed platform") }
|
|
}
|
|
|
|
fn get_status(
|
|
_client: &reqwest::Client,
|
|
) -> impl Future<Output = color_eyre::Result<ServerStatus>> {
|
|
async { panic!("stubbed platform") }
|
|
}
|
|
|
|
fn ping_server(
|
|
_address: &str,
|
|
_port: u16,
|
|
) -> impl Future<Output = color_eyre::Result<ServerStatus>> {
|
|
async { panic!("stubbed platform") }
|
|
}
|
|
|
|
fn load_config() -> impl Future<Output = color_eyre::Result<ClientConfig>> {
|
|
async { panic!("stubbed platform") }
|
|
}
|
|
|
|
fn load_username() -> Option<String> {
|
|
panic!("stubbed platform")
|
|
}
|
|
|
|
fn load_server_url() -> Option<String> {
|
|
panic!("stubbed platform")
|
|
}
|
|
|
|
fn set_default_username(_username: &str) -> Option<()> {
|
|
panic!("stubbed platform")
|
|
}
|
|
|
|
fn set_default_server(_server: &str) -> Option<()> {
|
|
panic!("stubbed platform")
|
|
}
|
|
|
|
fn load_servers() -> Vec<ServerEntry> {
|
|
panic!("stubbed platform")
|
|
}
|
|
|
|
fn save_servers(_servers: &[ServerEntry]) {
|
|
panic!("stubbed platform")
|
|
}
|
|
|
|
fn sleep(_duration: std::time::Duration) -> impl Future<Output = ()> {
|
|
async { panic!("stubbed platform") }
|
|
}
|
|
}
|
|
|
|
pub struct StubAudioSystem;
|
|
|
|
impl super::AudioSystemInterface for StubAudioSystem {
|
|
type AudioPlayer = StubAudioPlayer;
|
|
|
|
async fn new() -> Result<Self, Error> {
|
|
panic!("stubbed platform")
|
|
}
|
|
|
|
fn set_processor(&self, _processor: AudioProcessor) {
|
|
panic!("stubbed platform")
|
|
}
|
|
|
|
fn start_recording(
|
|
&mut self,
|
|
_each: impl FnMut(Vec<u8>, bool) + Send + 'static,
|
|
) -> Result<(), Error> {
|
|
panic!("stubbed platform")
|
|
}
|
|
|
|
fn create_player(&mut self) -> Result<Self::AudioPlayer, Error> {
|
|
panic!("stubbed platform")
|
|
}
|
|
}
|
|
|
|
pub struct StubAudioPlayer;
|
|
|
|
impl super::AudioPlayerInterface for StubAudioPlayer {
|
|
fn play_opus(&mut self, _payload: &[u8]) {
|
|
panic!("stubbed platform")
|
|
}
|
|
}
|
|
|
|
#[allow(unused)]
|
|
pub struct SpawnHandle;
|
|
|
|
impl SpawnHandle {
|
|
#[allow(unused)]
|
|
pub fn spawn<F>(&self, _future: F)
|
|
where
|
|
F: Future<Output = ()> + 'static,
|
|
{
|
|
panic!("stubbed platform")
|
|
}
|
|
|
|
#[allow(unused)]
|
|
pub fn current() -> Self {
|
|
SpawnHandle
|
|
}
|
|
}
|
|
|
|
#[allow(unused)]
|
|
pub fn spawn<F>(_future: F)
|
|
where
|
|
F: Future<Output = ()> + 'static,
|
|
{
|
|
panic!("stubbed platform")
|
|
}
|