From 399ac289f80b7a40aa4210341db6b447cacdcf14 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 09 八月 2022 17:42:33 +0800
Subject: [PATCH] 广告升级,隐私政策整改

---
 app/src/main/java/com/tejia/lijin/app/util/web/RebateJavaInterfaceBS.java |  139 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 121 insertions(+), 18 deletions(-)

diff --git a/app/src/main/java/com/tejia/lijin/app/util/web/RebateJavaInterfaceBS.java b/app/src/main/java/com/tejia/lijin/app/util/web/RebateJavaInterfaceBS.java
index f7fb93e..9d4100b 100644
--- a/app/src/main/java/com/tejia/lijin/app/util/web/RebateJavaInterfaceBS.java
+++ b/app/src/main/java/com/tejia/lijin/app/util/web/RebateJavaInterfaceBS.java
@@ -40,9 +40,11 @@
 import com.tejia.lijin.app.callBack.GeneralBackCallback;
 import com.tejia.lijin.app.callBack.PermissionInterface;
 import com.tejia.lijin.app.entity.ImgText;
+import com.tejia.lijin.app.entity.JumpDetail;
 import com.tejia.lijin.app.entity.share.ShareImageEntity;
 import com.tejia.lijin.app.ui.dialog.ShapeLoadingDialog;
 import com.tejia.lijin.app.ui.invite.ShareBrowserActivity;
+import com.tejia.lijin.app.updateApp.UpdateApp;
 import com.tejia.lijin.app.util.JumpActivityUtil;
 import com.tejia.lijin.app.util.PermissionHelper;
 import com.tejia.lijin.app.util.ToastUtil;
@@ -129,7 +131,7 @@
         } else {//瀛樺偍鏉冮檺宸插紑
             String md5 = MD5Utils.getMD532(url.toString());
             String path = com.wpc.library.util.Environment.getExternalStorageDirectory()
-                    + "/blksapp";
+                    + "/tejiaapp";
             File file = new File(path + "/" + md5 + ".jpg");
             if (!file.exists()) {
                 try {
@@ -145,6 +147,53 @@
 
             } else {
                 Toast.makeText(mContext, "鍥剧墖宸茬粡淇濆瓨!", Toast.LENGTH_LONG).show();
+            }
+        }
+    }
+
+
+    /**
+     * 寮傛淇濆瓨鍥剧墖
+     *
+     * @param args
+     * @param handler
+     * @throws JSONException
+     */
+    public void savePictureAsync(Object args, final CompletionHandler handler) throws JSONException {
+        JSONObject jsonObject = new JSONObject(args.toString());
+        String url = jsonObject.optString("url");
+        if (mPermissionsChecker == null)
+            mPermissionsChecker = new PermissionHelper(mContext, this);
+        if (mPermissionsChecker.lacksPermissions(getPermissions())) { //瀛樺偍鏉冮檺鏈紑鍚�
+            mPermissionsChecker.showNormalDialog();
+        } else {//瀛樺偍鏉冮檺宸插紑
+            String md5 = MD5Utils.getMD532(url);
+            String path = com.wpc.library.util.Environment.getExternalStorageDirectory()
+                    + "/tejiaapp";
+            File file = new File(path + "/" + md5 + ".jpg");
+            if (!file.exists()) {
+                try {
+                    File resultFile = Tools.saveImageFromPathToSdCard(mContext, url, path, md5 + ".jpg");
+                    if (resultFile != null) {
+                        JSONObject result = new JSONObject();
+                        result.put("code", 0);
+                        result.put("msg", "淇濆瓨鎴愬姛");
+                        handler.complete(result);
+                    }
+                } catch (Exception e) {
+                    JSONObject result = new JSONObject();
+                    result.put("code", 1);
+                    result.put("msg", "鍥剧墖淇濆瓨澶辫触");
+                    handler.complete(result);
+                    if (file.exists())
+                        file.delete();
+                }
+
+            } else {
+                JSONObject result = new JSONObject();
+                result.put("code", 2);
+                result.put("msg", "鍥剧墖宸茬粡淇濆瓨");
+                handler.complete(result);
             }
         }
     }
@@ -239,6 +288,21 @@
         mContext.startActivity(intent);
         if (!boo)
             mContext.finish();
+    }
+
+
+    /**
+     * 璺宠浆涓夋柟骞冲彴
+     *
+     * @param args
+     * @throws JSONException
+     */
+    @JavascriptInterface
+    public void jumpThirdPlatform(Object args) throws JSONException {
+        JSONObject json = new JSONObject(args.toString());
+        JumpDetail jumpDetail = new JumpDetail();
+        jumpDetail.setType("thirdPlatform");
+        JumpActivityUtil.jumpPage(mContext, jumpDetail, com.alibaba.fastjson.JSONObject.parseObject(json.toString()));
     }
 
 
@@ -357,11 +421,10 @@
         int type = json.optInt("type");
         final String url = json.optString("url");
 
