Browse Source

0409 修改百川sdk,新增百川的key数据

tags/0.0.11+8
23028876916@qq.com 3 years ago
parent
commit
ee32f1ed2c
8 changed files with 179 additions and 715 deletions
  1. +45
    -20
      example/android/app/build.gradle
  2. +2
    -2
      example/android/app/src/main/AndroidManifest.xml
  3. +0
    -108
      example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/TestActivity.java
  4. +0
    -521
      example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/WebActivity.java
  5. +1
    -1
      example/lib/main.dart
  6. +12
    -12
      example/pubspec.yaml
  7. +13
    -2
      lib/models/app_config_model.dart
  8. +106
    -49
      lib/register.dart

+ 45
- 20
example/android/app/build.gradle View File

@@ -54,7 +54,7 @@ android {
ndk {
//选择要添加的对应cpu类型的.so库。
abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a'
// abiFilters 'armeabi-v7a','x86_64'
// abiFilters 'armeabi-v7a','x86_64'
}
}

@@ -164,26 +164,51 @@ dependencies {
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

//登陆
implementation 'com.ali.auth.sdk:alibabauth_core:2.0.0.11@aar'
implementation 'com.ali.auth.sdk:alibabauth_ui:2.0.0.11@aar'
implementation 'com.ali.auth.sdk:alibabauth_ext:2.0.0.11@aar'
//安全组件
implementation 'com.taobao.android:securityguardaar3:5.4.171@aar'
implementation 'com.taobao.android:securitybodyaar3:5.4.99@aar'
implementation 'com.taobao.android:avmpaar3:5.4.36@aar'
implementation 'com.taobao.android:sgmiddletieraar3:5.4.9@aar'
//Mtop
implementation 'com.taobao.android:mtopsdk_allinone_open:3.1.2.5@jar'
//applink
implementation 'com.alibaba.sdk.android:alibc_link_partner:4.1.15@aar'
//ut
implementation 'com.taobao.android:utdid4all:1.5.2'
implementation 'com.alibaba.mtl:app-monitor-sdk:2.6.4.5_for_bc'
// //登陆
// implementation 'com.ali.auth.sdk:alibabauth_core:2.0.0.11@aar'
// implementation 'com.ali.auth.sdk:alibabauth_ui:2.0.0.11@aar'
// implementation 'com.ali.auth.sdk:alibabauth_ext:2.0.0.11@aar'
// //安全组件
// implementation 'com.taobao.android:securityguardaar3:5.4.171@aar'
// implementation 'com.taobao.android:securitybodyaar3:5.4.99@aar'
// implementation 'com.taobao.android:avmpaar3:5.4.36@aar'
// implementation 'com.taobao.android:sgmiddletieraar3:5.4.9@aar'
// //Mtop
// implementation 'com.taobao.android:mtopsdk_allinone_open:3.1.2.5@jar'
// //applink
// implementation 'com.alibaba.sdk.android:alibc_link_partner:4.1.15@aar'
// //ut
// implementation 'com.taobao.android:utdid4all:1.5.2'
// implementation 'com.alibaba.mtl:app-monitor-sdk:2.6.4.5_for_bc'
// // 电商基础组件
// implementation 'com.alibaba.sdk.android:AlibcTradeCommon:4.0.0.16@aar'
// implementation 'com.alibaba.sdk.android:AlibcTradeBiz:4.0.0.16@aar'
// implementation 'com.alibaba.sdk.android:nb_trade:4.0.0.16@aar'

implementation 'com.alibaba.baichuan.sdk:alibclogin:5.0.0.13'
// applink
implementation 'com.alibaba.baichuan.sdk:alibcapplink:5.0.0.13'
// 广告SDK
implementation 'com.alibaba.baichuan.sdk:alibcad:5.0.0.13'
// 小程序
implementation 'com.alibaba.baichuan.sdk:alibctriver:5.0.0.13'
// c++基础库(如果工程中没有接入该so包:libc++_shared.so,需要接入该sdk)
implementation "llvm.stl:cpp_shared:0.0.3@aar"
// 直播
implementation 'com.alibaba.baichuan.sdk:alibctriver_live:5.0.0.13'
// webview容器
implementation 'com.alibaba.baichuan.sdk:alibcwebview:5.0.0.13'
// 电商基础组件
implementation 'com.alibaba.sdk.android:AlibcTradeCommon:4.0.0.16@aar'
implementation 'com.alibaba.sdk.android:AlibcTradeBiz:4.0.0.16@aar'
implementation 'com.alibaba.sdk.android:nb_trade:4.0.0.16@aar'
implementation 'com.alibaba.baichuan.sdk:alibctradecommon:5.0.0.13'
implementation 'com.alibaba.baichuan.sdk:alibcnbtrade:5.0.0.13'
implementation 'com.alibaba.baichuan.sdk:alibcprotocol:5.0.0.13'
// 辅助排查工具(可选)
implementation "com.alibaba.baichuan.sdk:alibctools:5.0.0.13"
// 安全保镖v5版本(根据实际情况,v5和v6版本选择其一)
implementation 'com.taobao.android:securityguardaar3:5.0.0.9-v5@aar'
implementation 'com.taobao.android:securitybodyaar3:5.0.0.9-v5@aar'
implementation 'com.taobao.android:avmpaar3:5.0.0.9-v5@aar'
implementation 'com.taobao.android:sgmiddletieraar3:5.0.0.9-v5@aar'
implementation 'com.alibaba:fastjson:1.2.41@jar'
implementation 'com.amap.api:location:5.2.0'



+ 2
- 2
example/android/app/src/main/AndroidManifest.xml View File

@@ -48,14 +48,14 @@
android:label="@string/app_name"
android:usesCleartextTraffic="true"
android:authorities="${applicationId}.fileprovider"
tools:replace="android:name, android:allowBackup,android:authorities">
tools:replace="android:name,android:allowBackup,android:authorities">

<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:usesCleartextTraffic="true"
android:windowSoftInputMode="adjustResize">



+ 0
- 108
example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/TestActivity.java View File

@@ -1,108 +0,0 @@
package cn.zhios.zhiying_base_widget_example;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.TextView;
import android.widget.Toast;

import com.alibaba.baichuan.android.trade.AlibcTrade;
import com.alibaba.baichuan.android.trade.AlibcTradeSDK;
import com.alibaba.baichuan.android.trade.callback.AlibcTradeCallback;
import com.alibaba.baichuan.android.trade.callback.AlibcTradeInitCallback;
import com.alibaba.baichuan.android.trade.model.AlibcShowParams;
import com.alibaba.baichuan.trade.biz.context.AlibcTradeResult;
import com.alibaba.baichuan.trade.biz.core.taoke.AlibcTaokeParams;
import com.alibaba.baichuan.trade.biz.login.AlibcLogin;
import com.alibaba.baichuan.trade.biz.login.AlibcLoginCallback;
import com.alibaba.baichuan.trade.common.utils.AlibcLogger;

import java.util.HashMap;

public class TestActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
TextView aliBcTV = findViewById(R.id.tv_aliBc);
AlibcTradeSDK.asyncInit(this.getApplication(), new AlibcTradeInitCallback() {
@Override
public void onSuccess() {
Toast.makeText(TestActivity.this, "阿里百川注册成功", Toast.LENGTH_LONG).show();
}

@Override
public void onFailure(int i, String s) {
Toast.makeText(TestActivity.this, "阿里百川注册失败" + s, Toast.LENGTH_LONG).show();
}
});

aliBcTV.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlibcLogin.getInstance().showLogin(new AlibcLoginCallback() {
@Override
public void onSuccess(int i, String s, String s1) {
Toast.makeText(TestActivity.this, "授权成功" + s, Toast.LENGTH_LONG).show();
}

@Override
public void onFailure(int i, String s) {
Toast.makeText(TestActivity.this, "登陆失败" + s, Toast.LENGTH_LONG).show();
}
});
}
});

