props統合
This commit is contained in:
parent
9738b752fb
commit
170bc36afa
@ -44,33 +44,38 @@ export const getDelayData = async () => {
|
||||
return { time, delayString };
|
||||
};
|
||||
export async function widgetTaskHandler(props) {
|
||||
const {
|
||||
widgetInfo,
|
||||
widgetAction,
|
||||
renderWidget,
|
||||
clickAction,
|
||||
clickActionData,
|
||||
} = props;
|
||||
const WidgetName = await AS.getItem(
|
||||
`widgetType/${props.widgetInfo.widgetId}`
|
||||
`widgetType/${widgetInfo.widgetId}`
|
||||
).catch((e) => "JR_shikoku_train_info");
|
||||
ToastAndroid.show(
|
||||
`Widget Action: ${JSON.stringify(props.widgetInfo.widgetId)}`,
|
||||
`Widget Action: ${JSON.stringify(widgetInfo.widgetId)}`,
|
||||
ToastAndroid.SHORT
|
||||
);
|
||||
ToastAndroid.show(`Widget Name: ${WidgetName}`, ToastAndroid.SHORT);
|
||||
switch (props.widgetAction) {
|
||||
switch (widgetAction) {
|
||||
case "WIDGET_ADDED":
|
||||
case "WIDGET_UPDATE":
|
||||
case "WIDGET_CLICK":
|
||||
case "WIDGET_RESIZED":
|
||||
if (WidgetName === "JR_shikoku_train_info") {
|
||||
const { time, delayString } = await getDelayData();
|
||||
props.renderWidget(
|
||||
<TraInfoEXWidget time={time} delayString={delayString} />
|
||||
);
|
||||
renderWidget(<TraInfoEXWidget time={time} delayString={delayString} />);
|
||||
} else if (WidgetName === "Info_Widget") {
|
||||
const { time, text } = await getInfoString();
|
||||
props.renderWidget(<InfoWidget time={time} delayString={text} />);
|
||||
renderWidget(<InfoWidget time={time} delayString={text} />);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "WIDGET_DELETED":
|
||||
AS.removeItem(`widgetType/${props.widgetInfo.widgetId}`);
|
||||
AS.removeItem(`widgetType/${widgetInfo.widgetId}`);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user