diff --git a/android/build.gradle b/android/build.gradle index 8143843..c53106b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -4,7 +4,7 @@ version '1.0-SNAPSHOT' buildscript { repositories { google() - jcenter() + mavenCentral() maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} flatDir { dirs 'libs' @@ -22,7 +22,7 @@ buildscript { rootProject.allprojects { repositories { google() - jcenter() + mavenCentral() maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} } } @@ -100,7 +100,6 @@ dependencies{ // implementation 'com.taobao.android:avmpaar3:5.0.0.9-v5@aar' // implementation 'com.taobao.android:sgmiddletieraar3:5.0.0.9-v5@aar' - compileOnly fileTree(include: ['*.jar','*.aar'], dir: 'libs') // implementation(name: 'cardview-1.0.0', ext: 'aar') diff --git a/android/libs/alibcad-5.0.0.13.aar b/android/libs/alibcad-5.0.0.13.aar deleted file mode 100644 index 6c5f640..0000000 Binary files a/android/libs/alibcad-5.0.0.13.aar and /dev/null differ diff --git a/android/libs/alibcad-5.0.1.0.aar b/android/libs/alibcad-5.0.1.0.aar new file mode 100644 index 0000000..9f4ba56 Binary files /dev/null and b/android/libs/alibcad-5.0.1.0.aar differ diff --git a/android/libs/alibcapplink-5.0.0.13.aar b/android/libs/alibcapplink-5.0.0.13.aar deleted file mode 100644 index 0d903dd..0000000 Binary files a/android/libs/alibcapplink-5.0.0.13.aar and /dev/null differ diff --git a/android/libs/alibcapplink-5.0.1.0.aar b/android/libs/alibcapplink-5.0.1.0.aar new file mode 100644 index 0000000..1c9002b Binary files /dev/null and b/android/libs/alibcapplink-5.0.1.0.aar differ diff --git a/android/libs/alibcauth-5.0.1.0.aar b/android/libs/alibcauth-5.0.1.0.aar new file mode 100644 index 0000000..cc6c5a8 Binary files /dev/null and b/android/libs/alibcauth-5.0.1.0.aar differ diff --git a/android/libs/alibcextend-5.0.1.0.aar b/android/libs/alibcextend-5.0.1.0.aar new file mode 100644 index 0000000..0921f24 Binary files /dev/null and b/android/libs/alibcextend-5.0.1.0.aar differ diff --git a/android/libs/alibclogin-5.0.0.13.aar b/android/libs/alibclogin-5.0.0.13.aar deleted file mode 100644 index 875d59a..0000000 Binary files a/android/libs/alibclogin-5.0.0.13.aar and /dev/null differ diff --git a/android/libs/alibclogin-5.0.1.0.aar b/android/libs/alibclogin-5.0.1.0.aar new file mode 100644 index 0000000..7051b1f Binary files /dev/null and b/android/libs/alibclogin-5.0.1.0.aar differ diff --git a/android/libs/alibcnbtrade-5.0.0.13.aar b/android/libs/alibcnbtrade-5.0.0.13.aar deleted file mode 100644 index 0375210..0000000 Binary files a/android/libs/alibcnbtrade-5.0.0.13.aar and /dev/null differ diff --git a/android/libs/alibcnbtrade-5.0.1.0.aar b/android/libs/alibcnbtrade-5.0.1.0.aar new file mode 100644 index 0000000..64e54a1 Binary files /dev/null and b/android/libs/alibcnbtrade-5.0.1.0.aar differ diff --git a/android/libs/alibcprotocol-5.0.0.13.aar b/android/libs/alibcprotocol-5.0.0.13.aar deleted file mode 100644 index 49ba771..0000000 Binary files a/android/libs/alibcprotocol-5.0.0.13.aar and /dev/null differ diff --git a/android/libs/alibcprotocol-5.0.1.0.aar b/android/libs/alibcprotocol-5.0.1.0.aar new file mode 100644 index 0000000..55a8db9 Binary files /dev/null and b/android/libs/alibcprotocol-5.0.1.0.aar differ diff --git a/android/libs/alibctools-5.0.0.13.aar b/android/libs/alibctools-5.0.0.13.aar deleted file mode 100644 index 96d102f..0000000 Binary files a/android/libs/alibctools-5.0.0.13.aar and /dev/null differ diff --git a/android/libs/alibctradecommon-5.0.0.13.aar b/android/libs/alibctradecommon-5.0.0.13.aar deleted file mode 100644 index 2653247..0000000 Binary files a/android/libs/alibctradecommon-5.0.0.13.aar and /dev/null differ diff --git a/android/libs/alibctradecommon-5.0.1.0.aar b/android/libs/alibctradecommon-5.0.1.0.aar new file mode 100644 index 0000000..36f0b0d Binary files /dev/null and b/android/libs/alibctradecommon-5.0.1.0.aar differ diff --git a/android/libs/alibctriver-5.0.0.13.aar b/android/libs/alibctriver-5.0.1.0.aar similarity index 53% rename from android/libs/alibctriver-5.0.0.13.aar rename to android/libs/alibctriver-5.0.1.0.aar index c24c78a..6e65817 100644 Binary files a/android/libs/alibctriver-5.0.0.13.aar and b/android/libs/alibctriver-5.0.1.0.aar differ diff --git a/android/libs/alibctriver_live-5.0.0.13.aar b/android/libs/alibctriver_live-5.0.1.0.aar similarity index 88% rename from android/libs/alibctriver_live-5.0.0.13.aar rename to android/libs/alibctriver_live-5.0.1.0.aar index 80f153a..2efa885 100644 Binary files a/android/libs/alibctriver_live-5.0.0.13.aar and b/android/libs/alibctriver_live-5.0.1.0.aar differ diff --git a/android/libs/alibcwebview-5.0.0.13.aar b/android/libs/alibcwebview-5.0.0.13.aar deleted file mode 100644 index 0a2dd28..0000000 Binary files a/android/libs/alibcwebview-5.0.0.13.aar and /dev/null differ diff --git a/android/libs/alibcwebview-5.0.1.0.aar b/android/libs/alibcwebview-5.0.1.0.aar new file mode 100644 index 0000000..1ad1cac Binary files /dev/null and b/android/libs/alibcwebview-5.0.1.0.aar differ diff --git a/android/libs/cpp_shared-0.0.3.aar b/android/libs/cpp_shared-0.0.3.aar new file mode 100644 index 0000000..9756374 Binary files /dev/null and b/android/libs/cpp_shared-0.0.3.aar differ diff --git a/android/libs/sweet-alert-dialog_v1.3.aar b/android/libs/sweet-alert-dialog_v1.3.aar deleted file mode 100644 index 183c3dd..0000000 Binary files a/android/libs/sweet-alert-dialog_v1.3.aar and /dev/null differ diff --git a/android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcHandle.java b/android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcHandle.java index e2b87c4..4c41649 100644 --- a/android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcHandle.java +++ b/android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcHandle.java @@ -32,10 +32,10 @@ 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.randy.alibcextend.auth.AuthCallback; +import com.randy.alibcextend.auth.TopAuth; import com.ut.device.UTDevice; import com.wxwx.flutter_alibc.web.WebViewActivity; @@ -119,16 +119,20 @@ public class FlutterAlibcHandle { @Override public void onSuccess(String s, String s1) { - Map userInfo = new HashMap<>(); + try { + Map userInfo = new HashMap<>(); // Session session = AlibcLogin.getInstance().getSession(); - Session session = new LoginServiceImpl().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()); + Session session = new LoginServiceImpl().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()); + } catch (Exception e) { + e.printStackTrace(); + } } @Override @@ -208,6 +212,7 @@ public class FlutterAlibcHandle { 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) { @@ -313,7 +318,11 @@ public class FlutterAlibcHandle { // Intent intent = new Intent(register.context(), WebActivity.class); // intent.putExtra("url", (String) call.argument("url")); // register.activity().startActivityForResult(intent, 1111); - taoKeLoginNew(call, result); + try { + taoKeLoginNew(call, result); + } catch (Exception e) { + e.printStackTrace(); + } } @Override @@ -365,16 +374,24 @@ public class FlutterAlibcHandle { // results.put("paySuccessOrders", tradeResult.payResult.paySuccessOrders); // } // result.success(PluginResponse.success(results).toMap()); +// } + +// @Override +// public void onSuccess(int i) { +// Map results = new HashMap<>(); +// result.success(PluginResponse.success(results).toMap()); // } @Override - public void onSuccess(int i) { + public void onSuccess(int i, Object o) { + Log.d("错误", o.toString()); Map results = new HashMap<>(); result.success(PluginResponse.success(results).toMap()); } @Override public void onFailure(int code, String msg) { + Log.d("错误", msg); result.success(new PluginResponse(Integer.toString(code), msg, null).toMap()); } }); @@ -450,10 +467,23 @@ public class FlutterAlibcHandle { // results.put("paySuccessOrders", tradeResult.payResult.paySuccessOrders); // } // result.success(PluginResponse.success(results).toMap()); +// } + +// @Override +// public void onSuccess(int i) { +// Map 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 - public void onSuccess(int i) { + public void onSuccess(int i, Object o) { Map results = new HashMap<>(); // if (AlibcResultType.TYPECART == tradeResult.resultType) { // results.put("type", 1); @@ -492,7 +522,7 @@ public class FlutterAlibcHandle { } public void getUdid(MethodCall call, Result result1) { - String udid = UTDevice.getUtdid(getApplicationContext()); + String udid = UTDevice.getUtdid(getApplicationContext()); Map resMap = new HashMap(); resMap.put("udid", udid); result1.success(resMap); diff --git a/android/src/main/java/com/wxwx/flutter_alibc/WebActivity.java b/android/src/main/java/com/wxwx/flutter_alibc/WebActivity.java index 30232fc..c75f41f 100644 --- a/android/src/main/java/com/wxwx/flutter_alibc/WebActivity.java +++ b/android/src/main/java/com/wxwx/flutter_alibc/WebActivity.java @@ -23,7 +23,6 @@ import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ImageView; -import android.widget.Toast; import com.alibaba.alibclogin.AlibcLogin; @@ -69,23 +68,18 @@ public class WebActivity extends Activity { // alibcTaokeParams.extraParams.put("taokeAppkey", SPUtils.getPrefString(mActivity, Pkey.APP_alliance_appkey, "")); AlibcShowParams showParams = new AlibcShowParams(); showParams.setBackUrl("alisdk://"); - AlibcTrade.openByUrl(WebActivity.this, url, showParams, - new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() { +// AlibcTrade.openByUrl(WebActivity.this, url, showParams, +// new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() { // @Override -// public void onTradeSuccess(AlibcTradeResult alibcTradeResult) { +// public void onSuccess(int i, Object o) { // // } - - @Override - public void onSuccess(int i) { - - } - - @Override - public void onFailure(int i, String s) { - - } - }); +// +// @Override +// public void onFailure(int i, String s) { +// +// } +// }); } //用于百川授权的简化的WebClient @@ -110,13 +104,8 @@ public class WebActivity extends Activity { showParams.setBackUrl("alisdk://"); AlibcTrade.openByUrl(WebActivity.this, url,showParams, new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() { -// @Override -// public void onTradeSuccess(AlibcTradeResult alibcTradeResult) { -// Log.d("cg", alibcTradeResult.toString()); -// } - @Override - public void onSuccess(int i) { + public void onSuccess(int i, Object o) { } @@ -350,10 +339,15 @@ public class WebActivity extends Activity { // @Override // public void onTradeSuccess(AlibcTradeResult alibcTradeResult) { // +// } +// +// @Override +// public void onSuccess(int i) { +// // } @Override - public void onSuccess(int i) { + public void onSuccess(int i, Object o) { } diff --git a/android/src/main/java/com/wxwx/flutter_alibc/web/WebViewActivity.java b/android/src/main/java/com/wxwx/flutter_alibc/web/WebViewActivity.java index c9f1c76..b4657a1 100644 --- a/android/src/main/java/com/wxwx/flutter_alibc/web/WebViewActivity.java +++ b/android/src/main/java/com/wxwx/flutter_alibc/web/WebViewActivity.java @@ -118,8 +118,13 @@ public class WebViewActivity extends Activity { // @Override // public void onTradeSuccess(AlibcTradeResult tradeResult) {}//不会回调 +// @Override +// public void onSuccess(int i) { +// +// } + @Override - public void onSuccess(int i) { + public void onSuccess(int i, Object o) { } diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies index 892db97..6da07db 100644 --- a/example/.flutter-plugins-dependencies +++ b/example/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_alibc","path":"/Users/fnuouser/Documents/code/zhiying/zhiying_flutter_alibc/","dependencies":[]}],"android":[{"name":"flutter_alibc","path":"/Users/fnuouser/Documents/code/zhiying/zhiying_flutter_alibc/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_alibc","dependencies":[]}],"date_created":"2022-03-30 14:23:23.445986","version":"2.10.3"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_alibc","path":"/Users/fnuo123/Documents/fnuo_project_two/zhiying_flutter_alibc/","dependencies":[]}],"android":[{"name":"flutter_alibc","path":"/Users/fnuo123/Documents/fnuo_project_two/zhiying_flutter_alibc/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_alibc","dependencies":[]}],"date_created":"2022-09-13 09:39:00.780891","version":"2.10.3"} \ No newline at end of file diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index adb54c6..b86d490 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 29 + compileSdkVersion 31 lintOptions { disable 'InvalidPackage' @@ -78,19 +78,21 @@ dependencies { implementation 'com.android.support:cardview-v7:27.1.1' implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.2' + implementation fileTree(include: ['*.jar','*.aar'], dir: 'libs') - implementation(name: 'alibcad-5.0.0.13', ext: 'aar') - implementation(name: 'alibcapplink-5.0.0.13', ext: 'aar') - implementation(name: 'alibclogin-5.0.0.13', ext: 'aar') - implementation(name: 'alibcnbtrade-5.0.0.13', ext: 'aar') - implementation(name: 'alibcprotocol-5.0.0.13', ext: 'aar') - implementation(name: 'alibctradecommon-5.0.0.13', ext: 'aar') - implementation(name: 'alibctriver-5.0.0.13', ext: 'aar') - implementation(name: 'alibctriver_live-5.0.0.13', ext: 'aar') - implementation(name: 'alibcwebview-5.0.0.13', ext: 'aar') - - implementation(name: 'avmpaar3-5.0.0.9-v5', ext: 'aar') - implementation(name: 'securitybodyaar3-5.0.0.9-v5', ext: 'aar') - implementation(name: 'securityguardaar3-5.0.0.9-v5', ext: 'aar') - implementation(name: 'sgmiddletieraar3-5.0.0.9-v5', ext: 'aar') +// implementation(name: 'alibcad-5.0.0.13', ext: 'aar') +// implementation(name: 'alibcapplink-5.0.0.13', ext: 'aar') +// implementation(name: 'alibclogin-5.0.0.13', ext: 'aar') +// implementation(name: 'alibcnbtrade-5.0.0.13', ext: 'aar') +// implementation(name: 'alibcprotocol-5.0.0.13', ext: 'aar') +// implementation(name: 'alibctradecommon-5.0.0.13', ext: 'aar') +// implementation(name: 'alibctriver-5.0.0.13', ext: 'aar') +// implementation(name: 'alibctriver_live-5.0.0.13', ext: 'aar') +// implementation(name: 'alibcwebview-5.0.0.13', ext: 'aar') +// implementation(name: 'cpp_shared-0.0.3', ext: 'aar') +// +// implementation(name: 'avmpaar3-5.0.0.9-v5', ext: 'aar') +// implementation(name: 'securitybodyaar3-5.0.0.9-v5', ext: 'aar') +// implementation(name: 'securityguardaar3-5.0.0.9-v5', ext: 'aar') +// implementation(name: 'sgmiddletieraar3-5.0.0.9-v5', ext: 'aar') } diff --git a/example/android/app/libs/alibcad-5.0.0.13.aar b/example/android/app/libs/alibcad-5.0.0.13.aar deleted file mode 100644 index 6c5f640..0000000 Binary files a/example/android/app/libs/alibcad-5.0.0.13.aar and /dev/null differ diff --git a/example/android/app/libs/alibcapplink-5.0.0.13.aar b/example/android/app/libs/alibcapplink-5.0.0.13.aar deleted file mode 100644 index 0d903dd..0000000 Binary files a/example/android/app/libs/alibcapplink-5.0.0.13.aar and /dev/null differ diff --git a/example/android/app/libs/alibclogin-5.0.0.13.aar b/example/android/app/libs/alibclogin-5.0.0.13.aar deleted file mode 100644 index 875d59a..0000000 Binary files a/example/android/app/libs/alibclogin-5.0.0.13.aar and /dev/null differ diff --git a/example/android/app/libs/alibcnbtrade-5.0.0.13.aar b/example/android/app/libs/alibcnbtrade-5.0.0.13.aar deleted file mode 100644 index 0375210..0000000 Binary files a/example/android/app/libs/alibcnbtrade-5.0.0.13.aar and /dev/null differ diff --git a/example/android/app/libs/alibcprotocol-5.0.0.13.aar b/example/android/app/libs/alibcprotocol-5.0.0.13.aar deleted file mode 100644 index 49ba771..0000000 Binary files a/example/android/app/libs/alibcprotocol-5.0.0.13.aar and /dev/null differ diff --git a/example/android/app/libs/alibctools-5.0.0.13.aar b/example/android/app/libs/alibctools-5.0.0.13.aar deleted file mode 100644 index 96d102f..0000000 Binary files a/example/android/app/libs/alibctools-5.0.0.13.aar and /dev/null differ diff --git a/example/android/app/libs/alibctradecommon-5.0.0.13.aar b/example/android/app/libs/alibctradecommon-5.0.0.13.aar deleted file mode 100644 index 2653247..0000000 Binary files a/example/android/app/libs/alibctradecommon-5.0.0.13.aar and /dev/null differ diff --git a/example/android/app/libs/alibctriver-5.0.0.13.aar b/example/android/app/libs/alibctriver-5.0.0.13.aar deleted file mode 100644 index c24c78a..0000000 Binary files a/example/android/app/libs/alibctriver-5.0.0.13.aar and /dev/null differ diff --git a/example/android/app/libs/alibctriver_live-5.0.0.13.aar b/example/android/app/libs/alibctriver_live-5.0.0.13.aar deleted file mode 100644 index 80f153a..0000000 Binary files a/example/android/app/libs/alibctriver_live-5.0.0.13.aar and /dev/null differ diff --git a/example/android/app/libs/alibcwebview-5.0.0.13.aar b/example/android/app/libs/alibcwebview-5.0.0.13.aar deleted file mode 100644 index 0a2dd28..0000000 Binary files a/example/android/app/libs/alibcwebview-5.0.0.13.aar and /dev/null differ diff --git a/example/android/app/libs/avmpaar3-5.0.0.9-v5.aar b/example/android/app/libs/avmpaar3-5.0.0.9-v5.aar deleted file mode 100644 index f914f4d..0000000 Binary files a/example/android/app/libs/avmpaar3-5.0.0.9-v5.aar and /dev/null differ diff --git a/example/android/app/libs/securitybodyaar3-5.0.0.9-v5.aar b/example/android/app/libs/securitybodyaar3-5.0.0.9-v5.aar deleted file mode 100644 index 20f28ab..0000000 Binary files a/example/android/app/libs/securitybodyaar3-5.0.0.9-v5.aar and /dev/null differ diff --git a/example/android/app/libs/securityguardaar3-5.0.0.9-v5.aar b/example/android/app/libs/securityguardaar3-5.0.0.9-v5.aar deleted file mode 100644 index d6c5300..0000000 Binary files a/example/android/app/libs/securityguardaar3-5.0.0.9-v5.aar and /dev/null differ diff --git a/example/android/app/libs/sgmiddletieraar3-5.0.0.9-v5.aar b/example/android/app/libs/sgmiddletieraar3-5.0.0.9-v5.aar deleted file mode 100644 index c5eaf92..0000000 Binary files a/example/android/app/libs/sgmiddletieraar3-5.0.0.9-v5.aar and /dev/null differ diff --git a/example/android/app/libs/sweet-alert-dialog_v1.3.aar b/example/android/app/libs/sweet-alert-dialog_v1.3.aar deleted file mode 100644 index 183c3dd..0000000 Binary files a/example/android/app/libs/sweet-alert-dialog_v1.3.aar and /dev/null differ diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 6679005..bd6e16c 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -10,8 +10,9 @@ + tools:replace="android:label,android:allowBackup">