mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
remove registration services
This commit is contained in:
parent
886dec1174
commit
65fafe9c58
11 changed files with 30 additions and 393 deletions
|
@ -1,4 +1,4 @@
|
|||
define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom', 'recordingHelper', 'events', 'registrationServices', 'paper-icon-button-light', 'emby-button', 'css!./recordingfields'], function (globalize, connectionManager, require, loading, appHost, dom, recordingHelper, events, registrationServices) {
|
||||
define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom', 'recordingHelper', 'events', 'paper-icon-button-light', 'emby-button', 'css!./recordingfields'], function (globalize, connectionManager, require, loading, appHost, dom, recordingHelper, events) {
|
||||
'use strict';
|
||||
|
||||
function onRecordingButtonClick(e) {
|
||||
|
|
|
@ -1,75 +1,16 @@
|
|||
define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loading', 'apphost', 'dom', 'recordingHelper', 'events', 'registrationServices', 'paper-icon-button-light', 'emby-button', 'css!./recordingfields', 'flexStyles'], function (globalize, connectionManager, serverNotifications, require, loading, appHost, dom, recordingHelper, events, registrationServices) {
|
||||
define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loading', 'apphost', 'dom', 'recordingHelper', 'events', 'paper-icon-button-light', 'emby-button', 'css!./recordingfields', 'flexStyles'], function (globalize, connectionManager, serverNotifications, require, loading, appHost, dom, recordingHelper, events) {
|
||||
'use strict';
|
||||
|
||||
function getRegistration(apiClient, feature) {
|
||||
|
||||
return registrationServices.validateFeature(feature, {
|
||||
showDialog: false,
|
||||
viewOnly: true
|
||||
});
|
||||
}
|
||||
|
||||
function showConvertRecordingsUnlockMessage(context, apiClient) {
|
||||
|
||||
getRegistration(apiClient, getDvrFeatureCode()).then(function () {
|
||||
|
||||
context.querySelector('.convertRecordingsContainer').classList.add('hide');
|
||||
}, function () {
|
||||
context.querySelector('.convertRecordingsContainer').classList.remove('hide');
|
||||
});
|
||||
}
|
||||
|
||||
function showSeriesRecordingFields(context, programId, apiClient) {
|
||||
|
||||
getRegistration(apiClient, getDvrFeatureCode()).then(function () {
|
||||
|
||||
context.querySelector('.supporterContainer').classList.add('hide');
|
||||
context.querySelector('.convertRecordingsContainer').classList.add('hide');
|
||||
context.querySelector('.recordSeriesContainer').classList.remove('hide');
|
||||
|
||||
}, function () {
|
||||
|
||||
context.querySelector('.supporterContainerText').innerHTML = globalize.translate('MessageActiveSubscriptionRequiredSeriesRecordings');
|
||||
context.querySelector('.supporterContainer').classList.remove('hide');
|
||||
context.querySelector('.recordSeriesContainer').classList.add('hide');
|
||||
context.querySelector('.convertRecordingsContainer').classList.add('hide');
|
||||
});
|
||||
}
|
||||
|
||||
function getDvrFeatureCode() {
|
||||
|
||||
return 'dvr';
|
||||
context.querySelector('.convertRecordingsContainer').classList.add('hide');
|
||||
context.querySelector('.recordSeriesContainer').classList.remove('hide');
|
||||
}
|
||||
|
||||
function showSingleRecordingFields(context, programId, apiClient) {
|
||||
|
||||
getRegistration(apiClient, getDvrFeatureCode()).then(function () {
|
||||
|
||||
context.querySelector('.supporterContainer').classList.add('hide');
|
||||
showConvertRecordingsUnlockMessage(context, apiClient);
|
||||
|
||||
}, function () {
|
||||
|
||||
context.querySelector('.supporterContainerText').innerHTML = globalize.translate('DvrSubscriptionRequired');
|
||||
context.querySelector('.supporterContainer').classList.remove('hide');
|
||||
context.querySelector('.convertRecordingsContainer').classList.add('hide');
|
||||
});
|
||||
}
|
||||
|
||||
function showRecordingFieldsContainer(context, programId, apiClient) {
|
||||
|
||||
getRegistration(apiClient, getDvrFeatureCode()).then(function () {
|
||||
|
||||
context.querySelector('.recordingFields').classList.remove('hide');
|
||||
|
||||
}, function () {
|
||||
|
||||
context.querySelector('.recordingFields').classList.add('hide');
|
||||
});
|
||||
context.querySelector('.convertRecordingsContainer').classList.add('hide');
|
||||
}
|
||||
|
||||
function loadData(parent, program, apiClient) {
|
||||
|
||||
if (program.IsSeries) {
|
||||
parent.querySelector('.recordSeriesContainer').classList.remove('hide');
|
||||
showSeriesRecordingFields(parent, program.Id, apiClient);
|
||||
|
@ -91,13 +32,11 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
|||
if (program.TimerId && program.Status !== 'Cancelled') {
|
||||
parent.querySelector('.btnManageRecording').classList.remove('hide');
|
||||
parent.querySelector('.singleRecordingButton .recordingIcon').classList.add('recordingIcon-active');
|
||||
|
||||
if (program.Status === 'InProgress') {
|
||||
parent.querySelector('.singleRecordingButton .buttonText').innerHTML = globalize.translate('StopRecording');
|
||||
} else {
|
||||
parent.querySelector('.singleRecordingButton .buttonText').innerHTML = globalize.translate('DoNotRecord');
|
||||
}
|
||||
|
||||
} else {
|
||||
parent.querySelector('.btnManageRecording').classList.add('hide');
|
||||
parent.querySelector('.singleRecordingButton .recordingIcon').classList.remove('recordingIcon-active');
|
||||
|
@ -110,20 +49,16 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
|||
var options = instance.options;
|
||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||
|
||||
showRecordingFieldsContainer(options.parent, options.programId, apiClient);
|
||||
|
||||
instance.querySelector('.recordingFields').classList.remove('hide');
|
||||
return apiClient.getLiveTvProgram(options.programId, apiClient.getCurrentUserId()).then(function (program) {
|
||||
|
||||
instance.TimerId = program.TimerId;
|
||||
instance.Status = program.Status;
|
||||
instance.SeriesTimerId = program.SeriesTimerId;
|
||||
|
||||
loadData(options.parent, program, apiClient);
|
||||
});
|
||||
}
|
||||
|
||||
function onTimerChangedExternally(e, apiClient, data) {
|
||||
|
||||
var options = this.options;
|
||||
var refresh = false;
|
||||
|
||||
|
@ -144,7 +79,6 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
|||
}
|
||||
|
||||
function onSeriesTimerChangedExternally(e, apiClient, data) {
|
||||
|
||||
var options = this.options;
|
||||
var refresh = false;
|
||||
|
||||
|
@ -181,26 +115,16 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
|||
events.on(serverNotifications, 'SeriesTimerCancelled', seriesTimerChangedHandler);
|
||||
}
|
||||
|
||||
function onSupporterButtonClick() {
|
||||
registrationServices.showPremiereInfo();
|
||||
}
|
||||
|
||||
function onManageRecordingClick(e) {
|
||||
|
||||
var options = this.options;
|
||||
|
||||
if (!this.TimerId || this.Status === 'Cancelled') {
|
||||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
|
||||
require(['recordingEditor'], function (recordingEditor) {
|
||||
|
||||
recordingEditor.show(self.TimerId, options.serverId, {
|
||||
|
||||
enableCancel: false
|
||||
|
||||
}).then(function () {
|
||||
self.changed = true;
|
||||
});
|
||||
|
@ -282,21 +206,16 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
|||
|
||||
if (isChecked) {
|
||||
showSeriesRecordingFields(options.parent, options.programId, apiClient);
|
||||
|
||||
if (!this.SeriesTimerId) {
|
||||
|
||||
var promise = this.TimerId ?
|
||||
recordingHelper.changeRecordingToSeries(apiClient, this.TimerId, options.programId) :
|
||||
recordingHelper.createRecording(apiClient, options.programId, true);
|
||||
|
||||
promise.then(function () {
|
||||
fetchData(self);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
showSingleRecordingFields(options.parent, options.programId, apiClient);
|
||||
|
||||
if (this.SeriesTimerId) {
|
||||
apiClient.cancelLiveTvSeriesTimer(this.SeriesTimerId).then(function () {
|
||||
sendToast(globalize.translate('RecordingCancelled'));
|
||||
|
@ -307,22 +226,13 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
|||
}
|
||||
|
||||
RecordingEditor.prototype.embed = function () {
|
||||
|
||||
var self = this;
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['text!./recordingfields.template.html'], function (template) {
|
||||
|
||||
var options = self.options;
|
||||
var context = options.parent;
|
||||
context.innerHTML = globalize.translateDocument(template, 'core');
|
||||
|
||||
var supporterButtons = context.querySelectorAll('.btnSupporter');
|
||||
for (var i = 0, length = supporterButtons.length; i < length; i++) {
|
||||
supporterButtons[i].addEventListener('click', onSupporterButtonClick);
|
||||
}
|
||||
|
||||
context.querySelector('.singleRecordingButton').addEventListener('click', onRecordChange.bind(self));
|
||||
context.querySelector('.seriesRecordingButton').addEventListener('click', onRecordSeriesChange.bind(self));
|
||||
context.querySelector('.btnManageRecording').addEventListener('click', onManageRecordingClick.bind(self));
|
||||
|
@ -334,17 +244,14 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
|||
};
|
||||
|
||||
RecordingEditor.prototype.hasChanged = function () {
|
||||
|
||||
return this.changed;
|
||||
};
|
||||
|
||||
RecordingEditor.prototype.refresh = function () {
|
||||
|
||||
fetchData(this);
|
||||
};
|
||||
|
||||
RecordingEditor.prototype.destroy = function () {
|
||||
|
||||
var timerChangedHandler = this.timerChangedHandler;
|
||||
this.timerChangedHandler = null;
|
||||
|
||||
|
|
|
@ -1,20 +1,8 @@
|
|||
<div class="convertRecordingsContainer hide infoBanner" style="margin: 1em 0 2em;">
|
||||
<h1 style="margin: .25em 0 .5em;">${HeaderConvertYourRecordings}</h1>
|
||||
<div class="fieldDescription">${PromoConvertRecordingsToStreamingFormat}</div>
|
||||
<br />
|
||||
<button is="emby-button" type="button" class="raised btnSupporter btnSupporterForConverting button-submit">
|
||||
<span>${HeaderLearnMore}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="supporterContainer hide infoBanner" style="margin: 1em 0 2em;">
|
||||
<div class="supporterContainerText"></div>
|
||||
<br />
|
||||
<button is="emby-button" type="button" class="btnSupporter raised button-submit block">
|
||||
<span>${HeaderBecomeProjectSupporter}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="recordingFields hide">
|
||||
|
||||
<div class="recordSeriesContainer recordingFields-buttons flex align-items-center hide">
|
||||
<div>
|
||||
<button is="emby-button" type="button" class="raised recordingButton seriesRecordingButton">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define(['globalize', 'loading', 'connectionManager', 'registrationServices'], function (globalize, loading, connectionManager, registrationServices) {
|
||||
define(['globalize', 'loading', 'connectionManager'], function (globalize, loading, connectionManager) {
|
||||
'use strict';
|
||||
|
||||
function changeRecordingToSeries(apiClient, timerId, programId, confirmTimerCancellation) {
|
||||
|
@ -18,7 +18,7 @@ define(['globalize', 'loading', 'connectionManager', 'registrationServices'], fu
|
|||
});
|
||||
});
|
||||
} else {
|
||||
// cancel
|
||||
// cancel
|
||||
if (confirmTimerCancellation) {
|
||||
return cancelTimerWithConfirmation(timerId, apiClient.serverId());
|
||||
}
|
||||
|
@ -190,30 +190,21 @@ define(['globalize', 'loading', 'connectionManager', 'registrationServices'], fu
|
|||
}
|
||||
|
||||
function toggleRecording(serverId, programId, timerId, timerStatus, seriesTimerId) {
|
||||
|
||||
return registrationServices.validateFeature('dvr').then(function () {
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
var hasTimer = timerId && timerStatus !== 'Cancelled';
|
||||
|
||||
if (seriesTimerId && hasTimer) {
|
||||
|
||||
// cancel
|
||||
return showMultiCancellationPrompt(serverId, programId, timerId, timerStatus, seriesTimerId);
|
||||
|
||||
} else if (hasTimer && programId) {
|
||||
|
||||
// change to series recording, if possible
|
||||
// otherwise cancel individual recording
|
||||
return changeRecordingToSeries(apiClient, timerId, programId, true);
|
||||
|
||||
} else if (programId) {
|
||||
// schedule recording
|
||||
return createRecording(apiClient, programId);
|
||||
} else {
|
||||
return Promise.reject();
|
||||
}
|
||||
});
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
var hasTimer = timerId && timerStatus !== 'Cancelled';
|
||||
if (seriesTimerId && hasTimer) {
|
||||
// cancel
|
||||
return showMultiCancellationPrompt(serverId, programId, timerId, timerStatus, seriesTimerId);
|
||||
} else if (hasTimer && programId) {
|
||||
// change to series recording, if possible
|
||||
// otherwise cancel individual recording
|
||||
return changeRecordingToSeries(apiClient, timerId, programId, true);
|
||||
} else if (programId) {
|
||||
// schedule recording
|
||||
return createRecording(apiClient, programId);
|
||||
} else {
|
||||
return Promise.reject();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue