Browse Source

0409 升级android端百川sdk,新增授权方法

tags/0.0.7
23028876916@qq.com 3 years ago
parent
commit
f83ba0a4d4
23 changed files with 436 additions and 319 deletions
  1. +54
    -22
      android/build.gradle
  2. +1
    -0
      android/gradle.properties
  3. +177
    -71
      android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcHandle.java
  4. +2
    -0
      android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcPlugin.java
  5. +25
    -24
      android/src/main/java/com/wxwx/flutter_alibc/PluginUtil.java
  6. +33
    -17
      android/src/main/java/com/wxwx/flutter_alibc/WebActivity.java
  7. +19
    -15
      android/src/main/java/com/wxwx/flutter_alibc/web/WebViewActivity.java
  8. BIN
     
  9. BIN
     
  10. BIN
     
  11. BIN
     
  12. BIN
     
  13. +1
    -1
      example/.flutter-plugins-dependencies
  14. +3
    -1
      example/android/app/build.gradle
  15. +1
    -1
      example/android/app/src/main/AndroidManifest.xml
  16. +4
    -1
      example/android/build.gradle
  17. +3
    -1
      example/android/gradle.properties
  18. +2
    -2
      example/android/gradle/wrapper/gradle-wrapper.properties
  19. +10
    -5
      example/ios/Flutter/flutter_export_environment.sh
  20. +20
    -10
      example/lib/main.dart
  21. +33
    -75
      example/pubspec.lock
  22. +17
    -0
      lib/flutter_alibc.dart
  23. +31
    -73
      pubspec.lock

+ 54
- 22
android/build.gradle View File

@@ -9,7 +9,7 @@ buildscript {
} }


dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.2'
} }
} }


