mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-26 20:56:35 +00:00
parent
b407d0aee0
commit
b8c718ce9e
@ -49,7 +49,10 @@ export class AuthenticationClientService
|
||||
this.service
|
||||
.session()
|
||||
.then((session) => this.notifySessionDidChange(session));
|
||||
|
||||
this.setOptions();
|
||||
this.service.initAuthSession()
|
||||
|
||||
this.arduinoPreferences.onPreferenceChanged((event) => {
|
||||
if (event.preferenceName.startsWith('arduino.auth.')) {
|
||||
this.setOptions();
|
||||
|
@ -23,6 +23,7 @@ export interface AuthenticationService
|
||||
session(): Promise<AuthenticationSession | undefined>;
|
||||
disposeClient(client: AuthenticationServiceClient): void;
|
||||
setOptions(authOptions: AuthOptions): void;
|
||||
initAuthSession(): Promise<void>;
|
||||
}
|
||||
|
||||
export interface AuthenticationServiceClient {
|
||||
|
@ -19,6 +19,8 @@ export class AuthenticationServiceImpl
|
||||
protected readonly delegate = new ArduinoAuthenticationProvider();
|
||||
protected readonly clients: AuthenticationServiceClient[] = [];
|
||||
protected readonly toDispose = new DisposableCollection();
|
||||
|
||||
private initialized = false;
|
||||
|
||||
async onStart(): Promise<void> {
|
||||
this.toDispose.pushAll([
|
||||
@ -42,7 +44,13 @@ export class AuthenticationServiceImpl
|
||||
this.clients.forEach((client) => this.disposeClient(client))
|
||||
),
|
||||
]);
|
||||
await this.delegate.init();
|
||||
}
|
||||
|
||||
async initAuthSession(): Promise<void> {
|
||||
if (!this.initialized) {
|
||||
await this.delegate.init();
|
||||
this.initialized = true
|
||||
}
|
||||
}
|
||||
|
||||
setOptions(authOptions: AuthOptions) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user