findViewById(R.id.tv_open_detail).setOnClickListener(new View.OnClickListener() {
AlibcShowParams showParams = new AlibcShowParams();
@Override
public void onClick(View v) {
// // 以显示传入url的方式打开页面(第二个参数是套件名称)
// AlibcTrade.openByUrl(TestActivity.this, "", "http://www.izhim.com/comm/tb_callback.php?_ctrl=domain&domain_state=MTI2&domain_return_url=aHR0cDovLzE5Mi4xNjguMC4xMTM6NTAwMC9hcGkvdjEvdGFvYmFvL2F1dGgvY2FsbGJhY2s%2FdGltZT0xNjAyNDk4MjA3", new WebView(TestActivity.this),
// new WebViewClient(), new WebChromeClient(), showParams,
// new AlibcTaokeParams("","",""), new HashMap<String,String>(), new AlibcTradeCallback() {
// @Override
// public void onTradeSuccess(AlibcTradeResult tradeResult) {
// AlibcLogger.i("", "request success");
// }
// @Override
// public void onFailure(int code, String msg) {
// AlibcLogger.e("", "code=" + code + ", msg=" + msg);
// if (code == -1) {
// Toast.makeText(TestActivity.this, msg, Toast.LENGTH_SHORT).show();
// }
// }
// });

if (!AlibcLogin.getInstance().isLogin()) {

AlibcLogin.getInstance().showLogin(new AlibcLoginCallback() {
@Override
public void onSuccess(int i, String s, String s1) {
startActivity(new Intent(TestActivity.this,WebActivity.class));
}

@Override
public void onFailure(int i, String s) {
Log.d("阿里百川授权失败",s);
}
});
} else {
startActivity(new Intent(TestActivity.this,WebActivity.class));
}


}
});

}
}

+ 0
- 521
example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/WebActivity.java View File

@@ -1,521 +0,0 @@
package cn.zhios.zhiying_base_widget_example;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Bundle;
import android.util.Log;
import android.util.Patterns;
import android.view.View;
import android.webkit.GeolocationPermissions;
import android.webkit.JavascriptInterface;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;

import com.alibaba.baichuan.android.trade.AlibcTrade;
import com.alibaba.baichuan.android.trade.callback.AlibcTradeCallback;
import com.alibaba.baichuan.android.trade.model.AlibcShowParams;
import com.alibaba.baichuan.trade.biz.context.AlibcTradeResult;
import com.alibaba.baichuan.trade.biz.core.taoke.AlibcTaokeParams;
import com.alibaba.baichuan.trade.biz.login.AlibcLogin;
import com.alibaba.baichuan.trade.biz.login.AlibcLoginCallback;

import java.util.HashMap;
import java.util.Map;

public class WebActivity extends Activity {
WebView mainWeb;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web_bc);
mainWeb = findViewById(R.id.webview_main);
mainWeb.getSettings().setJavaScriptEnabled(true);
mainWeb.getSettings().setDomStorageEnabled(true);
mainWeb.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
mainWeb.getSettings().setLoadWithOverviewMode(true);
mainWeb.getSettings().setAllowFileAccess(true);
mainWeb.getSettings().setDatabaseEnabled(true);
MyWebClient myWebClient = new MyWebClient();
MyWebChromeClient myWebChromeClient = new MyWebChromeClient();
mainWeb.setWebViewClient(myWebClient);
mainWeb.setWebChromeClient(myWebChromeClient);

