From d338b4b93c0d78edd3bca4da599d64fa16d676a4 Mon Sep 17 00:00:00 2001 From: Stanley Dimant Date: Sun, 10 Jul 2022 20:23:02 +0200 Subject: [PATCH] fix intro UI not showing secret key after registration, fix file system watchers not starting automatically initially --- MareSynchronos/Managers/FileCacheManager.cs | 2 +- MareSynchronos/MareSynchronos.csproj | 2 +- MareSynchronos/UI/IntroUI.cs | 2 +- MareSynchronos/UI/UIShared.cs | 4 ++-- MareSynchronos/WebAPI/ApIController.Functions.Users.cs | 8 ++++++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/MareSynchronos/Managers/FileCacheManager.cs b/MareSynchronos/Managers/FileCacheManager.cs index 39faf12..cd6f943 100644 --- a/MareSynchronos/Managers/FileCacheManager.cs +++ b/MareSynchronos/Managers/FileCacheManager.cs @@ -91,7 +91,7 @@ namespace MareSynchronos.Managers public void StartWatchers() { - if (!_ipcManager.Initialized || !_pluginConfiguration.HasValidSetup()) return; + if (!_ipcManager.Initialized || string.IsNullOrEmpty(_pluginConfiguration.CacheFolder)) return; Logger.Verbose("Starting File System Watchers"); _penumbraDirWatcher?.Dispose(); _cacheDirWatcher?.Dispose(); diff --git a/MareSynchronos/MareSynchronos.csproj b/MareSynchronos/MareSynchronos.csproj index 4a2d7a7..1181e7c 100644 --- a/MareSynchronos/MareSynchronos.csproj +++ b/MareSynchronos/MareSynchronos.csproj @@ -3,7 +3,7 @@ - 0.1.7.0 + 0.1.8.0 https://github.com/Penumbra-Sync/client diff --git a/MareSynchronos/UI/IntroUI.cs b/MareSynchronos/UI/IntroUI.cs index 9f03bc3..1bdb250 100644 --- a/MareSynchronos/UI/IntroUI.cs +++ b/MareSynchronos/UI/IntroUI.cs @@ -176,7 +176,7 @@ namespace MareSynchronos.UI "Make a backup of your secret key. In case of loss, it cannot be restored. The secret key is your identification to the service " + "to verify who you are. It is directly tied to the UID you will be receiving. In case of loss, you will have to re-register an account.", ImGuiColors.DalamudRed); UiShared.ColorTextWrapped("Do not ever, under any circumstances, share your secret key to anyone! Likewise do not share your Mare Synchronos plugin configuration to anyone!", ImGuiColors.DalamudRed); - _uiShared.DrawServiceSelection(() => SwitchToMainUi?.Invoke(), true); + _uiShared.DrawServiceSelection(new Action(() => { }), true); } } } diff --git a/MareSynchronos/UI/UIShared.cs b/MareSynchronos/UI/UIShared.cs index b565567..7a712c0 100644 --- a/MareSynchronos/UI/UIShared.cs +++ b/MareSynchronos/UI/UIShared.cs @@ -318,7 +318,7 @@ namespace MareSynchronos.UI { _pluginConfiguration.FullPause = false; _pluginConfiguration.Save(); - Task.Run(_apiController.Register); + Task.Run(() => _apiController.Register(isIntroUi)); ShowClientSecret = true; callBackOnExit?.Invoke(); } @@ -345,7 +345,7 @@ namespace MareSynchronos.UI if (_enterSecretKey) { - ColorTextWrapped("This will overwrite your currently used secret key for the selected service. Make sure to have a backup for the current secret key if you want to switch back to this acocunt.", ImGuiColors.DalamudYellow); + ColorTextWrapped("This will overwrite your currently used secret key for the selected service. Make sure to have a backup for the current secret key if you want to switch back to this account.", ImGuiColors.DalamudYellow); ImGui.SetNextItemWidth(400); ImGui.InputText("Enter Secret Key", ref _secretKey, 255); ImGui.SameLine(); diff --git a/MareSynchronos/WebAPI/ApIController.Functions.Users.cs b/MareSynchronos/WebAPI/ApIController.Functions.Users.cs index de6a8d2..6e496d2 100644 --- a/MareSynchronos/WebAPI/ApIController.Functions.Users.cs +++ b/MareSynchronos/WebAPI/ApIController.Functions.Users.cs @@ -18,14 +18,18 @@ namespace MareSynchronos.WebAPI await CreateConnections(); } - public async Task Register() + public async Task Register(bool isIntroUi = false) { if (!ServerAlive) return; Logger.Debug("Registering at service " + ApiUri); var response = await _userHub!.InvokeAsync(UserHubAPI.InvokeRegister); _pluginConfiguration.ClientSecret[ApiUri] = response; _pluginConfiguration.Save(); - RegisterFinalized?.Invoke(); + if (!isIntroUi) + { + RegisterFinalized?.Invoke(); + } + await CreateConnections(); }