mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
Add exit on "Go back"
This commit is contained in:
parent
02f6928fcd
commit
60e64f8a58
@ -551,7 +551,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||
return false;
|
||||
}
|
||||
|
||||
if (curr.type === 'home') {
|
||||
if (!document.querySelector('.dialogContainer') && curr.type === 'home') {
|
||||
return false;
|
||||
}
|
||||
return page.canGoBack();
|
||||
|
@ -311,6 +311,52 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Do exit according to platform
|
||||
*/
|
||||
function doExit() {
|
||||
try {
|
||||
if (window.NativeShell) {
|
||||
window.NativeShell.AppHost.exit();
|
||||
} else if (browser.tizen) {
|
||||
tizen.application.getCurrentApplication().exit();
|
||||
} else if (browser.web0s) {
|
||||
webOS.platformBack();
|
||||
} else {
|
||||
window.close();
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("error closing application: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
var exitPromise;
|
||||
|
||||
/**
|
||||
* Ask user for exit
|
||||
*/
|
||||
function askForExit() {
|
||||
if (!!exitPromise) {
|
||||
return;
|
||||
}
|
||||
|
||||
require(["actionsheet"], function (actionsheet) {
|
||||
exitPromise = actionsheet.show({
|
||||
title: Globalize.translate("MessageConfirmAppExit"),
|
||||
items: [
|
||||
{id: "yes", name: Globalize.translate("Yes")},
|
||||
{id: "no", name: Globalize.translate("No")}
|
||||
]
|
||||
}).then(function (value) {
|
||||
if (value === "yes") {
|
||||
doExit();
|
||||
}
|
||||
}).finally(function () {
|
||||
exitPromise = null;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var deviceId;
|
||||
var deviceName;
|
||||
var appName = "Jellyfin Web";
|
||||
@ -326,16 +372,10 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||
alert("setWindowState is not supported and should not be called");
|
||||
},
|
||||
exit: function () {
|
||||
if (window.NativeShell) {
|
||||
window.NativeShell.AppHost.exit();
|
||||
} else if (browser.tizen) {
|
||||
try {
|
||||
tizen.application.getCurrentApplication().exit();
|
||||
} catch (err) {
|
||||
console.log("error closing application: " + err);
|
||||
}
|
||||
if (!!window.appMode && browser.tizen) {
|
||||
askForExit();
|
||||
} else {
|
||||
window.close();
|
||||
doExit();
|
||||
}
|
||||
},
|
||||
supports: function (command) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
define(['playbackManager', 'focusManager', 'appRouter', 'dom'], function (playbackManager, focusManager, appRouter, dom) {
|
||||
define(['playbackManager', 'focusManager', 'appRouter', 'dom', 'apphost'], function (playbackManager, focusManager, appRouter, dom, appHost) {
|
||||
'use strict';
|
||||
|
||||
var lastInputTime = new Date().getTime();
|
||||
@ -98,7 +98,11 @@ define(['playbackManager', 'focusManager', 'appRouter', 'dom'], function (playba
|
||||
appRouter.showSettings();
|
||||
break;
|
||||
case 'back':
|
||||
appRouter.back();
|
||||
if (appRouter.canGoBack()) {
|
||||
appRouter.back();
|
||||
} else if (appHost.supports('exit')) {
|
||||
appHost.exit();
|
||||
}
|
||||
break;
|
||||
case 'forward':
|
||||
break;
|
||||
|
@ -945,6 +945,7 @@
|
||||
"MessageAlreadyInstalled": "This version is already installed.",
|
||||
"MessageAreYouSureDeleteSubtitles": "Are you sure you wish to delete this subtitle file?",
|
||||
"MessageAreYouSureYouWishToRemoveMediaFolder": "Are you sure you wish to remove this media folder?",
|
||||
"MessageConfirmAppExit": "Do you want to exit?",
|
||||
"MessageConfirmDeleteGuideProvider": "Are you sure you wish to delete this guide provider?",
|
||||
"MessageConfirmDeleteTunerDevice": "Are you sure you wish to delete this device?",
|
||||
"MessageConfirmProfileDeletion": "Are you sure you wish to delete this profile?",
|
||||
|
@ -890,6 +890,7 @@
|
||||
"MessageAlreadyInstalled": "Данная версия уже установлена.",
|
||||
"MessageAreYouSureDeleteSubtitles": "Вы действительно хотите удалить данный файл субитров?",
|
||||
"MessageAreYouSureYouWishToRemoveMediaFolder": "Вы действительно хотите изъять данную медиапапку?",
|
||||
"MessageConfirmAppExit": "Вы хотите выйти?",
|
||||
"MessageConfirmDeleteGuideProvider": "Вы действительно хотите удалить данного поставщика телегида?",
|
||||
"MessageConfirmDeleteTunerDevice": "Вы действительно хотите удалить данное устройство?",
|
||||
"MessageConfirmProfileDeletion": "Вы действительно хотите удалить данный профиль?",
|
||||
|
Loading…
Reference in New Issue
Block a user