Browse Source

1.升价百川SDK

tags/0.2.2
huaxuan 2 years ago
parent
commit
f885b001d1
45 changed files with 121 additions and 60 deletions
  1. +2
    -3
      android/build.gradle
  2. BIN
     
  3. BIN
     
  4. BIN
     
  5. BIN
     
  6. BIN
     
  7. BIN
     
  8. BIN
     
  9. BIN
     
  10. BIN
     
  11. BIN
     
  12. BIN
     
  13. BIN
     
  14. BIN
     
  15. BIN
     
  16. BIN
     
  17. BIN
     
  18. BIN
     
  19. BIN
     
  20. BIN
     
  21. BIN
     
  22. BIN
     
  23. +45
    -15
      android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcHandle.java
  24. +16
    -22
      android/src/main/java/com/wxwx/flutter_alibc/WebActivity.java
  25. +6
    -1
      android/src/main/java/com/wxwx/flutter_alibc/web/WebViewActivity.java
  26. +1
    -1
      example/.flutter-plugins-dependencies
  27. +17
    -15
      example/android/app/build.gradle
  28. BIN
     
  29. BIN
     
  30. BIN
     
  31. BIN
     
  32. BIN
     
  33. BIN
     
  34. BIN
     
  35. BIN
     
  36. BIN
     
  37. BIN
     
  38. BIN
     
  39. BIN
     
  40. BIN
     
  41. BIN
     
  42. BIN
     
  43. +2
    -1
      example/android/app/src/main/AndroidManifest.xml
  44. +31
    -1
      example/android/build.gradle
  45. +1
    -1
      example/android/gradle/wrapper/gradle-wrapper.properties

+ 2
- 3
android/build.gradle View File

