From abce02c7a61820f5d580f87364d542e817be429c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 06 七月 2021 15:22:11 +0800 Subject: [PATCH] 1.1.1完善 --- app/src/main/java/com/tejia/lijin/app/util/ToolUtil.java | 100 ++------------------------------------------------ 1 files changed, 4 insertions(+), 96 deletions(-) diff --git a/app/src/main/java/com/tejia/lijin/app/util/ToolUtil.java b/app/src/main/java/com/tejia/lijin/app/util/ToolUtil.java index dac0a8e..47ff88a 100644 --- a/app/src/main/java/com/tejia/lijin/app/util/ToolUtil.java +++ b/app/src/main/java/com/tejia/lijin/app/util/ToolUtil.java @@ -39,10 +39,9 @@ import com.alibaba.baichuan.android.trade.model.AlibcShowParams; import com.alibaba.baichuan.android.trade.model.OpenType; import com.app.hubert.guide.util.ScreenUtils; -import com.coloros.mcssdk.PushManager; import com.google.gson.Gson; -import com.huawei.android.hms.agent.HMSAgent; -import com.huawei.android.hms.agent.push.handler.EnableReceiveNormalMsgHandler; +import com.heytap.msp.push.HeytapPushManager; +import com.heytap.msp.push.callback.ICallBackResultService; import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache; @@ -391,39 +390,6 @@ } /** - * 娉ㄥ唽 OPPO RegId - */ - public static void registeredOPPOId(Context context) { - String registerId = null; - if (PushManager.getInstance() != null) - registerId = PushManager.getInstance().getRegisterID(); - if (!StringUtils.isEmpty(registerId)) - ShoppingApi.bindOPPOPush(context, UserUtil.getUid(ShoppingApplication.application), registerId, new BasicTextHttpResponseHandler() { - @Override - public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { - super.onSuccessPerfect(statusCode, headers, jsonObject); - } - }); - } - - /** - * 娉ㄥ唽 VIVO RegId - */ - public static void registeredVIVORegId(Context context) { -// Log.e("eee", "registeredVIVORegId-uid: " + uid); - String registerId = null; - if (PushClient.getInstance(context) != null) - registerId = PushClient.getInstance(context).getRegId(); - if (!StringUtils.isEmpty(registerId)) - ShoppingApi.bindVIVOPush(context, UserUtil.getUid(ShoppingApplication.application), registerId, new BasicTextHttpResponseHandler() { - @Override - public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { - super.onSuccessPerfect(statusCode, headers, jsonObject); - } - }); - } - - /** * 鎺ㄩ�佸厤鎵撴壈妯″紡 * * @param mContext 涓婁笅鏂� @@ -450,73 +416,15 @@ weekDays.add(i); } if (isChecked) - PushManager.getInstance().setPushTime(weekDays, 20, 0, 8, 0); + HeytapPushManager.setPushTime(weekDays, 20, 0, 8, 0); else - PushManager.getInstance().setPushTime(weekDays, 0, 0, 23, 59); + HeytapPushManager.setPushTime(weekDays, 0, 0, 23, 59); break; case "vivo": break; default: break; } - } - } - - /** - * 鎵撳紑鎴栧叧闂帹閫� - */ - public static void setPush_OFF_NO(MainActivity mContext) { - if (mContext != null) { - /** - * false 鍏抽棴鎺ㄩ�� - * _01 绗竴娆℃煡璇紙绗竴娆℃煡璇� 鍏抽棴鎺ㄩ�� 鍙叧闂竴娆★級 - * true 寮�鍚帹閫� - * _02 浜屾鏌ヨ锛堝彧寮�鍚竴娆★級 - * */ - SharedPreferences sp = mContext.getSharedPreferences("user", Context.MODE_PRIVATE); - String off_no = sp.getString("push_off_no", "false_01"); - SharedPreferences.Editor editor = sp.edit(); - String mBRAND = Build.BRAND.toLowerCase(); - if (mBRAND.equals("xiaomi")) { -// Log.e("eee", "setPush_OFF_NO: " + mBRAND + "--" + off_no); - if (off_no.equals("false_01")) {//鍏抽棴涓�娆℃帹閫� -// Log.e("eee", "setPush_OFF_NO: 鍏抽棴MiPush鎺ㄩ�佹湇鍔�"); - MiPushClient.pausePush(mContext, null);/**鏆傚仠鎺ユ敹MiPush鏈嶅姟鎺ㄩ�佺殑娑堟伅*/ - editor.putString("push_off_no", "false_02"); - } else if (off_no.equals("true_01")) { -// Log.e("eee", "setPush_OFF_NO: 鍚敤MiPush鎺ㄩ�佹湇鍔�"); - MiPushClient.resumePush(mContext, null);/**鎭㈠鎺ユ敹MiPush鏈嶅姟鎺ㄩ�佺殑娑堟伅锛岃繖鏃舵湇鍔″櫒浼氭妸鏆傚仠鏃舵湡鐨勬帹閫佹秷鎭噸鏂版帹閫佽繃鏉�*/ - editor.putString("push_off_no", "true_02"); - } - } else if (mBRAND.equals("huawei") || mBRAND.equals("honor")) { -// Log.e("eee", "honor: "); - if (off_no.equals("false_01")) { - editor.putString("push_off_no", "false_02"); - HMSAgent.Push.enableReceiveNormalMsg(false, new EnableReceiveNormalMsgHandler() { - @Override - public void onResult(int rst) { - } - }); - } else if (off_no.equals("true_01")) { - editor.putString("push_off_no", "true_02"); - HMSAgent.Push.enableReceiveNormalMsg(true, new EnableReceiveNormalMsgHandler() { - @Override - public void onResult(int rst) { - } - }); - } - } else if (mBRAND.equals("oppo")) { - if (off_no.equals("false_01")) { - PushManager.getInstance().pausePush();/*** 鏆傚仠鎺ユ敹OPush鏈嶅姟鎺ㄩ�佺殑娑堟伅*/ - editor.putString("push_off_no", "false_02"); - } else if (off_no.equals("true_01")) { - PushManager.getInstance().resumePush();/*** 鎭㈠鎺ユ敹OPush鏈嶅姟鎺ㄩ�佺殑娑堟伅锛岃繖鏃舵湇鍔″櫒浼氭妸鏆傚仠鏃舵湡鐨勬帹閫佹秷鎭噸鏂版帹閫佽繃鏉�*/ - editor.putString("push_off_no", "true_02"); - } - } else if (mBRAND.equals("vivo")) { - - } - editor.commit(); } } -- Gitblit v1.8.0