@@ -32,7 +32,8 @@ android {
defaultConfig { defaultConfig {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", "true"
minSdkVersion 16 minSdkVersion 16
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
} }
lintOptions { lintOptions {
disable 'InvalidPackage' disable 'InvalidPackage'
@@ -45,26 +46,57 @@ android {


dependencies{ dependencies{


//登陆
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:fastjson:1.2.52@jar'

implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'
implementation 'androidx.cardview:cardview:1.0.0'
// 登陆
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:fastjson:1.2.52@jar'
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.1.71.android'


} }

+ 1
- 0
android/gradle.properties View File

@@ -1,2 +1,3 @@
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M


#android.enableR8=true

+ 177
- 71
android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcHandle.java View File

@@ -1,5 +1,6 @@
package com.wxwx.flutter_alibc; package com.wxwx.flutter_alibc;


import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.webkit.WebChromeClient; import android.webkit.WebChromeClient;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
@@ -7,23 +8,7 @@ import android.widget.Toast;
import android.content.Intent; import android.content.Intent;


import com.ali.auth.third.core.model.Session; import com.ali.auth.third.core.model.Session;
import com.alibaba.baichuan.trade.biz.context.AlibcResultType;
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.android.trade.model.OpenType;
import com.alibaba.baichuan.android.trade.page.AlibcBasePage;
import com.alibaba.baichuan.android.trade.page.AlibcDetailPage;
import com.alibaba.baichuan.android.trade.page.AlibcMyCartsPage;
import com.alibaba.baichuan.android.trade.page.AlibcShopPage;
import com.alibaba.baichuan.trade.biz.applink.adapter.AlibcFailModeType;
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.android.trade.AlibcTradeSDK;
import com.alibaba.baichuan.android.trade.callback.AlibcTradeInitCallback;
import com.alibaba.baichuan.trade.common.utils.AlibcLogger;



import io.flutter.plugin.common.PluginRegistry; import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.Registrar; import io.flutter.plugin.common.PluginRegistry.Registrar;
@@ -37,6 +22,19 @@ import android.app.AlertDialog;
import static com.wxwx.flutter_alibc.PluginConstants.*; import static com.wxwx.flutter_alibc.PluginConstants.*;
import static com.wxwx.flutter_alibc.PluginUtil.*; import static com.wxwx.flutter_alibc.PluginUtil.*;


import com.ali.auth.third.login.LoginServiceImpl;
import com.alibaba.alibclogin.AlibcLogin;
import com.alibaba.alibcprotocol.callback.AlibcLoginCallback;
import com.alibaba.alibcprotocol.callback.AlibcTradeCallback;
import com.alibaba.alibcprotocol.param.AlibcBizParams;
import com.alibaba.alibcprotocol.param.AlibcShowParams;
import com.alibaba.alibcprotocol.param.AlibcTaokeParams;
import com.alibaba.alibcprotocol.route.proxy.IAlibcLoginProxy;
import com.baichuan.nb_trade.AlibcTrade;
import com.baichuan.nb_trade.auth.TopAuth;
import com.baichuan.nb_trade.callback.AlibcTradeInitCallback;
import com.baichuan.nb_trade.callback.AuthCallback;
import com.baichuan.nb_trade.core.AlibcTradeSDK;
import com.wxwx.flutter_alibc.web.WebViewActivity; import com.wxwx.flutter_alibc.web.WebViewActivity;


import java.util.Map; import java.util.Map;
@@ -51,7 +49,7 @@ public class FlutterAlibcHandle {
private static FlutterAlibcHandle handle; private static FlutterAlibcHandle handle;
private static Registrar register; private static Registrar register;
private static boolean isFirst = true; private static boolean isFirst = true;
private static Result result;
private static Result result;


//第一次调用getInstance register不能为空 //第一次调用getInstance register不能为空
public static FlutterAlibcHandle getInstance(Registrar register) { public static FlutterAlibcHandle getInstance(Registrar register) {
@@ -70,7 +68,7 @@ public class FlutterAlibcHandle {
* @param result * @param result
*/ */
public void initAlibc(MethodCall call, Result result) { public void initAlibc(MethodCall call, Result result) {
AlibcTradeSDK.asyncInit(register.activity().getApplication(), new AlibcTradeInitCallback() {
AlibcTradeSDK.asyncInit(register.activity().getApplication(), new HashMap<>(), new AlibcTradeInitCallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
result.success(PluginResponse.success(null).toMap()); result.success(PluginResponse.success(null).toMap());
@@ -89,9 +87,10 @@ public class FlutterAlibcHandle {
* @param result * @param result
*/ */
public void loginTaoBao(Result result) { public void loginTaoBao(Result result) {
final AlibcLogin alibcLogin = AlibcLogin.getInstance();
final IAlibcLoginProxy alibcLogin = AlibcLogin.getInstance();
if (alibcLogin.isLogin()) { if (alibcLogin.isLogin()) {
Session session = AlibcLogin.getInstance().getSession();
// Session session = AlibcLogin.getInstance().getSession();
Session session = new LoginServiceImpl().getSession();
Map<String, Object> userInfo = new HashMap<>(); Map<String, Object> userInfo = new HashMap<>();
userInfo.put("nick", session.nick); userInfo.put("nick", session.nick);
userInfo.put("avatarUrl", session.avatarUrl); userInfo.put("avatarUrl", session.avatarUrl);
@@ -103,10 +102,24 @@ public class FlutterAlibcHandle {
return; return;
} }
alibcLogin.showLogin(new AlibcLoginCallback() { alibcLogin.showLogin(new AlibcLoginCallback() {
// @Override
// public void onSuccess(int loginResult, String openId, String userNick) {
// Map<String, Object> userInfo = new HashMap<>();
// Session session = AlibcLogin.getInstance().getSession();
// userInfo.put("nick", session.nick);
// userInfo.put("avatarUrl", session.avatarUrl);
// userInfo.put("openId", session.openId);
// userInfo.put("openSid", session.openSid);
// userInfo.put("topAccessToken", session.topAccessToken);
// userInfo.put("topAuthCode", session.topAuthCode);
// result.success(PluginResponse.success(userInfo).toMap());
// }

@Override @Override
public void onSuccess(int loginResult, String openId, String userNick) {
public void onSuccess(String s, String s1) {
Map<String, Object> userInfo = new HashMap<>(); Map<String, Object> userInfo = new HashMap<>();
Session session = AlibcLogin.getInstance().getSession();
// Session session = AlibcLogin.getInstance().getSession();
Session session = new LoginServiceImpl().getSession();
userInfo.put("nick", session.nick); userInfo.put("nick", session.nick);
userInfo.put("avatarUrl", session.avatarUrl); userInfo.put("avatarUrl", session.avatarUrl);
userInfo.put("openId", session.openId); userInfo.put("openId", session.openId);
@@ -130,10 +143,15 @@ public class FlutterAlibcHandle {
* @param result * @param result
*/ */
public void loginOut(Result result) { public void loginOut(Result result) {
AlibcLogin alibcLogin = AlibcLogin.getInstance();
IAlibcLoginProxy alibcLogin = AlibcLogin.getInstance();
alibcLogin.logout(new AlibcLoginCallback() { alibcLogin.logout(new AlibcLoginCallback() {
// @Override
// public void onSuccess(int loginResult, String openId, String userNick) {
// }

@Override @Override
public void onSuccess(int loginResult, String openId, String userNick) {
public void onSuccess(String s, String s1) {

} }


@Override @Override
@@ -172,6 +190,67 @@ public class FlutterAlibcHandle {
intent.putExtra("url", url); intent.putExtra("url", url);
intent.putExtra("arguments", map); intent.putExtra("arguments", map);
register.activity().startActivity(intent); register.activity().startActivity(intent);
}

/**
* 淘宝授权登陆 获取access_token
*
* @param call
* @param result
*/
public void taoKeLoginNew(MethodCall call, Result result) {
// String icon = call.argument("icon");
String name = call.argument("name");
String alibcAppKey = call.argument("alibcAppKey");
if (!AlibcLogin.getInstance().isLogin()) {
AlibcLogin.getInstance().showLogin(new AlibcLoginCallback() {
@Override
public void onSuccess(String s, String s1) {
TopAuth.showAuthDialog(register.activity(), R.mipmap.ic_launcher, name, alibcAppKey, new AuthCallback() {
@Override
public void onSuccess(String accessToken, String expireTime) {
Map<String, String> resMap = new HashMap();
resMap.put("accessToken", accessToken);
resMap.put("expireTime", expireTime);
result.success(resMap);
}

@Override
public void onError(String code, String msg) {
Map<String, String> resMap = new HashMap();
resMap.put("accessToken", "");
resMap.put("code", code);
resMap.put("msg", msg);
result.success(resMap);
}
});
}

@Override
public void onFailure(int i, String s) {
Log.d("阿里百川授权失败", s);
}
});
} else {
TopAuth.showAuthDialog(register.activity(), R.mipmap.ic_launcher, name, alibcAppKey, new AuthCallback() {
@Override
public void onSuccess(String accessToken, String expireTime) {
Map<String, String> resMap = new HashMap();
resMap.put("accessToken", accessToken);
resMap.put("expireTime", expireTime);
result.success(resMap);
}

@Override
public void onError(String code, String msg) {
Map<String, String> resMap = new HashMap();
resMap.put("accessToken", "");
resMap.put("code", code);
resMap.put("msg", msg);
result.success(resMap);
}
});
}


} }


@@ -184,14 +263,14 @@ public class FlutterAlibcHandle {
public void openByUrl(MethodCall call, Result result) { public void openByUrl(MethodCall call, Result result) {
AlibcShowParams showParams = new AlibcShowParams(); AlibcShowParams showParams = new AlibcShowParams();
AlibcTaokeParams taokeParams = new AlibcTaokeParams("", "", ""); AlibcTaokeParams taokeParams = new AlibcTaokeParams("", "", "");
FlutterAlibcHandle.result=result;
FlutterAlibcHandle.result = result;
showParams.setBackUrl(call.argument(key_BackUrl)); showParams.setBackUrl(call.argument(key_BackUrl));


///渠道授权 ///渠道授权
if ((Boolean) call.argument(login_And_Auth)) { if ((Boolean) call.argument(login_And_Auth)) {
///先APP授权 ///先APP授权
if(isFirst){
isFirst=false;
if (isFirst) {
isFirst = false;
register.addActivityResultListener(new PluginRegistry.ActivityResultListener() { register.addActivityResultListener(new PluginRegistry.ActivityResultListener() {
@Override @Override
public boolean onActivityResult(int requestCode, int resultCode, Intent data) { public boolean onActivityResult(int requestCode, int resultCode, Intent data) {
@@ -217,13 +296,22 @@ public class FlutterAlibcHandle {
if (!AlibcLogin.getInstance().isLogin()) { if (!AlibcLogin.getInstance().isLogin()) {


AlibcLogin.getInstance().showLogin(new AlibcLoginCallback() { AlibcLogin.getInstance().showLogin(new AlibcLoginCallback() {
@Override
public void onSuccess(int i, String s, String s1) {
Log.d("阿里百川打开WebView", "webview");
Intent intent = new Intent(register.context(), WebActivity.class);
intent.putExtra("url", (String) call.argument("url"));
register.activity().startActivityForResult(intent, 1111);
// @Override
// public void onSuccess(int i, String s, String s1) {
// Log.d("阿里百川打开WebView", "webview");
// Intent intent = new Intent(register.context(), WebActivity.class);
// intent.putExtra("url", (String) call.argument("url"));
// register.activity().startActivityForResult(intent, 1111);
//
// }


@Override
public void onSuccess(String s, String s1) {
// Log.d("阿里百川打开WebView", "webview");
// Intent intent = new Intent(register.context(), WebActivity.class);
// intent.putExtra("url", (String) call.argument("url"));
// register.activity().startActivityForResult(intent, 1111);
taoKeLoginNew(call, result);
} }


@Override @Override
@@ -233,9 +321,10 @@ public class FlutterAlibcHandle {
}); });
} else { } else {
Log.d("阿里百川打开WebView", "webview"); Log.d("阿里百川打开WebView", "webview");
Intent intent = new Intent(register.context(), WebActivity.class);
intent.putExtra("url", (String) call.argument("url"));
register.activity().startActivityForResult(intent, 1111);
// Intent intent = new Intent(register.context(), WebActivity.class);
// intent.putExtra("url", (String) call.argument("url"));
// register.activity().startActivityForResult(intent, 1111);
taoKeLoginNew(call, result);
} }
///后渠道信息 ///后渠道信息
return; return;
@@ -261,19 +350,24 @@ public class FlutterAlibcHandle {
Map<String, String> trackParams = new HashMap<>(); Map<String, String> trackParams = new HashMap<>();
String url = call.argument("url"); String url = call.argument("url");
// 以显示传入url的方式打开页面(第二个参数是套件名称) // 以显示传入url的方式打开页面(第二个参数是套件名称)
AlibcTrade.openByUrl(register.activity(), "", url, null,
new WebViewClient(), new WebChromeClient(), showParams,
AlibcTrade.openByUrl(register.activity(), url, showParams,
taokeParams, trackParams, new AlibcTradeCallback() { taokeParams, trackParams, new AlibcTradeCallback() {
// @Override
// public void onTradeSuccess(AlibcTradeResult tradeResult) {
// Map<String, Object> results = new HashMap<>();
// if (AlibcResultType.TYPECART == tradeResult.resultType) {
// results.put("type", 1);
// } else if (AlibcResultType.TYPEPAY == tradeResult.resultType) {
// results.put("type", 0);
// results.put("payFailedOrders", tradeResult.payResult.payFailedOrders);
// results.put("paySuccessOrders", tradeResult.payResult.paySuccessOrders);
// }
// result.success(PluginResponse.success(results).toMap());
// }

@Override @Override
public void onTradeSuccess(AlibcTradeResult tradeResult) {
public void onSuccess(int i) {
Map<String, Object> results = new HashMap<>(); Map<String, Object> results = new HashMap<>();
if (AlibcResultType.TYPECART == tradeResult.resultType) {
results.put("type", 1);
} else if (AlibcResultType.TYPEPAY == tradeResult.resultType) {
results.put("type", 0);
results.put("payFailedOrders", tradeResult.payResult.payFailedOrders);
results.put("paySuccessOrders", tradeResult.payResult.paySuccessOrders);
}
result.success(PluginResponse.success(results).toMap()); result.success(PluginResponse.success(results).toMap());
} }


@@ -293,8 +387,8 @@ public class FlutterAlibcHandle {
* @param result * @param result
*/ */
public void openShop(MethodCall call, Result result) { public void openShop(MethodCall call, Result result) {
AlibcBasePage page = new AlibcShopPage(call.argument("shopId"));
openByBizCode(page, "shop", call, result);
// AlibcBasePage page = new AlibcShopPage(call.argument("shopId"));
// openByBizCode(page, "shop", call, result);
} }


/** /**
@@ -303,8 +397,8 @@ public class FlutterAlibcHandle {
* @param result * @param result
*/ */
public void openCart(MethodCall call, Result result) { public void openCart(MethodCall call, Result result) {
AlibcBasePage page = new AlibcMyCartsPage();
openByBizCode(page, "cart", call, result);
// AlibcBasePage page = new AlibcMyCartsPage();
// openByBizCode(page, "cart", call, result);
} }


/** /**
@@ -314,11 +408,11 @@ public class FlutterAlibcHandle {
* @param result * @param result
*/ */
public void openItemDetail(MethodCall call, Result result) { public void openItemDetail(MethodCall call, Result result) {
AlibcBasePage page = new AlibcDetailPage(call.argument("itemID"));
openByBizCode(page, "detail", call, result);
// AlibcBasePage page = new AlibcDetailPage(call.argument("itemID"));
openByBizCode(call.argument("itemID"), "detail", call, result);
} }


private void openByBizCode(AlibcBasePage page, String type, MethodCall call, Result result) {
private void openByBizCode(String page, String type, MethodCall call, Result result) {
AlibcShowParams showParams = new AlibcShowParams(); AlibcShowParams showParams = new AlibcShowParams();
AlibcTaokeParams taokeParams = new AlibcTaokeParams("", "", ""); AlibcTaokeParams taokeParams = new AlibcTaokeParams("", "", "");


@@ -334,26 +428,38 @@ public class FlutterAlibcHandle {
taokeParams = getTaokeParams(call.argument("taokeParams")); taokeParams = getTaokeParams(call.argument("taokeParams"));
} }


if ("false".equals(call.argument("isNeedCustomNativeFailMode"))) {
showParams.setNativeOpenFailedMode(AlibcFailModeType.AlibcNativeFailModeNONE);
} else if (call.argument(key_NativeFailMode) != null) {
showParams.setNativeOpenFailedMode(getFailModeType("" + call.argument(key_NativeFailMode)));
}
// if ("false".equals(call.argument("isNeedCustomNativeFailMode"))) {
// showParams.setNativeOpenFailedMode(AlibcFailModeType.AlibcNativeFailModeNONE);
// } else if (call.argument(key_NativeFailMode) != null) {
// showParams.n(getFailModeType("" + call.argument(key_NativeFailMode)));
// }


Map<String, String> trackParams = new HashMap<>(); Map<String, String> trackParams = new HashMap<>();
AlibcTrade.openByBizCode(register.activity(), page, null, new WebViewClient(),
new WebChromeClient(), type, showParams, taokeParams,
AlibcTrade.openByCode(register.activity(), page, new AlibcBizParams(), showParams, taokeParams,
trackParams, new AlibcTradeCallback() { trackParams, new AlibcTradeCallback() {
// @Override
// public void onTradeSuccess(AlibcTradeResult tradeResult) {
// Map<String, Object> results = new HashMap<>();
// if (AlibcResultType.TYPECART == tradeResult.resultType) {
// results.put("type", 1);
// } else if (AlibcResultType.TYPEPAY == tradeResult.resultType) {
// results.put("type", 0);
// results.put("payFailedOrders", tradeResult.payResult.payFailedOrders);
// results.put("paySuccessOrders", tradeResult.payResult.paySuccessOrders);
// }
// result.success(PluginResponse.success(results).toMap());
// }

@Override @Override
public void onTradeSuccess(AlibcTradeResult tradeResult) {
public void onSuccess(int i) {
Map<String, Object> results = new HashMap<>(); Map<String, Object> results = new HashMap<>();
if (AlibcResultType.TYPECART == tradeResult.resultType) {
results.put("type", 1);
} else if (AlibcResultType.TYPEPAY == tradeResult.resultType) {
results.put("type", 0);
results.put("payFailedOrders", tradeResult.payResult.payFailedOrders);
results.put("paySuccessOrders", tradeResult.payResult.paySuccessOrders);
}
// if (AlibcResultType.TYPECART == tradeResult.resultType) {
// results.put("type", 1);
// } else if (AlibcResultType.TYPEPAY == tradeResult.resultType) {
// results.put("type", 0);
// results.put("payFailedOrders", tradeResult.payResult.payFailedOrders);
// results.put("paySuccessOrders", tradeResult.payResult.paySuccessOrders);
// }
result.success(PluginResponse.success(results).toMap()); result.success(PluginResponse.success(results).toMap());
} }


@@ -371,7 +477,7 @@ public class FlutterAlibcHandle {
* @param call * @param call
*/ */
public void syncForTaoke(MethodCall call) { public void syncForTaoke(MethodCall call) {
AlibcTradeSDK.setSyncForTaoke(call.argument("isSync"));
// AlibcTradeSDK.setSyncForTaoke(call.argument("isSync"));
} }


/** /**
@@ -380,7 +486,7 @@ public class FlutterAlibcHandle {
* @param call * @param call
*/ */
public void useAlipayNative(MethodCall call) { public void useAlipayNative(MethodCall call) {
AlibcTradeSDK.setShouldUseAlipay(call.argument("isNeed"));
// AlibcTradeSDK.setShouldUseAlipay(call.argument("isNeed"));
} }





+ 2
- 0
android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcPlugin.java View File

@@ -29,6 +29,8 @@ public class FlutterAlibcPlugin implements MethodCallHandler {
handle.loginTaoBao(result); handle.loginTaoBao(result);
} else if (call.method.equals("taoKeLogin")){ } else if (call.method.equals("taoKeLogin")){
handle.taoKeLogin(call, result); handle.taoKeLogin(call, result);
} else if (call.method.equals("taoKeLoginNew")){
handle.taoKeLoginNew(call, result);
} else if (call.method.equals("loginOut")){ } else if (call.method.equals("loginOut")){
handle.loginOut(result); handle.loginOut(result);
}else if (call.method.equals("openByUrl")){ }else if (call.method.equals("openByUrl")){


+ 25
- 24
android/src/main/java/com/wxwx/flutter_alibc/PluginUtil.java View File

@@ -1,9 +1,10 @@
package com.wxwx.flutter_alibc; package com.wxwx.flutter_alibc;


import com.alibaba.alibcprotocol.param.AlibcTaokeParams;
import com.alibaba.alibcprotocol.param.OpenType;

import static com.wxwx.flutter_alibc.PluginConstants.*; import static com.wxwx.flutter_alibc.PluginConstants.*;
import com.alibaba.baichuan.android.trade.model.OpenType;
import com.alibaba.baichuan.trade.biz.applink.adapter.AlibcFailModeType;
import com.alibaba.baichuan.trade.biz.core.taoke.AlibcTaokeParams;



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


@@ -11,40 +12,40 @@ import java.util.Map;
* @Author karedem * @Author karedem
* @Date 2019/9/10 11:42 * @Date 2019/9/10 11:42
* @Description 映射返回对应值 * @Description 映射返回对应值
**/
**/
public class PluginUtil { public class PluginUtil {


public static OpenType getOpenType(String open){
if (Auto_OpenType.equals(open)){
public static OpenType getOpenType(String open) {
if (Auto_OpenType.equals(open)) {
return OpenType.Auto; return OpenType.Auto;
}else {
return OpenType.Native;
} else {
return OpenType.Native;
} }
} }


public static String getClientType(String client){
if (client.equals(Tmall_ClientType)){
public static String getClientType(String client) {
if (client.equals(Tmall_ClientType)) {
return "tmall"; return "tmall";
}else {
} else {
return "taobao"; return "taobao";
} }
} }


public static AlibcFailModeType getFailModeType(String mode){
if (JumpH5_FailMode.equals(mode)){
return AlibcFailModeType.AlibcNativeFailModeJumpH5;
}else if (JumpDownloadPage_FailMode.equals(mode)){
return AlibcFailModeType.AlibcNativeFailModeJumpDOWNLOAD;
}else {
return AlibcFailModeType.AlibcNativeFailModeNONE;
}
}
public static AlibcTaokeParams getTaokeParams(Map<String, Object> taokePar){
// public static AlibcFailModeType getFailModeType(String mode) {
// if (JumpH5_FailMode.equals(mode)) {
// return AlibcFailModeType.AlibcNativeFailModeJumpH5;
// } else if (JumpDownloadPage_FailMode.equals(mode)) {
// return AlibcFailModeType.AlibcNativeFailModeJumpDOWNLOAD;
// } else {
// return AlibcFailModeType.AlibcNativeFailModeNONE;
// }
// }
public static AlibcTaokeParams getTaokeParams(Map<String, Object> taokePar) {
String pid = (String) taokePar.get("pid"); String pid = (String) taokePar.get("pid");
AlibcTaokeParams taokeParams = new AlibcTaokeParams("", "", ""); AlibcTaokeParams taokeParams = new AlibcTaokeParams("", "", "");
if (pid != null){
taokeParams.setPid(pid);
if (pid != null) {
taokeParams.pid = pid;
} }
Object extParams = taokePar.get("extParams"); Object extParams = taokePar.get("extParams");
//TODO 其他参数待添加 //TODO 其他参数待添加


+ 33
- 17
android/src/main/java/com/wxwx/flutter_alibc/WebActivity.java View File

@@ -1,6 +1,7 @@
package com.wxwx.flutter_alibc; package com.wxwx.flutter_alibc;


import android.annotation.SuppressLint; import android.annotation.SuppressLint;

import android.app.Activity; import android.app.Activity;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Intent; import android.content.Intent;
@@ -24,13 +25,13 @@ import android.webkit.WebViewClient;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Toast; 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 com.alibaba.alibclogin.AlibcLogin;
import com.alibaba.alibcprotocol.callback.AlibcLoginCallback;
import com.alibaba.alibcprotocol.callback.AlibcTradeCallback;
import com.alibaba.alibcprotocol.param.AlibcShowParams;
import com.alibaba.alibcprotocol.param.AlibcTaokeParams;
import com.baichuan.nb_trade.AlibcTrade;


import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -68,11 +69,15 @@ public class WebActivity extends Activity {
// alibcTaokeParams.extraParams.put("taokeAppkey", SPUtils.getPrefString(mActivity, Pkey.APP_alliance_appkey, "")); // alibcTaokeParams.extraParams.put("taokeAppkey", SPUtils.getPrefString(mActivity, Pkey.APP_alliance_appkey, ""));
AlibcShowParams showParams = new AlibcShowParams(); AlibcShowParams showParams = new AlibcShowParams();
showParams.setBackUrl("alisdk://"); showParams.setBackUrl("alisdk://");
AlibcTrade.openByUrl(WebActivity.this, "", url,
mainWeb, new MyBaichuanWebClient(), new MyWebChromeClient(), showParams,
AlibcTrade.openByUrl(WebActivity.this, url, showParams,
new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() { new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() {
// @Override
// public void onTradeSuccess(AlibcTradeResult alibcTradeResult) {
//
// }

@Override @Override
public void onTradeSuccess(AlibcTradeResult alibcTradeResult) {
public void onSuccess(int i) {


} }


@@ -103,12 +108,16 @@ public class WebActivity extends Activity {
Map<String, String> exParams = new HashMap<>();//yhhpass参数 Map<String, String> exParams = new HashMap<>();//yhhpass参数
AlibcShowParams showParams = new AlibcShowParams(); AlibcShowParams showParams = new AlibcShowParams();
showParams.setBackUrl("alisdk://"); showParams.setBackUrl("alisdk://");
AlibcTrade.openByUrl(WebActivity.this, "", url,
mainWeb, new MyBaichuanWebClient(), new MyWebChromeClient(), showParams,
AlibcTrade.openByUrl(WebActivity.this, url,showParams,
new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() { new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() {
// @Override
// public void onTradeSuccess(AlibcTradeResult alibcTradeResult) {
// Log.d("cg", alibcTradeResult.toString());
// }

@Override @Override
public void onTradeSuccess(AlibcTradeResult alibcTradeResult) {
Log.d("cg", alibcTradeResult.toString());
public void onSuccess(int i) {
} }


@Override @Override
@@ -336,10 +345,15 @@ public class WebActivity extends Activity {
// alibcTaokeParams.extraParams.put("taokeAppkey", SPUtils.getPrefString(mActivity, Pkey.APP_alliance_appkey, "")); // alibcTaokeParams.extraParams.put("taokeAppkey", SPUtils.getPrefString(mActivity, Pkey.APP_alliance_appkey, ""));
AlibcShowParams showParams = new AlibcShowParams(); AlibcShowParams showParams = new AlibcShowParams();
showParams.setBackUrl("alisdk://"); showParams.setBackUrl("alisdk://");
AlibcTrade.openByUrl(WebActivity.this, "", url, mainWeb, new MyBaichuanWebClient(), new MyWebChromeClient(), showParams,
AlibcTrade.openByUrl(WebActivity.this, url, showParams,
new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() { new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() {
// @Override
// public void onTradeSuccess(AlibcTradeResult alibcTradeResult) {
//
// }

@Override @Override
public void onTradeSuccess(AlibcTradeResult alibcTradeResult) {
public void onSuccess(int i) {


} }


@@ -440,8 +454,10 @@ public class WebActivity extends Activity {
// } // }
if (url.contains("maliprod.alipay.com") && !url.contains("confirmGoods.do")) { if (url.contains("maliprod.alipay.com") && !url.contains("confirmGoods.do")) {
AlibcLogin.getInstance().showLogin(new AlibcLoginCallback() { AlibcLogin.getInstance().showLogin(new AlibcLoginCallback() {


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


} }




+ 19
- 15
android/src/main/java/com/wxwx/flutter_alibc/web/WebViewActivity.java View File

@@ -10,19 +10,18 @@ import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.Toast; 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.android.trade.model.OpenType;
import com.alibaba.baichuan.trade.biz.applink.adapter.AlibcFailModeType;
import com.alibaba.baichuan.trade.biz.context.AlibcTradeResult;
import com.alibaba.baichuan.trade.biz.core.taoke.AlibcTaokeParams;

import com.alibaba.alibcprotocol.callback.AlibcTradeCallback;
import com.alibaba.alibcprotocol.param.AlibcShowParams;
import com.alibaba.alibcprotocol.param.AlibcTaokeParams;
import com.alibaba.baichuan.trade.common.utils.AlibcLogger; import com.alibaba.baichuan.trade.common.utils.AlibcLogger;


import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static com.wxwx.flutter_alibc.PluginConstants.*; import static com.wxwx.flutter_alibc.PluginConstants.*;
import static com.wxwx.flutter_alibc.PluginUtil.*; import static com.wxwx.flutter_alibc.PluginUtil.*;

import com.baichuan.nb_trade.AlibcTrade;
import com.wxwx.flutter_alibc.R; import com.wxwx.flutter_alibc.R;
import java.net.URLDecoder; import java.net.URLDecoder;


@@ -85,11 +84,11 @@ public class WebViewActivity extends Activity {
if (argument.get("taokeParams") != null){ if (argument.get("taokeParams") != null){
taokeParams = getTaokeParams((HashMap<String, Object>)argument.get("taokeParams")); taokeParams = getTaokeParams((HashMap<String, Object>)argument.get("taokeParams"));
} }
if ("false".equals(argument.get("isNeedCustomNativeFailMode"))){
showParams.setNativeOpenFailedMode(AlibcFailModeType.AlibcNativeFailModeNONE);
}else if (argument.get(key_NativeFailMode) != null){
showParams.setNativeOpenFailedMode(getFailModeType(String.valueOf(argument.get(key_NativeFailMode))));
}
// if ("false".equals(argument.get("isNeedCustomNativeFailMode"))){
// showParams.setNativeOpenFailedMode(AlibcFailModeType.AlibcNativeFailModeNONE);
// }else if (argument.get(key_NativeFailMode) != null){
// showParams.setNativeOpenFailedMode(getFailModeType(String.valueOf(argument.get(key_NativeFailMode))));
// }


Map<String, String> trackParams = new HashMap<>(); Map<String, String> trackParams = new HashMap<>();


@@ -114,11 +113,16 @@ public class WebViewActivity extends Activity {
} }
}; };


AlibcTrade.openByUrl(WebViewActivity.this, "", url, webView,
client, new WebChromeClient(),
AlibcTrade.openByUrl(WebViewActivity.this, url,
showParams, taokeParams, trackParams, new AlibcTradeCallback() { showParams, taokeParams, trackParams, new AlibcTradeCallback() {
// @Override
// public void onTradeSuccess(AlibcTradeResult tradeResult) {}//不会回调

@Override @Override
public void onTradeSuccess(AlibcTradeResult tradeResult) {}//不会回调
public void onSuccess(int i) {

}

@Override @Override
public void onFailure(int code, String msg) {}//不会回调 public void onFailure(int code, String msg) {}//不会回调
}); });


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


+ 1
- 1
example/.flutter-plugins-dependencies View File

@@ -1 +1 @@
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"flutter_alibc","dependencies":[]}]}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_alibc","path":"D:\\\\zy_project\\\\zhiying_flutter_alibc\\\\","dependencies":[]}],"android":[{"name":"flutter_alibc","path":"D:\\\\zy_project\\\\zhiying_flutter_alibc\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_alibc","dependencies":[]}],"date_created":"2021-04-09 09:35:59.437953","version":"1.22.1"}

+ 3
- 1
example/android/app/build.gradle View File

@@ -36,6 +36,7 @@ android {
applicationId "wxwx.com.flutter_alibc_example" applicationId "wxwx.com.flutter_alibc_example"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 28 targetSdkVersion 28
multiDexEnabled true
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -73,5 +74,6 @@ dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1' androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'
} }

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

@@ -17,7 +17,7 @@
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing <!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if until Flutter renders its first frame. It can be removed if


+ 4
- 1
example/android/build.gradle View File

@@ -2,10 +2,13 @@ buildscript {
repositories { repositories {
google() google()
jcenter() jcenter()
maven {
url "http://repo.baichuan-android.taobao.com/content/groups/BaichuanRepositories/"
}
} }


dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:3.3.2'
} }
} }




+ 3
- 1
example/android/gradle.properties View File

@@ -2,4 +2,6 @@ org.gradle.jvmargs=-Xmx1536M


#android.useAndroidX=false #android.useAndroidX=false
#android.enableJetifier=true #android.enableJetifier=true
android.enableR8=true
#android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true

+ 2
- 2
example/android/gradle/wrapper/gradle-wrapper.properties View File

@@ -1,6 +1,6 @@
#Fri Jun 23 08:50:38 CEST 2017
#Wed Apr 07 18:44:33 CST 2021
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

+ 10
- 5
example/ios/Flutter/flutter_export_environment.sh View File

@@ -1,10 +1,15 @@
#!/bin/sh #!/bin/sh
# This is a generated file; do not edit or check into version control. # This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/fnuser02/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/fnuser02/Documents/fnuoProject/flutter_open/flutter_alibc/example"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_ROOT=D:\flutter\flutter"
export "FLUTTER_APPLICATION_PATH=D:\zy_project\zhiying_flutter_alibc\example"
export "FLUTTER_TARGET=lib\main.dart"
export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_FRAMEWORK_DIR=/Users/fnuser02/flutter/bin/cache/artifacts/engine/ios"
export "SYMROOT=${SOURCE_ROOT}/../build\ios"
export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
export "FLUTTER_FRAMEWORK_DIR=D:\flutter\flutter\bin\cache\artifacts\engine\ios"
export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1" export "FLUTTER_BUILD_NUMBER=1"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=false"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.packages"

+ 20
- 10
example/lib/main.dart View File

@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_alibc/alibc_const_key.dart'; import 'package:flutter_alibc/alibc_const_key.dart';
import 'package:flutter_alibc/flutter_alibc.dart'; import 'package:flutter_alibc/flutter_alibc.dart';
import 'package:flutter_alibc/alibc_model.dart';


void main() => runApp(MyApp()); void main() => runApp(MyApp());


@@ -71,7 +72,9 @@ class _MyAppState extends State<MyApp> {
// var waite3s = await FlutterAlibc.openItemDetail(itemID: "12345"); // var waite3s = await FlutterAlibc.openItemDetail(itemID: "12345");
// 如果什么都不给 // 如果什么都不给
var result = await FlutterAlibc.initAlibc(); var result = await FlutterAlibc.initAlibc();
print(result);
print("--------------");
print(result.errorMessage+"\n"+result.errorCode);
print("--------------");
} on Exception {} } on Exception {}
}, },
), ),
@@ -79,8 +82,7 @@ class _MyAppState extends State<MyApp> {
child: Text("登录淘宝"), child: Text("登录淘宝"),
onPressed: () async { onPressed: () async {
var result = await FlutterAlibc.loginTaoBao(); var result = await FlutterAlibc.loginTaoBao();
print(
"登录淘宝 ${result.data.nick} ${result.data.topAccessToken}");
print("登录淘宝 ${result.data.nick} ${result.data.topAccessToken}");
}, },
), ),
FlatButton( FlatButton(
@@ -90,15 +92,25 @@ class _MyAppState extends State<MyApp> {
}, },
), ),
FlatButton( FlatButton(
child: Text("淘客登录,二次授权"),
child: Text("淘客登录,渠道授权"),
onPressed: () async { onPressed: () async {
var result = await FlutterAlibc.taoKeLogin( var result = await FlutterAlibc.taoKeLogin(
url: url:
"https://oauth.taobao.com/authorize?response_type=token&client_id=27646673&state=1212&view=wap", "https://oauth.taobao.com/authorize?response_type=token&client_id=27646673&state=1212&view=wap",
openType: AlibcOpenType.AlibcOpenTypeNative, openType: AlibcOpenType.AlibcOpenTypeNative,
isNeedCustomNativeFailMode: true, isNeedCustomNativeFailMode: true,
nativeFailMode:
AlibcNativeFailMode.AlibcNativeFailModeJumpH5);
nativeFailMode: AlibcNativeFailMode.AlibcNativeFailModeJumpH5);
print("access token ${result["accessToken"]}");
},
),
FlatButton(
child: Text("淘客登录,新版渠道授权"),
onPressed: () async {
var result = await FlutterAlibc.taoKeLoginNew(
"测试名字",
"31333495"
);
print(result);
print("access token ${result["accessToken"]}"); print("access token ${result["accessToken"]}");
}, },
), ),
@@ -110,8 +122,7 @@ class _MyAppState extends State<MyApp> {
"https://uland.taobao.com/coupon/edetail?e=0I2EBL%2BTWswGQASttHIRqRXxIesJCFV0jSsDEwaP11URqogtr65NL3IIxArmwXZQtYdj3OrQBBwJkllDQLUC%2B79fwBwwUiqlvyfAqbG%2BQWkG6QT52O7rmXYefz8NXcoYTJnbK5InWzlFfSAQOJJoy8NEaV3mm%2FQSzjZt5gElMznom9kMiklcP0KJ92VgfYGd&traceId=0b0d82cf15669814548736276e3d95&union_lens=lensId:0b0b6466_0c0d_16cd75f7c39_528f&xId=6MboRwsAi2s8Glbqt3lJLAwSlyrPyBLCZ01KOk6QzKCNhw8C6RjXgA1bNbZdKzp30gOqd1J5j1k7ei7HYId1QZ&ut_sk=1.utdid_null_1566981455011.TaoPassword-Outside.taoketop&sp_tk=77+lTU5nMllrdHRqSVLvv6U=", "https://uland.taobao.com/coupon/edetail?e=0I2EBL%2BTWswGQASttHIRqRXxIesJCFV0jSsDEwaP11URqogtr65NL3IIxArmwXZQtYdj3OrQBBwJkllDQLUC%2B79fwBwwUiqlvyfAqbG%2BQWkG6QT52O7rmXYefz8NXcoYTJnbK5InWzlFfSAQOJJoy8NEaV3mm%2FQSzjZt5gElMznom9kMiklcP0KJ92VgfYGd&traceId=0b0d82cf15669814548736276e3d95&union_lens=lensId:0b0b6466_0c0d_16cd75f7c39_528f&xId=6MboRwsAi2s8Glbqt3lJLAwSlyrPyBLCZ01KOk6QzKCNhw8C6RjXgA1bNbZdKzp30gOqd1J5j1k7ei7HYId1QZ&ut_sk=1.utdid_null_1566981455011.TaoPassword-Outside.taoketop&sp_tk=77+lTU5nMllrdHRqSVLvv6U=",
//backUrl: "tbopen27822502:https://h5.m.taobao.com", //backUrl: "tbopen27822502:https://h5.m.taobao.com",
isNeedCustomNativeFailMode: true, isNeedCustomNativeFailMode: true,
nativeFailMode:
AlibcNativeFailMode.AlibcNativeFailModeJumpH5);
nativeFailMode: AlibcNativeFailMode.AlibcNativeFailModeJumpH5);
print(result); print(result);
}, },
), ),
@@ -122,8 +133,7 @@ class _MyAppState extends State<MyApp> {
itemID: "575688730394", itemID: "575688730394",
schemeType: AlibcSchemeType.AlibcSchemeTaoBao, schemeType: AlibcSchemeType.AlibcSchemeTaoBao,
isNeedCustomNativeFailMode: true, isNeedCustomNativeFailMode: true,
nativeFailMode:
AlibcNativeFailMode.AlibcNativeFailModeJumpH5);
nativeFailMode: AlibcNativeFailMode.AlibcNativeFailModeJumpH5);
print(result); print(result);
}, },
), ),


+ 33
- 75
example/pubspec.lock View File

@@ -1,62 +1,48 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.5.2"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.4.0"
version: "2.5.0-nullsafety.1"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.5"
charcode:
version: "2.1.0-nullsafety.1"
characters:
dependency: transitive dependency: transitive
description: description:
name: charcode
name: characters
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.2"
collection:
version: "1.1.0-nullsafety.3"
charcode:
dependency: transitive dependency: transitive
description: description:
name: collection
name: charcode
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.14.11"
convert:
version: "1.2.0-nullsafety.1"
clock:
dependency: transitive dependency: transitive
description: description:
name: convert
name: clock
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.1"
crypto:
version: "1.1.0-nullsafety.1"
collection:
dependency: transitive dependency: transitive
description: description:
name: crypto
name: collection
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.3"
version: "1.15.0-nullsafety.3"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -64,6 +50,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.2" version: "0.1.2"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0-nullsafety.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@@ -81,55 +74,27 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
image:
dependency: transitive
description:
name: image
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.4"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.12.6"
version: "0.12.10-nullsafety.1"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.8"
version: "1.3.0-nullsafety.3"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.6.4"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.5"
version: "1.8.0-nullsafety.1"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@@ -141,62 +106,55 @@ packages:
name: source_span name: source_span
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.5.5"
version: "1.8.0-nullsafety.2"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.9.3"
version: "1.10.0-nullsafety.1"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety.1"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.5"
version: "1.1.0-nullsafety.1"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0"
version: "1.2.0-nullsafety.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.2.11"
version: "0.2.19-nullsafety.2"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.6"
version: "1.3.0-nullsafety.3"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.5.0"
version: "2.1.0-nullsafety.3"
sdks: sdks:
dart: ">=2.4.0 <3.0.0"
dart: ">=2.10.0-110 <2.11.0"

+ 17
- 0
lib/flutter_alibc.dart View File

@@ -106,6 +106,23 @@ class FlutterAlibc {
return result; return result;
} }


///
/// @description: 渠道授权,获取access_token
/// name app名字
/// alibcAppKey 百川Key
/// Map<String,String>
static Future<Map<dynamic, dynamic>> taoKeLoginNew(
String name,
String alibcAppKey) async {

Map result = await _channel.invokeMethod("taoKeLoginNew", {
"name": name,
"alibcAppKey": alibcAppKey,
});

return result;
}

/// ///
/// @description: 通过url打开,包括h5,唤起手淘等 /// @description: 通过url打开,包括h5,唤起手淘等
/// @param /// @param


+ 31
- 73
pubspec.lock View File

@@ -1,62 +1,55 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.5.2"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.4.0"
version: "2.5.0-nullsafety.1"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.5"
version: "2.1.0-nullsafety.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.3"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.2"
collection:
version: "1.2.0-nullsafety.1"
clock:
dependency: transitive dependency: transitive
description: description:
name: collection
name: clock
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.14.11"
convert:
version: "1.1.0-nullsafety.1"
collection:
dependency: transitive dependency: transitive
description: description:
name: convert
name: collection
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.1"
crypto:
version: "1.15.0-nullsafety.3"
fake_async:
dependency: transitive dependency: transitive
description: description:
name: crypto
name: fake_async
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.3"
version: "1.2.0-nullsafety.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@@ -67,55 +60,27 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
image:
dependency: transitive
description:
name: image
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.4"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.12.6"
version: "0.12.10-nullsafety.1"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.8"
version: "1.3.0-nullsafety.3"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.6.4"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.4.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.5"
version: "1.8.0-nullsafety.1"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@@ -127,62 +92,55 @@ packages:
name: source_span name: source_span
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.5.5"
version: "1.8.0-nullsafety.2"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.9.3"
version: "1.10.0-nullsafety.1"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety.1"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.5"
version: "1.1.0-nullsafety.1"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0"
version: "1.2.0-nullsafety.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.2.11"
version: "0.2.19-nullsafety.2"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.6"
version: "1.3.0-nullsafety.3"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.8"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.5.0"
version: "2.1.0-nullsafety.3"
sdks: sdks:
dart: ">=2.4.0 <3.0.0"
dart: ">=2.10.0-110 <2.11.0"

Loading…
Cancel
Save