Map<String, String> exParams = new HashMap<>();//yhhpass参数
// AlibcTaokeParams alibcTaokeParams = new AlibcTaokeParams("", "", "");
// alibcTaokeParams.pid = SPUtils.getPrefString(mActivity, Pkey.pid, "");
// alibcTaokeParams.adzoneid = SPUtils.getPrefString(mActivity, Pkey.APP_adzoneId, "");
// alibcTaokeParams.extraParams = new HashMap<>();
// alibcTaokeParams.extraParams.put("taokeAppkey", SPUtils.getPrefString(mActivity, Pkey.APP_alliance_appkey, ""));
AlibcShowParams showParams = new AlibcShowParams();
showParams.setBackUrl("alisdk://");
AlibcTrade.openByUrl(WebActivity.this, "", "http://www.izhim.com/comm/tb_callback.php?_ctrl=domain&domain_state=MTI2&domain_return_url=aHR0cDovLzE5Mi4xNjguMC4xMTM6NTAwMC9hcGkvdjEvdGFvYmFvL2F1dGgvY2FsbGJhY2s%2FdGltZT0xNjAyNDk4MjA3",
mainWeb, new MyBaichuanWebClient(), new MyWebChromeClient(), showParams,
new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() {
@Override
public void onTradeSuccess(AlibcTradeResult alibcTradeResult) {

}

@Override
public void onFailure(int i, String s) {

}
});
}

//用于百川授权的简化的WebClient
@SuppressLint("AddJavascriptInterface")
private class MyBaichuanWebClient extends WebViewClient {
@SuppressLint("AddJavascriptInterface")
@Override
public boolean shouldOverrideUrlLoading(WebView view, final String url) {
Log.d("百川拦截", url);
//绑定会员关系时获取网页内容关闭网页
if (url.contains("comm/tbredirect.php") && !url.contains("oauth.m.taobao.com") && url.contains("track_id")) {
Log.d("百川系时获取网页内容关闭网页", url);
mainWeb.addJavascriptInterface(new InJavaScriptLocalObj(), "java_obj");

}
if (url.contains("oauth.taobao.com/authorize") || url.contains("oauth.m.taobao.com/authorize")) {
//渠道授权改动测试
Log.d("百川渠道授权改动测试", url);
Map<String, String> exParams = new HashMap<>();//yhhpass参数
AlibcShowParams showParams = new AlibcShowParams();
showParams.setBackUrl("alisdk://");
AlibcTrade.openByUrl(WebActivity.this, "", url,
mainWeb, new MyBaichuanWebClient(), new MyWebChromeClient(), showParams,
new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() {
@Override
public void onTradeSuccess(AlibcTradeResult alibcTradeResult) {
Log.d("cg", alibcTradeResult.toString());
}

@Override
public void onFailure(int i, String s) {
Log.d("sb", s);
}
});
}
return super.shouldOverrideUrlLoading(view, url);
}


@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// WebLoad.setVisibility(View.GONE);
mainWeb.setVisibility(View.GONE);
//开始加载设置为透明
super.onPageStarted(view, url, favicon);
}

@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
super.onReceivedError(view, request, error);
}

@Override
public void onPageFinished(WebView view, String url) {
// WebLoad.setVisibility(View.GONE);
mainWeb.setVisibility(View.VISIBLE);
// 获取页面内容
view.loadUrl("javascript:window.java_obj.showSource("
+ "document.documentElement.innerText);");

// 获取解析<meta name="share-description" content="获取到的值">
view.loadUrl("javascript:window.java_obj.showDescription("
+ "document.querySelector('meta[name=\"share-description\"]').getAttribute('content')"
+ ");");
// quanyikaText();
super.onPageFinished(view, url);
}

//处理 [Android]用WebView访问证书有问题的SSL网页
//http://blog.sina.com.cn/s/blog_4cd978f90102vrxk.html
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed();
}

}

/**
* 绑定渠道
*/
private final class InJavaScriptLocalObj {
@JavascriptInterface
public void showSource(final String html) {
//获取网页内容,用于判断是否成功绑定关系id

try {
if (html.contains("成功")) {//成功
Toast.makeText(WebActivity.this, "授权成功", Toast.LENGTH_SHORT).show();
finish();
} else {//失败
mainWeb.setAlpha(0);

}

} catch (Exception e) {
e.printStackTrace();
}
}

@JavascriptInterface
public void showDescription(String str) {


}
}


public class MyWebChromeClient extends WebChromeClient {

private CustomViewCallback mCustomViewCallback;
// 横屏时,显示视频的view
private View mCustomView;

// 点击全屏按钮时,调用的方法
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
super.onShowCustomView(view, callback);
//isFullPlayVedio = true;
//如果view 已经存在,则隐藏
if (mCustomView != null) {
callback.onCustomViewHidden();
return;
}

mCustomView = view;
mCustomView.setVisibility(View.VISIBLE);
mCustomViewCallback = callback;


}

// 取消全屏调用的方法
@Override
public void onHideCustomView() {
super.onHideCustomView();

if (mCustomView == null) {
return;
}
mCustomView.setVisibility(View.GONE);

mCustomView = null;

try {
mCustomViewCallback.onCustomViewHidden();
} catch (Exception e) {
}
// setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//竖屏


}

@Override
public void onProgressChanged(WebView view, int newProgress) {

}

