Skip to content

Commit

Permalink
Correct issues when Settings isn't populated
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Alland committed Sep 13, 2019
1 parent 6459edc commit 1f7a19d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions appinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
"diorite",
"emery"
],
"uuid": "133215f0-cf20-4c05-997b-3c9be5a64e5b",
"uuid": "f7db208c-a80b-4bca-b5fd-813f02c5570f",
"versionCode": 1,
"versionLabel": "1.0",
"versionLabel": "1.1",
"watchapp": {
"watchface": false
}
Expand Down
5 changes: 4 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ <h3>RSS Feeds</h3>
if (hash.feeds.length > 0) {
feeds = hash.feeds;
}
rss2jsonApiKey = hash.rss2jsonApiKey;
if (typeof hash.rss2jsonApiKey === 'undefined')
{
rss2jsonApiKey = hash.rss2jsonApiKey;
}
}

document.addEventListener("DOMContentLoaded", function() {
Expand Down
12 changes: 7 additions & 5 deletions src/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var defaultFeeds = [{

Settings.config({url: 'https://wowfunhappy.github.io/Pebble-RSS-Reader/', hash: true}, function(){
console.log("opened configurable");
if (Settings.option().feeds.length < 1) {
if (typeof Settings.option().feeds === 'undefined' || Settings.option().feeds.length < 1) {
Settings.option("feeds", defaultFeeds);
}
}, function(){
Expand All @@ -51,9 +51,8 @@ selectFeed();
function selectFeed()
{
/*Overwrite default feeds with what user input in Settings.*/
if (Settings.option().feeds.length > 0) {
if (typeof Settings.option().feeds !== 'undefined' && Settings.option().feeds.length > 0) {
feeds = Settings.option().feeds;
console.log("Opened configurable");
}
else {
feeds = defaultFeeds;
Expand Down Expand Up @@ -83,10 +82,13 @@ function getArticles(feed) {
loadingCard.show();
articleList = [];
jsonUrl = "https://api.rss2json.com/v1/api.json?rss_url=" + feed.url;
rss2jsonApiKey = Settings.option().rss2jsonApiKey;
if (rss2jsonApiKey !== "") {

var rss2jsonApiKey = "";
if (typeof Settings.option().rss2jsonApiKey !== 'undefined') {
rss2jsonApiKey = Settings.option().rss2jsonApiKey;
jsonUrl = jsonUrl + "&api_key=" + rss2jsonApiKey + "&count=100";
}

ajax({ url: jsonUrl }, function(json) {
json = JSON.parse(json);
if (json.status === "ok" && !shouldCancel) {
Expand Down

0 comments on commit 1f7a19d

Please sign in to comment.