feat: show errors from relay

This commit is contained in:
Anna 2021-02-05 16:03:45 -05:00
parent 8a64a7b5da
commit 24d2158e6d
Signed by: anna
GPG Key ID: 0B391D8F06FCD9E0
2 changed files with 10 additions and 0 deletions

View File

@ -205,6 +205,12 @@ namespace XIVChatPlugin {
ImGui.Spacing();
if ((this.Plugin.Relay?.Status ?? ConnectionStatus.Disconnected) == ConnectionStatus.Disconnected && Relay.ConnectionError != null) {
ImGui.TextUnformatted($"Error: {Relay.ConnectionError}");
ImGui.Spacing();
}
var relayAuth = this.Plugin.Config.RelayAuth ?? "";
WithWhiteText(() => ImGui.TextUnformatted("Relay authentication code"));
ImGui.PushItemWidth(-1f);

View File

@ -24,6 +24,8 @@ namespace XIVChatPlugin {
private const string RelayUrl = "wss://relay.xiv.chat/";
#endif
public static string? ConnectionError { get; private set; }
private bool Disposed { get; set; }
private Plugin Plugin { get; }
@ -135,9 +137,11 @@ namespace XIVChatPlugin {
switch (message) {
case RelaySuccess success:
if (success.Success) {
ConnectionError = null;
this.Status = ConnectionStatus.Connected;
} else {
PluginLog.LogWarning($"Relay: {success.Info}");
ConnectionError = success.Info;
this.Status = ConnectionStatus.Disconnected;
this.Plugin.StopRelay();
}