File tree 3 files changed +13
-1
lines changed
arduino-ide-extension/src
3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,10 @@ export class AuthenticationClientService
49
49
this . service
50
50
. session ( )
51
51
. then ( ( session ) => this . notifySessionDidChange ( session ) ) ;
52
+
52
53
this . setOptions ( ) ;
54
+ this . service . initAuthSession ( )
55
+
53
56
this . arduinoPreferences . onPreferenceChanged ( ( event ) => {
54
57
if ( event . preferenceName . startsWith ( 'arduino.auth.' ) ) {
55
58
this . setOptions ( ) ;
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ export interface AuthenticationService
23
23
session ( ) : Promise < AuthenticationSession | undefined > ;
24
24
disposeClient ( client : AuthenticationServiceClient ) : void ;
25
25
setOptions ( authOptions : AuthOptions ) : void ;
26
+ initAuthSession ( ) : Promise < void > ;
26
27
}
27
28
28
29
export interface AuthenticationServiceClient {
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ export class AuthenticationServiceImpl
19
19
protected readonly delegate = new ArduinoAuthenticationProvider ( ) ;
20
20
protected readonly clients : AuthenticationServiceClient [ ] = [ ] ;
21
21
protected readonly toDispose = new DisposableCollection ( ) ;
22
+
23
+ private initialized = false ;
22
24
23
25
async onStart ( ) : Promise < void > {
24
26
this . toDispose . pushAll ( [
@@ -42,7 +44,13 @@ export class AuthenticationServiceImpl
42
44
this . clients . forEach ( ( client ) => this . disposeClient ( client ) )
43
45
) ,
44
46
] ) ;
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
+ }
46
54
}
47
55
48
56
setOptions ( authOptions : AuthOptions ) {
You can’t perform that action at this time.
0 commit comments