|
@@ -21,6 +21,7 @@ import com.me.network.app.http.HttpClient;
|
|
|
import com.me.network.app.http.Method;
|
|
import com.me.network.app.http.Method;
|
|
|
import com.me.network.app.http.rx.ResultListener;
|
|
import com.me.network.app.http.rx.ResultListener;
|
|
|
import com.me.network.app.http.rx.ResultSubscriber;
|
|
import com.me.network.app.http.rx.ResultSubscriber;
|
|
|
|
|
+import com.me.network.app.http.ssl.TrustAllCerts;
|
|
|
import com.modular.apputils.R;
|
|
import com.modular.apputils.R;
|
|
|
import com.tencent.smtt.sdk.CookieManager;
|
|
import com.tencent.smtt.sdk.CookieManager;
|
|
|
import com.tencent.smtt.sdk.TbsReaderView;
|
|
import com.tencent.smtt.sdk.TbsReaderView;
|
|
@@ -30,12 +31,20 @@ import com.tencent.smtt.sdk.WebView;
|
|
|
import com.tencent.smtt.sdk.WebViewClient;
|
|
import com.tencent.smtt.sdk.WebViewClient;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
|
+import java.security.SecureRandom;
|
|
|
|
|
+
|
|
|
|
|
+import javax.net.ssl.SSLContext;
|
|
|
|
|
+import javax.net.ssl.SSLSocketFactory;
|
|
|
|
|
+import javax.net.ssl.TrustManager;
|
|
|
|
|
+
|
|
|
|
|
+import okhttp3.OkHttpClient;
|
|
|
|
|
|
|
|
public class SimpleWebActivity extends OABaseActivity implements ReaderCallback {
|
|
public class SimpleWebActivity extends OABaseActivity implements ReaderCallback {
|
|
|
private static final String TAG = "SimpleWebActivity";
|
|
private static final String TAG = "SimpleWebActivity";
|
|
|
private WebView webView;
|
|
private WebView webView;
|
|
|
private TbsReaderView mTbsReaderView;
|
|
private TbsReaderView mTbsReaderView;
|
|
|
private String filepath;
|
|
private String filepath;
|
|
|
|
|
+ private OkHttpClient mOkHttpClient;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
@@ -52,7 +61,7 @@ public class SimpleWebActivity extends OABaseActivity implements ReaderCallback
|
|
|
webView.getSettings().setDatabaseEnabled(true);
|
|
webView.getSettings().setDatabaseEnabled(true);
|
|
|
webView.getSettings().setAppCacheEnabled(true);
|
|
webView.getSettings().setAppCacheEnabled(true);
|
|
|
webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
|
webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
Intent intent = getIntent();
|
|
Intent intent = getIntent();
|
|
|
String url = intent.getStringExtra("url");
|
|
String url = intent.getStringExtra("url");
|
|
|
getSupportActionBar().setTitle(intent.getStringExtra("p"));
|
|
getSupportActionBar().setTitle(intent.getStringExtra("p"));
|
|
@@ -66,6 +75,33 @@ public class SimpleWebActivity extends OABaseActivity implements ReaderCallback
|
|
|
|
|
|
|
|
if ("http://mall.ubtob.com".equals(url)) {
|
|
if ("http://mall.ubtob.com".equals(url)) {
|
|
|
initBusinessToken();
|
|
initBusinessToken();
|
|
|
|
|
+
|
|
|
|
|
+ /*mOkHttpClient = new OkHttpClient.Builder()
|
|
|
|
|
+ .sslSocketFactory(createSSLSocketFactory(), new TrustAllCerts())
|
|
|
|
|
+ .hostnameVerifier(new TrustAllHostnameVerifier())
|
|
|
|
|
+ .connectTimeout(30, TimeUnit.SECONDS)
|
|
|
|
|
+ .readTimeout(30, TimeUnit.SECONDS).build();
|
|
|
|
|
+
|
|
|
|
|
+ RequestBody requestBody = new FormBody.Builder()
|
|
|
|
|
+ .add("appId", "b2b")
|
|
|
|
|
+ .add("username", "13641490964")
|
|
|
|
|
+ .add("password", "111111")
|
|
|
|
|
+ .add("spaceId", "82121")
|
|
|
|
|
+ .build();
|
|
|
|
|
+ Request request = new Request.Builder().url("https://account.ubtob.com/sso/login").post(requestBody).build();
|
|
|
|
|
+
|
|
|
|
|
+ mOkHttpClient.newCall(request).enqueue(new Callback() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onFailure(Call call, IOException e) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onResponse(Call call, Response response) throws IOException {
|
|
|
|
|
+ Headers headers = response.headers();
|
|
|
|
|
+// List<String> headers = response.headers("Set-Cookie");
|
|
|
|
|
+ }
|
|
|
|
|
+ });*/
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
setThirdPartyCookiesEnabled(true);
|
|
setThirdPartyCookiesEnabled(true);
|
|
@@ -203,4 +239,15 @@ public class SimpleWebActivity extends OABaseActivity implements ReaderCallback
|
|
|
public void onCallBackAction(Integer integer, Object o, Object o1) {
|
|
public void onCallBackAction(Integer integer, Object o, Object o1) {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public SSLSocketFactory createSSLSocketFactory() {
|
|
|
|
|
+ SSLSocketFactory ssfFactory = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ SSLContext sc = SSLContext.getInstance("TLS");
|
|
|
|
|
+ sc.init(null, new TrustManager[]{new TrustAllCerts()}, new SecureRandom());
|
|
|
|
|
+ ssfFactory = sc.getSocketFactory();
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ }
|
|
|
|
|
+ return ssfFactory;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|