mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
use common sharing manager
This commit is contained in:
parent
190f70bb71
commit
3657bdf7b7
10 changed files with 80 additions and 79 deletions
|
@ -960,8 +960,8 @@
|
|||
switch (id) {
|
||||
|
||||
case 'share':
|
||||
require(['sharingmanager'], function () {
|
||||
SharingManager.showMenu(Dashboard.getCurrentUserId(), itemId);
|
||||
require(['sharingmanager'], function (sharingManager) {
|
||||
sharingManager.showMenu(ApiClient, itemId);
|
||||
});
|
||||
break;
|
||||
case 'addtocollection':
|
||||
|
|
|
@ -576,8 +576,8 @@
|
|||
LibraryBrowser.playInExternalPlayer(itemId);
|
||||
break;
|
||||
case 'share':
|
||||
require(['sharingmanager'], function () {
|
||||
SharingManager.showMenu(Dashboard.getCurrentUserId(), itemId);
|
||||
require(['sharingmanager'], function (sharingManager) {
|
||||
sharingManager.showMenu(ApiClient, itemId);
|
||||
});
|
||||
break;
|
||||
case 'removefromplaylist':
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
define([], function () {
|
||||
|
||||
function onSharingSuccess(options) {
|
||||
|
||||
console.log('share success. shareId: ' + options.share.Id);
|
||||
|
||||
}
|
||||
|
||||
function onSharingCancel(options) {
|
||||
|
||||
var shareId = options.share.Id;
|
||||
|
||||
console.log('share cancelled. shareId: ' + shareId);
|
||||
|
||||
// Delete the share since it was cancelled
|
||||
ApiClient.ajax({
|
||||
|
||||
type: 'DELETE',
|
||||
url: ApiClient.getUrl('Social/Shares/' + shareId)
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function showMenu(userId, itemId) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
require(['sharingwidget'], function (SharingWidget) {
|
||||
|
||||
ApiClient.ajax({
|
||||
type: 'POST',
|
||||
url: ApiClient.getUrl('Social/Shares', {
|
||||
|
||||
ItemId: itemId,
|
||||
UserId: userId
|
||||
}),
|
||||
dataType: "json"
|
||||
|
||||
}).then(function (share) {
|
||||
|
||||
var options = {
|
||||
share: share
|
||||
};
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
SharingWidget.showMenu(options, onSharingSuccess, onSharingCancel);
|
||||
|
||||
}, function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
window.SharingManager = {
|
||||
showMenu: showMenu
|
||||
};
|
||||
|
||||
});
|
|
@ -1651,12 +1651,12 @@ var AppInfo = {};
|
|||
paths.hlsjs = bowerPath + "/hls.js/dist/hls.min";
|
||||
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
paths.sharingwidget = "cordova/sharingwidget";
|
||||
paths.sharingMenu = "cordova/sharingwidget";
|
||||
paths.serverdiscovery = "cordova/serverdiscovery";
|
||||
paths.wakeonlan = "cordova/wakeonlan";
|
||||
paths.actionsheet = "cordova/actionsheet";
|
||||
} else {
|
||||
paths.sharingwidget = "components/sharingwidget";
|
||||
paths.sharingMenu = "components/sharingwidget";
|
||||
paths.serverdiscovery = apiClientBowerPath + "/serverdiscovery";
|
||||
paths.wakeonlan = apiClientBowerPath + "/wakeonlan";
|
||||
|
||||
|
@ -1678,6 +1678,8 @@ var AppInfo = {};
|
|||
return viewManager;
|
||||
});
|
||||
|
||||
define("sharingmanager", [embyWebComponentsBowerPath + "/sharing/sharingmanager"], returnFirstDependency);
|
||||
|
||||
// hack for an android test before browserInfo is loaded
|
||||
if (Dashboard.isRunningInCordova() && window.MainActivity) {
|
||||
paths.appStorage = "cordova/android/appstorage";
|
||||
|
@ -2028,8 +2030,6 @@ var AppInfo = {};
|
|||
define("detailtablecss", ['css!css/detailtable.css']);
|
||||
define("tileitemcss", ['css!css/tileitem.css']);
|
||||
|
||||
define("sharingmanager", ["scripts/sharingmanager"]);
|
||||
|
||||
if (Dashboard.isRunningInCordova() && browserInfo.safari) {
|
||||
define("searchmenu", ["cordova/searchmenu"]);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue