|
@@ -4,6 +4,7 @@ import android.app.AlertDialog;
|
|
|
import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.content.pm.ActivityInfo;
|
|
|
+import android.content.pm.PackageManager;
|
|
|
import android.graphics.Color;
|
|
|
import android.media.MediaPlayer;
|
|
|
import android.util.Base64;
|
|
@@ -54,7 +55,7 @@ public class JsInterfaces {
|
|
|
MessageDialogBean mMessageBean;
|
|
|
PhoneNumberAuthHelper mPhoneNumberAuthHelperl;
|
|
|
String mSecret = "UgC3rEZPVMBKi8WqdoubeWMSJNSeeA6i0dLu3Z1GZKfIgXFhF8RmMLdsmDSgmwWjg2TUOhkvbuHZH6pt4RUxiQSpVyu9P1Q7h9Th05DhNVqxuOU2GRLLs0C43B59eS6nXrUEy7PZzn3wPTXEpelTmH5rMl+VZ7UKa3tC35qkB073Dfikr6ITRfCF31mTPjOGQRo9RKrtbeIhj4jIqx7M9PJSp9+W8huzLCUEOVquVNKDtpCBUq2Znu+PgISvLg3JouLtVv9ldoftxKci+VfHaO3izxkHOi+3jauqBTigrfA7D4I4va/7PlgCNoXJogcy";
|
|
|
- public final String GET_USER_PHONENUMBER_URL = "http://ott80test-api.efunbox.cn:81/member/getMobile";
|
|
|
+ public final String GET_USER_PHONENUMBER_URL = "http://m-xyyf-api.ai160.com/member/getMobile";
|
|
|
|
|
|
public JsInterfaces(MainView view) {
|
|
|
mGson = new Gson();
|
|
@@ -288,18 +289,42 @@ public class JsInterfaces {
|
|
|
}
|
|
|
|
|
|
@JavascriptInterface
|
|
|
- public void toMiniProgram(String programId, String path) {
|
|
|
- if (!PayInit.getInstance().WX_API.isWXAppInstalled()) {
|
|
|
- ToastUtil.showToast("请安装微信");
|
|
|
+ public void toMiniProgram(final String programId, final String path) {
|
|
|
+ PackageManager packageManager = mView.getActivity().getPackageManager();
|
|
|
+ Intent intent = packageManager.getLaunchIntentForPackage("com.tencent.mm");
|
|
|
+ if (intent == null) {
|
|
|
+ mView.loadJSMehtodPost("noWeChat()");
|
|
|
return;
|
|
|
+ } else {
|
|
|
+ mView.getActivity().startActivity(intent);
|
|
|
+ }
|
|
|
+ mView.acPostDelayed(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ WXLaunchMiniProgram.Req req = new WXLaunchMiniProgram.Req();
|
|
|
+ req.userName = programId; // 填小程序原始id
|
|
|
+ req.path = path; //拉起小程序页面的可带参路径,不填默认拉起小程序首页
|
|
|
+ req.miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE;// 可选打开 开发版,体验版和正式版
|
|
|
+ PayInit.getInstance().WX_API.sendReq(req);
|
|
|
+ }
|
|
|
+ }, 800);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @JavascriptInterface
|
|
|
+ public boolean startOtherApp(String pckName) {
|
|
|
+ PackageManager packageManager = mView.getActivity().getPackageManager();
|
|
|
+ Intent intent = packageManager.getLaunchIntentForPackage(pckName);
|
|
|
+ if (intent == null) {
|
|
|
+// mView.loadJSMehtodPost("noWeChat()");
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ mView.getActivity().startActivity(intent);
|
|
|
+ return true;
|
|
|
}
|
|
|
- WXLaunchMiniProgram.Req req = new WXLaunchMiniProgram.Req();
|
|
|
- req.userName = programId; // 填小程序原始id
|
|
|
- req.path = path; //拉起小程序页面的可带参路径,不填默认拉起小程序首页
|
|
|
- req.miniprogramType = WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE;// 可选打开 开发版,体验版和正式版
|
|
|
- PayInit.getInstance().WX_API.sendReq(req);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@JavascriptInterface
|
|
|
public void setBackGround(String color) {
|
|
|
mView.getWebView().setBackgroundColor(Color.parseColor(color));
|