@@ -4,7 +4,7 @@ version '1.0-SNAPSHOT'
buildscript { buildscript {
repositories { repositories {
google() google()
jcenter()
mavenCentral()
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'}
flatDir { flatDir {
dirs 'libs' dirs 'libs'
@@ -22,7 +22,7 @@ buildscript {
rootProject.allprojects { rootProject.allprojects {
repositories { repositories {
google() google()
jcenter()
mavenCentral()
maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} 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:avmpaar3:5.0.0.9-v5@aar'
// implementation 'com.taobao.android:sgmiddletieraar3:5.0.0.9-v5@aar' // implementation 'com.taobao.android:sgmiddletieraar3:5.0.0.9-v5@aar'



compileOnly fileTree(include: ['*.jar','*.aar'], dir: 'libs') compileOnly fileTree(include: ['*.jar','*.aar'], dir: 'libs')
// implementation(name: 'cardview-1.0.0', ext: 'aar') // implementation(name: 'cardview-1.0.0', ext: 'aar')




BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


+ 45
- 15
android/src/main/java/com/wxwx/flutter_alibc/FlutterAlibcHandle.java View File

@@ -32,10 +32,10 @@ import com.alibaba.alibcprotocol.param.AlibcShowParams;
import com.alibaba.alibcprotocol.param.AlibcTaokeParams; import com.alibaba.alibcprotocol.param.AlibcTaokeParams;
import com.alibaba.alibcprotocol.route.proxy.IAlibcLoginProxy; import com.alibaba.alibcprotocol.route.proxy.IAlibcLoginProxy;
import com.baichuan.nb_trade.AlibcTrade; 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.AlibcTradeInitCallback;
import com.baichuan.nb_trade.callback.AuthCallback;
import com.baichuan.nb_trade.core.AlibcTradeSDK; 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.ut.device.UTDevice;
import com.wxwx.flutter_alibc.web.WebViewActivity; import com.wxwx.flutter_alibc.web.WebViewActivity;


@@ -119,16 +119,20 @@ public class FlutterAlibcHandle {


@Override @Override
public void onSuccess(String s, String s1) { public void onSuccess(String s, String s1) {
Map<String, Object> userInfo = new HashMap<>();
try {
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("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 @Override
@@ -208,6 +212,7 @@ public class FlutterAlibcHandle {
AlibcLogin.getInstance().showLogin(new AlibcLoginCallback() { AlibcLogin.getInstance().showLogin(new AlibcLoginCallback() {
@Override @Override
public void onSuccess(String s, String s1) { public void onSuccess(String s, String s1) {

TopAuth.showAuthDialog(register.activity(), R.mipmap.ic_launcher, name, alibcAppKey, new AuthCallback() { TopAuth.showAuthDialog(register.activity(), R.mipmap.ic_launcher, name, alibcAppKey, new AuthCallback() {
@Override @Override
public void onSuccess(String accessToken, String expireTime) { public void onSuccess(String accessToken, String expireTime) {
@@ -313,7 +318,11 @@ public class FlutterAlibcHandle {
// Intent intent = new Intent(register.context(), WebActivity.class); // Intent intent = new Intent(register.context(), WebActivity.class);
// intent.putExtra("url", (String) call.argument("url")); // intent.putExtra("url", (String) call.argument("url"));
// register.activity().startActivityForResult(intent, 1111); // register.activity().startActivityForResult(intent, 1111);
taoKeLoginNew(call, result);
try {
taoKeLoginNew(call, result);
} catch (Exception e) {
e.printStackTrace();
}
} }


@Override @Override
@@ -365,16 +374,24 @@ public class FlutterAlibcHandle {
// results.put("paySuccessOrders", tradeResult.payResult.paySuccessOrders); // results.put("paySuccessOrders", tradeResult.payResult.paySuccessOrders);
// } // }
// result.success(PluginResponse.success(results).toMap()); // result.success(PluginResponse.success(results).toMap());
// }

// @Override
// public void onSuccess(int i) {
// Map<String, Object> results = new HashMap<>();
// result.success(PluginResponse.success(results).toMap());
// } // }


@Override @Override
public void onSuccess(int i) {
public void onSuccess(int i, Object o) {
Log.d("错误", o.toString());
Map<String, Object> results = new HashMap<>(); Map<String, Object> results = new HashMap<>();
result.success(PluginResponse.success(results).toMap()); result.success(PluginResponse.success(results).toMap());
} }


@Override @Override
public void onFailure(int code, String msg) { public void onFailure(int code, String msg) {
Log.d("错误", msg);
result.success(new PluginResponse(Integer.toString(code), msg, null).toMap()); result.success(new PluginResponse(Integer.toString(code), msg, null).toMap());
} }
}); });
@@ -450,10 +467,23 @@ public class FlutterAlibcHandle {
// results.put("paySuccessOrders", tradeResult.payResult.paySuccessOrders); // results.put("paySuccessOrders", tradeResult.payResult.paySuccessOrders);
// } // }
// result.success(PluginResponse.success(results).toMap()); // result.success(PluginResponse.success(results).toMap());
// }

// @Override
// public void onSuccess(int i) {
// 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 onSuccess(int i) {
public void onSuccess(int i, Object o) {
Map<String, Object> results = new HashMap<>(); Map<String, Object> results = new HashMap<>();
// if (AlibcResultType.TYPECART == tradeResult.resultType) { // if (AlibcResultType.TYPECART == tradeResult.resultType) {
// results.put("type", 1); // results.put("type", 1);
@@ -492,7 +522,7 @@ public class FlutterAlibcHandle {
} }


public void getUdid(MethodCall call, Result result1) { public void getUdid(MethodCall call, Result result1) {
String udid = UTDevice.getUtdid(getApplicationContext());
String udid = UTDevice.getUtdid(getApplicationContext());
Map<String, String> resMap = new HashMap(); Map<String, String> resMap = new HashMap();
resMap.put("udid", udid); resMap.put("udid", udid);
result1.success(resMap); result1.success(resMap);


+ 16
- 22
android/src/main/java/com/wxwx/flutter_alibc/WebActivity.java View File

@@ -23,7 +23,6 @@ import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Toast;




import com.alibaba.alibclogin.AlibcLogin; 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, "")); // 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, showParams,
new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() {
// AlibcTrade.openByUrl(WebActivity.this, url, showParams,
// new AlibcTaokeParams("", "", ""), exParams, new AlibcTradeCallback() {
// @Override // @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 //用于百川授权的简化的WebClient
@@ -110,13 +104,8 @@ public class WebActivity extends Activity {
showParams.setBackUrl("alisdk://"); showParams.setBackUrl("alisdk://");
AlibcTrade.openByUrl(WebActivity.this, url,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 onSuccess(int i) {
public void onSuccess(int i, Object o) {


} }


@@ -350,10 +339,15 @@ public class WebActivity extends Activity {
// @Override // @Override
// public void onTradeSuccess(AlibcTradeResult alibcTradeResult) { // public void onTradeSuccess(AlibcTradeResult alibcTradeResult) {
// //
// }
//
// @Override
// public void onSuccess(int i) {
//
// } // }


@Override @Override
public void onSuccess(int i) {
public void onSuccess(int i, Object o) {


} }




+ 6
- 1
android/src/main/java/com/wxwx/flutter_alibc/web/WebViewActivity.java View File

@@ -118,8 +118,13 @@ public class WebViewActivity extends Activity {
// @Override // @Override
// public void onTradeSuccess(AlibcTradeResult tradeResult) {}//不会回调 // public void onTradeSuccess(AlibcTradeResult tradeResult) {}//不会回调


// @Override
// public void onSuccess(int i) {
//
// }

@Override @Override
public void onSuccess(int i) {
public void onSuccess(int i, Object o) {


} }




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

@@ -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"}
{"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"}

+ 17
- 15
example/android/app/build.gradle View File

@@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"


android { android {
compileSdkVersion 29
compileSdkVersion 31


lintOptions { lintOptions {
disable 'InvalidPackage' disable 'InvalidPackage'
@@ -78,19 +78,21 @@ dependencies {
implementation 'com.android.support:cardview-v7:27.1.1' implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2' 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')
} }

BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


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

@@ -10,8 +10,9 @@
<application <application
android:name="io.flutter.app.FlutterApplication" android:name="io.flutter.app.FlutterApplication"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:allowBackup="true"
android:label="flutter_alibc_example" android:label="flutter_alibc_example"
tools:replace="android:label">
tools:replace="android:label,android:allowBackup">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"


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

@@ -1,16 +1,46 @@
buildscript { buildscript {
repositories { repositories {
mavenCentral()
// 百川
maven(){
url "https://maven.aliyun.com/repository/public/"
}
maven {
url "https://mvn.mob.com/android/"
}
maven {
url 'https://artifact.bytedance.com/repository/pangle'
}
google() google()

flatDir {
dirs 'libs'
}
} }


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


allprojects { allprojects {
repositories { repositories {
mavenCentral()
// 百川
maven(){
url "https://maven.aliyun.com/repository/public/"
}
maven {
url "https://mvn.mob.com/android/"
}
maven {
url 'https://artifact.bytedance.com/repository/pangle'
}
google() google()

flatDir {
dirs 'libs'
}
flatDir { flatDir {
dirs 'libs' dirs 'libs'
} }


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

@@ -3,4 +3,4 @@ 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-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

Loading…
Cancel
Save