update storage

This commit is contained in:
Luke Pulverenti 2015-05-20 13:29:26 -04:00
parent 9fc4c86111
commit 3beaf88745
15 changed files with 36 additions and 29 deletions

View File

@ -141,7 +141,7 @@
var userId = Dashboard.getCurrentUserId();
var val = store.getItem('enableBackdrops-' + userId);
var val = appStorage.getItem('enableBackdrops-' + userId);
// For bandwidth
return val == '1' || (val != '0' && isEnabledByDefault());

View File

@ -40,12 +40,12 @@
break;
case MediaBrowser.ConnectionState.ServerSignIn:
{
Dashboard.navigate('login.html?serverid=' + result.Servers[0].Id);
Dashboard.navigate('login.html?serverid=' + result.Servers[0].Id, false, 'none');
}
break;
case MediaBrowser.ConnectionState.ServerSelection:
{
Dashboard.navigate('selectserver.html');
Dashboard.navigate('selectserver.html', false, 'none');
}
break;
case MediaBrowser.ConnectionState.ConnectSignIn:

View File

@ -478,4 +478,4 @@
showMenu: showPlayMenu
};
})(window, window.store);
})(window, window.appStorage);

View File

@ -2893,4 +2893,4 @@
}
};
})(window, document, jQuery, screen, window.store);
})(window, document, jQuery, screen, window.appStorage);

View File

@ -371,7 +371,7 @@
function getTopParentId() {
return getParameterByName('topParentId') /*|| sessionStore.getItem('topParentId')*/ || null;
return getParameterByName('topParentId') || null;
}
window.LibraryMenu = {

View File

@ -746,4 +746,4 @@
mirrorIfEnabled(info);
});
})(jQuery, window, window.store);
})(jQuery, window, window.appStorage);

View File

@ -1740,4 +1740,4 @@
});
})(document, setTimeout, clearTimeout, screen, window.store, $, setInterval, window);
})(document, setTimeout, clearTimeout, screen, window.appStorage, $, setInterval, window);

View File

@ -2,7 +2,7 @@
function loadForm(page, userId, displayPreferences) {
var externalPlayers = JSON.parse(store.getItem('externalplayers') || '[]');
var externalPlayers = JSON.parse(appStorage.getItem('externalplayers') || '[]');
$('#selectMaxBitrate', page).val(AppSettings.maxStreamingBitrate()).selectmenu("refresh");
$('#selectMaxChromecastBitrate', page).val(AppSettings.maxChromecastBitrate()).selectmenu("refresh");
@ -18,8 +18,8 @@
}).checkboxradio('refresh');
$('#selectThemeSong', page).val(store.getItem('enableThemeSongs-' + userId) || '').selectmenu("refresh");
$('#selectBackdrop', page).val(store.getItem('enableBackdrops-' + userId) || '').selectmenu("refresh");
$('#selectThemeSong', page).val(appStorage.getItem('enableThemeSongs-' + userId) || '').selectmenu("refresh");
$('#selectBackdrop', page).val(appStorage.getItem('enableBackdrops-' + userId) || '').selectmenu("refresh");
$('#selectHomeSection1', page).val(displayPreferences.CustomPrefs.home0 || '').selectmenu("refresh");
$('#selectHomeSection2', page).val(displayPreferences.CustomPrefs.home1 || '').selectmenu("refresh");
@ -33,8 +33,8 @@
function saveUser(page, userId, displayPreferences) {
store.setItem('enableThemeSongs-' + userId, $('#selectThemeSong', page).val());
store.setItem('enableBackdrops-' + userId, $('#selectBackdrop', page).val());
appStorage.setItem('enableThemeSongs-' + userId, $('#selectThemeSong', page).val());
appStorage.setItem('enableBackdrops-' + userId, $('#selectBackdrop', page).val());
displayPreferences.CustomPrefs.home0 = $('#selectHomeSection1', page).val();
displayPreferences.CustomPrefs.home1 = $('#selectHomeSection2', page).val();
@ -64,7 +64,7 @@
});
store.setItem('externalplayers', JSON.stringify(externalPlayers));
appStorage.setItem('externalplayers', JSON.stringify(externalPlayers));
AppSettings.maxStreamingBitrate($('#selectMaxBitrate', page).val());
AppSettings.maxChromecastBitrate($('#selectMaxChromecastBitrate', page).val());
@ -138,4 +138,4 @@
};
})(window, window.store);
})(window, window.appStorage);

