diff --git a/components/AndroidWidget/widget-task-handler.jsx b/components/AndroidWidget/widget-task-handler.jsx index d6b811d..7878f6f 100644 --- a/components/AndroidWidget/widget-task-handler.jsx +++ b/components/AndroidWidget/widget-task-handler.jsx @@ -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( - - ); + renderWidget(); } else if (WidgetName === "Info_Widget") { const { time, text } = await getInfoString(); - props.renderWidget(); + renderWidget(); } break; case "WIDGET_DELETED": - AS.removeItem(`widgetType/${props.widgetInfo.widgetId}`); + AS.removeItem(`widgetType/${widgetInfo.widgetId}`); break; default: break;