| | |
| | | import com.hdl.photovoltaic.databinding.ActivityCpowerStationBinding; |
| | | import com.hdl.photovoltaic.enums.NetworkType; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.other.HdlAiLogic; |
| | | import com.hdl.photovoltaic.other.HdlCommonLogic; |
| | | import com.hdl.photovoltaic.other.HdlDeviceLogic; |
| | | import com.hdl.photovoltaic.other.HdlESLocalJsonLogic; |
| | |
| | | import com.hdl.photovoltaic.other.HdlUniLogic; |
| | | import com.hdl.photovoltaic.push.PushMessageInfoBean; |
| | | import com.hdl.photovoltaic.services.ForeService; |
| | | import com.hdl.photovoltaic.ui.bean.ChatInfoBean; |
| | | import com.hdl.photovoltaic.ui.bean.ChatMessageListBean; |
| | | import com.hdl.photovoltaic.ui.bean.ChatMessagePageBean; |
| | | import com.hdl.photovoltaic.ui.bean.DeviceRemoteInfo; |
| | | import com.hdl.photovoltaic.ui.bean.HouseIdBean; |
| | | import com.hdl.photovoltaic.ui.bean.MessageBean; |
| | |
| | | |
| | | @Override |
| | | public void onBindView(Bundle savedInstanceState) { |
| | | // //通知栏点击进来,防止应用在后台时被重复启动,阿里云推动通知指定打开某个Activity,没有设置Flags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);默认启动新实例,导致多个实例 |
| | | // if (!isTaskRoot()) { |
| | | // finish(); |
| | | // } |
| | | setStatusBarTranslucent(); |
| | | getWindow().setNavigationBarColor(getColor(R.color.text_FF000000)); |
| | | //C端启动App自动打开小程序电站详情界面 |
| | |
| | | this.initMqttClient(); |
| | | // //上传极光注册ID到云端 |
| | | // this.pushTokens(); |
| | | this.getChatInfo(); |
| | | //上传推动令牌到云端(谷歌FCM推送) |
| | | this.sendPushTokenToServer(UserConfigManage.getInstance().getPushToken()); |
| | | //点击通知栏消息进来 |
| | |
| | | HdlESLocalJsonLogic.getInstance().getAllHdlESLocalJson(); |
| | | // mForegroundService= new Intent(this, ForeService.class); |
| | | // startService(); |
| | | } |
| | | |
| | | /** |
| | | * 查看智能体详情 |
| | | * |
| | | */ |
| | | private void getChatInfo() { |
| | | HdlAiLogic.getInstance().getChatInfo(new CloudCallBeak<ChatInfoBean>() { |
| | | @Override |
| | | public void onSuccess(ChatInfoBean chatInfoBean) { |
| | | UserConfigManage.getInstance().setAgentSecret(chatInfoBean.getAgentSecret()); |
| | | UserConfigManage.getInstance().setAgentUrl(chatInfoBean.getAgentUrl()); |
| | | UserConfigManage.getInstance().Save(); |
| | | HdlAiLogic.getInstance().chatMessagesList(new CloudCallBeak<ChatMessagePageBean>() { |
| | | @Override |
| | | public void onSuccess(ChatMessagePageBean obj) { |
| | | if (obj != null && !obj.getData().isEmpty()) { |
| | | UserConfigManage.getInstance().setConversationId(obj.getData().get(0).getId()); |
| | | UserConfigManage.getInstance().Save(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | HdlLogLogic.print("获取智能体详情失败:" + e.getMessage(), true); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | Intent mForegroundService; |
| | |
| | | return; |
| | | } |
| | | PushMessageInfoBean pushMessageInfoBean = HdlPushLogic.getInstance().pushDataProcessing("", "", data); |
| | | if (TextUtils.isEmpty(pushMessageInfoBean.getMsgId())) { |
| | | if (TextUtils.isEmpty(pushMessageInfoBean.getMsgId()) && !pushMessageInfoBean.isAiPrompt()) { |
| | | return; |
| | | } |
| | | Log.d("==========111111", tag); |
| | | HDLUniMPSDKManager.uinEnabled = false; |
| | | if (tag.equals("onNewIntent")) { |
| | | HDLUniMPSDKManager.uinEnabled = false; |
| | |
| | | @Override |
| | | public void run() { |
| | | if (pushMessageInfoBean.isAiPrompt()) { |
| | | HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_open_ai_push_message, new HDLUniMP.UniCallBackBaseBean()); |
| | | HDLUniMP.UniCallBackBaseBean uniCallBackBaseBean = new HDLUniMP.UniCallBackBaseBean(); |
| | | uniCallBackBaseBean.setType(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_open_ai_push_message); |
| | | HdlUniLogic.getInstance().sendUni(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL, uniCallBackBaseBean); |
| | | HdlLogLogic.print("uni---原生主动向小程序发送通知AI事件---", false); |
| | | } else { |
| | | MessageBean messageBean = new MessageBean(); |
| | | messageBean.setMsgId(Long.valueOf(pushMessageInfoBean.getMsgId())); |
| | |
| | | intentMessageInfoActivity.setClass(_mActivity, MessageInfoActivity.class); |
| | | intentMessageInfoActivity.putExtra("messageBean", JSONObject.toJSONString(messageBean)); |
| | | startActivity(intentMessageInfoActivity); |
| | | HdlLogLogic.print("uni---原生主动向小程序发送通知AI事件---11111", false); |
| | | } |
| | | |
| | | } |
| | |
| | | //防止app启动的时候没有网络(app也登录不了),导致获取不了mqtt远程连接信息; |
| | | initMqttClient(); |
| | | |
| | | HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(UserConfigManage.getInstance().getHomeId(), new CloudCallBeak<List<GatewayBean>>() { |
| | | HdlDeviceLogic.getInstance().getCurrentHomeLocalAndCloudGatewayList(UserConfigManage.getInstance().getHomeId(), UserConfigManage.getInstance().getPowerStationType(), new CloudCallBeak<List<GatewayBean>>() { |
| | | @Override |
| | | public void onSuccess(List<GatewayBean> obj) { |
| | | // AppManagerUtils.getAppManager().hideLoading(); |
| | |
| | | } |
| | | HouseIdBean houseIdBean = HouseIdList.get(select_home); |
| | | HdlResidenceLogic.getInstance().switchHouse(houseIdBean, false); |
| | | String path = HDLUniMP.UNI_EVENT_OPEN_HOME_DETAILS_C + "?homeId=" + houseIdBean.getHomeId() + "&homeName=" + houseIdBean.getHomeName() + "&powerStationStatus=" + houseIdBean.getPowerStationStatus(); |
| | | HdlUniLogic.getInstance().openUniMP(path, null); |
| | | HdlResidenceLogic.getInstance().openPowerStationDetails(houseIdBean); |
| | | } |
| | | |
| | | } |
| | |
| | | // UserConfigManage.getInstance().setRegistrationID(registrationID); |
| | | // UserConfigManage.getInstance().Save(); |
| | | String finalRegistrationID = registrationID; |
| | | HdlResidenceLogic.getInstance().pushAdd(new CloudCallBeak<String>() { |
| | | HdlPushLogic.getInstance().pushAdd(new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String pushId) { |
| | | |
| | |
| | | if (TextUtils.isEmpty(token)) { |
| | | return; |
| | | } |
| | | HdlResidenceLogic.getInstance().pushAdd(new CloudCallBeak<String>() { |
| | | HdlPushLogic.getInstance().pushAdd(new CloudCallBeak<String>() { |
| | | @Override |
| | | public void onSuccess(String pushId) { |
| | | |