diff --git a/CHANGELOG.md b/CHANGELOG.md index 4272924..4a1c1f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- A tab with a failed core remains selectable for recovery. Selecting a stale tab after restart no longer exits the application or disrupts the other tabs. + - On a confirmed move to another channel, the core revokes already captured audio before publishing the new channel snapshot. Other users' moves do not interrupt capture. - Hiding offline contacts also hides the grouping switch without resetting its saved value. diff --git a/docs/mobile-port-progress.md b/docs/mobile-port-progress.md index 37329d0..388f312 100644 --- a/docs/mobile-port-progress.md +++ b/docs/mobile-port-progress.md @@ -4,6 +4,8 @@ ## Возврат к разработке на ПК, 2026-11-26 +Windows, preload:onCoreStatus: менеджер публикует Starting перед созданием нового worker при перезапуске. Вкладка показывает состояние неработающего ядра и не предлагает подключение до Ready. Три адресных теста прошли. На уровне менеджера занятие временного слота дало Failed и Disconnected, соседняя вкладка ответила на profile_get, снятие блокировки позволило восстановить Ready. В отдельном тесте окна Slint выбор со старым SessionKey после перезапуска дал target_changed, цикл приложения продолжил работать, соседняя вкладка выбиралась и отвечала. Быстрое промежуточное Starting не измерялось как отдельный отрисованный кадр. + Windows, голосовое ядро: собственное событие ClientChannel с изменившимся каналом отзывает очередь и разрешение отправки ранее захваченных кадров, после чего снимок публикуется без обычной задержки. Три адресных теста teamspeach-core прошли: проверены собственный и чужой перенос, повторное уведомление без смены канала, блокировка отправки со старым разрешением и приём кадра с новым. Физический микрофон и сетевой переход не проверялись. Windows: contact_sort_uses_saved_mode_after_two_restarts проверил сортировку из настройки Chats. В негруппированном списке локальный псевдоним Alpha (офлайн) был выше Zulu (онлайн) при алфавитном порядке. После отключения настройки и двух перезапусков первым отображался онлайн-контакт Zulu. Присутствие взято из тестового снимка сервера; облачные сервисы не использовались. Вместе с проверкой независимого раскрытия групп прошли два теста. diff --git a/native/resources/i18n/en.json b/native/resources/i18n/en.json index f023d53..841671e 100644 --- a/native/resources/i18n/en.json +++ b/native/resources/i18n/en.json @@ -23,6 +23,7 @@ "bookmarks.empty": "No Bookmarks", "window.titlebar": "Window title bar", "ui.starting.core": "Starting core…", + "native.core.stopping": "Stopping core…", "ui.restarting.core": "Restarting core…", "ui.core.unavailable": "Core unavailable", "ui.restart.core": "Restart core", diff --git a/native/resources/i18n/ru.json b/native/resources/i18n/ru.json index 93a3867..b1d59b4 100644 --- a/native/resources/i18n/ru.json +++ b/native/resources/i18n/ru.json @@ -2367,4 +2367,5 @@ ,"native.privacy.list.current": "Список актуален" ,"native.privacy.list.cached": "Используется последняя доступная копия" ,"native.privacy.list.unavailable": "Список не загружен" + ,"native.core.stopping": "Остановка ядра…" } diff --git a/native/src/app/connections.rs b/native/src/app/connections.rs index 50d3dad..176bfab 100644 --- a/native/src/app/connections.rs +++ b/native/src/app/connections.rs @@ -62,7 +62,7 @@ impl From for ConnectionError { #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum ConnectionState { Disconnected, Connecting, Connected, Disconnecting } #[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub enum CoreStatus { Ready, Stopping, Stopped, Failed } +pub enum CoreStatus { Starting, Ready, Stopping, Stopped, Failed } #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub struct AudioState { pub input_muted: bool, @@ -575,12 +575,14 @@ impl Actor { Operation::Key(id, reply) => { let _ = reply.send(self.index(&id).map(|index| self.entries[index].key())); } Operation::Workflow(settings, reply) => { self.workflow = settings; let _ = reply.send(Ok(())); } Operation::View(key, reply) => { - let result = self.checked(&key).map(|index| { + let result = self.index(&key.connection_id).and_then(|index| { + if self.entries[index].key()!=key { return Err(ConnectionError::TargetChanged); } let changed = self.viewed.as_ref() != Some(&key.connection_id); self.viewed = Some(key.connection_id.clone()); if changed && self.workflow.auto_enable_microphone && self.entries[index].snapshot.is_connected() { self.revoke(); self.choose_input(Some(key.connection_id.clone())); self.configure_input(index, key, None); } + Ok(()) }); self.publish(); let _ = reply.send(result); } @@ -853,6 +855,8 @@ impl Actor { stopped.result.clone().and_then(|()| { let index = self.index(&stopped.id)?; let incarnation = self.entries[index].incarnation.checked_add(1).ok_or(ConnectionError::IdExhausted)?; + self.entries[index].snapshot.status = CoreStatus::Starting; + self.publish(); let worker = self.spawn_worker(&stopped.id, stopped.slot, incarnation)?; self.entries[index].worker = Some(worker); self.entries[index].incarnation = incarnation; diff --git a/native/src/app/connections_tests.rs b/native/src/app/connections_tests.rs index 19cbc72..0eb29f7 100644 --- a/native/src/app/connections_tests.rs +++ b/native/src/app/connections_tests.rs @@ -283,6 +283,9 @@ async fn failed_worker_restart_reports_failure_and_recovers_after_slot_unlock() let failed = snapshots.borrow().get(&first.connection_id).unwrap().clone(); assert_eq!(failed.status, CoreStatus::Failed); assert_eq!(failed.state, ConnectionState::Disconnected); + let (reply, viewed) = oneshot::channel(); + actor.operation(Operation::View(failed.key.clone(), reply)); + viewed.await.unwrap().unwrap(); assert!(actor.entries[actor.checked(&other).unwrap()].worker.as_ref().unwrap().core.request(Command::ProfileGet).await.is_ok()); blocker.shutdown().await.unwrap(); diff --git a/native/src/app/runtime/mod.rs b/native/src/app/runtime/mod.rs index 0ed82d9..a2b2bb8 100644 --- a/native/src/app/runtime/mod.rs +++ b/native/src/app/runtime/mod.rs @@ -177,7 +177,19 @@ async fn run(config:AppConfig,runtime:Weak,mut commands:mpsc::Receiv ShellAction::Navigate(destination)=>{close_recording_panel(&ctx,&mut state).await;state.snapshot.destination=destination;dirty=true;}, ShellAction::Back=>{close_recording_panel(&ctx,&mut state).await;state.selected=None;state.detail_target=None;state.snapshot.detail=Detail::default();dirty=true;}, ShellAction::LeaveRecordingDetail=>{close_recording_panel(&ctx,&mut state).await;dirty=true;}, - ShellAction::Select(target)=>{if let Some(key)=&target.session{ctx.require_key(key,false)?;}state.selected=Some(target.clone());if let Some(key)=&target.session{match target.entity{Entity::Connection=>{close_recording_panel(&ctx,&mut state).await;ctx.connected.connections.view(key).await.map_err(context::connection_error)?;},Entity::Channel{id}=>{ctx.connected.connections.select_channel(key,id).await.map_err(context::connection_error)?;},_=>{}}}dirty=true;}, + ShellAction::Select(target)=>{ + let result=match (&target.session,&target.entity){ + (Some(key),Entity::Connection)=>ctx.connected.connections.view(key).await.map_err(context::connection_error), + (Some(key),Entity::Channel{id})=>ctx.connected.connections.select_channel(key,*id).await.map_err(context::connection_error), + (Some(key),_)=>ctx.require_key(key,false), + (None,_)=>Ok(()), + }; + match result { + Ok(())=>{if matches!(target.entity,Entity::Connection){close_recording_panel(&ctx,&mut state).await;}state.selected=Some(target);}, + Err(error)=>{state.snapshot.error=error.message.clone();state.snapshot.last_error=Some(error);} + } + dirty=true; + }, ShellAction::Expand(target)=>{match (&target.session,target.entity){ (Some(key),Entity::Channel{id})=>{let item=(key.connection_id.clone(),id);if !state.expanded.remove(&item){state.expanded.insert(item);}}, (None,Entity::ContactGroup{online})=>{let pref=if online{"contactsOnlineExpanded"}else{"contactsOfflineExpanded"};let sender=events.clone();jobs.spawn(async move{let result=ctx.mutate(move|p|{let next=p.prefs.get()[pref]!=true;p.prefs.set(serde_json::json!({(pref):next}))?;Ok(())}).await.map(|_|events::WorkflowResult::default());let _=sender.send(ServiceEvent::Workflow(result)).await;});}, diff --git a/native/src/app/runtime/model.rs b/native/src/app/runtime/model.rs index 8472b06..3771420 100644 --- a/native/src/app/runtime/model.rs +++ b/native/src/app/runtime/model.rs @@ -61,8 +61,18 @@ impl AppState { self.snapshot.catalog=c;let connections=ctx.connected.connections.snapshot(); self.snapshot.tabs=connections.connections.iter().map(|connection|{ let target=tab_target(connection); - let mut operations=if connection.is_connected(){vec![Operation::Disconnect,Operation::UseMicrophone,Operation::SetNickname,Operation::SetAway,Operation::ServerChat,Operation::RecordingOpen,Operation::CaptureChoose]}else{vec![Operation::Connect,Operation::RestartCore]};operations.push(Operation::CloseConnection); - Tab{title:target.name.clone(),selected:connections.viewed_id.as_deref()==Some(&connection.key.connection_id),microphone_owner:connections.input_id.as_deref()==Some(&connection.key.connection_id),connected:connection.is_connected(),unread:ctx.notifications.lock().ok().and_then(|n|n.unread_count(&connection.key).ok()).unwrap_or(0).min(usize::MAX as u64) as usize,actions:actions(&target,&operations,&c),target} + use crate::app::connections::CoreStatus; + use Operation::*; + let (operations,caption):(&[Operation],Option<&str>)=match connection.status { + CoreStatus::Ready if connection.is_connected()=>(&[Disconnect,UseMicrophone,SetNickname,SetAway,ServerChat,RecordingOpen,CaptureChoose,CloseConnection],None), + CoreStatus::Ready=>(&[Connect,RestartCore,CloseConnection],None), + CoreStatus::Starting=>(&[],Some("ui.starting.core")), + CoreStatus::Stopping=>(&[],Some("native.core.stopping")), + CoreStatus::Stopped=>(&[RestartCore,CloseConnection],Some("ui.the.core.stopped")), + CoreStatus::Failed=>(&[RestartCore,CloseConnection],Some("ui.core.unavailable")), + }; + let title=caption.map_or_else(||target.name.clone(),|caption|format!("{} · {}",target.name,c.text(caption))); + Tab{title,selected:connections.viewed_id.as_deref()==Some(&connection.key.connection_id),microphone_owner:connections.input_id.as_deref()==Some(&connection.key.connection_id),connected:connection.is_connected(),unread:ctx.notifications.lock().ok().and_then(|n|n.unread_count(&connection.key).ok()).unwrap_or(0).min(usize::MAX as u64) as usize,actions:actions(&target,operations,&c),target} }).collect(); let viewed=connections.viewed_id.as_deref().and_then(|id|connections.get(id)); if let Some((connection,server))=viewed.and_then(|connection|connection.server.as_ref().map(|server|(connection,server))) { diff --git a/native/src/smoke/tabs.rs b/native/src/smoke/tabs.rs index 2668670..e71f18e 100644 --- a/native/src/smoke/tabs.rs +++ b/native/src/smoke/tabs.rs @@ -381,7 +381,13 @@ fn offline_restart_from_tab_menu_reports_completion() { let row = s.connections.get(&first.connection_id)?; (row.key.session > first.session && row.status == CoreStatus::Ready && !row.is_connected() && bridge.get_status() == "Restarted the core for TeamsPeach.").then(|| row.key.clone()) }).await?; - projection(runtime, ui, &[key, other.clone()], 0).await?; + let current=[key,other.clone()]; + let tabs=projection(runtime, ui, ¤t, 0).await?; + use crate::ui::shell::{Entity,ShellAction,Target}; + runtime.dispatch_shell(ShellAction::Select(Target{session:Some(first),entity:Entity::Connection,..Target::application()})).map_err(|e|e.message)?; + wait(runtime,"rejected stale tab selection",|s|s.last_error.as_ref().filter(|e|e.code=="target_changed").map(|_|())).await?; + click_tab(ui,tabs[1].0)?; + projection(runtime,ui,¤t,1).await?; manager.request(&other, Command::ProfileGet).await.map_err(|e| e.to_string())?; Ok(()) }).unwrap();