Skip to content

Commit

Permalink
feat(gDriveSync): make syncing work nicely
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesjo committed Mar 10, 2018
1 parent f6ebeb8 commit 30070c7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions app-src/scripts/main/global-services/google-drive-sync-s.js
Expand Up @@ -36,7 +36,7 @@
this.GoogleApi.getFileInfo(this.data.backupDocId)
.then((res) => {
const lastModifiedRemote = res.data.modifiedDate;
console.log(lastModifiedRemote, this.data.lastLocalUpdate);
console.log(lastModifiedRemote, this.data.lastLocalUpdate, this._isNewerThan(lastModifiedRemote, this.data.lastLocalUpdate));

if (this._isNewerThan(lastModifiedRemote, this.data.lastLocalUpdate)) {
console.log('GoogleDriveSync: HAS CHANGED, TRYING TO UPDATE');
Expand Down Expand Up @@ -69,11 +69,6 @@
return (d1.getTime() > d2.getTime());
}

// TODO check for valid data
_isValidData(data) {
return data.tasks && data.backlogTasks && data.config;
}

_getLocalAppData() {
return this.AppStorage.getCompleteBackupData();
}
Expand Down Expand Up @@ -119,6 +114,8 @@
if (res && res.data) {
this.data.backupDocId = res.data.id;
this.data.lastSyncToRemote = res.data.modifiedDate;
// also needs to be updated
this.data.lastLocalUpdate = res.data.modifiedDate;
}
});
}
Expand Down

0 comments on commit 30070c7

Please sign in to comment.