diff --git a/dashboard-ui/css/chromecast.css b/dashboard-ui/css/chromecast.css index da6cf9996a..2997857f25 100644 --- a/dashboard-ui/css/chromecast.css +++ b/dashboard-ui/css/chromecast.css @@ -36,7 +36,7 @@ top: 0; } -@media all and (max-width: 740px) { +@media all and (max-width: 600px) { .headerSelectedPlayer { display: none; } diff --git a/dashboard-ui/css/notifications.css b/dashboard-ui/css/notifications.css index b7f443e49b..1e1a6b9b31 100644 --- a/dashboard-ui/css/notifications.css +++ b/dashboard-ui/css/notifications.css @@ -29,7 +29,7 @@ } .flyoutNotification { - border-top: 1px solid #444; + border-top: 1px solid #404040; padding: 0 0 .5em; } @@ -40,7 +40,7 @@ } .flyoutNotification:last-child { - border-bottom: 1px solid #444; + border-bottom: 1px solid #404040; } .flyoutNotification a { diff --git a/dashboard-ui/scripts/extensions.js b/dashboard-ui/scripts/extensions.js index 28717e674b..21b875e8d1 100644 --- a/dashboard-ui/scripts/extensions.js +++ b/dashboard-ui/scripts/extensions.js @@ -124,7 +124,8 @@ var WebNotifications = { show: function (data) { - if (window.cordova && window.cordova.plugins && window.cordova.plugins.notification) { + // Seeing crashes in android + if (window.cordova && window.cordova.plugins && window.cordova.plugins.notification && !$.browser.android) { if (!WebNotifications.lastId) { // Cordova plugin will crash on android with long. need an int diff --git a/dashboard-ui/scripts/mediaplayer-video.js b/dashboard-ui/scripts/mediaplayer-video.js index 8c3efcb7b7..9cb076fa2f 100644 --- a/dashboard-ui/scripts/mediaplayer-video.js +++ b/dashboard-ui/scripts/mediaplayer-video.js @@ -68,7 +68,7 @@ elem.popup("open").parents(".ui-popup-container").css("margin-top", 30); if ($.browser.safari) { - $('.itemVideo').css('visibility', 'hidden'); + //$('.itemVideo').css('visibility', 'hidden'); } } diff --git a/dashboard-ui/thirdparty/apiclient/apiclient.js b/dashboard-ui/thirdparty/apiclient/apiclient.js index 60af3f1035..d9917e76df 100644 --- a/dashboard-ui/thirdparty/apiclient/apiclient.js +++ b/dashboard-ui/thirdparty/apiclient/apiclient.js @@ -185,21 +185,28 @@ function switchConnectionMode(connectionMode) { - var newConnectionMode; - var currentServerInfo = self.serverInfo(); + var newConnectionMode = connectionMode; - if (connectionMode == MediaBrowser.ConnectionMode.Local && currentServerInfo.RemoteAddress) { - newConnectionMode = MediaBrowser.ConnectionMode.Remote; - } - else if (connectionMode != MediaBrowser.ConnectionMode.Local && currentServerInfo.LocalAddress) { - newConnectionMode = MediaBrowser.ConnectionMode.Local; - } - else { - newConnectionMode = connectionMode; + newConnectionMode--; + if (newConnectionMode < 0) { + newConnectionMode = MediaBrowser.ConnectionMode.Manual; } - return newConnectionMode; + if (MediaBrowser.ServerInfo.getServerAddress(currentServerInfo, newConnectionMode)) { + return newConnectionMode; + } + + newConnectionMode--; + if (newConnectionMode < 0) { + newConnectionMode = MediaBrowser.ConnectionMode.Manual; + } + + if (MediaBrowser.ServerInfo.getServerAddress(currentServerInfo, newConnectionMode)) { + return newConnectionMode; + } + + return connectionMode; } function tryReconnectInternal(deferred, connectionMode, currentRetryCount) { @@ -209,13 +216,15 @@ logger.log("Attempting reconnection to " + url); + var timeout = connectionMode == MediaBrowser.ConnectionMode.Local ? 5000 : 15000; + AjaxApi.ajax({ type: "GET", url: url + "/system/info/public", dataType: "json", - timeout: 15000 + timeout: timeout }).done(function () { diff --git a/dashboard-ui/thirdparty/cordova/android/iap.js b/dashboard-ui/thirdparty/cordova/android/iap.js index 60e6667505..16fd22553a 100644 --- a/dashboard-ui/thirdparty/cordova/android/iap.js +++ b/dashboard-ui/thirdparty/cordova/android/iap.js @@ -9,10 +9,14 @@ return r.id != id; }); - updatedProducts.push({ + var product = { id: id, owned: owned - }); + }; + + updatedProducts.push(product); + + Events.trigger(IapManager, 'productupdated', [product]); } function hasPurchased(id) { @@ -39,7 +43,14 @@ } function onPurchaseComplete(result) { - alert(result); + + if (result) { + refreshPurchases(); + } + } + + function refreshPurchases() { + NativeIapManager.isPurchased(unlockId, "window.IapManager.updateProduct"); } window.IapManager = { @@ -50,6 +61,6 @@ onPurchaseComplete: onPurchaseComplete }; - NativeIapManager.isPurchased(unlockId, "window.IapManager.updateProduct"); + refreshPurchases(); })(); \ No newline at end of file diff --git a/dashboard-ui/thirdparty/cordova/android/imagestore.js b/dashboard-ui/thirdparty/cordova/android/imagestore.js index 1162fa7e31..e39cb36a5a 100644 --- a/dashboard-ui/thirdparty/cordova/android/imagestore.js +++ b/dashboard-ui/thirdparty/cordova/android/imagestore.js @@ -139,11 +139,30 @@ return deferred.promise(); }; + function getCacheKey(url) { + + // Try to strip off the domain to share the cache between local and remote connections + var index = url.indexOf('://'); + + if (index != -1) { + url = url.substring(index + 3); + + index = url.indexOf('/'); + + if (index != -1) { + url = url.substring(index + 1); + } + + } + + return CryptoJS.MD5(url).toString(); + } + self.getImageUrl = function (originalUrl) { console.log('getImageUrl:' + originalUrl); - var key = CryptoJS.MD5(originalUrl + "1").toString(); + var key = getCacheKey(originalUrl); var deferred = DeferredBuilder.Deferred(); diff --git a/dashboard-ui/thirdparty/cordova/imagestore.js b/dashboard-ui/thirdparty/cordova/imagestore.js index 01b953096c..32b5a8b0aa 100644 --- a/dashboard-ui/thirdparty/cordova/imagestore.js +++ b/dashboard-ui/thirdparty/cordova/imagestore.js @@ -76,12 +76,29 @@ return deferred.promise(); }; + function getCacheKey(url) { + + // Try to strip off the domain to share the cache between local and remote connections + var index = url.indexOf('://'); + + if (index != -1) { + url = url.substring(index + 3); + + index = url.indexOf('/'); + + if (index != -1) { + url = url.substring(index + 1); + } + + } + return CryptoJS.MD5(url).toString(); + } self.getImageUrl = function (originalUrl) { console.log('getImageUrl:' + originalUrl); - var key = CryptoJS.SHA1(originalUrl).toString(); + var key = getCacheKey(originalUrl); var deferred = DeferredBuilder.Deferred(); diff --git a/dashboard-ui/thirdparty/cordova/registrationservices.js b/dashboard-ui/thirdparty/cordova/registrationservices.js index d25a49b164..34f1d6e7ce 100644 --- a/dashboard-ui/thirdparty/cordova/registrationservices.js +++ b/dashboard-ui/thirdparty/cordova/registrationservices.js @@ -140,10 +140,21 @@ $('.inAppPurchaseOverlay').remove(); } + var currentDisplayingProductInfo = null; + var currentDisplayingDeferred = null; + + function clearCurrentDisplayingInfo() { + currentDisplayingProductInfo = null; + currentDisplayingDeferred = null; + } + function showInAppPurchaseInfo(info, serverRegistrationInfo, deferred) { var elem = getInAppPurchaseElement(info); + currentDisplayingProductInfo = info; + currentDisplayingDeferred = deferred; + $('.inAppPurchaseForm', elem).on('submit', function () { IapManager.beginPurchase(info.id); @@ -151,6 +162,8 @@ }); $('.btnCancel', elem).on('click', function () { + + clearCurrentDisplayingInfo(); cancelInAppPurchase(); // For testing purposes @@ -162,6 +175,8 @@ }); $('.btnSignInSupporter', elem).on('click', function () { + clearCurrentDisplayingInfo(); + Dashboard.alert({ message: Globalize.translate('MessagePleaseSignInLocalNetwork'), callback: function () { @@ -172,6 +187,21 @@ }); } + function onProductUpdated(e, product) { + + var currentInfo = currentDisplayingProductInfo; + var deferred = currentDisplayingDeferred; + + if (currentInfo && deferred) { + if (product.owned && product.id == currentInfo.id) { + + clearCurrentDisplayingInfo(); + cancelInAppPurchase(); + deferred.resolve(); + } + } + } + window.RegistrationServices = { renderPluginInfo: function (page, pkg, pluginSecurityInfo) { @@ -203,10 +233,14 @@ } }; + function onIapManagerLoaded() { + Events.on(IapManager, 'productupdated', onProductUpdated); + } + if (isAndroid()) { - requirejs(['thirdparty/cordova/android/iap']); + requirejs(['thirdparty/cordova/android/iap', onIapManagerLoaded]); } else { - requirejs(['thirdparty/cordova/iap']); + requirejs(['thirdparty/cordova/iap', onIapManagerLoaded]); } })(); \ No newline at end of file