Skip to content

Commit

Permalink
remove onReceivedSslError callback
Browse files Browse the repository at this point in the history
  • Loading branch information
odaridavid committed Jul 14, 2019
1 parent 50ed956 commit 6e2171c
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions app/src/main/java/com/lca/odari/alc40/ui/AlcFragment.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package com.lca.odari.alc40.ui


import android.net.http.SslError
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.webkit.SslErrorHandler
import android.webkit.WebView
import android.webkit.WebViewClient
import android.widget.Toast
import androidx.fragment.app.Fragment
import com.lca.odari.alc40.R
import kotlinx.android.synthetic.main.fragment_alc_view.view.*
Expand All @@ -22,22 +17,9 @@ class AlcViewFragment : Fragment() {
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.fragment_alc_view, container, false)
view.webview.webViewClient = object : WebViewClient() {
override fun onReceivedSslError(view: WebView?, handler: SslErrorHandler?, error: SslError?) {
val message = when (error?.primaryError) {
SslError.SSL_DATE_INVALID -> "Date Invalid"
SslError.SSL_EXPIRED -> "Expired"
SslError.SSL_IDMISMATCH -> "ID Mismatch"
SslError.SSL_INVALID -> "Invalid"
SslError.SSL_NOTYETVALID -> "Not Yet Valid"
SslError.SSL_UNTRUSTED -> "Untrusted"
else -> "Unknown"
}
Toast.makeText(context, "SSL Certificates : $message", Toast.LENGTH_LONG).show()
handler?.proceed()
}
view.webview.apply {
loadUrl(getString(R.string.alc_link))
}
view.webview.loadUrl("https://andela.com/alc/")
return view
}

Expand Down

0 comments on commit 6e2171c

Please sign in to comment.