fixed so the app is working offline again
This commit is contained in:
parent
22d6761ba3
commit
aec6cd079b
3 changed files with 24 additions and 9 deletions
|
@ -227,7 +227,7 @@ OwnCloud.prototype.append = function(key, array) {
|
||||||
if (typeof tmp !== "undefined") tmp = JSON.parse(tmp);
|
if (typeof tmp !== "undefined") tmp = JSON.parse(tmp);
|
||||||
else tmp = [];
|
else tmp = [];
|
||||||
|
|
||||||
tmp.concat(options.items);
|
tmp.concat(array);
|
||||||
localStorage[key] = JSON.stringify(tmp);
|
localStorage[key] = JSON.stringify(tmp);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
26
js/Pond.js
26
js/Pond.js
|
@ -15,7 +15,13 @@ Pond.prototype.onoffline = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
Pond.prototype.ononline = function() {
|
Pond.prototype.ononline = function() {
|
||||||
// Send read
|
["read", "unread"].forEach(function(type) {
|
||||||
|
var articles = localStorage[type + "_articles"];
|
||||||
|
if(articles) {
|
||||||
|
var callback = function(ok) { if(ok) localStorage[type + "_articles"] = null }
|
||||||
|
this.call("setArticles" + type.capitalize(), [JSON.parse(articles), callback]);
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Pond.prototype.toString = function() {
|
Pond.prototype.toString = function() {
|
||||||
|
@ -159,11 +165,11 @@ Pond.prototype.setArticleStatus = function(article, callback, status) {
|
||||||
|
|
||||||
var url = "subscriptions/" + article.feed_id + "/articles/" + article.id
|
var url = "subscriptions/" + article.feed_id + "/articles/" + article.id
|
||||||
|
|
||||||
if (navigator.onLine) this.doOperation("PUT", url, options, callback);
|
if (navigator.onLine) {
|
||||||
else {
|
this.doOperation("PUT", url, options, callback);
|
||||||
this.append("unread_articles", articles);
|
} else {
|
||||||
|
this.append(status + "_articles", articles);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Pond.prototype.setArticleRead = function(article, callback) {
|
Pond.prototype.setArticleRead = function(article, callback) {
|
||||||
|
@ -194,6 +200,16 @@ Pond.prototype.setArticleUnstarred = function(articles, callback) {
|
||||||
// not implemented yet in Pond
|
// not implemented yet in Pond
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TinyTinyRSS.prototype.append = function(key, array) {
|
||||||
|
var tmp = localStorage[key];
|
||||||
|
|
||||||
|
if (typeof tmp !== "undefined") tmp = JSON.parse(tmp);
|
||||||
|
else tmp = [];
|
||||||
|
|
||||||
|
tmp.concat(array);
|
||||||
|
localStorage[key] = JSON.stringify(tmp);
|
||||||
|
};
|
||||||
|
|
||||||
Pond.prototype.logOut = function() {
|
Pond.prototype.logOut = function() {
|
||||||
this.doOperation("DELETE", "auth/sessions/" + this.session_token );
|
this.doOperation("DELETE", "auth/sessions/" + this.session_token );
|
||||||
localStorage.feeds = null;
|
localStorage.feeds = null;
|
||||||
|
|
|
@ -150,13 +150,12 @@ TinyTinyRSS.prototype.setArticleUnstarred = function(article, callback) {
|
||||||
};
|
};
|
||||||
|
|
||||||
TinyTinyRSS.prototype.append = function(key, array) {
|
TinyTinyRSS.prototype.append = function(key, array) {
|
||||||
|
|
||||||
var tmp = localStorage[key];
|
var tmp = localStorage[key];
|
||||||
|
|
||||||
if (typeof tmp !== "undefined") tmp = JSON.parse(tmp);
|
if (typeof tmp !== "undefined") tmp = JSON.parse(tmp);
|
||||||
else tmp = [];
|
else tmp = [];
|
||||||
|
|
||||||
tmp.concat(options.items);
|
tmp.concat(array);
|
||||||
localStorage[key] = JSON.stringify(tmp);
|
localStorage[key] = JSON.stringify(tmp);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Reference in a new issue