refactor
This commit is contained in:
		
							parent
							
								
									9cc3cf92ab
								
							
						
					
					
						commit
						8648c70df4
					
				| @ -263,12 +263,16 @@ async fn handle(data: Data, stream: &mut Connection) { | ||||
|             Some(value) => { | ||||
|                 let v0 = Config::get_option("stop-service"); | ||||
|                 let v1 = Config::get_rendezvous_servers(); | ||||
|                 let v2 = Config::get_option("audio-input"); | ||||
|                 Config::set_options(value); | ||||
|                 if v0 != Config::get_option("stop-service") | ||||
|                     || v1 != Config::get_rendezvous_servers() | ||||
|                 { | ||||
|                     RendezvousMediator::restart(); | ||||
|                 } | ||||
|                 if v2 != Config::get_option("audio-input") { | ||||
|                     crate::audio_service::restart(); | ||||
|                 } | ||||
|                 allow_err!(stream.send(&Data::Options(None)).await); | ||||
|             } | ||||
|         }, | ||||
| @ -515,10 +519,6 @@ pub fn set_option(key: &str, value: &str) { | ||||
|     set_options(options).ok(); | ||||
| } | ||||
| 
 | ||||
| pub fn restart_autdio_service() { | ||||
|     crate::audio_service::restart(); | ||||
| } | ||||
| 
 | ||||
| #[tokio::main(flavor = "current_thread")] | ||||
| pub async fn set_options(value: HashMap<String, String>) -> ResultType<()> { | ||||
|     let mut c = connect(1000, "").await?; | ||||
|  | ||||
| @ -364,10 +364,6 @@ impl UI { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     fn refresh_audio_input(&self) { | ||||
|         ipc::restart_autdio_service(); | ||||
|     } | ||||
| 
 | ||||
|     fn install_path(&mut self) -> String { | ||||
|         #[cfg(windows)] | ||||
|         return crate::platform::windows::get_install_info().1; | ||||
| @ -705,7 +701,6 @@ impl sciter::EventHandler for UI { | ||||
|         fn create_shortcut(String); | ||||
|         fn discover(); | ||||
|         fn get_lan_peers(); | ||||
|         fn refresh_audio_input(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -131,7 +131,6 @@ class AudioInputs: Reactor.Component { | ||||
|         if (v == this.get_value()) return; | ||||
|         if (v == this.get_default()) v = ""; | ||||
|         handler.set_option("audio-input", v); | ||||
|         handler.refresh_audio_input(); | ||||
|         this.toggleMenuState(); | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user