sync provider wip

This commit is contained in:
Mo Bitar
2017-01-25 19:44:48 -06:00
parent 51012d7d54
commit b2200c5707
17 changed files with 173 additions and 145 deletions

View File

@@ -20,7 +20,7 @@ angular.module('app.frontend')
* Insert 4 spaces when a tab key is pressed,
* only used when inside of the text editor.
* If the shift key is pressed first, this event is
* not fired.
* not fired.
*/
var handleTab = function (event) {
if (!event.shiftKey && event.which == 9) {
@@ -146,8 +146,6 @@ angular.module('app.frontend')
note.dummy = false;
this.save()(note, function(success){
if(success) {
apiController.clearDraft();
if(statusTimeout) $timeout.cancel(statusTimeout);
statusTimeout = $timeout(function(){
this.noteStatus = "All changes saved"
@@ -171,10 +169,6 @@ angular.module('app.frontend')
this.changesMade = function() {
this.note.hasChanges = true;
this.note.dummy = false;
if(apiController.isUserSignedIn()) {
// signed out users have local autosave, dont need draft saving
apiController.saveDraftToDisk(this.note);
}
if(saveTimeout) $timeout.cancel(saveTimeout);
if(statusTimeout) $timeout.cancel(statusTimeout);
@@ -236,7 +230,6 @@ angular.module('app.frontend')
}
this.deleteNote = function() {
apiController.clearDraft();
this.remove()(this.note);
this.showMenu = false;
}

View File

@@ -21,7 +21,7 @@ angular.module('app.frontend')
this.user = apiController.user;
this.accountMenuPressed = function() {
this.serverData = {url: apiController.getServer()};
this.serverData = {url: syncManager.serverURL()};
this.showAccountMenu = !this.showAccountMenu;
this.showFaq = false;
this.showNewPasswordForm = false;

View File

@@ -7,9 +7,9 @@ angular.module('app.frontend')
syncManager.sync(null);
// refresh every 30s
setInterval(function () {
syncManager.sync(null);
}, 30000);
// setInterval(function () {
// syncManager.sync(null);
// }, 30000);
});
$scope.allTag = new Tag({all: true});

View File

@@ -48,14 +48,8 @@ angular.module('app.frontend')
if(isFirstLoad) {
$timeout(function(){
var draft = apiController.getDraft();
if(draft) {
var note = draft;
this.selectNote(note);
} else {
this.createNewNote();
isFirstLoad = false;
}
this.createNewNote();
isFirstLoad = false;
}.bind(this))
} else if(tag.notes.length == 0) {
this.createNewNote();