Skip to content

Commit f4800f3

Browse files
authored
Rework whether to reuse auth for edit sessions (microsoft#159069)
1 parent e1d50b0 commit f4800f3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/vs/workbench/contrib/editSessions/browser/editSessionsStorageService.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
1414
import { IQuickInputService, IQuickPickItem, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput';
1515
import { IRequestService } from 'vs/platform/request/common/request';
1616
import { IStorageService, IStorageValueChangeEvent, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
17-
import { createSyncHeaders, IAuthenticationProvider, IResourceRefHandle, IUserDataSyncEnablementService } from 'vs/platform/userDataSync/common/userDataSync';
17+
import { createSyncHeaders, IAuthenticationProvider, IResourceRefHandle } from 'vs/platform/userDataSync/common/userDataSync';
1818
import { UserDataSyncStoreClient } from 'vs/platform/userDataSync/common/userDataSyncStoreService';
1919
import { AuthenticationSession, AuthenticationSessionsChangeEvent, IAuthenticationService } from 'vs/workbench/services/authentication/common/authentication';
2020
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
@@ -23,6 +23,7 @@ import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
2323
import { generateUuid } from 'vs/base/common/uuid';
2424
import { ICredentialsService } from 'vs/platform/credentials/common/credentials';
2525
import { getCurrentAuthenticationSessionInfo } from 'vs/workbench/services/authentication/browser/authenticationService';
26+
import { isWeb } from 'vs/base/common/platform';
2627

2728
type ExistingSession = IQuickPickItem & { session: AuthenticationSession & { providerId: string } };
2829
type AuthenticationProviderOption = IQuickPickItem & { provider: IAuthenticationProvider };
@@ -57,7 +58,6 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
5758
@IRequestService private readonly requestService: IRequestService,
5859
@IDialogService private readonly dialogService: IDialogService,
5960
@ICredentialsService private readonly credentialsService: ICredentialsService,
60-
@IUserDataSyncEnablementService private readonly userDataSyncEnablementService: IUserDataSyncEnablementService,
6161
) {
6262
super();
6363

@@ -202,7 +202,7 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
202202
}
203203

204204
// If settings sync is already enabled, avoid asking again to authenticate
205-
if (this.userDataSyncEnablementService.isEnabled()) {
205+
if (this.shouldAttemptEditSessionInit()) {
206206
this.logService.info(`Reusing user data sync enablement`);
207207
const authenticationSessionInfo = await getCurrentAuthenticationSessionInfo(this.credentialsService, this.productService);
208208
if (authenticationSessionInfo !== undefined) {
@@ -222,6 +222,10 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
222222
return undefined;
223223
}
224224

225+
private shouldAttemptEditSessionInit(): boolean {
226+
return isWeb && this.storageService.isNew(StorageScope.APPLICATION) && this.storageService.isNew(StorageScope.WORKSPACE);
227+
}
228+
225229
/**
226230
*
227231
* Prompts the user to pick an authentication option for storing and getting edit sessions.

0 commit comments

Comments
 (0)