From 7d4943e0fd111f9bb1320ec992cf662e34da6734 Mon Sep 17 00:00:00 2001 From: benweet Date: Fri, 12 Apr 2013 10:49:40 +0100 Subject: [PATCH] Repared offline mode --- cache.manifest | 2 +- js/synchronizer.js | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/cache.manifest b/cache.manifest index 167f7135..4b480207 100644 --- a/cache.manifest +++ b/cache.manifest @@ -1 +1 @@ -CACHE MANIFEST # v33 CACHE: index.html css/bootstrap.css css/jgrowl.css css/main.css js/async-runner.js js/bootstrap.js js/config.js js/custo.github.js js/dropbox-helper.js js/github-helper.js js/google-helper.js js/jgrowl.js js/jquery.js js/jquery-ui.js js/layout.js js/main.js js/Markdown.Converter.js js/Markdown.Editor.js js/Markdown.Sanitizer.js js/publisher.js js/require.js js/synchronizer.js js/underscore-min.js img/ajax-loader.gif img/glyphicons-halflings.png img/glyphicons-halflings-white.png img/icons.png img/stackedit-32.ico img/stackedit-promo.png NETWORK: * +CACHE MANIFEST # v33 CACHE: index.html css/bootstrap.css css/jgrowl.css css/main.css js/async-runner.js js/bootstrap.js js/config.js js/core.js js/custo.github.js js/dropbox-helper.js js/github-helper.js js/google-helper.js js/jgrowl.js js/jquery.js js/jquery-ui.js js/layout.js js/main.js js/Markdown.Converter.js js/Markdown.Editor.js js/Markdown.Sanitizer.js js/publisher.js js/require.js js/synchronizer.js js/underscore-min.js img/ajax-loader.gif img/glyphicons-halflings.png img/glyphicons-halflings-white.png img/icons.png img/stackedit-32.ico img/stackedit-promo.png NETWORK: * diff --git a/js/synchronizer.js b/js/synchronizer.js index 27e7af3c..653f355f 100644 --- a/js/synchronizer.js +++ b/js/synchronizer.js @@ -173,10 +173,9 @@ define(["jquery", "google-helper", "dropbox-helper"], function($, googleHelper, var change = changes[i]; var fileSyncIndex = SYNC_PROVIDER_GDRIVE + change.fileId; var fileIndex = fileManager.getFileIndexFromSync(fileSyncIndex); - // No file corresponding (this should never happen...) + // No file corresponding (file may have been deleted locally) if(fileIndex === undefined) { - // We can remove the stored etag - localStorage.removeItem(fileSyncIndex + ".etag"); + fileManager.removeSync(fileSyncIndex); continue; } var localTitle = localStorage[fileIndex + ".title"]; @@ -221,7 +220,7 @@ define(["jquery", "google-helper", "dropbox-helper"], function($, googleHelper, localStorage[fileSyncIndex + ".titleCRC"] = core.crc32(file.title); // Synchronize file with others locations - uploadPending = true; + uploadPending = true; // (may be unnecessary since syncUp checks content changes) } if(updateFileTitles) { fileManager.updateFileTitles(); @@ -255,10 +254,9 @@ define(["jquery", "google-helper", "dropbox-helper"], function($, googleHelper, var change = changes[i]; var fileSyncIndex = SYNC_PROVIDER_DROPBOX + encodeURIComponent(change.path.toLowerCase()); var fileIndex = fileManager.getFileIndexFromSync(fileSyncIndex); - // No file corresponding (this should never happen...) + // No file corresponding (file may have been deleted locally) if(fileIndex === undefined) { - // We can remove the stored version - localStorage.removeItem(fileSyncIndex + ".version"); + fileManager.removeSync(fileSyncIndex); continue; } var localTitle = localStorage[fileIndex + ".title"]; @@ -293,7 +291,7 @@ define(["jquery", "google-helper", "dropbox-helper"], function($, googleHelper, localStorage[fileSyncIndex + ".contentCRC"] = core.crc32(file.content); // Synchronize file with others locations - uploadPending = true; + uploadPending = true; // (may be unnecessary since syncUp checks content changes) } if(updateFileTitles) { fileManager.updateFileTitles();