Skip to content

Commit

Permalink
Fix #100348
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Jul 2, 2020
1 parent 04545fa commit 8d699df
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/vs/platform/userDataSync/common/userDataAutoSyncService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,14 @@ export class UserDataAutoSyncService extends UserDataAutoSyncEnablementService i
this.telemetryService.publicLog2<{ code: string }, AutoSyncErrorClassification>(`autosync/error`, { code: userDataSyncError.code });
}

// Turned off from another device or session got expired
if (userDataSyncError.code === UserDataSyncErrorCode.TurnedOff || userDataSyncError.code === UserDataSyncErrorCode.SessionExpired) {
// Session got expired
if (userDataSyncError.code === UserDataSyncErrorCode.SessionExpired) {
await this.turnOff(false, true /* force soft turnoff on error */);
this.logService.info('Auto Sync: Turned off sync because current session is expired');
}

// Turned off from another device
if (userDataSyncError.code === UserDataSyncErrorCode.TurnedOff) {
await this.turnOff(false, true /* force soft turnoff on error */);
this.logService.info('Auto Sync: Turned off sync because sync is turned off in the cloud');
}
Expand Down
12 changes: 10 additions & 2 deletions src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,19 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo

private onAutoSyncError(error: UserDataSyncError): void {
switch (error.code) {
case UserDataSyncErrorCode.TurnedOff:
case UserDataSyncErrorCode.SessionExpired:
this.notificationService.notify({
severity: Severity.Info,
message: localize('turned off', "Preferences sync was turned off from another device."),
message: localize('session expired', "Preferences sync was turned off because current session is expired, please sign in again to turn on sync."),
actions: {
primary: [new Action('turn on sync', localize('turn on sync', "Turn on Preferences Sync..."), undefined, true, () => this.turnOn())]
}
});
break;
case UserDataSyncErrorCode.TurnedOff:
this.notificationService.notify({
severity: Severity.Info,
message: localize('turned off', "Preferences sync was turned off from another device, please sign in again to turn on sync."),
actions: {
primary: [new Action('turn on sync', localize('turn on sync', "Turn on Preferences Sync..."), undefined, true, () => this.turnOn())]
}
Expand Down

0 comments on commit 8d699df

Please sign in to comment.