3
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
- import { Disposable , MutableDisposable } from 'vs/base/common/lifecycle' ;
6
+ import { Disposable } from 'vs/base/common/lifecycle' ;
7
7
import { URI } from 'vs/base/common/uri' ;
8
8
import { localize } from 'vs/nls' ;
9
9
import { Action2 , MenuId , registerAction2 } from 'vs/platform/actions/common/actions' ;
@@ -26,15 +26,11 @@ import { getCurrentAuthenticationSessionInfo } from 'vs/workbench/services/authe
26
26
import { isWeb } from 'vs/base/common/platform' ;
27
27
import { ICommandService } from 'vs/platform/commands/common/commands' ;
28
28
import { Codicon } from 'vs/base/common/codicons' ;
29
- import { IActivityService , NumberBadge } from 'vs/workbench/services/activity/common/activity' ;
30
- import { WorkspaceFolderCountContext } from 'vs/workbench/common/contextkeys' ;
31
29
32
30
type ExistingSession = IQuickPickItem & { session : AuthenticationSession & { providerId : string } } ;
33
31
type AuthenticationProviderOption = IQuickPickItem & { provider : IAuthenticationProvider } ;
34
32
35
33
const configureContinueOnPreference = { iconClass : Codicon . settingsGear . classNames , tooltip : localize ( 'configure continue on' , 'Configure this preference in settings' ) } ;
36
- const turnOnEditSessionsTitle = localize ( 'sign in' , 'Turn on Edit Sessions...' ) ;
37
-
38
34
export class EditSessionsWorkbenchService extends Disposable implements IEditSessionsStorageService {
39
35
40
36
_serviceBrand = undefined ;
@@ -52,8 +48,6 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
52
48
return this . existingSessionId !== undefined ;
53
49
}
54
50
55
- private globalActivityBadgeDisposable = this . _register ( new MutableDisposable ( ) ) ;
56
-
57
51
constructor (
58
52
@IFileService private readonly fileService : IFileService ,
59
53
@IStorageService private readonly storageService : IStorageService ,
@@ -67,8 +61,7 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
67
61
@IRequestService private readonly requestService : IRequestService ,
68
62
@IDialogService private readonly dialogService : IDialogService ,
69
63
@ICredentialsService private readonly credentialsService : ICredentialsService ,
70
- @ICommandService private readonly commandService : ICommandService ,
71
- @IActivityService private readonly activityService : IActivityService ,
64
+ @ICommandService private readonly commandService : ICommandService
72
65
) {
73
66
super ( ) ;
74
67
@@ -78,13 +71,11 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
78
71
// If another window changes the preferred session storage, reset our cached auth state in memory
79
72
this . _register ( this . storageService . onDidChangeValue ( e => this . onDidChangeStorage ( e ) ) ) ;
80
73
81
- this . registerTurnOnAction ( ) ;
74
+ this . registerSignInAction ( ) ;
82
75
this . registerResetAuthenticationAction ( ) ;
83
76
84
77
this . signedInContext = EDIT_SESSIONS_SIGNED_IN . bindTo ( this . contextKeyService ) ;
85
78
this . signedInContext . set ( this . existingSessionId !== undefined ) ;
86
-
87
- this . updateGlobalActivityBadge ( ) ;
88
79
}
89
80
90
81
/**
@@ -165,7 +156,6 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
165
156
}
166
157
this . initialized = await this . doInitialize ( fromContinueOn ) ;
167
158
this . signedInContext . set ( this . initialized ) ;
168
- this . updateGlobalActivityBadge ( ) ;
169
159
return this . initialized ;
170
160
171
161
}
@@ -408,14 +398,13 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
408
398
}
409
399
}
410
400
411
- private registerTurnOnAction ( ) {
401
+ private registerSignInAction ( ) {
412
402
const that = this ;
413
- const when = ContextKeyExpr . equals ( EDIT_SESSIONS_SIGNED_IN_KEY , false ) ;
414
- this . _register ( registerAction2 ( class TurnOnEditSessionsAction extends Action2 {
403
+ this . _register ( registerAction2 ( class ResetEditSessionAuthenticationAction extends Action2 {
415
404
constructor ( ) {
416
405
super ( {
417
406
id : 'workbench.editSessions.actions.signIn' ,
418
- title : turnOnEditSessionsTitle ,
407
+ title : localize ( 'sign in' , 'Turn on Edit Sessions...' ) ,
419
408
category : EDIT_SESSION_SYNC_CATEGORY ,
420
409
precondition : ContextKeyExpr . equals ( EDIT_SESSIONS_SIGNED_IN_KEY , false ) ,
421
410
menu : [ {
@@ -424,7 +413,7 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
424
413
{
425
414
id : MenuId . AccountsContext ,
426
415
group : '2_editSessions' ,
427
- when,
416
+ when : ContextKeyExpr . equals ( EDIT_SESSIONS_SIGNED_IN_KEY , false ) ,
428
417
} ]
429
418
} ) ;
430
419
}
@@ -433,28 +422,6 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
433
422
return await that . initialize ( false ) ;
434
423
}
435
424
} ) ) ;
436
-
437
- this . _register ( registerAction2 ( class TurnOnEditSessionsAndResumeAction extends Action2 {
438
- constructor ( ) {
439
- super ( {
440
- id : 'workbench.editSessions.actions.turnOnAndResume' ,
441
- title : turnOnEditSessionsTitle ,
442
- menu : {
443
- group : '6_editSessions' ,
444
- id : MenuId . GlobalActivity ,
445
- // Do not push for edit sessions when there are no workspace folders open
446
- when : ContextKeyExpr . and ( when , WorkspaceFolderCountContext . notEqualsTo ( 0 ) ) ,
447
- order : 2
448
- }
449
- } ) ;
450
- }
451
-
452
- async run ( ) {
453
- if ( await that . initialize ( false ) ) {
454
- await that . commandService . executeCommand ( 'workbench.experimental.editSessions.actions.resumeLatest' , undefined , true ) ;
455
- }
456
- }
457
- } ) ) ;
458
425
}
459
426
460
427
private registerResetAuthenticationAction ( ) {
@@ -493,13 +460,4 @@ export class EditSessionsWorkbenchService extends Disposable implements IEditSes
493
460
}
494
461
} ) ) ;
495
462
}
496
-
497
- private updateGlobalActivityBadge ( ) {
498
- if ( this . initialized ) {
499
- return this . globalActivityBadgeDisposable . clear ( ) ;
500
- }
501
-
502
- const badge = new NumberBadge ( 1 , ( ) => turnOnEditSessionsTitle ) ;
503
- this . globalActivityBadgeDisposable . value = this . activityService . showGlobalActivity ( { badge, priority : 1 } ) ;
504
- }
505
463
}
0 commit comments