Add server select support for NativeShell

This commit is contained in:
Dmitry Lyzo 2020-02-01 23:55:07 +03:00
parent 254c69b2f1
commit 6d6cce02af
5 changed files with 17 additions and 3 deletions

View File

@ -187,6 +187,9 @@ define(["apphost", "appSettings", "dom", "connectionManager", "loading", "layout
view.querySelector("#txtManualName").value = "";
showManualForm(view, true);
});
view.querySelector(".btnSelectServer").addEventListener("click", function () {
Dashboard.selectServer();
});
view.addEventListener("viewshow", function (e) {
loading.show();

View File

@ -6,6 +6,10 @@ define(["apphost", "connectionManager", "listViewStyle", "emby-button"], functio
Dashboard.logout();
});
view.querySelector(".selectServer").addEventListener("click", function () {
Dashboard.selectServer();
});
view.addEventListener("viewshow", function() {
// this page can also be used by admins to change user preferences from the user edit page
var userId = params.userId || Dashboard.getCurrentUserId();

View File

@ -47,9 +47,9 @@
<span>${ButtonForgotPassword}</span>
</button>
<a is="emby-linkbutton" href="selectserver.html" class="raised block btnSelectServer">
<button is="emby-button" type="button" class="raised block btnSelectServer">
<span>${ButtonChangeServer}</span>
</a>
</button>
<p class="disclaimer" style="text-align: center; margin-top: 2em;"></p>
</div>

View File

@ -69,7 +69,7 @@
</div>
<div class="userSection verticalSection verticalSection-extrabottompadding">
<h2 class="sectionTitle" style="padding-left:.25em;">${HeaderUser}</h2>
<a is="emby-linkbutton" data-ripple="false" href="selectserver.html" style="display:block;padding:0;margin:0;" class="selectServer hide listItem-border">
<a is="emby-linkbutton" data-ripple="false" href="#" style="display:block;padding:0;margin:0;" class="selectServer hide listItem-border">
<div class="listItem">
<i class="material-icons listItemIcon listItemIcon-transparent">wifi</i>
<div class="listItemBody">

View File

@ -221,6 +221,13 @@ var Dashboard = {
};
appHost.getPushTokenInfo();
return capabilities = Object.assign(capabilities, appHost.getPushTokenInfo());
},
selectServer: function () {
if (window.NativeShell && typeof window.NativeShell.selectServer === "function") {
window.NativeShell.selectServer();
} else {
Dashboard.navigate("selectserver.html");
}
}
};