This commit is contained in:
Sandeep Somavarapu
2020-07-02 08:35:28 +02:00
parent 04545fa880
commit 8d699df76b
2 changed files with 18 additions and 4 deletions

View File

@@ -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');
}

View File

@@ -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())]
}