Search in sources :

Example 21 with ParseManager

use of com.benmu.framework.manager.impl.ParseManager in project WeexErosFramework by bmfe.

the class EventShare method relayToCricle.

public void relayToCricle(Context context, String params, ArrayList<JSCallback> callbacks) {
    mSuccessCallback = callbacks.get(0);
    mFailedCallback = callbacks.get(1);
    if (context == null || TextUtils.isEmpty(params)) {
        if (mFailedCallback != null) {
            mFailedCallback.invoke(new BaseResultBean(WeChatRelayUtil.ERROR_ILLEGALARGUMENT, "参数有误"));
        }
        return;
    }
    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
    RelayBean object = parseManager.parseObject(params, RelayBean.class);
    if (object == null) {
        if (mFailedCallback != null) {
            mFailedCallback.invoke(new BaseResultBean(WeChatRelayUtil.ERROR_ILLEGALARGUMENT, "参数有误"));
        }
        return;
    }
    if (!WeChatRelayUtil.PLATFORM_WECHAT.equals(object.getPlatform())) {
        if (mFailedCallback != null) {
            mFailedCallback.invoke(new BaseResultBean(WeChatRelayUtil.ERROR_UNSUPPORT_PLATFORM, "不支持的平台"));
        }
        return;
    }
    // 不支持的平台
    if (WeChatRelayUtil.MEDIA_VIDEO.equals(object.getMediaType())) {
        // 粘贴描述到剪切板
        String description = object.getDescription();
        if (!TextUtils.isEmpty(description)) {
            BaseCommonUtil.copyString(context, object.getDescription());
            if (!TextUtils.isEmpty(object.getClipboardNotice())) {
                ModalManager.BmToast.toast(context, object.getClipboardNotice(), Toast.LENGTH_SHORT);
            }
        }
    }
    // 下载视频或图片
    downLoadResource(context, object, ACTION_CRICLE);
}
Also used : RelayBean(com.benmu.framework.model.RelayBean) BaseResultBean(com.benmu.framework.model.BaseResultBean) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Example 22 with ParseManager

use of com.benmu.framework.manager.impl.ParseManager in project WeexErosFramework by bmfe.

the class GTPushReceiver method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    Bundle bundle = intent.getExtras();
    switch(bundle.getInt(PushConsts.CMD_ACTION)) {
        case PushConsts.GET_MSG_DATA:
            // 收到透传消息
            byte[] payloads = bundle.getByteArray("payload");
            String content = null;
            try {
                content = new String(payloads, "UTF-8");
                Log.e("GPush", "payload>>>>>>>>" + content);
                if (!TextUtils.isEmpty(content)) {
                    ParseManager parseManager = ManagerFactory.getManagerService(ParseManager.class);
                    JSONObject payload = parseManager.parseObject(content);
                    if (payload != null) {
                        String data = payload.getString("payload");
                        ManagerFactory.getManagerService(PushManager.class).handlePush(context, data);
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            break;
        case PushConsts.GET_CLIENTID:
            // 收到clientId
            String mCid = bundle.getString("clientid");
            Log.e("GPush", "cid>>>>>>>>" + mCid);
            // 保存cid
            if (!TextUtils.isEmpty(mCid)) {
                SharePreferenceUtil.setClientId(context, mCid);
            }
            break;
        default:
            break;
    }
}
Also used : PushManager(com.benmu.framework.manager.impl.PushManager) JSONObject(com.alibaba.fastjson.JSONObject) Bundle(android.os.Bundle) ParseManager(com.benmu.framework.manager.impl.ParseManager)

Aggregations

ParseManager (com.benmu.framework.manager.impl.ParseManager)22 BaseResultBean (com.benmu.framework.model.BaseResultBean)6 View (android.view.View)4 ImageView (android.widget.ImageView)4 TextView (android.widget.TextView)4 ModalBean (com.benmu.framework.model.ModalBean)4 NavigatorBarModel (com.benmu.framework.model.NavigatorBarModel)4 BaseToolBar (com.benmu.widget.view.BaseToolBar)4 Activity (android.app.Activity)3 DialogInterface (android.content.DialogInterface)3 AbstractWeexActivity (com.benmu.framework.activity.AbstractWeexActivity)3 RouterModel (com.benmu.framework.model.RouterModel)3 Intent (android.content.Intent)2 JSONObject (com.alibaba.fastjson.JSONObject)2 AxiosManager (com.benmu.framework.manager.impl.AxiosManager)2 JsVersionInfoBean (com.benmu.framework.model.JsVersionInfoBean)2 RelayBean (com.benmu.framework.model.RelayBean)2 Bitmap (android.graphics.Bitmap)1 Bundle (android.os.Bundle)1 CompoundButton (android.widget.CompoundButton)1