Fix some app list refreshing bugs

This commit is contained in:
Cameron Gutman 2016-07-10 21:31:35 -07:00
parent fd3d19ca03
commit 3767990bb0
3 changed files with 4 additions and 19 deletions

View File

@ -222,14 +222,10 @@ function showApps() {
return; return;
} }
// if game grid is populated, empty it
$("#game-grid").empty();
api.getAppList().then(function (appList) { api.getAppList().then(function (appList) {
// if game grid is populated, empty it
if($("#game-grid").children().length > 0) {
$("#game-grid").empty();
}
appList.forEach(function (app) { appList.forEach(function (app) {
api.getBoxArt(app.id).then(function (resolvedPromise) { api.getBoxArt(app.id).then(function (resolvedPromise) {
var imageBlob = new Blob([resolvedPromise], {type: "image/png"}); var imageBlob = new Blob([resolvedPromise], {type: "image/png"});

View File

@ -23,7 +23,7 @@ function handleMessage(msg) {
if(msg.data === 'streamTerminated') { // if it's a recognized event, notify the appropriate function if(msg.data === 'streamTerminated') { // if it's a recognized event, notify the appropriate function
$('#loadingSpinner').css('display', 'none'); // This is a fallback for RTSP handshake failing, which immediately terminates the stream. $('#loadingSpinner').css('display', 'none'); // This is a fallback for RTSP handshake failing, which immediately terminates the stream.
api.refreshServerInfo().then(function (ret) { api.refreshServerInfo().then(function (ret) {
showAppsMode(); showApps();
chrome.app.window.current().restore(); chrome.app.window.current().restore();
}); });
} else if(msg.data === 'Connection Established') { } else if(msg.data === 'Connection Established') {

View File

@ -40,7 +40,6 @@ function NvHTTP(address, clientUid) {
this.clientUid = clientUid; this.clientUid = clientUid;
this._baseUrlHttps = 'https://' + address + ':47984'; this._baseUrlHttps = 'https://' + address + ':47984';
this._baseUrlHttp = 'http://' + address + ':47989'; this._baseUrlHttp = 'http://' + address + ':47989';
this._appListCache = null;
this._memCachedBoxArtArray = {}; this._memCachedBoxArtArray = {};
_self = this; _self = this;
}; };
@ -133,13 +132,6 @@ NvHTTP.prototype = {
}, },
getAppList: function () { getAppList: function () {
if (_self._appListCache) {
console.log('Returning app list from cache');
return new Promise(function (resolve, reject) {
resolve(_self._appListCache);
});
}
return sendMessage('openUrl', [_self._baseUrlHttps + '/applist?' + _self._buildUidStr(), false]).then(function (ret) { return sendMessage('openUrl', [_self._baseUrlHttps + '/applist?' + _self._buildUidStr(), false]).then(function (ret) {
$xml = _self._parseXML(ret); $xml = _self._parseXML(ret);
@ -155,9 +147,6 @@ NvHTTP.prototype = {
}); });
} }
if (appList)
_self._appListCache = appList;
return appList; return appList;
}); });
}, },