diff --git a/deadlock-plugins/deadlock-extension/src/core/controller.ts b/deadlock-plugins/deadlock-extension/src/core/controller.ts index afee4a86fcfaf4c135a15852e25f8e4026504c38..bf1a9ed2d2aa509b20a728056c91602c74b28e03 100644 --- a/deadlock-plugins/deadlock-extension/src/core/controller.ts +++ b/deadlock-plugins/deadlock-extension/src/core/controller.ts @@ -9,7 +9,7 @@ import KeycloakOAuth2DeviceFlowConnection from './keycloakOAuth2DeviceFlowConnec export default class Controller { public connection: KeycloakOAuth2DeviceFlowConnection; private commandHandler: CommandHandler; - private briefingView; + private briefingView: BriefingView; private gettingStartedView: GettingStartedView; constructor(private context: vscode.ExtensionContext) { this.briefingView = new BriefingView(); @@ -21,6 +21,9 @@ export default class Controller { 'https://auth.dev.deadlock.io/auth/realms/Deadlock/protocol/openid-connect/userinfo', ); + this.init(); + } + private async init() { const that = this; vscode.window.registerUriHandler({ handleUri(uri: vscode.Uri) { @@ -37,20 +40,18 @@ export default class Controller { } }, }); - this.init(); - } - async init() { + const exensionStorage = ExtensionStore.getInstance(); this.gettingStartedView.isAlreadyConnected = !!(await exensionStorage.getAccessToken()); } - async clear() { + public async clear() { const exensionStorage = ExtensionStore.getInstance(); await exensionStorage.clear(); this.gettingStartedView.isAlreadyConnected = false; } - async authenticate() { + public async authenticate() { // WARN generate a new device code every time student clicks on log in button. Should I keep it ?\ // The answer might be 'yes' because when the student is already authenticated, the log in button should be disabled. await this.connection.registerDevice(); @@ -64,7 +65,7 @@ export default class Controller { vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(url)); } - async launchMission(missionId: string | null) { + public async launchMission(missionId: string | null) { if (missionId) { vscode.window.showInformationMessage(`vous lancez la mission ${missionId}`); const extensionStore = ExtensionStore.getInstance();