@@ -43,6 +43,7 @@ import java.security.cert.X509Certificate
4343
4444
4545const val START_VPN_REQUEST = 123
46+ const val START_VPN_REQUEST_NO_CERT = 124
4647const val INSTALL_CERT_REQUEST = 456
4748const val SCAN_REQUEST = 789
4849const val PICK_APPS_REQUEST = 499
@@ -361,6 +362,13 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
361362 onActivityResult(START_VPN_REQUEST , RESULT_OK , null )
362363 }
363364 }
365+ .setNegativeButton(" Continue without certificate" ) { _, _ ->
366+ if (vpnNotConfigured) {
367+ startActivityForResult(vpnIntent, START_VPN_REQUEST_NO_CERT )
368+ } else {
369+ onActivityResult(START_VPN_REQUEST_NO_CERT , RESULT_OK , null )
370+ }
371+ }
364372 .show()
365373 }
366374 } else if (vpnNotConfigured) {
@@ -497,6 +505,7 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
497505 Log .i(TAG , " onActivityResult: " + (
498506 when (requestCode) {
499507 START_VPN_REQUEST -> " start-vpn"
508+ START_VPN_REQUEST_NO_CERT -> " start-vpn-nocrt"
500509 INSTALL_CERT_REQUEST -> " install-cert"
501510 SCAN_REQUEST -> " scan-request"
502511 PICK_APPS_REQUEST -> " pick-apps"
@@ -513,6 +522,9 @@ class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
513522 if (requestCode == START_VPN_REQUEST && currentProxyConfig != null ) {
514523 Log .i(TAG , " Installing cert..." )
515524 ensureCertificateTrusted(currentProxyConfig!! )
525+ } else if (requestCode == START_VPN_REQUEST_NO_CERT && currentProxyConfig != null ) {
526+ Log .i(TAG , " Ignore cert..." )
527+ onActivityResult(INSTALL_CERT_REQUEST , RESULT_OK , null )
516528 } else if (requestCode == INSTALL_CERT_REQUEST ) {
517529 Log .i(TAG ," Cert installed, checking notification perms..." )
518530 ensureNotificationsEnabled()
0 commit comments