@Override
public void onReceivedTitle(WebView view, String title) {
super.onReceivedTitle(view, title);
// Logger.wtf("我的url" + view.getUrl());
String url = view.getUrl();
if (Patterns.WEB_URL.matcher(title).matches()) {
//网址不显示为标题

} else {

//不是网址
if (!url.contains("api.ejiayou.com/pages/platform/soulList/index.html")) {

}
}
}

@Override
public void onGeolocationPermissionsShowPrompt(final String origin, final GeolocationPermissions.Callback callback) {


super.onGeolocationPermissionsShowPrompt(origin, callback);
}


// For Android 3.0+
public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType) {


}

// For Android < 3.0
public void openFileChooser(ValueCallback<Uri> uploadMsg) {
openFileChooser(uploadMsg, "");
}

// For Android > 4.1.1
public void openFileChooser(ValueCallback<Uri> uploadMsg,
String acceptType, String capture) {

openFileChooser(uploadMsg, acceptType);
}

// For Android > 5.0
@Override
public boolean onShowFileChooser(WebView webView,
ValueCallback<Uri[]> filePathCallback,
FileChooserParams fileChooserParams) {

return true;
}


}

@SuppressLint("AddJavascriptInterface")
private class MyWebClient extends WebViewClient {

@SuppressLint("AddJavascriptInterface")
@Override
public boolean shouldOverrideUrlLoading(WebView view, final String url) {

if (url.startsWith("tel:")) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
return true;
}
if (url.startsWith("bdnetdisk:")) {
return true;
}


if (url.contains("tmast://")) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
} catch (Exception e) {

}
return true;
}
if (url.startsWith("http://ditu.amap.com") ||
url.startsWith("https://ditu.amap.com")) {
return true;
}
if (url.contains("oauth.taobao.com/authorize") || url.contains("oauth.m.taobao.com/authorize")) {

// mainWeb.addJavascriptInterface(new InJavaScriptLocadeUpgralObj(), "java_obj");
Map<String, String> exParams = new HashMap<>();//yhhpass参数
// AlibcTaokeParams alibcTaokeParams = new AlibcTaokeParams("", "", "");
// alibcTaokeParams.pid = SPUtils.getPrefString(mActivity, Pkey.pid, "");
// alibcTaokeParams.adzoneid = SPUtils.getPrefString(mActivity, Pkey.APP_adzoneId, "");
// alibcTaokeParams.extraParams = new HashMap<>();
// alibcTaokeParams.extraParams.put("taokeAppkey", SPUtils.getPrefString(mActivity, Pkey.APP_alliance_appkey, ""));
AlibcShowParams showParams = new AlibcShowParams();
showParams.setBackUrl("alisdk://");
AlibcTrade.openByUrl(WebActivity.this, "", url, mainWeb, new MyBaichuanWebClient(), new MyWebChromeClient(), showParams,
new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() {
@Override
public void onTradeSuccess(AlibcTradeResult alibcTradeResult) {

}

@Override
public void onFailure(int i, String s) {

}
});
}

if (url.contains("tbopen://") || url.contains("tmall://") || url.contains("taobaotravel://")) {
return true;
}


if (url.contains("dianping://")) {
return true;
}
if (url.contains("aliim:")) {
return true;
}
if (url.contains("?mod=appapi&act=miandan_course&ctrl=close")) {
finish();
return true;
}
if (url.contains("vipma.net/quickapp.html?")) {
return true;
}


// 如下方案可在非微信内部WebView的H5页面中调出微信支付
if (url.startsWith("weixin://wap/pay?")) {
try {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
return true;
} catch (Exception e) {
e.printStackTrace();

}
return true;
}
if (url.startsWith("weixin://")) {
try {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
return true;
} catch (Exception e) {
e.printStackTrace();

}
return true;
}
if (url.endsWith("native://wechat")) {
Intent intent = new Intent();
ComponentName cmp = new ComponentName("com.tencent.mm", "com.tencent.mm.ui.LauncherUI");
intent.setAction(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(cmp);
startActivity(intent);
return true;
}
if (url.contains("navite://save#")) {

}
//不拦截的话绑定淘宝关系id的时候会因为下面login.m.taobao.com的拦截而唤醒手淘授权之后导致不能切换帐号
// if (url.contains("client_id") && url.contains("login.m.taobao.com/logout.htm?")) {
// view.loadUrl(url);
// return true;
// }
if (url.contains("client_id")) {
view.loadUrl(url);
return true;
}
// if (url.contains("login.m.taobao.com")) {
// if (!AlibcLogin.getInstance().isLogin()) {
// AlibcLogin.getInstance().showLogin(new AlibcLoginCallback() {
//// @Override
//// public void onSuccess(int i) {
//// }
//
// @Override
// public void onSuccess(int i, String s, String s1) {
//
// }
//
// @Override
// public void onFailure(int i, String s) {
// }
// });
// }
// return true;
// }
if (url.contains("maliprod.alipay.com") && !url.contains("confirmGoods.do")) {
AlibcLogin.getInstance().showLogin(new AlibcLoginCallback() {
@Override
public void onSuccess(int i, String s, String s1) {

}

@Override
public void onFailure(int i, String s) {

}
});
}

if (url.contains("intent://go/ju/webview?")) {
return true;
}
// if (url.contains("s.click.taobao.com")) {
// Logger.wtf(SPUtils.getPrefString(WebActivity.this, Pkey.IS_OPEN_TAOBAO, ""));
// if (SPUtils.getPrefString(WebActivity.this, Pkey.IS_OPEN_TAOBAO, "").equals("shoutao")) {
// if (!Token.isLogin()) {
// if (isFirst2Login) {
// ActivityJump.toLogin(WebActivity.this);
// }
// isFirst2Login = false;
// finish();
// } else {
// if (isInstallTaoBao(WebActivity.this)) {
// jump2TaoBao(url);
// finish();
// } else {
// view.loadUrl(url);
// }
// }
// return true;
// }
// }


// if (url.contains("kingcard.dgunicom.com") && url.contains("newMsg") && url.contains("fill.html")) {
// getItf(url);
// }


// else {
// Logger.wtf("123");
// mainWeb.loadUrl(url);
// }
return super.shouldOverrideUrlLoading(view, url);
}


