diff --git a/.gitignore b/.gitignore index d1abc22..c04b893 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ dist node_modules .vscode-test/ intellijpublish.yml -*.log \ No newline at end of file +*.log +out \ No newline at end of file diff --git a/package.json b/package.json index 36997d3..682478a 100644 --- a/package.json +++ b/package.json @@ -100,11 +100,6 @@ "title": "Sign Out", "when": "keploy.signedOut != true && view == Keploy-Sidebar" }, - { - "command": "keploy.SignOut", - "title": "Sign Out", - "when": "keploy.signedOut != true && view == Keploy-Sidebar" - }, { "command": "keploy.utg", "title": "Keploy: Unit Test Generation" diff --git a/src/extension.ts b/src/extension.ts index 3e139ec..5641e3b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -93,7 +93,11 @@ export function activate(context: vscode.ExtensionContext) { // Disable the sign-in command since the user is already signed in vscode.commands.executeCommand('setContext', 'keploy.signedIn', true); vscode.window.showInformationMessage('You are already signed in!'); + // enable the signout command + vscode.commands.executeCommand('setContext', 'keploy.signedOut', false); + } else { + vscode.commands.executeCommand('setContext', 'keploy.signedOut', true); // Register the sign-in command if not signed in let signInCommand = vscode.commands.registerCommand('keploy.SignIn', async () => { try { @@ -110,11 +114,13 @@ export function activate(context: vscode.ExtensionContext) { const { emailID, isValid, error } = await validateFirst(accessToken, "https://api.keploy.io"); // if (isValid) { - vscode.window.showInformationMessage('You are now signed in!'); - vscode.commands.executeCommand('setContext', 'keploy.signedIn', true); + vscode.window.showInformationMessage('You are now signed in!'); + vscode.commands.executeCommand('setContext', 'keploy.signedIn', true); + vscode.commands.executeCommand('setContext', 'keploy.signedOut', false); // } else { // console.log('Validation failed for the user !'); // } + } else { console.log('Failed to get the session or email.'); vscode.window.showInformationMessage('Failed to sign in Keploy!'); @@ -133,6 +139,7 @@ export function activate(context: vscode.ExtensionContext) { context.globalState.update('accessToken', undefined); vscode.window.showInformationMessage('You have been signed out.'); vscode.commands.executeCommand('setContext', 'keploy.signedIn', false); + vscode.commands.executeCommand('setContext', 'keploy.signedOut', true); }); context.subscriptions.push(signout);