add luna command: addReservation / deleteReservation
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import appinfo from "../../webos-meta/appinfo.json";
|
||||
import LS2Request from "./LS2Request";
|
||||
|
||||
export const getConnectionStatus = ({ onSuccess, onFailure, onComplete }) => {
|
||||
@@ -191,3 +192,77 @@ export const setSubtitleEnableOver5 = (
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// system Alert
|
||||
export const addReservation = (data) => {
|
||||
if (typeof window === "object" && !window.PalmSystem) {
|
||||
console.log("LUNA SEND addReservation data", data);
|
||||
return;
|
||||
}
|
||||
|
||||
return new LS2Request().send({
|
||||
service: "luna://com.webos.service.tvReservationAgent",
|
||||
method: "add",
|
||||
parameters: {
|
||||
scheduleType: "LGShopping",
|
||||
startTime: {
|
||||
month: data.startTime.month,
|
||||
day: data.startTime.day,
|
||||
hour: data.startTime.hour,
|
||||
minute: data.startTime.minute,
|
||||
year: data.startTime.year,
|
||||
second: data.startTime.second,
|
||||
},
|
||||
callback: {
|
||||
method: "luna://com.webos.notification/createAlert",
|
||||
params: {
|
||||
message: data.params.message,
|
||||
buttons: [
|
||||
{
|
||||
label: data.params.buttons[0].label,
|
||||
onclick: "luna://com.webos.applicationManager/launch",
|
||||
params: {
|
||||
id: window.PalmSystem.identifier ?? appinfo.id,
|
||||
params: data.params.launch,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: data.params.buttons[1].label,
|
||||
},
|
||||
],
|
||||
autoTimeout: 30,
|
||||
},
|
||||
},
|
||||
information: {
|
||||
showId: data.params.showId,
|
||||
},
|
||||
},
|
||||
onSuccess: (res) => {
|
||||
console.log("LUNA SEND addReservation success", res);
|
||||
},
|
||||
onFailure: (err) => {
|
||||
console.log("LUNA SEND addReservation failed", err);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteReservation = (scheduleIdList) => {
|
||||
if (typeof window === "object" && !window.PalmSystem) {
|
||||
console.log("LUNA SEND deleteReservation scheduleIdList", scheduleIdList);
|
||||
return;
|
||||
}
|
||||
|
||||
return new LS2Request().send({
|
||||
service: "luna://com.webos.service.tvReservationAgent",
|
||||
method: "delete",
|
||||
parameters: {
|
||||
scheduleIdList: scheduleIdList,
|
||||
},
|
||||
onSuccess: (res) => {
|
||||
console.log("LUNA SEND deleteReservation success", res);
|
||||
},
|
||||
onFailure: (err) => {
|
||||
console.log("LUNA SEND deleteReservation failed", err);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user