feat(postit): rejoin chat room automatically after reconnect
Also drop unused usings in BlogsViewModel.
This commit is contained in:
parent
95e8f251d2
commit
cd7351a783
3 changed files with 17 additions and 4 deletions
11
CHANGELOG.md
11
CHANGELOG.md
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 =>
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue