Solo: no idle unready, no party corner in fullscreen; a cancelled Invite returns to solo

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
foxyzandClaude Opus 5.5 committed 2026-10-09 23:39:48 +03:00
1 parent 0115d54ab8
commit 059b7dd306
4 files changed
+42 -8

No files matched your search

+25 -1
View File
@@ -260,12 +260,13 @@ class SessionState {
/// pick, seeked to where it was; if hosting fails, solo comes back.
Future<void> host(ConnectParams params, ConnectForm form) async {
if (!solo.peek()) return _host(params, form: form);
final carry = _carry();
final carry = _invited = _carry();
switching.value = true;
try {
await coordinator.leave();
await stopServer();
solo.value = false;
coordinator.solo = false;
try {
await _host(params, form: form);
} catch (_) {
@@ -289,6 +290,27 @@ class SessionState {
}
}
/// What an Invite from solo carried over, for [cancelInvite].
({PickedMedia pick, double position})? _invited;
/// Invite cancelled after the hosted server already came up: back to
/// solo with the same media, not out of the session.
Future<void> cancelInvite() async {
final carry = _invited;
switching.value = true;
try {
await coordinator.leave();
await stopServer();
await _host(_soloParams!, soloSession: true);
if (carry != null) await _resume(carry);
} catch (e) {
debugPrint('back to solo failed: $e');
await leave();
} finally {
switching.value = false;
}
}
/// Watch alone: the same hosted path, on 127.0.0.1 and a free port, no
/// password, nothing put up yet. Nobody else can reach it.
Future<void> startSolo(ConnectParams params) async {
@@ -394,6 +416,7 @@ class SessionState {
rethrow;
}
solo.value = soloSession;
coordinator.solo = soloSession;
route.value = AppRoute.session;
} finally {
if (form != null) await _saveFormQuietly();
@@ -478,6 +501,7 @@ class SessionState {
await coordinator.leave();
await stopServer();
solo.value = false;
coordinator.solo = false;
serverLabel.value = '';
status.value = const HealthStatus(HealthSeverity.info, 'idle');
route.value = AppRoute.home;