@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// WebLoad.setVisibility(View.GONE);
//开始加载设置为透明
super.onPageStarted(view, url, favicon);
}

@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
super.onReceivedError(view, request, error);
}

@Override
public void onPageFinished(WebView view, String url) {
// WebLoad.setVisibility(View.GONE);
// // 获取页面内容
view.loadUrl("javascript:window.java_obj.showSource("
+ "document.documentElement.innerText);");

// 获取解析<meta name="share-description" content="获取到的值">
view.loadUrl("javascript:window.java_obj.showDescription("
+ "document.querySelector('meta[name=\"share-description\"]').getAttribute('content')"
+ ");");
// quanyikaText();
super.onPageFinished(view, url);
}

//处理 [Android]用WebView访问证书有问题的SSL网页
//http://blog.sina.com.cn/s/blog_4cd978f90102vrxk.html
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed();
}

}

}



+ 1
- 1
example/lib/main.dart View File

@@ -71,7 +71,7 @@ class _MyAppState extends State<MyApp> {
CreditCardRegister.init();
print('初始化百川');
FlutterAlibc.initAlibc(version: "", appName: "").then((result) {
print("川" + '${result.errorCode} ${result.errorMessage}');
print("川" + '${result.errorCode} ${result.errorMessage}');
});
MobPushUtil.setCanPush();



+ 12
- 12
example/pubspec.yaml View File

@@ -38,22 +38,22 @@ dev_dependencies:
path: ../../zhiying_credit_card
#微信导师
zhiying_wechat_teacher:
#path: ../zhiying_wechat_teacher
git:
ref: 0.0.2
url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_wechat_teacher.git
path: ../../zhiying_wechat_teacher
# git:
# ref: 0.0.2
# url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_wechat_teacher.git
#朋友圈
zhiying_moments:
#path: ../zhiying_moments
git:
ref: 0.2.2
url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_moments.git
path: ../../zhiying_moments
# git:
# ref: 0.2.2
# url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_moments.git
#会员升级
zhiying_member_upgrade:
#path: ../Zhiying_Member_Upgrade
git:
ref: 0.0.6
url: http://192.168.0.138:3000/FnuoOS_ZhiYing/Zhiying_Member_Upgrade.git
path: ../../Zhiying_Member_Upgrade
# git:
# ref: 0.0.6
# url: http://192.168.0.138:3000/FnuoOS_ZhiYing/Zhiying_Member_Upgrade.git
plugin_platform_interface: "1.0.2"
permission_handler_platform_interface: "2.0.1"



+ 13
- 2
lib/models/app_config_model.dart View File

@@ -75,9 +75,10 @@ class AppConfigKeyModel {
AppConfigKeyItemModel weixin;
AppConfigKeyItemModel jdIos;
AppConfigKeyItemModel jdAndroid;
AppConfigKeyItemModel taobao;
GDModel gd;

AppConfigKeyModel({this.weibo, this.qq, this.weixin, this.jdIos, this.jdAndroid});
AppConfigKeyModel({this.weibo, this.qq, this.weixin, this.jdIos, this.jdAndroid,this.taobao});

AppConfigKeyModel.fromJson(Map<String, dynamic> json) {
weibo = json['weibo'] != null ? new AppConfigKeyItemModel.fromJson(json['weibo']) : null;
@@ -85,6 +86,7 @@ class AppConfigKeyModel {
weixin = json['weixin'] != null ? new AppConfigKeyItemModel.fromJson(json['weixin']) : null;
jdIos = json['jd_ios'] != null ? new AppConfigKeyItemModel.fromJson(json['jd_ios']) : null;
jdAndroid = json['jd_android'] != null ? new AppConfigKeyItemModel.fromJson(json['jd_android']) : null;
taobao = json['taobao'] != null ? new AppConfigKeyItemModel.fromJson(json['taobao']) : null;
gd = json['gd'] != null ? GDModel.fromJson(json['gd']) : null;
}

@@ -105,6 +107,9 @@ class AppConfigKeyModel {
if (this.jdAndroid != null) {
data['jd_android'] = this.jdAndroid.toJson();
}
if (this.taobao != null) {
data['taobao'] = this.taobao.toJson();
}
if (this.gd != null) {
data['gd'] = this.gd.toJson();
}
@@ -182,13 +187,17 @@ class AppConfigKeyItemModel {
String secret;
String redirectUrl;
String universalLink;
String androidKey;
String iosKey;

AppConfigKeyItemModel({this.appkey, this.secret, this.redirectUrl});
AppConfigKeyItemModel({this.appkey, this.secret, this.redirectUrl,this.androidKey,this.iosKey});

AppConfigKeyItemModel.fromJson(Map<String, dynamic> json) {
appId = json['app_id'];
appkey = json['appkey'];
secret = json['secret'];
androidKey = json['android_key'];
iosKey = json['ios_key'];
redirectUrl = json['redirect_url'];
universalLink = json['universal_link'];
}
@@ -199,6 +208,8 @@ class AppConfigKeyItemModel {
data['appkey'] = this.appkey;
data['secret'] = this.secret;
data['redirect_url'] = this.redirectUrl;
data['android_key'] = this.androidKey;
data['ios_key'] = this.iosKey;
data['universal_link'] = this.universalLink;
return data;
}


+ 106
- 49
lib/register.dart View File

@@ -96,6 +96,8 @@ import 'widgets/search/tabbar/search_tab_creater.dart';
import 'widgets/search_result/goods_list/search_result_goods_list_creater.dart';
import 'widgets/search_result/search_input/search_result_input.dart';
import 'package:zhiying_comm/util/mob_util/mob_util.dart';
import 'package:zhiying_comm/util/taobao/taobao_auth.dart';
import 'package:package_info/package_info.dart';

class BaseWidgetRegister {
/// 初始化方法
@@ -114,13 +116,21 @@ class BaseWidgetRegister {

Application.addMethod(() async {
AppConfigModel config = await AppConfigModel.init(isGetCache: true);
PackageInfo packageInfo = await PackageInfo.fromPlatform();
String appname = packageInfo.appName;
if (Platform.isIOS) {
TaobaoAuth.setParams(name: appname, alibcAppKey: config.keys.taobao.iosKey);
} else {
TaobaoAuth.setParams(name: appname, alibcAppKey: config.keys.taobao.androidKey);
}
if (config == null) {
Logger.debug('app 初始化失败');
return;
}
ShareSDKRegister register = ShareSDKRegister();
// ================ Weixin
register.setupWechat(config.keys?.weixin?.appId ?? '', config.keys?.weixin?.secret ?? '', config.keys?.weixin?.universalLink ?? '');
register.setupWechat(config.keys?.weixin?.appId ?? '',
config.keys?.weixin?.secret ?? '', config.keys?.weixin?.universalLink ?? '');

//================ Weibo
register.setupSinaWeibo(config.keys?.weibo?.appkey ?? '', config.keys?.weibo?.secret ?? '', config.keys?.weibo?.redirectUrl ?? '',config.keys?.weibo?.universalLink??'templink');
@@ -131,19 +141,24 @@ class BaseWidgetRegister {
// ================ jd
SharesdkPlugin.regist(register);


///微信支付初始化
registerWxApi(appId: config?.keys?.weixin?.appId, universalLink: config?.keys?.weixin?.universalLink);
registerWxApi(
appId: config?.keys?.weixin?.appId,
universalLink: config?.keys?.weixin?.universalLink);

///高德定位注册
AMapFlutterLocation.setApiKey(config?.keys?.gd?.androidKey ?? "", config?.keys?.gd?.iosKey);
AMapFlutterLocation.setApiKey(
config?.keys?.gd?.androidKey ?? "", config?.keys?.gd?.iosKey);

if (Platform.isIOS) {
Jdsdk.init(appKey: config.keys?.jdIos?.appkey ?? '', appSecret: config.keys?.jdIos?.secret ?? '');
Jdsdk.init(
appKey: config.keys?.jdIos?.appkey ?? '',
appSecret: config.keys?.jdIos?.secret ?? '');
} else if (Platform.isAndroid) {
Jdsdk.init(appKey: config.keys?.jdAndroid?.appkey ?? '', appSecret: config.keys?.jdAndroid?.secret ?? '');
Jdsdk.init(
appKey: config.keys?.jdAndroid?.appkey ?? '',
appSecret: config.keys?.jdAndroid?.secret ?? '');
}

});

// MOB 秒验
@@ -227,16 +242,20 @@ class BaseWidgetRegister {
/// 订单页面
PageFactory.regist('pub.flutter.my_order', (model) => OrdersPage(model));
PageFactory.regist('pub.flutter.account_security', (model) => SecurityPage(model));
PageFactory.regist('pub.flutter.account_security_alipay', (model) => SecurityBindAlipayPage(model));
PageFactory.regist(
'pub.flutter.account_security_alipay', (model) => SecurityBindAlipayPage(model));

/// 登录密码
PageFactory.regist('pub.flutter.account_security_password', (model) => SecurityPassword(model));
PageFactory.regist(
'pub.flutter.account_security_password', (model) => SecurityPassword(model));

/// 修改手机号
PageFactory.regist('pub.flutter.account_security_mobile', (model) => SecurityMobile(model));
PageFactory.regist(
'pub.flutter.account_security_mobile', (model) => SecurityMobile(model));

/// 邀请好友
PageFactory.regist('pub.flutter.invite_friends', (model) => InvitedFriendsPage(model));
PageFactory.regist(
'pub.flutter.invite_friends', (model) => InvitedFriendsPage(model));

/// 我的团队
PageFactory.regist('pub.flutter.my_team', (model) => TeamPage(model));
@@ -257,13 +276,15 @@ class BaseWidgetRegister {
PageFactory.regist('pub.flutter.about_us', (model) => AboutUsPage(model));

/// 隐私设置
PageFactory.regist('pub.flutter.privacy_settings', (model) => PrivacySettingsPage(model));
PageFactory.regist(
'pub.flutter.privacy_settings', (model) => PrivacySettingsPage(model));

/// 注销账号页
PageFactory.regist('pub.flutter.account_delete', (model) => AccountDeletePage(model));

/// 消息设置
PageFactory.regist('pub.flutter.message_settings', (model) => MessageSettingsPage(model));
PageFactory.regist(
'pub.flutter.message_settings', (model) => MessageSettingsPage(model));

/// 钱包明细
PageFactory.regist('pub.flutter.my_wallet_detail', (model) => BilDetailPage(model));
@@ -287,83 +308,108 @@ class BaseWidgetRegister {

/// ==================== 搜索页面 ==================== ///
// 搜索输入框
WidgetFactory.regist('search_index_input', DefaultWidgetCreater((model) => SearchInputWidget(model)));
WidgetFactory.regist(
'search_index_input', DefaultWidgetCreater((model) => SearchInputWidget(model)));
// // 搜索tabBar
WidgetFactory.regist('search_index_icon_list', SearcchTabCreater());
// // 热门搜索标签
WidgetFactory.regist('search_index_hot_keyword', DefaultWidgetCreater((model) => SearchHotTagWidget(model)));
WidgetFactory.regist('search_index_hot_keyword',
DefaultWidgetCreater((model) => SearchHotTagWidget(model)));
// // 历史搜索标签
WidgetFactory.regist('search_index_history', DefaultWidgetCreater((model) => SearchHistoryTagWidget(model)));
WidgetFactory.regist('search_index_history',
DefaultWidgetCreater((model) => SearchHistoryTagWidget(model)));

/// ==================== 搜索结果页面 ==================== ///
// 输入框
WidgetFactory.regist('search_result_input', DefaultWidgetCreater((model) => SearchResultInputWidget(model)));
WidgetFactory.regist('search_result_input',
DefaultWidgetCreater((model) => SearchResultInputWidget(model)));
// tabbar
WidgetFactory.regist('search_result_icon_list', SearchResultTabCreater());
// 搜索筛选Widget
WidgetFactory.regist('search_conditions', DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
WidgetFactory.regist('search_conditions',
DefaultWidgetCreater((model) => SearchResultSortWidget(model)));

// 搜索结果页筛选widget 淘宝
WidgetFactory.regist('search_result_taobao_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
WidgetFactory.regist('search_result_taobao_sort',
DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
// 搜索结果的商品列表 淘宝
WidgetFactory.regist('search_result_taobao_item', SearchResultGoodsListCreater());

// 搜索结果页筛选widget 京东
WidgetFactory.regist('search_result_jd_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
WidgetFactory.regist('search_result_jd_sort',
DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
// 搜索结果的商品列表 京东
WidgetFactory.regist('search_result_jd_item', SearchResultGoodsListCreater());

// 搜索结果页筛选widget 苏宁
WidgetFactory.regist('search_result_suning_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
WidgetFactory.regist('search_result_suning_sort',
DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
// 搜索结果的商品列表 苏宁
WidgetFactory.regist('search_result_suning_item', SearchResultGoodsListCreater());

// 搜索结果页筛选widget 拼多多
WidgetFactory.regist('search_result_pdd_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
WidgetFactory.regist('search_result_pdd_sort',
DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
// 搜索结果的商品列表 拼多多
WidgetFactory.regist('search_result_pdd_item', SearchResultGoodsListCreater());

// 搜索结果页筛选widget 唯品会
WidgetFactory.regist('search_result_vip_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
WidgetFactory.regist('search_result_vip_sort',
DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
// 搜索结果的商品列表 唯品会
WidgetFactory.regist('search_result_vip_item', SearchResultGoodsListCreater());

// 搜索结果页筛选widget 考拉
WidgetFactory.regist('search_result_kaola_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
WidgetFactory.regist('search_result_kaola_sort',
DefaultWidgetCreater((model) => SearchResultSortWidget(model)));
// 搜索结果的商品列表 考拉
WidgetFactory.regist('search_result_kaola_item', SearchResultGoodsListCreater());

/// ==================== 商品详情 ==================== ///
// 商品详情轮播图
WidgetFactory.regist('product_detail_carousel', DefaultWidgetCreater((model) => GoodsDetailsSlideBannerWidget(model)));
WidgetFactory.regist('product_detail_carousel',
DefaultWidgetCreater((model) => GoodsDetailsSlideBannerWidget(model)));
// 商品详情下载APP提示
WidgetFactory.regist('product_detail_bulletin', DefaultWidgetCreater((model) => UpgradeTipWidget(model)));
WidgetFactory.regist('product_detail_bulletin',
DefaultWidgetCreater((model) => UpgradeTipWidget(model)));
// 商品详情标题(包括价格)
WidgetFactory.regist('product_detail_title', DefaultWidgetCreater((model) => GoodsDetailsTitleWidget(model)));
WidgetFactory.regist('product_detail_title',
DefaultWidgetCreater((model) => GoodsDetailsTitleWidget(model)));
// 标签组件组件
WidgetFactory.regist('product_detail_tag', DefaultWidgetCreater((model) => GoodsDetailsTagWidget(model)));
WidgetFactory.regist('product_detail_tag',
DefaultWidgetCreater((model) => GoodsDetailsTagWidget(model)));
// 商品详情优惠劵
WidgetFactory.regist('product_detail_coupon', DefaultWidgetCreater((model) => CounponWidget(model)));
WidgetFactory.regist(
'product_detail_coupon', DefaultWidgetCreater((model) => CounponWidget(model)));
// 商品详情店铺
WidgetFactory.regist('product_detail_shop', DefaultWidgetCreater((model) => StoreWidget(model)));
WidgetFactory.regist(
'product_detail_shop', DefaultWidgetCreater((model) => StoreWidget(model)));
// 商品详情宝贝评价
WidgetFactory.regist('product_detail_comment', DefaultWidgetCreater((model) => GoodsDetailsEvaluateWidget(model)));
WidgetFactory.regist('product_detail_comment',
DefaultWidgetCreater((model) => GoodsDetailsEvaluateWidget(model)));
// 商品详情图片
WidgetFactory.regist('product_detail_image', DefaultWidgetCreater((model) => GoodsDetailsImgWidget(model)));
WidgetFactory.regist('product_detail_image',
DefaultWidgetCreater((model) => GoodsDetailsImgWidget(model)));
// 商品推荐列表的小标题
WidgetFactory.regist('product_detail_recommend_title', DefaultWidgetCreater((model) => GoodsDetailsRecommendTitleWidget(model)));
WidgetFactory.regist('product_detail_recommend_title',
DefaultWidgetCreater((model) => GoodsDetailsRecommendTitleWidget(model)));
// 商品详情底部推荐列表(改用首页的商品列表了)
// WidgetFactory.regist('product_detail_bottom_rec', GoodsDetailCommendCreater());
// 商品详情底部
WidgetFactory.regist('product_detail_bottom', DefaultWidgetCreater((model) => GoodsDetailsFooterWidget(model)));
WidgetFactory.regist('product_detail_bottom',
DefaultWidgetCreater((model) => GoodsDetailsFooterWidget(model)));

// ==================== 个人中心
WidgetFactory.regist('appbar', MineNavCreater());
WidgetFactory.regist('profile_background', DefaultWidgetCreater((model) => MineNavBg(model)));
WidgetFactory.regist('member_info', DefaultWidgetCreater((model) => MineHeader(model)));
WidgetFactory.regist(
'profile_background', DefaultWidgetCreater((model) => MineNavBg(model)));
WidgetFactory.regist(
'member_info', DefaultWidgetCreater((model) => MineHeader(model)));
WidgetFactory.regist('earning', DefaultWidgetCreater((model) => MineData(model)));
WidgetFactory.regist('profile_functions', DefaultWidgetCreater((model) => MineQuickEntry(model)));
WidgetFactory.regist('profile_my_functions', DefaultWidgetCreater((model) => MineQuickEntry(model)));
WidgetFactory.regist(
'profile_functions', DefaultWidgetCreater((model) => MineQuickEntry(model)));
WidgetFactory.regist(
'profile_my_functions', DefaultWidgetCreater((model) => MineQuickEntry(model)));
// WidgetFactory.regist('profile_carousel', DefaultWidgetCreater((model) => HomeBannerWidget(model)));
// WidgetFactory.regist('profile_carousel', HomeBannerCreater());

@@ -375,14 +421,18 @@ class BaseWidgetRegister {
// )));
WidgetFactory.regist('my_wallet_appbar', NormalNavCreater());

WidgetFactory.regist('my_wallet_header', DefaultWidgetCreater((model) => WalletData(model)));
WidgetFactory.regist('my_wallet_bil', DefaultWidgetCreater((model) => WalletBil(model)));
WidgetFactory.regist(
'my_wallet_header', DefaultWidgetCreater((model) => WalletData(model)));
WidgetFactory.regist(
'my_wallet_bil', DefaultWidgetCreater((model) => WalletBil(model)));
// WidgetFactory.regist(
// 'wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));
// WidgetFactory.regist('wallet_detail', HomeAuthCreater());
WidgetFactory.regist('my_wallet_providers', DefaultWidgetCreater((model) => WalletDetail(model)));
WidgetFactory.regist(
'my_wallet_providers', DefaultWidgetCreater((model) => WalletDetail(model)));

WidgetFactory.regist('wallet_income', DefaultWidgetCreater((model) => WalletIncome()));
WidgetFactory.regist(
'wallet_income', DefaultWidgetCreater((model) => WalletIncome()));

//======================= 账单明细
WidgetFactory.regist(
@@ -392,23 +442,30 @@ class BaseWidgetRegister {
)));

//======================== 热榜
WidgetFactory.regist('hot_rank_appbar', DefaultWidgetCreater((model) => HotRankingAppBar(model)));
WidgetFactory.regist('hot_rank_tabs', DefaultWidgetCreater((model) => HotRankTableBar(model)));
WidgetFactory.regist('hot_rank_tab_view', DefaultWidgetCreater((model) => HotRankingList(model)));
WidgetFactory.regist(
'hot_rank_appbar', DefaultWidgetCreater((model) => HotRankingAppBar(model)));
WidgetFactory.regist(
'hot_rank_tabs', DefaultWidgetCreater((model) => HotRankTableBar(model)));
WidgetFactory.regist(
'hot_rank_tab_view', DefaultWidgetCreater((model) => HotRankingList(model)));

/// ==================== 通用模块 ==================== ///
// 搜索
WidgetFactory.regist('search', DefaultWidgetCreater((model) => CustomSearchWidget(model)));
WidgetFactory.regist(
'search', DefaultWidgetCreater((model) => CustomSearchWidget(model)));
// 轮播广告位, 可滑动
WidgetFactory.regist('carousel', CustomSlideBannerCreater());
// 多眼导航,可滑动
WidgetFactory.regist('multi_nav', DefaultWidgetCreater((model) => CustomQuickEntry(model)));
WidgetFactory.regist(
'multi_nav', DefaultWidgetCreater((model) => CustomQuickEntry(model)));
// banner, 不可滑动
WidgetFactory.regist('banner', DefaultWidgetCreater((model) => CustomBannerWidget(model)));
WidgetFactory.regist(
'banner', DefaultWidgetCreater((model) => CustomBannerWidget(model)));
// 商品列表
WidgetFactory.regist('product', CustomGoodsCreater());
// 公告头条
WidgetFactory.regist('placard', DefaultWidgetCreater((model) => CustomNoticeWidget(model)));
WidgetFactory.regist(
'placard', DefaultWidgetCreater((model) => CustomNoticeWidget(model)));
// 授权
WidgetFactory.regist('audit_tip', DefaultWidgetCreater((model) => HomeAuth(model)));
// 分享内容组件


Loading…
Cancel
Save