View File

@ -633,12 +633,12 @@
var expected = '2';
if (store.getItem('remotecontrolswipedown') != expected) {
if (appStorage.getItem('remotecontrolswipedown') != expected) {
Dashboard.alert({
message: Globalize.translate('MessageSwipeDownOnRemoteControl'),
title: Globalize.translate('HeaderAlert')
});
store.setItem('remotecontrolswipedown', expected);
appStorage.setItem('remotecontrolswipedown', expected);
}
}

View File

@ -420,7 +420,7 @@ var Dashboard = {
return "ConfigurationPage?name=" + encodeURIComponent(name);
},
navigate: function (url, preserveQueryString) {
navigate: function (url, preserveQueryString, transition) {
if (!url) {
throw new Error('url cannot be null or empty');
@ -430,7 +430,14 @@ var Dashboard = {
if (preserveQueryString && queryString) {
url += queryString;
}
$.mobile.changePage(url);
var options = {};
if (transition) {
options.transition = transition;
}
$.mobile.changePage(url, options);
},
showLoadingMsg: function () {
@ -1979,7 +1986,7 @@ $(document).on('pagecreate', ".page", function () {
}
}
if (this.id !== "loginPage" && !page.hasClass('forgotPasswordPage') && !page.hasClass('wizardPage') && !isConnectMode) {
if (!isConnectMode && this.id !== "loginPage" && !page.hasClass('forgotPasswordPage') && !page.hasClass('wizardPage')) {
console.log('Not logged into server. Redirecting to login.');
Dashboard.logout(true, true);

View File

@ -77,7 +77,7 @@ $.fn.taskButton = function (options) {
var key = 'scheduledTaskButton' + options.taskKey;
var expectedValue = '4';
if (store.getItem(key) == expectedValue) {
if (appStorage.getItem(key) == expectedValue) {
onScheduledTaskMessageConfirmed(instance, id);
} else {
@ -90,7 +90,7 @@ $.fn.taskButton = function (options) {
if (result) {
store.setItem(key, expectedValue);
appStorage.setItem(key, expectedValue);
onScheduledTaskMessageConfirmed(instance, id);
}
});

View File

@ -44,7 +44,7 @@
var userId = Dashboard.getCurrentUserId();
var val = store.getItem('enableThemeSongs-' + userId);
var val = appStorage.getItem('enableThemeSongs-' + userId);
var localAutoPlayers = MediaController.getPlayers().filter(function (p) {

View File

@ -12,7 +12,7 @@
function ensure() {
credentials = credentials || JSON.parse(store.getItem(key) || '{}');
credentials = credentials || JSON.parse(appStorage.getItem(key) || '{}');
credentials.servers = credentials.servers || [];
}
@ -26,7 +26,7 @@
if (data) {
credentials = data;
store.setItem(key, JSON.stringify(data));
appStorage.setItem(key, JSON.stringify(data));
} else {
self.clear();
}
@ -34,7 +34,7 @@
self.clear = function () {
credentials = null;
store.removeItem(key);
appStorage.removeItem(key);
};
self.credentials = function (data) {

View File

@ -17,13 +17,13 @@
var randomId = '';
// Since the above is not guaranteed to be unique per device, add a little more
randomId = store.getItem(keyName);
randomId = appStorage.getItem(keyName);
if (!randomId) {
randomId = new Date().getTime();
store.setItem(keyName, randomId.toString());
appStorage.setItem(keyName, randomId.toString());
}
keys.push(randomId);

View File

@ -44,7 +44,7 @@
};
}
globalScope.store = new myStore(localStorage);
globalScope.appStorage = new myStore(localStorage);
globalScope.sessionStore = new myStore(sessionStorage);
})(window, window.localStorage, window.sessionStorage);