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);
}
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;
}
}
Aggregations