Przeglądaj źródła

通过配置地址来决定跳转地址;
内部h5增加直接关闭的x

zengjiebin 7 lat temu
rodzic
commit
3bb661ce38

+ 20 - 1
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -2482,6 +2482,10 @@ public class Jump2View {
      */
     public void gotoVip(Activity activity) {
         CommonUtil.getInstance().initUrlConfigByNet(Config.KEY_BUY_VIP_URL, url -> {
+            if(url == null){
+                G.showToast(R.string.coming_soon);
+                return;
+            }
             WebParams webParams = new WebParams(url).setShowTitle(false);
             goWeb(activity, webParams);
         });
@@ -2498,8 +2502,19 @@ public class Jump2View {
     /**
      * 小绵羊3.4.7新增 -- 跳转龙猫界面
      * @param activity
+     * @return 原生启动成功返回true
      */
     public boolean gotoLongMao(Activity activity) {
+        if(!PackageUtil.isAppInstalled(SheepApp.getInstance(), Config.LONG_MAO_APP_PACKAGE_NAME)){
+            CommonUtil.getInstance().initUrlConfigByNet(Config.KEY_LMJC_URL, url -> {
+                if(url == null){
+                    G.showToast(R.string.coming_soon);
+                    return;
+                }
+                goWeb(activity, new WebParams(url, Config.LONG_MAO_APP_NAME).setShowTitle(false));
+            });
+            return false;
+        }
         try {
             PackageUtil.startApp(SheepApp.getInstance(), Config.LONG_MAO_APP_PACKAGE_NAME);
         } catch (Exception ignore) {
@@ -2519,7 +2534,11 @@ public class Jump2View {
      * @param activity
      */
     public void gotoYfShop(Activity activity) {
-        goWeb(activity, new WebParams(SheepApp.getInstance().getConnectAddress().getYfShotHomeSheep(), Config.YF_SHOP_NAME).setShowTitle(false).tokenFirstUpperCase());
+        CommonUtil.getInstance().initUrlConfigByNet(Config.KEY_YF_SHOP_URL, url -> {
+            if(url == null)
+                url = SheepApp.getInstance().getConnectAddress().getYfShotHomeSheep();
+            goWeb(activity, new WebParams(url, Config.YF_SHOP_NAME).setShowTitle(false).tokenFirstUpperCase());
+        });
     }
 
     //点击一条消息

+ 3 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/ActWebX5.java

@@ -97,6 +97,7 @@ public class ActWebX5 extends BaseActWeb {
                     .getInstance()
                     .setShowOrHide(this, true)
                     .setTitle(this, webParams.getTitle())
+                    .setRightImgBotton(this, R.drawable.ic_edit_text_delete, view -> finish())
                     .setTitleFinish(this);
         }
         initWebViewSettings(mWebView);
@@ -292,12 +293,13 @@ public class ActWebX5 extends BaseActWeb {
         mWebView.setWebViewClient(new WebViewClient() {
             @Override
             public WebResourceResponse shouldInterceptRequest(WebView webView, String s) {
+                LogUtil.println("ActWeb", "shouldInterceptRequest from cache", url);
                 return WebResourceResponseAdapter.adapter(WebViewCacheInterceptorInst.getInstance().interceptRequest(s));
             }
 
             @Override
             public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest webResourceRequest) {
-
+                LogUtil.println("ActWeb", "shouldInterceptRequest from cache", url);
                 return WebResourceResponseAdapter.adapter(WebViewCacheInterceptorInst.getInstance().interceptRequest(WebResourceRequestAdapter.adapter(webResourceRequest)));
             }
             @Override

+ 5 - 1
app/src/main/java/com/sheep/jiuyan/samllsheep/Config.java

@@ -26,7 +26,11 @@ public class Config {
     public static final String LONG_MAO_APP_PACKAGE_NAME = "com.cfyl.galesaur.guess";
     public static final String LONG_MAO_APP_URI = "guess://longmao";
 
-    //vip h5配置
+    //有范商城地址的 key
+    public static final String KEY_YF_SHOP_URL = "yf_shop_url";
+    //龙猫竞猜分享地址 key
+    public static final String KEY_LMJC_URL = "lmjc_url";
+    //充值VIP地址的 key
     public static final String KEY_BUY_VIP_URL = "buy_vip_url";
 
 }