@@ -17,13 +17,14 @@ import { IExperimentationService, TreatmentsChangeEvent } from '../common/nullEx
1717export class UserInfoStore extends Disposable {
1818 private _internalOrg : string | undefined ;
1919 private _sku : string | undefined ;
20+ private _isFcv1 : boolean | undefined ;
2021
2122 private _onDidChangeUserInfo = this . _register ( new Emitter < void > ( ) ) ;
2223 readonly onDidChangeUserInfo = this . _onDidChangeUserInfo . event ;
2324
2425 static INTERNAL_ORG_STORAGE_KEY = 'exp.github.copilot.internalOrg' ;
2526 static SKU_STORAGE_KEY = 'exp.github.copilot.sku' ;
26-
27+ static IS_FCV1_STORAGE_KEY = 'exp.github.copilot.isFcv1' ;
2728 constructor ( private readonly context : IVSCodeExtensionContext , copilotTokenStore : ICopilotTokenStore ) {
2829 super ( ) ;
2930
@@ -38,15 +39,16 @@ export class UserInfoStore extends Disposable {
3839 } ;
3940
4041 copilotTokenStore . onDidStoreUpdate ( ( ) => {
41- this . updateUserInfo ( getInternalOrg ( ) , copilotTokenStore . copilotToken ?. sku ) ;
42+ this . updateUserInfo ( getInternalOrg ( ) , copilotTokenStore . copilotToken ?. sku , copilotTokenStore . copilotToken ?. isFcv1 ( ) ) ;
4243 } ) ;
4344
4445 if ( copilotTokenStore . copilotToken ) {
45- this . updateUserInfo ( getInternalOrg ( ) , copilotTokenStore . copilotToken . sku ) ;
46+ this . updateUserInfo ( getInternalOrg ( ) , copilotTokenStore . copilotToken . sku , copilotTokenStore . copilotToken . isFcv1 ( ) ) ;
4647 } else {
4748 const cachedInternalValue = this . context . globalState . get < string > ( UserInfoStore . INTERNAL_ORG_STORAGE_KEY ) ;
4849 const cachedSkuValue = this . context . globalState . get < string > ( UserInfoStore . SKU_STORAGE_KEY ) ;
49- this . updateUserInfo ( cachedInternalValue , cachedSkuValue ) ;
50+ const cachedIsFcv1Value = this . context . globalState . get < boolean > ( UserInfoStore . IS_FCV1_STORAGE_KEY ) ;
51+ this . updateUserInfo ( cachedInternalValue , cachedSkuValue , cachedIsFcv1Value ) ;
5052 }
5153 }
5254 }
@@ -59,17 +61,22 @@ export class UserInfoStore extends Disposable {
5961 return this . _sku ;
6062 }
6163
62- private updateUserInfo ( internalOrg ?: string , sku ?: string ) : void {
63- if ( this . _internalOrg === internalOrg && this . _sku === sku ) {
64+ get isFcv1 ( ) : boolean | undefined {
65+ return this . _isFcv1 ;
66+ }
67+
68+ private updateUserInfo ( internalOrg ?: string , sku ?: string , isFcv1 ?: boolean ) : void {
69+ if ( this . _internalOrg === internalOrg && this . _sku === sku && this . _isFcv1 === isFcv1 ) {
6470 // no change
6571 return ;
6672 }
6773
6874 this . _internalOrg = internalOrg ;
6975 this . _sku = sku ;
70-
76+ this . _isFcv1 = isFcv1 ;
7177 this . context . globalState . update ( UserInfoStore . INTERNAL_ORG_STORAGE_KEY , this . _internalOrg ) ;
7278 this . context . globalState . update ( UserInfoStore . SKU_STORAGE_KEY , this . _sku ) ;
79+ this . context . globalState . update ( UserInfoStore . IS_FCV1_STORAGE_KEY , this . _isFcv1 ) ;
7380
7481 this . _onDidChangeUserInfo . fire ( ) ;
7582 }
@@ -186,4 +193,4 @@ function equalMap(map1: Map<string, string>, map2: Map<string, string>): boolean
186193 }
187194
188195 return true ;
189- }
196+ }
0 commit comments