Search in sources :

Example 1 with EventDeleteData

use of com.benmu.framework.event.shorage.EventDeleteData in project WeexErosFramework by bmfe.

the class DispatchEventCenter method onWeexEvent.

@Subscribe
public void onWeexEvent(WeexEventBean weexEventBean) {
    if (weexEventBean == null)
        return;
    Context context = safeContext(weexEventBean.getContext());
    if (context == null)
        return;
    String params = weexEventBean.getJsParams();
    switch(weexEventBean.getKey()) {
        case WXConstant.WXEventCenter.EVENT_PAYBYWECHAT:
            if (TextUtils.isEmpty(params))
                return;
            new EventPay().pay(params, context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_OPEN:
            if (TextUtils.isEmpty(params))
                return;
            if (weexEventBean.getCallbacks() != null) {
                new EventOpen().open(params, context, weexEventBean.getCallbacks());
            } else if (weexEventBean.getJscallback() != null) {
                new EventOpen().open(params, context, weexEventBean.getJscallback());
            } else {
                new EventOpen().open(params, context);
            }
            break;
        case WXConstant.WXEventCenter.EVENT_GETPARAMS:
            new EventGetParams().getParams(context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_BACK:
            new EventBack().back(params, context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_GETBACKPARAMS:
            new EventGetBackParams().getBackParams(context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_REFRESH:
            new EventRefresh().refresh(context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_FINISH:
            new EventFinish().finish(context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_TOMAP:
            new EventToMap().toMap(params, context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_TOWEBVIEW:
            new EventWebView().toWebView(params, context);
            break;
        case WXConstant.WXEventCenter.EVENT_CALL:
            new EventCall().call(params, context);
            break;
        case WXConstant.WXEventCenter.EVENT_SETDATA:
            new EventSetData().setData(context, weexEventBean.getParamsList(), weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_GETDATA:
            new EventGetData().getData(context, weexEventBean.getParamsList(), weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_DELETEDATA:
            new EventDeleteData().deleteData(context, weexEventBean.getParamsList(), weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_REMOVEDATA:
            new EventRemoveData().removeData(context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_BROWSERIMG:
            if (TextUtils.isEmpty(params))
                return;
            new EventBrowse().open(params, context);
            break;
        case WXConstant.WXEventCenter.EVENT_MODAL_ALERT:
            if (TextUtils.isEmpty(params))
                return;
            JSCallback modal_alert_callback = weexEventBean.getJscallback();
            new EventAlert().alert(params, modal_alert_callback, context);
            break;
        case WXConstant.WXEventCenter.EVENT_MODAL_CONFIRM:
            if (TextUtils.isEmpty(params))
                return;
            ArrayList<JSCallback> callbacks = weexEventBean.getCallbacks();
            if (callbacks == null && callbacks.size() < 2)
                return;
            new EventConfirm().confirm(params, callbacks.get(0), callbacks.get(1), context);
            break;
        case WXConstant.WXEventCenter.EVENT_MODAL_SHOWLOADING:
            if (TextUtils.isEmpty(params))
                return;
            JSCallback modal_showloading_callback = weexEventBean.getJscallback();
            new EventShowLoading().showLoading(params, modal_showloading_callback, context);
            break;
        case WXConstant.WXEventCenter.EVENT_MODAL_TOAST:
            if (TextUtils.isEmpty(params))
                return;
            new EventToast().toast(params, context);
            break;
        case WXConstant.WXEventCenter.EVENT_FETCH:
            new EventFetch().fetch(params, context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_CAMERA_UPLOADIMAGE:
            new EventCamera().uploadImage(params, context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_CAMERA_PATH:
            new EventCamera().openCamera(params, context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_CAMERA:
            JSCallback jscallback = weexEventBean.getJscallback();
            new EventCamera().scan(jscallback, context);
            break;
        case WXConstant.WXEventCenter.EVENT_RIGHTITEM:
            new EventRightItem().setRightItem(params, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_LEFTITEM:
            new EventLeftItem().setLeftItem(params, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_CENTERITEM:
            new EventCenterItem().setCenterItem(params, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_NAVIGATIONINFO:
            new EventNavigationInfo().setNavigationInfo(params, context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_RESIGNKEYBOARD:
            new EventTool().resignKeyboard(context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_ISINSTALLWXAPP:
            new EventTool().isWXInstall(context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_GETCID:
            new EventTool().getCid(context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_COPYSTRING:
            new EventTool().copyString(context, params, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_MODAL_DISMISSLOADING:
            new EventDismissLoading().dismiss(context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_SHARE:
            new EventShare().share(context, params, weexEventBean.getCallbacks().get(0), weexEventBean.getCallbacks().get(1));
            break;
        case WXConstant.WXEventCenter.EVENT_RELAYTOFRIEND:
            new EventShare().relayToFriend(context, params, weexEventBean.getCallbacks());
            break;
        case WXConstant.WXEventCenter.EVENT_RELAYTOCRICLE:
            new EventShare().relayToCricle(context, params, weexEventBean.getCallbacks());
            break;
        case WXConstant.WXEventCenter.EVENT_WECHATLOGIN:
            new EventAuth().wechat(context, params, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_OPENBROWSER:
            new EventOpenBrowser().openBrowser(context, params, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_COMMUNICATION_SMS:
            new EventCommunication().sms(weexEventBean.getExpand().toString(), params, context);
            break;
        case WXConstant.WXEventCenter.EVENT_COMMUNICATION_CONTACTS:
            new EventCommunication().contacts(context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_SET_HOMEPAGE:
            new EventSetHomePage().setHomePage(context, params);
            break;
        case WXConstant.WXEventCenter.EVENT_IMAGE_PICK:
            new EventImage().pick(params, context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_IMAGE_UPLOAD:
            new EventFetch().uploadImage(params, context, weexEventBean.getJscallback());
            break;
        case WXConstant.WXEventCenter.EVENT_NAV:
            new EventNav().nav(params, context);
            break;
        case WXConstant.WXEventCenter.EVENT_GEOLOCATION_GET:
            reflectionClazzPerform("com.plugamap.EventGeo", context, params, weexEventBean.getJscallback(), "");
            break;
        default:
            break;
    }
}
Also used : EventRightItem(com.benmu.framework.event.nav.EventRightItem) EventNavigationInfo(com.benmu.framework.event.nav.EventNavigationInfo) EventImage(com.benmu.framework.event.camera.EventImage) EventDismissLoading(com.benmu.framework.event.modal.EventDismissLoading) EventBack(com.benmu.framework.event.router.EventBack) EventBrowse(com.benmu.framework.event.browse.EventBrowse) EventOpenBrowser(com.benmu.framework.event.router.EventOpenBrowser) EventSetHomePage(com.benmu.framework.event.router.EventSetHomePage) EventShare(com.benmu.framework.event.share.EventShare) EventAuth(com.benmu.framework.event.auth.EventAuth) EventCamera(com.benmu.framework.event.camera.EventCamera) EventAlert(com.benmu.framework.event.modal.EventAlert) EventGetBackParams(com.benmu.framework.event.router.EventGetBackParams) EventLeftItem(com.benmu.framework.event.nav.EventLeftItem) Context(android.content.Context) EventGetParams(com.benmu.framework.event.router.EventGetParams) EventRefresh(com.benmu.framework.event.router.EventRefresh) EventPay(com.benmu.framework.event.pay.EventPay) EventRemoveData(com.benmu.framework.event.shorage.EventRemoveData) EventTool(com.benmu.framework.event.tool.EventTool) EventNav(com.benmu.framework.event.router.EventNav) EventWebView(com.benmu.framework.event.router.EventWebView) EventSetData(com.benmu.framework.event.shorage.EventSetData) EventToMap(com.benmu.framework.event.router.EventToMap) EventGetData(com.benmu.framework.event.shorage.EventGetData) EventOpen(com.benmu.framework.event.router.EventOpen) EventFinish(com.benmu.framework.event.router.EventFinish) EventToast(com.benmu.framework.event.modal.EventToast) JSCallback(com.taobao.weex.bridge.JSCallback) EventCall(com.benmu.framework.event.router.EventCall) EventDeleteData(com.benmu.framework.event.shorage.EventDeleteData) EventFetch(com.benmu.framework.event.http.EventFetch) EventCenterItem(com.benmu.framework.event.nav.EventCenterItem) EventShowLoading(com.benmu.framework.event.modal.EventShowLoading) EventConfirm(com.benmu.framework.event.modal.EventConfirm) Subscribe(com.squareup.otto.Subscribe)

Example 2 with EventDeleteData

use of com.benmu.framework.event.shorage.EventDeleteData in project WeexErosFramework by bmfe.

the class StorageModule method deleteDataSync.

@JSMethod(uiThread = false)
public Object deleteDataSync(String key) {
    ArrayList<String> list = new ArrayList();
    list.add(key);
    return new EventDeleteData().deleteDataSync(mWXSDKInstance.getContext(), list);
}
Also used : EventDeleteData(com.benmu.framework.event.shorage.EventDeleteData) ArrayList(java.util.ArrayList) JSMethod(com.taobao.weex.annotation.JSMethod)

Aggregations

EventDeleteData (com.benmu.framework.event.shorage.EventDeleteData)2 Context (android.content.Context)1 EventAuth (com.benmu.framework.event.auth.EventAuth)1 EventBrowse (com.benmu.framework.event.browse.EventBrowse)1 EventCamera (com.benmu.framework.event.camera.EventCamera)1 EventImage (com.benmu.framework.event.camera.EventImage)1 EventFetch (com.benmu.framework.event.http.EventFetch)1 EventAlert (com.benmu.framework.event.modal.EventAlert)1 EventConfirm (com.benmu.framework.event.modal.EventConfirm)1 EventDismissLoading (com.benmu.framework.event.modal.EventDismissLoading)1 EventShowLoading (com.benmu.framework.event.modal.EventShowLoading)1 EventToast (com.benmu.framework.event.modal.EventToast)1 EventCenterItem (com.benmu.framework.event.nav.EventCenterItem)1 EventLeftItem (com.benmu.framework.event.nav.EventLeftItem)1 EventNavigationInfo (com.benmu.framework.event.nav.EventNavigationInfo)1 EventRightItem (com.benmu.framework.event.nav.EventRightItem)1 EventPay (com.benmu.framework.event.pay.EventPay)1 EventBack (com.benmu.framework.event.router.EventBack)1 EventCall (com.benmu.framework.event.router.EventCall)1 EventFinish (com.benmu.framework.event.router.EventFinish)1