mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Clean up appHost and shell method checking.
This commit is contained in:
parent
17b3a2aa05
commit
c4e87eb562
2 changed files with 13 additions and 11 deletions
|
@ -360,18 +360,20 @@ export const appHost = {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
deviceName: function () {
|
deviceName: function () {
|
||||||
return window.NativeShell && window.NativeShell.AppHost.deviceName
|
return window.NativeShell?.AppHost?.deviceName
|
||||||
? window.NativeShell.AppHost.deviceName() : getDeviceName();
|
? window.NativeShell.AppHost.deviceName() : getDeviceName();
|
||||||
},
|
},
|
||||||
deviceId: function () {
|
deviceId: function () {
|
||||||
return window.NativeShell && window.NativeShell.AppHost.deviceId
|
return window.NativeShell?.AppHost?.deviceId
|
||||||
? window.NativeShell.AppHost.deviceId() : getDeviceId();
|
? window.NativeShell.AppHost.deviceId() : getDeviceId();
|
||||||
},
|
},
|
||||||
appName: function () {
|
appName: function () {
|
||||||
return window.NativeShell ? window.NativeShell.AppHost.appName() : appName;
|
return window.NativeShell?.AppHost?.appName
|
||||||
|
? window.NativeShell.AppHost.appName() : appName;
|
||||||
},
|
},
|
||||||
appVersion: function () {
|
appVersion: function () {
|
||||||
return window.NativeShell ? window.NativeShell.AppHost.appVersion() : appVersion;
|
return window.NativeShell?.AppHost?.appVersion
|
||||||
|
? window.NativeShell.AppHost.appVersion() : appVersion;
|
||||||
},
|
},
|
||||||
getPushTokenInfo: function () {
|
getPushTokenInfo: function () {
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
// 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() {
|
||||||
if (window.NativeShell && window.NativeShell.enableFullscreen) {
|
if (window.NativeShell?.enableFullscreen) {
|
||||||
window.NativeShell.enableFullscreen();
|
window.NativeShell.enableFullscreen();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
disableFullscreen: function() {
|
disableFullscreen: function() {
|
||||||
if (window.NativeShell && window.NativeShell.disableFullscreen) {
|
if (window.NativeShell?.disableFullscreen) {
|
||||||
window.NativeShell.disableFullscreen();
|
window.NativeShell.disableFullscreen();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
openUrl: function(url, target) {
|
openUrl: function(url, target) {
|
||||||
if (window.NativeShell) {
|
if (window.NativeShell?.openUrl) {
|
||||||
window.NativeShell.openUrl(url, target);
|
window.NativeShell.openUrl(url, target);
|
||||||
} else {
|
} else {
|
||||||
window.open(url, target || '_blank');
|
window.open(url, target || '_blank');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateMediaSession(mediaInfo) {
|
updateMediaSession(mediaInfo) {
|
||||||
if (window.NativeShell && window.NativeShell.updateMediaSession) {
|
if (window.NativeShell?.updateMediaSession) {
|
||||||
window.NativeShell.updateMediaSession(mediaInfo);
|
window.NativeShell.updateMediaSession(mediaInfo);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
hideMediaSession() {
|
hideMediaSession() {
|
||||||
if (window.NativeShell && window.NativeShell.hideMediaSession) {
|
if (window.NativeShell?.hideMediaSession) {
|
||||||
window.NativeShell.hideMediaSession();
|
window.NativeShell.hideMediaSession();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -32,7 +32,7 @@ export default {
|
||||||
* Useful for e.g. remote playback.
|
* Useful for e.g. remote playback.
|
||||||
*/
|
*/
|
||||||
updateVolumeLevel(volume) {
|
updateVolumeLevel(volume) {
|
||||||
if (window.NativeShell && window.NativeShell.updateVolumeLevel) {
|
if (window.NativeShell?.updateVolumeLevel) {
|
||||||
window.NativeShell.updateVolumeLevel(volume);
|
window.NativeShell.updateVolumeLevel(volume);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -42,7 +42,7 @@ export default {
|
||||||
* @returns true on success
|
* @returns true on success
|
||||||
*/
|
*/
|
||||||
downloadFiles(items) {
|
downloadFiles(items) {
|
||||||
if (window.NativeShell) {
|
if (window.NativeShell?.downloadFile) {
|
||||||
items.forEach(item => window.NativeShell.downloadFile(item));
|
items.forEach(item => window.NativeShell.downloadFile(item));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue