mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Enhance NativeShell for JMP.
This commit is contained in:
parent
93aefafdee
commit
68e74ede99
4 changed files with 26 additions and 18 deletions
|
@ -275,7 +275,7 @@ const supportedFeatures = function () {
|
||||||
*/
|
*/
|
||||||
function doExit() {
|
function doExit() {
|
||||||
try {
|
try {
|
||||||
if (window.NativeShell) {
|
if (window.NativeShell && window.NativeShell.AppHost.exit) {
|
||||||
window.NativeShell.AppHost.exit();
|
window.NativeShell.AppHost.exit();
|
||||||
} else if (browser.tizen) {
|
} else if (browser.tizen) {
|
||||||
tizen.application.getCurrentApplication().exit();
|
tizen.application.getCurrentApplication().exit();
|
||||||
|
@ -360,10 +360,12 @@ export const appHost = {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
deviceName: function () {
|
deviceName: function () {
|
||||||
return window.NativeShell ? window.NativeShell.AppHost.deviceName() : getDeviceName();
|
return window.NativeShell && window.NativeShell.AppHost.deviceName
|
||||||
|
? window.NativeShell.AppHost.deviceName() : getDeviceName();
|
||||||
},
|
},
|
||||||
deviceId: function () {
|
deviceId: function () {
|
||||||
return window.NativeShell ? window.NativeShell.AppHost.deviceId() : getDeviceId();
|
return window.NativeShell && window.NativeShell.AppHost.deviceId
|
||||||
|
? window.NativeShell.AppHost.deviceId() : getDeviceId();
|
||||||
},
|
},
|
||||||
appName: function () {
|
appName: function () {
|
||||||
return window.NativeShell ? window.NativeShell.AppHost.appName() : appName;
|
return window.NativeShell ? window.NativeShell.AppHost.appName() : appName;
|
||||||
|
|
|
@ -3,6 +3,8 @@ import globalize from '../scripts/globalize';
|
||||||
import loading from './loading/loading';
|
import loading from './loading/loading';
|
||||||
import appSettings from '../scripts/settings/appSettings';
|
import appSettings from '../scripts/settings/appSettings';
|
||||||
import { playbackManager } from './playback/playbackmanager';
|
import { playbackManager } from './playback/playbackmanager';
|
||||||
|
import { appHost } from '../components/apphost';
|
||||||
|
import { appRouter } from '../components/appRouter';
|
||||||
|
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
@ -90,7 +92,10 @@ import { playbackManager } from './playback/playbackmanager';
|
||||||
events: Events,
|
events: Events,
|
||||||
loading,
|
loading,
|
||||||
appSettings,
|
appSettings,
|
||||||
playbackManager
|
playbackManager,
|
||||||
|
globalize,
|
||||||
|
appHost,
|
||||||
|
appRouter
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.debug(`Loading plugin (via dynamic import): ${pluginSpec}`);
|
console.debug(`Loading plugin (via dynamic import): ${pluginSpec}`);
|
||||||
|
|
|
@ -79,15 +79,6 @@ export function getMultiServer() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getIgnorePlayPermission() {
|
|
||||||
return getConfig().then(config => {
|
|
||||||
return !!config.ignorePlayPermission;
|
|
||||||
}).catch(error => {
|
|
||||||
console.log('cannot get web config:', error);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getServers() {
|
export function getServers() {
|
||||||
return getConfig().then(config => {
|
return getConfig().then(config => {
|
||||||
return config.servers || [];
|
return config.servers || [];
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
// TODO: This seems like a good candidate for deprecation
|
// TODO: This seems like a good candidate for deprecation
|
||||||
export default {
|
export default {
|
||||||
enableFullscreen: function() {
|
enableFullscreen: function() {
|
||||||
window.NativeShell?.enableFullscreen();
|
if (window.NativeShell && window.NativeShell.enableFullscreen) {
|
||||||
|
window.NativeShell.enableFullscreen();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
disableFullscreen: function() {
|
disableFullscreen: function() {
|
||||||
window.NativeShell?.disableFullscreen();
|
if (window.NativeShell && window.NativeShell.disableFullscreen) {
|
||||||
|
window.NativeShell.disableFullscreen();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
openUrl: function(url, target) {
|
openUrl: function(url, target) {
|
||||||
if (window.NativeShell) {
|
if (window.NativeShell) {
|
||||||
|
@ -14,17 +18,23 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateMediaSession(mediaInfo) {
|
updateMediaSession(mediaInfo) {
|
||||||
window.NativeShell?.updateMediaSession(mediaInfo);
|
if (window.NativeShell && window.NativeShell.updateMediaSession) {
|
||||||
|
window.NativeShell.updateMediaSession(mediaInfo);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
hideMediaSession() {
|
hideMediaSession() {
|
||||||
window.NativeShell?.hideMediaSession();
|
if (window.NativeShell && window.NativeShell.hideMediaSession) {
|
||||||
|
window.NativeShell.hideMediaSession();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Notify the NativeShell about volume level changes.
|
* Notify the NativeShell about volume level changes.
|
||||||
* Useful for e.g. remote playback.
|
* Useful for e.g. remote playback.
|
||||||
*/
|
*/
|
||||||
updateVolumeLevel(volume) {
|
updateVolumeLevel(volume) {
|
||||||
window.NativeShell?.updateVolumeLevel(volume);
|
if (window.NativeShell && window.NativeShell.updateVolumeLevel) {
|
||||||
|
window.NativeShell.updateVolumeLevel(volume);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Download specified files with NativeShell if possible
|
* Download specified files with NativeShell if possible
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue