Skip to content
Snippets Groups Projects

sprint 1

1 file
+ 8
7
Compare changes
  • Side-by-side
  • Inline
@@ -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();
Loading