@@ -10,7 +10,6 @@ import type {
10
10
} from 'vscode' ;
11
11
import { EventEmitter , FileType , Uri , window , workspace } from 'vscode' ;
12
12
import { encodeUtf8Hex } from '@env/hex' ;
13
- import { isWeb } from '@env/platform' ;
14
13
import { CharCode , Schemes } from '../../../../constants' ;
15
14
import { HostingIntegrationId } from '../../../../constants.integrations' ;
16
15
import type { Container } from '../../../../container' ;
@@ -1459,42 +1458,37 @@ export class GitHubGitProvider implements GitProvider, Disposable {
1459
1458
1460
1459
private _sessionPromise : Promise < AuthenticationSession > | undefined ;
1461
1460
private async ensureSession ( force : boolean = false , silent : boolean = false ) : Promise < AuthenticationSession > {
1462
- // never get silent in web environments, because we assume that we always have a github session there:
1463
- silent = silent && ! isWeb ;
1464
1461
if ( force || this . _sessionPromise == null ) {
1465
1462
async function getSession ( this : GitHubGitProvider ) : Promise < AuthenticationSession > {
1466
1463
let skip = this . container . storage . get ( `provider:authentication:skip:${ this . descriptor . id } ` , false ) ;
1467
- const authenticationProvider = await this . authenticationService . get ( this . authenticationProviderId ) ;
1468
- let options :
1469
- | { forceNewSession : true ; createIfNeeded ?: never ; silent ?: never }
1470
- | { forceNewSession ?: never ; createIfNeeded : true ; silent ?: never }
1471
- | { forceNewSession ?: never ; createIfNeeded ?: never ; silent : true } = isWeb
1472
- ? { createIfNeeded : true }
1473
- : { silent : true } ;
1474
1464
1475
1465
try {
1466
+ let session ;
1476
1467
if ( force ) {
1477
1468
skip = false ;
1478
1469
void this . container . storage . delete ( `provider:authentication:skip:${ this . descriptor . id } ` ) ;
1479
- options = { forceNewSession : true } ;
1470
+
1471
+ session = await getBuiltInIntegrationSession (
1472
+ this . container ,
1473
+ HostingIntegrationId . GitHub ,
1474
+ this . authenticationDescriptor ,
1475
+ { forceNewSession : true } ,
1476
+ ) ;
1480
1477
} else if ( ! skip && ! silent ) {
1481
- options = { createIfNeeded : true } ;
1478
+ session = await getBuiltInIntegrationSession (
1479
+ this . container ,
1480
+ HostingIntegrationId . GitHub ,
1481
+ this . authenticationDescriptor ,
1482
+ { createIfNeeded : true } ,
1483
+ ) ;
1482
1484
} else {
1483
- options = isWeb ? { createIfNeeded : true } : { silent : true } ;
1485
+ session = await getBuiltInIntegrationSession (
1486
+ this . container ,
1487
+ HostingIntegrationId . GitHub ,
1488
+ this . authenticationDescriptor ,
1489
+ ) ;
1484
1490
}
1485
1491
1486
- const session = isWeb
1487
- ? await getBuiltInIntegrationSession (
1488
- this . container ,
1489
- HostingIntegrationId . GitHub ,
1490
- this . authenticationDescriptor ,
1491
- options ,
1492
- )
1493
- : await authenticationProvider . getSession (
1494
- this . authenticationDescriptor ,
1495
- options . silent ? undefined : options ,
1496
- ) ;
1497
-
1498
1492
if ( session != null ) return session ;
1499
1493
1500
1494
throw new Error ( 'User did not consent' ) ;
0 commit comments