[AdvancedPaste]Hide custom actions on Paste menu when Paste with AI disabled (#35047)

This commit is contained in:
Ani
2024-09-25 12:10:11 +02:00
committed by GitHub
parent 1e18e83af6
commit a8b858f612
3 changed files with 49 additions and 34 deletions

View File

@@ -142,13 +142,13 @@ private:
{
try
{
winrt::Windows::Security::Credentials::PasswordVault vault;
return vault.Retrieve(OPENAI_VAULT_RESOURCE, OPENAI_VAULT_USERNAME) != nullptr;
winrt::Windows::Security::Credentials::PasswordVault().Retrieve(OPENAI_VAULT_RESOURCE, OPENAI_VAULT_USERNAME);
return true;
}
catch (const winrt::hresult_error& ex)
{
// Looks like the only way to access the PasswordVault is through the an API that throws an exception in case the resource doesn't exist.
// If the compiler breaks here when you're debugging, just continue.
// If the debugger breaks here, just continue.
// If you want to disable breaking here in a more permanent way, just add a condition in Visual Studio's Exception Settings to not break on win::hresult_error, but that might make you not hit other exceptions you might want to catch.
if (ex.code() == HRESULT_FROM_WIN32(ERROR_NOT_FOUND))
{