-        //妫�娴嬫潈闄�
-        String[] str = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
-                Manifest.permission.WRITE_EXTERNAL_STORAGE};
-        if (lacksPermissions(str)) {//缂哄皯鏉冮檺
-            generalBackCallback.onSuccess(type, url);
+        if (mPermissionsChecker == null)
+            mPermissionsChecker = new PermissionHelper(mContext, this);
+        if (mPermissionsChecker.lacksPermissions(getPermissions())) { //瀛樺偍鏉冮檺鏈紑鍚�
+            mPermissionsChecker.showNormalDialog();
         } else {
             this.type = type;
             this.imgurl = url;
@@ -392,10 +455,10 @@
         final String urls = json.optString("urls");
 
 
-        String[] str = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
-                Manifest.permission.WRITE_EXTERNAL_STORAGE};
-        if (lacksPermissions(str)) {//缂哄皯鏉冮檺
-            generalBackCallback.onSuccess(type, null);
+        if (mPermissionsChecker == null)
+            mPermissionsChecker = new PermissionHelper(mContext, this);
+        if (mPermissionsChecker.lacksPermissions(getPermissions())) { //瀛樺偍鏉冮檺鏈紑鍚�
+            mPermissionsChecker.showNormalDialog();
         } else {
             List<String> urlList = new ArrayList<>();
             try {
@@ -479,8 +542,6 @@
                 TTAdNative mTTAdNative = TTAdSdk.getAdManager().createAdNative(mContext);
                 AdSlot adSlot = new AdSlot.Builder()
                         .setCodeId(pid)
-                        .setRewardName("閲戝竵") //濂栧姳鐨勫悕绉� 閫夊~
-                        .setRewardAmount(3)  //濂栧姳鐨勬暟閲� 閫夊~
 //                        .setUserID("tag123")//tag_id
                         .setMediaExtra("media_extra") //闄勫姞鍙傛暟
                         .setOrientation(TTAdConstant.VERTICAL) //蹇呭~鍙傛暟锛屾湡鏈涜棰戠殑鎾斁鏂瑰悜锛歍TAdConstant.HORIZONTAL 鎴� TTAdConstant.VERTICAL
@@ -511,6 +572,16 @@
                         handler.setProgressData(result);
                     }
 
+                    @Override
+                    public void onRewardVideoCached(TTRewardVideoAd ttRewardVideoAd) {
+                        mttRewardVideoAd=ttRewardVideoAd;
+                        //寮�鍙戣�呭仛涓�涓爣璇�
+                        com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject();
+                        result.put("code", 100);
+                        result.put("msg", "缂撳瓨鎴愬姛");
+                        handler.setProgressData(result);
+                    }
+
                     //瑙嗛骞垮憡鐨勭礌鏉愬姞杞藉畬姣曪紝姣斿瑙嗛url绛夛紝鍦ㄦ鍥炶皟鍚庯紝鍙互鎾斁鍦ㄧ嚎瑙嗛锛岀綉缁滀笉濂藉彲鑳藉嚭鐜板姞杞界紦鍐诧紝褰卞搷浣撻獙銆�
                     @Override
                     public void onRewardVideoAdLoad(TTRewardVideoAd ad) {
@@ -519,7 +590,10 @@
                         mttRewardVideoAd.setRewardAdInteractionListener(new TTRewardVideoAd.RewardAdInteractionListener() {
                             @Override
                             public void onAdShow() {
-
+                                com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject();
+                                result.put("code", 201);
+                                result.put("msg", "骞垮憡寮�濮嬪睍绀�");
+                                handler.setProgressData(result);
                             }
 
                             @Override
@@ -539,7 +613,7 @@
 
                             @Override
                             public void onVideoError() {
-                                com.alibaba.fastjson.JSONObject  result = new com.alibaba.fastjson.JSONObject();
+                                com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject();
                                 result.put("code", 2);
                                 result.put("msg", "瑙嗛鍑洪敊");
                                 handler.complete(result);
@@ -547,10 +621,15 @@
 
                             @Override
                             public void onRewardVerify(boolean b, int i, String s, int i1, String s1) {
-                                com.alibaba.fastjson.JSONObject  result = new com.alibaba.fastjson.JSONObject();
+                                com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject();
                                 result.put("code", 0);
                                 result.put("msg", "骞垮憡灞曠ず瀹屾垚");
                                 handler.complete(result);
+                            }
+
+                            @Override
+                            public void onRewardArrived(boolean b, int i, Bundle bundle) {
+
                             }
 
                             @Override
@@ -594,6 +673,29 @@
                 ToastUtil.showToast(view, view.getContext(), Toast.LENGTH_SHORT, Gravity.CENTER);
             }
         });
+    }
+
+
+    @JavascriptInterface
+    public void checkUpdate(Object obj) {
+        UpdateApp app = new UpdateApp(mContext, mContext.getResources().getString(R.string.update_key));
+        app.getUpdateInfo(new UpdateApp.UpdateJudgeCallback() {
+
+            @Override
+            public void onSuccess(boolean show) {
+
+            }
+
+            @Override
+            public void closeUpdate(boolean close) {
+
+            }
+
+            @Override
+            public void onFinish() {
+
+            }
+        }, true);//寮哄埗妫�娴嬫洿鏂�
     }
 
 
@@ -665,7 +767,7 @@
                     + "/rebateshare";
         } else if (type == 2) {
             path = com.wpc.library.util.Environment.getExternalStorageDirectory()
-                    + "/blksapp";
+                    + "/tejiaapp";
         }
         final File storageDir = new File(path);
         List<String> filePathList = new ArrayList<>();
@@ -774,9 +876,9 @@
 
                     ArrayList<Uri> uriList = new ArrayList<Uri>();
                     if (imageList != null)
-                        for (ShareImageEntity entity : imageList)
+                        for (ShareImageEntity entity : imageList) {
                             uriList.add(Tools.getImageContentUri(mContext, new File(entity.getFilePath())));
-
+                        }
                     if (platfrom == 1) {
                         ShareImageUtil.shareWXPictureByIntent(mContext, uriList);
                     } else if (platfrom == 2) {
@@ -879,4 +981,5 @@
     public void requestPermissionsFail() {
 //        Toast.makeText(this, "浣犱互鎷掔粷鏉冮檺", Toast.LENGTH_SHORT).show();
     }
+
 }

--
Gitblit v1.8.0