diff --git a/dashboard-ui/apiclient/sync/multiserversync.js b/dashboard-ui/apiclient/sync/multiserversync.js index 0747229fdb..b4136be797 100644 --- a/dashboard-ui/apiclient/sync/multiserversync.js +++ b/dashboard-ui/apiclient/sync/multiserversync.js @@ -4,18 +4,18 @@ var self = this; - self.sync = function () { + self.sync = function (options) { var deferred = DeferredBuilder.Deferred(); connectionManager.getAvailableServers().done(function (result) { - syncNext(result, 0, deferred); + syncNext(result, 0, options, deferred); }); return deferred.promise(); }; - function syncNext(servers, index, deferred) { + function syncNext(servers, index, options, deferred) { var length = servers.length; @@ -34,13 +34,13 @@ require(['serversync'], function () { - new MediaBrowser.ServerSync(connectionManager).sync(server).done(function () { + new MediaBrowser.ServerSync(connectionManager).sync(server, options).done(function () { - syncNext(servers, index + 1, deferred); + syncNext(servers, index + 1, options, deferred); }).fail(function () { - syncNext(servers, index + 1, deferred); + syncNext(servers, index + 1, options, deferred); }); }); } diff --git a/dashboard-ui/apiclient/sync/serversync.js b/dashboard-ui/apiclient/sync/serversync.js index 51671e8d4d..4450910d91 100644 --- a/dashboard-ui/apiclient/sync/serversync.js +++ b/dashboard-ui/apiclient/sync/serversync.js @@ -4,7 +4,7 @@ var self = this; - self.sync = function (server) { + self.sync = function (server, options) { var deferred = DeferredBuilder.Deferred(); @@ -24,7 +24,7 @@ connectionManager.connectToServer(server, connectionOptions).done(function (result) { if (result.State == MediaBrowser.ConnectionState.SignedIn) { - performSync(server, deferred); + performSync(server, options, deferred); } else { Logger.log('Unable to connect to server id: ' + server.Id); deferred.reject(); @@ -39,23 +39,34 @@ return deferred.promise(); }; - function performSync(server, deferred) { + function performSync(server, options, deferred) { Logger.log("Creating ContentUploader to server: " + server.Id); + var nextAction = function () { + syncOfflineUsers(server, deferred); + }; + + options = options || {}; + + if (options.uploadPhotos === false) { + nextAction(); + return; + } + require(['contentuploader'], function () { new MediaBrowser.ContentUploader(connectionManager).uploadImages(server).done(function () { Logger.log("ContentUploaded succeeded to server: " + server.Id); - syncOfflineUsers(server, deferred); + nextAction(); }).fail(function () { Logger.log("ContentUploaded failed to server: " + server.Id); - syncOfflineUsers(server, deferred); + nextAction(); }); }); } diff --git a/dashboard-ui/bower_components/iron-meta/.bower.json b/dashboard-ui/bower_components/iron-meta/.bower.json index 8119ebcf41..9e650790be 100644 --- a/dashboard-ui/bower_components/iron-meta/.bower.json +++ b/dashboard-ui/bower_components/iron-meta/.bower.json @@ -25,14 +25,14 @@ "web-component-tester": "*", "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" }, - "homepage": "https://github.com/polymerelements/iron-meta", + "homepage": "https://github.com/PolymerElements/iron-meta", "_release": "1.0.3", "_resolution": { "type": "version", "tag": "v1.0.3", "commit": "91529259262b0d8f33fed44bc3fd47aedf35cb04" }, - "_source": "git://github.com/polymerelements/iron-meta.git", + "_source": "git://github.com/PolymerElements/iron-meta.git", "_target": "^1.0.0", - "_originalSource": "polymerelements/iron-meta" + "_originalSource": "PolymerElements/iron-meta" } \ No newline at end of file diff --git a/dashboard-ui/cordova/android/localsync.js b/dashboard-ui/cordova/android/localsync.js index 7653a63289..d20c2b78c9 100644 --- a/dashboard-ui/cordova/android/localsync.js +++ b/dashboard-ui/cordova/android/localsync.js @@ -6,7 +6,7 @@ return true; }, - startSync: function () { + sync: function () { AndroidSync.startSync(); }, diff --git a/dashboard-ui/cordova/ios/backgroundfetch.js b/dashboard-ui/cordova/ios/backgroundfetch.js new file mode 100644 index 0000000000..a48fa26079 --- /dev/null +++ b/dashboard-ui/cordova/ios/backgroundfetch.js @@ -0,0 +1,52 @@ +(function () { + + function onDeviceReady() { + + var fetcher = window.BackgroundFetch; + + fetcher.configure(onBackgroundFetch, onBackgroundFetchFailed, { + stopOnTerminate: false // <-- false is default + }); + } + + function onSyncFinish() { + + Logger.log('BackgroundFetch completed'); + + var fetcher = window.BackgroundFetch; + fetcher.finish(); // <-- N.B. You MUST called #finish so that native-side can signal completion of the background-thread to the os. + } + + function onSyncFail() { + + Logger.log('BackgroundFetch completed - sync failed'); + + var fetcher = window.BackgroundFetch; + fetcher.finish(); // <-- N.B. You MUST called #finish so that native-side can signal completion of the background-thread to the os. + } + + function onBackgroundFetch() { + + Logger.log('BackgroundFetch initiated'); + + require(['localsync'], function () { + + if (LocalSync.getSyncStatus() == 'Syncing') { + onSyncFinish(); + return; + } + + var syncOptions = { + uploadPhotos: false + }; + + LocalSync.sync(syncOptions).done(onSyncFinish).fail(onSyncFail); + }); + } + + function onBackgroundFetchFailed() { + Logger.log('- BackgroundFetch failed'); + } + + onDeviceReady(); +})(); \ No newline at end of file diff --git a/dashboard-ui/css/librarymenu.css b/dashboard-ui/css/librarymenu.css index fd7047d0a6..57e44e357d 100644 --- a/dashboard-ui/css/librarymenu.css +++ b/dashboard-ui/css/librarymenu.css @@ -135,10 +135,6 @@ display: none; } -.barsMenuButton:hover { - opacity: .5 !important; -} - .libraryMenuButtonText { color: #fff !important; text-decoration: none; @@ -236,10 +232,6 @@ vertical-align: middle; } -.headerButtonRight:hover { - opacity: .5; -} - .viewMenuLink:hover { color: #fff; } @@ -374,11 +366,11 @@ display: none !important; } -.libraryDocument .sidebarLinkNotifications { +.dashboardDocument .lnkMySync { display: none !important; } -.dashboardDocument .lnkMySync { +.dashboardDocument .dashboardEntryHeaderButton { display: none !important; } @@ -390,6 +382,10 @@ display: none !important; } +body:not(.dashboardDocument) .btnNotifications{ + display: none !important; +} + .darkDrawer { background-color: #282828 !important; } diff --git a/dashboard-ui/css/notifications.css b/dashboard-ui/css/notifications.css index d9a56f0447..5f7693685c 100644 --- a/dashboard-ui/css/notifications.css +++ b/dashboard-ui/css/notifications.css @@ -5,31 +5,34 @@ margin: 0 !important; float: right; vertical-align: middle; + min-width: 4.1em; } .btnNotificationsInner { color: #fff; - font-weight: 400; - display: none; + font-weight: 500; position: relative; - top: -4px; - padding: 3px 8px; + top: -8px; border-radius: 1000px; + background: #444; + line-height: 28px; + min-width: 30px; + display: inline-flex; + align-items: center; + justify-content: center; + text-align: center; } .levelNormal { background-color: #4d90fe; - display: block; } .levelWarning { background-color: #FF7537; - display: block; } .levelError { background-color: #d14836; - display: block; } .flyoutNotification { diff --git a/dashboard-ui/dashboard.html b/dashboard-ui/dashboard.html index c1f6228993..afef49d921 100644 --- a/dashboard-ui/dashboard.html +++ b/dashboard-ui/dashboard.html @@ -106,18 +106,14 @@
-
-

${HeaderRecentActivity}

-
-
+

${HeaderRecentActivity}

+
-
-

${HeaderLatestNews}

-
-
+

${HeaderLatestNews}

+
diff --git a/dashboard-ui/scripts/dashboardpage.js b/dashboard-ui/scripts/dashboardpage.js index 3558a48214..6dd8e74c98 100644 --- a/dashboard-ui/scripts/dashboardpage.js +++ b/dashboard-ui/scripts/dashboardpage.js @@ -117,7 +117,7 @@ var query = { StartIndex: DashboardPage.newsStartIndex, - Limit: 5 + Limit: 7 }; ApiClient.getProductNews(query).done(function (result) { @@ -126,15 +126,31 @@ var itemHtml = ''; - itemHtml += '
'; - itemHtml += '' + item.Title + ''; + itemHtml += ''; + itemHtml += ''; - var date = parseISO8601Date(item.Date, { toLocal: true }); - itemHtml += '
' + date.toLocaleDateString() + '
'; + itemHtml += ''; - itemHtml += '
' + item.Description + '
'; + itemHtml += ''; + + itemHtml += '
'; + itemHtml += item.Title; itemHtml += '
'; + itemHtml += '
'; + var date = parseISO8601Date(item.Date, { toLocal: true }); + itemHtml += date.toLocaleDateString(); + itemHtml += '
'; + + itemHtml += '
'; + itemHtml += item.Description; + itemHtml += '
'; + + itemHtml += '
'; + + itemHtml += '
'; + itemHtml += '
'; + return itemHtml; }); @@ -1068,61 +1084,43 @@ $(document).on('pageshowready', "#dashboardPage", DashboardPage.onPageShow).on(' var html = ''; - html += '
'; + html += ''; - html += '
'; + var color = entry.Severity == 'Error' || entry.Severity == 'Fatal' || entry.Severity == 'Warn' ? '#cc0000' : '#52B54B'; - var date = parseISO8601Date(entry.Date, { toLocal: true }); - - var color = entry.Severity == 'Error' || entry.Severity == 'Fatal' || entry.Severity == 'Warn' ? '#cc0000' : 'green'; - - html += '
'; if (entry.UserId && entry.UserPrimaryImageTag) { var userImgUrl = ApiClient.getUserImageUrl(entry.UserId, { type: 'Primary', tag: entry.UserPrimaryImageTag, - height: 20 + height: 40 }); - html += ''; + + html += ''; + } + else { + html += ''; } - html += date.toLocaleDateString() + ' ' + date.toLocaleTimeString().toLowerCase(); - html += '
'; + html += ''; - html += '
'; + html += '
'; html += entry.Name; html += '
'; - entry.ShortOverview = entry.ShortOverview || ' '; - - if (entry.ShortOverview) { - - html += '
'; - - if (entry.Overview) { - html += ''; - } - html += entry.ShortOverview; - if (entry.Overview) { - html += ''; - } - - html += '
'; - - if (entry.Overview) { - html += ''; - } - } - - //if (notification.Url) { - // html += '

' + Globalize.translate('ButtonMoreInformation') + '

'; - //} - + html += '
'; + var date = parseISO8601Date(entry.Date, { toLocal: true }); + html += date.toLocaleDateString(); html += '
'; + html += '
'; + html += entry.ShortOverview || ''; html += '
'; + html += ''; + + html += ''; + return html; } diff --git a/dashboard-ui/scripts/itemdetailpage.js b/dashboard-ui/scripts/itemdetailpage.js index 343d5ce383..dff0368307 100644 --- a/dashboard-ui/scripts/itemdetailpage.js +++ b/dashboard-ui/scripts/itemdetailpage.js @@ -302,7 +302,13 @@ $('.itemTabs', page).hide(); if (context == 'tv') { - $(page).removeClass('noSecondaryNavPage'); + + if (AppInfo.enableBottomTabs) { + $(page).addClass('noSecondaryNavPage'); + } + else { + $(page).removeClass('noSecondaryNavPage'); + } $('#tvShowsTabs', page).show(); LibraryMenu.setMenuButtonVisible(true); diff --git a/dashboard-ui/scripts/librarybrowser.js b/dashboard-ui/scripts/librarybrowser.js index 5a3efc9161..beb84187f7 100644 --- a/dashboard-ui/scripts/librarybrowser.js +++ b/dashboard-ui/scripts/librarybrowser.js @@ -273,25 +273,20 @@ function fadeOutLeft(elem, iterations) { var keyframes = [{ opacity: '1', transform: 'none', offset: 0 }, { opacity: '0', transform: 'translate3d(-100%, 0, 0)', offset: 1 }]; - var timing = { duration: 600, iterations: iterations }; + var timing = { duration: 400, iterations: iterations }; return elem.animate(keyframes, timing); } if (!LibraryBrowser.navigateOnLibraryTabSelect()) { tabs.addEventListener('iron-select', function () { + var animateTab = !$.browser.safari; var selected = pages.selected; - if (selected != null) { + if (selected != null && animateTab) { var newValue = this.selected; var currentTab = pages.querySelectorAll('.pageTabContent')[selected]; - if ($.browser.safari) { - // Need this it flashes the previous content after the animation - currentTab.classList.add('hidingAnimatedTab'); - } fadeOutLeft(currentTab, 1).onfinish = function () { pages.selected = newValue; - - setTimeout(function () { currentTab.classList.remove('hidingAnimatedTab'); }, 500); }; } else { @@ -926,16 +921,16 @@ var href = LibraryBrowser.getHrefInternal(item, context); - //if (context != 'livetv') { - // if (topParentId == null && context != 'playlists') { - // topParentId = LibraryMenu.getTopParentId(); - // } + if (context == 'tv') { + if (!topParentId) { + topParentId = LibraryMenu.getTopParentId(); + } - // if (topParentId) { - // href += href.indexOf('?') == -1 ? "?topParentId=" : "&topParentId="; - // href += topParentId; - // } - //} + if (topParentId) { + href += href.indexOf('?') == -1 ? "?topParentId=" : "&topParentId="; + href += topParentId; + } + } return href; }, diff --git a/dashboard-ui/scripts/librarymenu.js b/dashboard-ui/scripts/librarymenu.js index ce4e49c199..fc64366412 100644 --- a/dashboard-ui/scripts/librarymenu.js +++ b/dashboard-ui/scripts/librarymenu.js @@ -28,12 +28,14 @@ html += ''; + //html += '
0
'; + if (!showUserAtTop()) { html += ''; } if (!$.browser.mobile && !Dashboard.isConnectMode()) { - html += ''; + html += ''; } html += '
'; @@ -350,11 +352,6 @@ html += '
'; - html += ''; - html += Globalize.translate('ButtonInbox'); - html += '
0
'; - html += '
'; - if (user.localUser && showUserAtTop()) { html += '' + Globalize.translate('ButtonSettings') + ''; } diff --git a/dashboard-ui/scripts/localsync.js b/dashboard-ui/scripts/localsync.js index 6f9afc9dce..963f04a84f 100644 --- a/dashboard-ui/scripts/localsync.js +++ b/dashboard-ui/scripts/localsync.js @@ -9,22 +9,29 @@ return AppInfo.isNativeApp; }, - startSync: function () { + sync: function (options) { - if (!syncPromise) { - require(['multiserversync'], function () { - - lastStart = new Date().getTime(); - syncPromise = new MediaBrowser.MultiServerSync(ConnectionManager).sync().done(function () { - - syncPromise = null; - - }).fail(function () { - - syncPromise = null; - }); - }); + if (syncPromise) { + return syncPromise.promise(); } + + var deferred = DeferredBuilder.Deferred(); + + require(['multiserversync'], function () { + + lastStart = new Date().getTime(); + syncPromise = new MediaBrowser.MultiServerSync(ConnectionManager).sync(options).done(function () { + + syncPromise = null; + deferred.resolve(); + + }).fail(function () { + + syncPromise = null; + }); + }); + + return deferred.promise(); }, getSyncStatus: function () { @@ -42,12 +49,12 @@ if (LocalSync.isSupported) { setInterval(function () { - LocalSync.startSync(); + //LocalSync.startSync(); }, syncInterval); if (lastStart > 0 && (now - lastStart) >= syncInterval) { - LocalSync.startSync(); + //LocalSync.startSync(); } } //LocalSync.startSync(); diff --git a/dashboard-ui/scripts/mysync.js b/dashboard-ui/scripts/mysync.js index 53a9d3c1ac..572fbb3e98 100644 --- a/dashboard-ui/scripts/mysync.js +++ b/dashboard-ui/scripts/mysync.js @@ -26,7 +26,7 @@ require(['localsync'], function () { - LocalSync.startSync(); + LocalSync.sync(); Dashboard.alert(Globalize.translate('MessageSyncStarted')); refreshSyncStatus(page); }); diff --git a/dashboard-ui/scripts/notifications.js b/dashboard-ui/scripts/notifications.js index 51d7a9556e..9596e378e2 100644 --- a/dashboard-ui/scripts/notifications.js +++ b/dashboard-ui/scripts/notifications.js @@ -27,6 +27,10 @@ return; } + if (!window.ApiClient) { + return; + } + var promise = self.getNotificationsSummary(); if (!promise) { @@ -168,13 +172,7 @@ } window.Notifications = new notifications(); - - $(document).on('libraryMenuCreated', function (e) { - - if (window.ApiClient) { - Notifications.updateNotificationCount(); - } - }); + var needsRefresh = true; function onWebSocketMessage(e, msg) { if (msg.MessageType === "NotificationUpdated" || msg.MessageType === "NotificationAdded" || msg.MessageType === "NotificationsMarkedRead") { @@ -198,6 +196,24 @@ $(ConnectionManager).on('apiclientcreated', function (e, apiClient) { initializeApiClient(apiClient); }); + + Events.on(ConnectionManager, 'localusersignedin', function () { + needsRefresh = true; + }); + + Events.on(ConnectionManager, 'localusersignedout', function () { + needsRefresh = true; + }); + }); + + pageClassOn('pageshowready', "type-interior", function () { + + var page = $(this); + + if (needsRefresh) { + Notifications.updateNotificationCount(); + } + }); })(jQuery, document, Dashboard, LibraryBrowser); \ No newline at end of file diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 24140827a9..ade0fd5a3e 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -1408,10 +1408,14 @@ var Dashboard = { setPageTitle: function (title) { - var elem = $($.mobile.activePage)[0].querySelector('.pageTitle'); + var page = $.mobile.activePage; - if (elem) { - elem.innerHTML = title; + if (page) { + var elem = $(page)[0].querySelector('.pageTitle'); + + if (elem) { + elem.innerHTML = title; + } } if (title) { @@ -2281,6 +2285,9 @@ var AppInfo = {}; if (AppInfo.isNativeApp && !$.browser.android) { require(['localsync']); } + if (AppInfo.isNativeApp && $.browser.safari) { + require(['cordova/ios/backgroundfetch']); + } //require(['localsync']); } diff --git a/dashboard-ui/scripts/syncactivity.js b/dashboard-ui/scripts/syncactivity.js index 97d610be1a..b0b54a9206 100644 --- a/dashboard-ui/scripts/syncactivity.js +++ b/dashboard-ui/scripts/syncactivity.js @@ -339,7 +339,7 @@ function onWebSocketMessage(e, msg) { - var page = $.mobile.activePage; + var page = $($.mobile.activePage)[0]; if (msg.MessageType == "SyncJobs") { diff --git a/dashboard-ui/themes/ios.css b/dashboard-ui/themes/ios.css index 8fb062aaec..cab35c18ed 100644 --- a/dashboard-ui/themes/ios.css +++ b/dashboard-ui/themes/ios.css @@ -17,7 +17,7 @@ .viewMenuBar, .libraryViewNav, paper-tabs { - background-color: rgba(28,28,28,.97); + background-color: rgb(28,28,28); } .viewMenuBar.semiTransparent { @@ -80,10 +80,6 @@ color: #FF2D55 !important; } -.viewMenuBar .headerButtonLeft { - color: #FF2D55 !important; -} - .channelTimeslotHeader { border-right-color: #FF2D55 !important; } @@ -191,4 +187,4 @@ paper-tab { #footer { /* Eliminate transparency to prevent clicks from passing through to the elements underneath */ background-color: rgb(26,26,26); -} \ No newline at end of file +}