正在查看: Clash Legends v0.0.1 应用的 AuthActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 AuthActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package co.paystack.android.ui;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import co.paystack.android.R;
import co.paystack.android.api.ApiClient;
public class AuthActivity extends Activity {
private String responseJson;
final AuthSingleton si = AuthSingleton.getInstance();
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.co_paystack_android____activity_auth);
setTitle("Authorize your card");
getWindow().addFlags(128);
this.webView = (WebView) findViewById(R.id.webView);
setup();
}
public void handleResponse() {
if (this.responseJson == null) {
this.responseJson = "{\"status\":\"requery\",\"message\":\"Reaffirm Transaction Status on Server\"}";
}
synchronized (this.si) {
this.si.setResponseJson(this.responseJson);
this.si.notify();
}
finish();
}
protected void setup() {
setContentView(R.layout.co_paystack_android____activity_auth);
WebView webView = (WebView) findViewById(R.id.webView);
this.webView = webView;
webView.setKeepScreenOn(true);
this.webView.getSettings().setJavaScriptEnabled(true);
this.webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
this.webView.addJavascriptInterface(new Object() {
public C1AuthResponseJI getJI() {
final AuthActivity authActivity = AuthActivity.this;
return new C1AuthResponseJI() {
@Override
@JavascriptInterface
public void processContent(String aContent) {
AuthActivity.this.responseJson = aContent;
AuthActivity.this.handleResponse();
}
};
}
}.getJI(), "INTERFACE");
this.webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
if (url.contains(ApiClient.API_URL + "charge/three_d_response/")) {
view.loadUrl("javascript:window.INTERFACE.processContent(document.getElementById('return').innerText);");
}
}
@Override
public void onLoadResource(WebView view, String url) {
super.onLoadResource(view, url);
}
});
this.webView.loadUrl(this.si.getUrl());
}
abstract class C1AuthResponseJI {
public abstract void processContent(String str);
C1AuthResponseJI() {
}
}
class C1AuthResponseLegacyJI extends C1AuthResponseJI {
C1AuthResponseLegacyJI() {
super();
}
@Override
public void processContent(String aContent) {
AuthActivity.this.responseJson = aContent;
AuthActivity.this.handleResponse();
}
}
@Override
public void onDestroy() {
super.onDestroy();
WebView webView = this.webView;
if (webView != null) {
webView.stopLoading();
this.webView.removeJavascriptInterface("INTERFACE");
}
handleResponse();
}
}