diff options
-rw-r--r-- | biblez.appcache | 5 | ||||
-rwxr-xr-x | buildApp.sh | 6 | ||||
-rw-r--r-- | source/moduleManager.js | 47 |
3 files changed, 33 insertions, 25 deletions
diff --git a/biblez.appcache b/biblez.appcache index 6f5e9c0..cb97b5c 100644 --- a/biblez.appcache +++ b/biblez.appcache @@ -1,5 +1,5 @@ CACHE MANIFEST -# v13 - 2014-04-16 +# v14 - 2014-04-16 CACHE: icon.png index.html @@ -51,3 +51,6 @@ lib/onyx/images/slider-handle.png lib/onyx/images/spinner-dark.gif lib/onyx/images/spinner-light.gif lib/sword/sword.min.js + +NETWORK: +http://zefanjas.de/apps/ diff --git a/buildApp.sh b/buildApp.sh index c3399fb..c672b46 100755 --- a/buildApp.sh +++ b/buildApp.sh @@ -6,6 +6,10 @@ cd deploy/biblez-ng/ zip -r -q ../biblez.zip ./ echo "\033[1;32mBuilding for Firefox\033[0m" cd ../.. -sh tools/deploy.sh -o github/app +#sh tools/deploy.sh -o github/app +rm -R github/app +mkdir -R github/app +cp -a deploy/biblez-ng/. github/app cp manifest.desktop github/app/manifest.webapp cp biblez.appcache github/app/biblez.appcache +echo "\033[1;32mDone! You'll find the app in github/app\033[0m" diff --git a/source/moduleManager.js b/source/moduleManager.js index 118e199..d865808 100644 --- a/source/moduleManager.js +++ b/source/moduleManager.js @@ -65,10 +65,14 @@ enyo.kind({ if (!this.started) { this.$.spinner.show(); api.get("repos", enyo.bind(this, function (inError, inData) { - if(!inData) - this.getRepos(); - else - this.setupRepoPicker(inData.repos, inData.currentRepo); + if(!inError) { + if(!inData) + this.getRepos(); + else + this.setupRepoPicker(inData.repos, inData.currentRepo); + } else { + this.handleError(inError); + } })); } this.getInstalledModules(); @@ -115,19 +119,11 @@ enyo.kind({ }, getRepos: function () { - if(navigator.onLine) + if(navigator.onLine) { if(enyo.platform.firefoxOS) { sword.installMgr.getRepositories(enyo.bind(this, function (inError, inRepos) { if (!inError) { - api.put({id: "repos", repos: inRepos, lastRepoUpdate: {time: new Date().getTime()}}, - enyo.bind(this, function (inError, inId) { - if(!inError) - this.setupRepoPicker(inRepos); - else - this.handleError(inError); - }) - ); - + this.saveRepoData(inRepos); } else { this.handleError(inError); } @@ -136,25 +132,30 @@ enyo.kind({ var xhr = new enyo.Ajax({url: "http://zefanjas.de/apps/biblezMasterlist.php"}); xhr.go(); xhr.response(this, function (inSender, inRepos) { - api.put({id: "repos", repos: inRepos, lastRepoUpdate: {time: new Date().getTime()}}, - enyo.bind(this, function (inError, inId) { - if(!inError) - this.setupRepoPicker(inRepos); - else - this.handleError(inError); - }) - ); + this.saveRepoData(inRepos); }); xhr.error(this, function (inSender, inResponse) { + console.log(inSender, inResponse); this.handleError({message: "Couldn't download MasterList!"}); }); } - else { + } else { this.$.spinner.stop(); this.handleError({message: $L("You need an internet connection to download modules!")}); } }, + saveRepoData: function (inRepos) { + api.put({id: "repos", repos: inRepos, lastRepoUpdate: {time: new Date().getTime()}}, + enyo.bind(this, function (inError, inId) { + if(!inError) + this.setupRepoPicker(inRepos); + else + this.handleError(inError); + }) + ); + }, + setupRepoPicker: function (inRepos, currentRepo) { this.currentRepo = currentRepo; var items = [], |