Skip to content

Commit

Permalink
Save without annoying pop up dialog
Browse files Browse the repository at this point in the history
… now that we have fileSystemWrite permission implemented
  • Loading branch information
vojtajina committed Jun 29, 2012
1 parent 5476262 commit d8cb963
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
13 changes: 3 additions & 10 deletions app/js/services/tabs.js
Expand Up @@ -92,7 +92,7 @@ TD.factory('tabs', function(editor, fs, log, Tab, chromeFs, lru, settings, $root
}

if (tab.file) {
chromeFs.getWritableFileEntry(tab.file, saveFile);
saveFile(tab.file);
} else {
chromeFs.chooseFile({type: "saveFile"}, saveFile);
}
Expand All @@ -106,9 +106,6 @@ TD.factory('tabs', function(editor, fs, log, Tab, chromeFs, lru, settings, $root
return;
}

// TODO(vojta): remove this hack when fixed in chrome
tab._hasWritePermission = true;

fs.saveFile(writableFileEntry, tab.session.getValue()).then(function() {
tab.setFileEntry(writableFileEntry);
});
Expand All @@ -120,18 +117,14 @@ TD.factory('tabs', function(editor, fs, log, Tab, chromeFs, lru, settings, $root
}

if (tab.file) {
if (tab._hasWritePermission) {
saveFile(tab.file);
} else {
chromeFs.getWritableFileEntry(tab.file, saveFile);
}
saveFile(tab.file);
} else {
chromeFs.chooseFile({type: "saveFile"}, saveFile);
}
};

tabs.open = function() {
chromeFs.chooseFile({type: 'openFile'}, function(fileEntry) {
chromeFs.chooseFile({type: 'openWritableFile'}, function(fileEntry) {
if (!fileEntry) {
return;
}
Expand Down
3 changes: 2 additions & 1 deletion app/manifest.json
Expand Up @@ -23,7 +23,8 @@
"clipboardWrite",
"unlimitedStorage",
"storage",
"fileSystem"
"fileSystem",
"fileSystemWrite"
],
"intents": {
"http://webintents.org/edit": [
Expand Down

0 comments on commit d8cb963

Please sign in to comment.