2020-04-01 17:28:14 +02:00
|
|
|
package org.mian.gitnex.helpers.ssl;
|
2020-03-30 23:01:54 +02:00
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.app.AlertDialog;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import org.mian.gitnex.R;
|
|
|
|
|
2020-03-30 23:25:49 +02:00
|
|
|
/**
|
2020-06-23 16:54:27 +02:00
|
|
|
* Author Georg Lukas, modified by opyale
|
2020-03-30 23:25:49 +02:00
|
|
|
*/
|
2020-03-31 16:44:11 +02:00
|
|
|
|
2020-03-30 23:01:54 +02:00
|
|
|
public class MemorizingActivity extends Activity {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
2020-03-31 21:14:49 +02:00
|
|
|
|
2020-03-30 23:01:54 +02:00
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
|
|
Intent intent = getIntent();
|
2020-03-31 22:09:42 +02:00
|
|
|
int decisionId = intent.getIntExtra("DECISION_INTENT_ID", MTMDecision.DECISION_INVALID);
|
|
|
|
int titleId = intent.getIntExtra("DECISION_TITLE_ID", R.string.mtm_accept_cert);
|
|
|
|
String cert = intent.getStringExtra("DECISION_INTENT_CERT");
|
2020-03-30 23:01:54 +02:00
|
|
|
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(MemorizingActivity.this);
|
|
|
|
builder.setTitle(titleId);
|
|
|
|
builder.setMessage(cert);
|
|
|
|
|
|
|
|
builder.setPositiveButton(R.string.mtm_decision_always, (dialog, which) -> onSendResult(decisionId, MTMDecision.DECISION_ALWAYS));
|
2020-04-01 18:39:39 +02:00
|
|
|
builder.setNeutralButton(R.string.mtm_decision_abort, (dialog, which) -> onSendResult(decisionId, MTMDecision.DECISION_ABORT));
|
2020-03-30 23:01:54 +02:00
|
|
|
builder.setOnCancelListener(dialog -> onSendResult(decisionId, MTMDecision.DECISION_ABORT));
|
|
|
|
|
|
|
|
builder.create().show();
|
2020-04-01 17:28:14 +02:00
|
|
|
|
2020-03-30 23:01:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void onSendResult(int decisionId, int decision) {
|
2020-03-31 21:14:49 +02:00
|
|
|
|
2020-03-30 23:01:54 +02:00
|
|
|
MemorizingTrustManager.interactResult(decisionId, decision);
|
|
|
|
finish();
|
2020-04-01 17:28:14 +02:00
|
|
|
|
2020-03-30 23:01:54 +02:00
|
|
|
}
|
2020-03-31 21:14:49 +02:00
|
|
|
|
2020-06-23 16:54:27 +02:00
|
|
|
}
|