File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed
arduino-ide-extension/src Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,10 @@ export class AuthenticationClientService
4949 this . service
5050 . session ( )
5151 . then ( ( session ) => this . notifySessionDidChange ( session ) ) ;
52+
5253 this . setOptions ( ) ;
54+ this . service . initAuthSession ( )
55+
5356 this . arduinoPreferences . onPreferenceChanged ( ( event ) => {
5457 if ( event . preferenceName . startsWith ( 'arduino.auth.' ) ) {
5558 this . setOptions ( ) ;
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ export interface AuthenticationService
2323 session ( ) : Promise < AuthenticationSession | undefined > ;
2424 disposeClient ( client : AuthenticationServiceClient ) : void ;
2525 setOptions ( authOptions : AuthOptions ) : void ;
26+ initAuthSession ( ) : Promise < void > ;
2627}
2728
2829export interface AuthenticationServiceClient {
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ export class AuthenticationServiceImpl
1919 protected readonly delegate = new ArduinoAuthenticationProvider ( ) ;
2020 protected readonly clients : AuthenticationServiceClient [ ] = [ ] ;
2121 protected readonly toDispose = new DisposableCollection ( ) ;
22+
23+ private initialized = false ;
2224
2325 async onStart ( ) : Promise < void > {
2426 this . toDispose . pushAll ( [
@@ -42,7 +44,13 @@ export class AuthenticationServiceImpl
4244 this . clients . forEach ( ( client ) => this . disposeClient ( client ) )
4345 ) ,
4446 ] ) ;
45- await this . delegate . init ( ) ;
47+ }
48+
49+ async initAuthSession ( ) : Promise < void > {
50+ if ( ! this . initialized ) {
51+ await this . delegate . init ( ) ;
52+ this . initialized = true
53+ }
4654 }
4755
4856 setOptions ( authOptions : AuthOptions ) {
You can’t perform that action at this time.
0 commit comments