Skip to content

Commit

Permalink
fix: wrong syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesjo committed Oct 8, 2019
1 parent 37c8880 commit b9ecfd5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/app/features/google/store/google-drive-sync.effects.ts
Expand Up @@ -15,7 +15,7 @@ import {
tap,
withLatestFrom
} from 'rxjs/operators';
import {combineLatest, EMPTY, from, interval, Observable, of, throwError} from 'rxjs';
import {combineLatest, EMPTY, from, interval, Observable, of, throwError, zip} from 'rxjs';
import {GoogleDriveSyncService} from '../google-drive-sync.service';
import {GoogleApiService} from '../google-api.service';
import {GlobalConfigService} from '../../config/global-config.service';
Expand Down Expand Up @@ -302,20 +302,25 @@ export class GoogleDriveSyncEffects {
if (isUpdated) {
return this._loadFile().pipe(
concatMap((loadRes) => {
return combineLatest([
return zip(
of(loadRes),
this._decodeAppDataIfNeeded(loadRes.backup)
]);
);
}),
concatMap(([loadResponse, appData]): any => {
const lastActiveLocal = this._syncService.getLastActive();
const lastActiveRemote = appData.lastActiveTime;

// update but ask if remote data is not newer than the last local update
const isSkipConfirm = (lastActiveRemote && this._isNewerThan(lastActiveRemote, lastActiveLocal));
console.log(isSkipConfirm, lastActiveRemote, lastActiveLocal);

if (isSkipConfirm) {
return of(new LoadFromGoogleDrive({loadResponse}));
return of(new LoadFromGoogleDrive({
// NOTE: to prevent having to decode again
...loadResponse,
backup: appData,
}));
} else {
this._openConfirmLoadDialog(lastActiveRemote);
return of(new LoadFromGoogleDriveCancel());
Expand Down

0 comments on commit b9ecfd5

Please sign in to comment.