diff --git a/dashboard-ui/cordova/chromecast.js b/dashboard-ui/cordova/chromecast.js index b089d58aef..1a8869df99 100644 --- a/dashboard-ui/cordova/chromecast.js +++ b/dashboard-ui/cordova/chromecast.js @@ -662,6 +662,12 @@ self.endSession = function () { + var session = currentWebAppSession; + + if (session) { + session.close(); + } + if (currentDevice) { currentDevice.disconnect(); } diff --git a/dashboard-ui/cordova/iap.js b/dashboard-ui/cordova/iap.js index 02234eaa86..069b20722d 100644 --- a/dashboard-ui/cordova/iap.js +++ b/dashboard-ui/cordova/iap.js @@ -67,6 +67,13 @@ function validateProduct(product, callback) { var productId = product.id; + + // We should never get in here with the unlock, but in case we do + if ((productId || '').toLowerCase().indexOf('appunlock') != -1) { + callback(true, product); + return; + } + var cacheKey = productId + (product.transaction.id || ''); var cachedResult = validationCache[cacheKey]; @@ -268,7 +275,7 @@ } function isUnlockedOverride(feature) { - + var deferred = DeferredBuilder.Deferred(); deferred.resolveWith(null, [false]); return deferred.promise(); diff --git a/dashboard-ui/music.html b/dashboard-ui/music.html index 6bdf46961b..47413a6304 100644 --- a/dashboard-ui/music.html +++ b/dashboard-ui/music.html @@ -13,6 +13,7 @@ ${TabArtists} ${TabSongs} ${TabGenres} + ${TabFolders}
${TabSuggestions} @@ -21,6 +22,7 @@ ${TabArtists} ${TabSongs} ${TabGenres} + ${TabFolders}
@@ -111,6 +113,15 @@
+ +
+
+
+
+
+
+
+
diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index f73cc55fd7..26571322e3 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -108,7 +108,7 @@ } else if ($.browser.ipad || $.browser.iphone || $.browser.android) { cacheDuration = 10000; } else { - cacheDuration = 60000; + cacheDuration = 30000; } if ((now - last) < cacheDuration) { @@ -221,7 +221,7 @@ return !LibraryBrowser.enableFullPaperTabs(); }, - configurePaperLibraryTabs: function (ownerpage, tabs, pages, baseUrl) { + configurePaperLibraryTabs: function (ownerpage, tabs, pages) { // Causing iron-select to not fire in IE and safari if ($.browser.chrome) { diff --git a/dashboard-ui/scripts/musicfolders.js b/dashboard-ui/scripts/musicfolders.js new file mode 100644 index 0000000000..06e59b54a7 --- /dev/null +++ b/dashboard-ui/scripts/musicfolders.js @@ -0,0 +1,110 @@ +(function ($, document) { + + var data = {}; + function getPageData() { + var key = getSavedQueryKey(); + var pageData = data[key]; + + if (!pageData) { + pageData = data[key] = { + query: { + SortBy: "SortName", + SortOrder: "Ascending", + Fields: "PrimaryImageAspectRatio,SortName,SyncInfo", + StartIndex: 0, + ImageTypeLimit: 1, + EnableImageTypes: "Primary,Backdrop,Banner,Thumb", + Limit: LibraryBrowser.getDefaultPageSize() + }, + view: LibraryBrowser.getSavedView(key) || LibraryBrowser.getDefaultItemsView('Poster', 'Poster') + }; + + pageData.query.ParentId = LibraryMenu.getTopParentId(); + LibraryBrowser.loadSavedQueryValues(key, pageData.query); + } + return pageData; + } + + function getQuery() { + + return getPageData().query; + } + + function getSavedQueryKey() { + + return LibraryBrowser.getSavedQueryKey('folders'); + } + + function reloadItems(page, viewPanel) { + + Dashboard.showLoadingMsg(); + + var query = getQuery(); + ApiClient.getItems(Dashboard.getCurrentUserId(), query).done(function (result) { + + // Scroll back up so they can see the results from the beginning + window.scrollTo(0, 0); + + var html = ''; + var view = getPageData().view; + var pagingHtml = LibraryBrowser.getQueryPagingHtml({ + startIndex: query.StartIndex, + limit: query.Limit, + totalRecordCount: result.TotalRecordCount, + viewButton: false, + showLimit: false, + sortButton: false, + addLayoutButton: false, + currentLayout: view, + updatePageSizeSetting: false, + viewIcon: 'filter-list', + layouts: 'List,Poster,PosterCard,Timeline' + }); + + page.querySelector('.listTopPaging').innerHTML = pagingHtml; + + if (view == "Poster") { + html = LibraryBrowser.getPosterViewHtml({ + items: result.Items, + shape: "square", + context: 'music', + showTitle: true, + showParentTitle: true, + lazy: true, + centerText: true, + overlayPlayButton: true + }); + } + + var elem = page.querySelector('#items'); + elem.innerHTML = html + pagingHtml; + ImageLoader.lazyChildren(elem); + + $('.btnNextPage', page).on('click', function () { + query.StartIndex += query.Limit; + reloadItems(page, viewPanel); + }); + + $('.btnPreviousPage', page).on('click', function () { + query.StartIndex -= query.Limit; + reloadItems(page, viewPanel); + }); + + LibraryBrowser.saveQueryValues(getSavedQueryKey(), query); + LibraryBrowser.setLastRefreshed(page); + Dashboard.hideLoadingMsg(); + }); + } + + window.MusicPage.initFoldersTab = function (page, tabContent) { + + }; + + window.MusicPage.renderFoldersTab = function (page, tabContent) { + + if (LibraryBrowser.needsRefresh(tabContent)) { + reloadItems(tabContent); + } + }; + +})(jQuery, document); \ No newline at end of file diff --git a/dashboard-ui/scripts/musicrecommended.js b/dashboard-ui/scripts/musicrecommended.js index 411879685f..fa359944e7 100644 --- a/dashboard-ui/scripts/musicrecommended.js +++ b/dashboard-ui/scripts/musicrecommended.js @@ -209,7 +209,7 @@ loadRecentlyPlayed(tabContent, parentId); loadFrequentlyPlayed(tabContent, parentId); - require(['scripts/favorites'], function() { + require(['scripts/favorites'], function () { FavoriteItems.render(tabContent, Dashboard.getCurrentUserId(), parentId, ['favoriteArtists', 'favoriteAlbums', 'favoriteSongs']); @@ -259,6 +259,11 @@ depends.push('scripts/musicgenres'); renderMethod = 'renderGenresTab'; break; + case 6: + depends.push('scripts/musicfolders'); + renderMethod = 'renderFoldersTab'; + initMethod = 'initFoldersTab'; + break; default: break; }