optimizations for device id and name in apphost
This commit is contained in:
parent
5c58d1472f
commit
2b962124a5
1 changed files with 47 additions and 43 deletions
|
@ -64,19 +64,22 @@ function generateDeviceId() {
|
|||
}
|
||||
|
||||
function getDeviceId() {
|
||||
if (!deviceId) {
|
||||
const key = '_deviceId2';
|
||||
let deviceId = appSettings.get(key);
|
||||
|
||||
deviceId = appSettings.get(key);
|
||||
|
||||
if (!deviceId) {
|
||||
deviceId = generateDeviceId();
|
||||
appSettings.set(key, deviceId);
|
||||
}
|
||||
}
|
||||
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
function getDeviceName() {
|
||||
let deviceName;
|
||||
if (!deviceName) {
|
||||
if (browser.tizen) {
|
||||
deviceName = 'Samsung Smart TV';
|
||||
} else if (browser.web0s) {
|
||||
|
@ -110,6 +113,7 @@ function getDeviceName() {
|
|||
} else if (browser.android) {
|
||||
deviceName += ' Android';
|
||||
}
|
||||
}
|
||||
|
||||
return deviceName;
|
||||
}
|
||||
|
@ -311,8 +315,8 @@ function askForExit() {
|
|||
});
|
||||
}
|
||||
|
||||
const deviceId = getDeviceId();
|
||||
const deviceName = getDeviceName();
|
||||
let deviceId;
|
||||
let deviceName;
|
||||
const appName = 'Jellyfin Web';
|
||||
const appVersion = '10.7.0';
|
||||
|
||||
|
@ -352,15 +356,15 @@ export const appHost = {
|
|||
}
|
||||
|
||||
return {
|
||||
deviceId,
|
||||
deviceName
|
||||
deviceId: getDeviceId(),
|
||||
deviceName: getDeviceName()
|
||||
};
|
||||
},
|
||||
deviceName: function () {
|
||||
return window.NativeShell ? window.NativeShell.AppHost.deviceName() : deviceName;
|
||||
return window.NativeShell ? window.NativeShell.AppHost.deviceName() : getDeviceName();
|
||||
},
|
||||
deviceId: function () {
|
||||
return window.NativeShell ? window.NativeShell.AppHost.deviceId() : deviceId;
|
||||
return window.NativeShell ? window.NativeShell.AppHost.deviceId() : getDeviceId();
|
||||
},
|
||||
appName: function () {
|
||||
return window.NativeShell ? window.NativeShell.AppHost.appName() : appName;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue