feat(postit): rejoin chat room automatically after reconnect

Also drop unused usings in BlogsViewModel.
This commit is contained in:
Paul Schneider 2026-10-09 17:55:03 +01:00
commit cd7351a783
Signed by: notazof
GPG key ID: AD4B9B545FBD7D12
3 changed files with 17 additions and 4 deletions

View file

@ -1,6 +1,17 @@
# Changelog # Changelog
## [1.0.8-rc24] - unstable
### Added
* [PostIt] Reconnection automatique aux salons de discussion au reconnect
### Changed
### Fixed
## [1.0.8-rc23] - unstable ## [1.0.8-rc23] - unstable
### Added ### Added

View file

@ -10,9 +10,7 @@ using Microsoft.Extensions.DependencyInjection;
using Yavsc.Blogspot; using Yavsc.Blogspot;
using Yavsc.Api.Client; using Yavsc.Api.Client;
using Yavsc.Abstract.Files; using Yavsc.Abstract.Files;
using PostIt.Helpers;
using AvaloniaEdit.Document; using AvaloniaEdit.Document;
using PostIt.Models;
namespace PostIt.ViewModels; namespace PostIt.ViewModels;

View file

@ -246,7 +246,7 @@ namespace PostIt.ViewModels.Chat
}); });
return Task.CompletedTask; return Task.CompletedTask;
}; };
_connection.Reconnected += _ => _connection.Reconnected += async _ =>
{ {
Avalonia.Threading.Dispatcher.UIThread.Post(() => Avalonia.Threading.Dispatcher.UIThread.Post(() =>
{ {
@ -254,7 +254,11 @@ namespace PostIt.ViewModels.Chat
Status = new StatusNotice("Reconnecté au Hub SignalR", StatusSeverity.Info, Status = new StatusNotice("Reconnecté au Hub SignalR", StatusSeverity.Info,
new RelayCheckCommand("Déconnecter", async () => await DisconnectAsync())); new RelayCheckCommand("Déconnecter", async () => await DisconnectAsync()));
}); });
return Task.CompletedTask; // La reconnexion crée une nouvelle ConnectionId côté
// serveur : l'appartenance aux salons est perdue, il
// faut rejoindre à nouveau le salon courant.
if (!string.IsNullOrWhiteSpace(CurrentRoom))
await JoinRoomAsync();
}; };
_connection.Closed += error => _connection.Closed += error =>
{ {