|
@@ -3,10 +3,8 @@ package com.vpn.fastestvpnservice.screens.helpScreensAll
|
|
|
import android.annotation.SuppressLint
|
|
|
import android.app.Activity
|
|
|
import android.graphics.Bitmap
|
|
|
-import android.os.Build
|
|
|
import android.util.Log
|
|
|
import android.view.ViewGroup
|
|
|
-import android.webkit.WebSettings
|
|
|
import android.webkit.WebView
|
|
|
import android.webkit.WebViewClient
|
|
|
import androidx.compose.animation.animateContentSize
|
|
@@ -68,18 +66,7 @@ import com.vpn.fastestvpnservice.beans.isDarkTheme
|
|
|
import com.vpn.fastestvpnservice.constants.AppConstant
|
|
|
import com.vpn.fastestvpnservice.constants.HelpDesc
|
|
|
import com.vpn.fastestvpnservice.helpers.BasePreferenceHelper
|
|
|
-import com.vpn.fastestvpnservice.retrofit.WebServiceFactory
|
|
|
import kotlinx.coroutines.delay
|
|
|
-import okhttp3.OkHttpClient
|
|
|
-import okhttp3.Request
|
|
|
-import java.io.IOException
|
|
|
-import java.security.SecureRandom
|
|
|
-import java.security.cert.X509Certificate
|
|
|
-import javax.net.ssl.HostnameVerifier
|
|
|
-import javax.net.ssl.SSLContext
|
|
|
-import javax.net.ssl.SSLSession
|
|
|
-import javax.net.ssl.TrustManager
|
|
|
-import javax.net.ssl.X509TrustManager
|
|
|
|
|
|
var showLoader: MutableState<Boolean> = mutableStateOf(true)
|
|
|
|
|
@@ -144,39 +131,6 @@ fun FAQ(navHostController: NavHostController) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//@Composable
|
|
|
-//fun BoxScope.CustomWebView(url: String) {
|
|
|
-// AndroidView(factory = { context ->
|
|
|
-// val webView = WebView(context).apply {
|
|
|
-// layoutParams = ViewGroup.LayoutParams(
|
|
|
-// ViewGroup.LayoutParams.MATCH_PARENT,
|
|
|
-// ViewGroup.LayoutParams.MATCH_PARENT
|
|
|
-// )
|
|
|
-//
|
|
|
-// settings.apply {
|
|
|
-// javaScriptEnabled = true
|
|
|
-// domStorageEnabled = true
|
|
|
-// loadsImagesAutomatically = true
|
|
|
-// mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
|
|
|
-// }
|
|
|
-//
|
|
|
-// webViewClient = object : WebViewClient() {
|
|
|
-// override fun onReceivedSslError(
|
|
|
-// view: WebView?,
|
|
|
-// handler: android.webkit.SslErrorHandler?,
|
|
|
-// error: android.net.http.SslError?
|
|
|
-// ) {
|
|
|
-// handler?.proceed() // Bypass SSL certificate issues (for debugging)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// // Make the OkHttp request
|
|
|
-// loadContentWithOkHttp(webView, url)
|
|
|
-// webView
|
|
|
-// })
|
|
|
-//}
|
|
|
-
|
|
|
@Composable
|
|
|
fun BoxScope.WebView(url: String) {
|
|
|
AndroidView(factory = {
|
|
@@ -214,84 +168,6 @@ fun BoxScope.WebView(url: String) {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-//fun loadContentWithOkHttp(webView: WebView, url: String) {
|
|
|
-// val client = createUnsafeOkHttpClient()
|
|
|
-// val request = Request.Builder().url(url).build()
|
|
|
-//
|
|
|
-// Log.d("test_webview", "loadContentWithOkHttp")
|
|
|
-//
|
|
|
-// client.newCall(request).enqueue(object : okhttp3.Callback {
|
|
|
-// override fun onFailure(call: okhttp3.Call, e: IOException) {
|
|
|
-// showLoader.value = false
|
|
|
-// Log.d("test_webview", "onFailure")
|
|
|
-// Log.e("CustomWebView", "Failed to load URL with OkHttp: ${e.message}")
|
|
|
-// }
|
|
|
-//
|
|
|
-// override fun onResponse(call: okhttp3.Call, response: okhttp3.Response) {
|
|
|
-// showLoader.value = false
|
|
|
-// Log.d("test_webview", "onResponse")
|
|
|
-//
|
|
|
-// val htmlContent = response.body?.string() ?: ""
|
|
|
-// // Load the HTML content into the WebView on the main thread
|
|
|
-//
|
|
|
-// webView.post {
|
|
|
-// showLoader.value = false
|
|
|
-// Log.d("test_webview", "webView.post")
|
|
|
-// webView.loadDataWithBaseURL(url, htmlContent, "text/html", "UTF-8", null)
|
|
|
-// }
|
|
|
-// }
|
|
|
-// })
|
|
|
-//}
|
|
|
-
|
|
|
-
|
|
|
-//fun WebView.trustAllCertificates() {
|
|
|
-// try {
|
|
|
-// Log.d("test_webview", "try")
|
|
|
-// val trustAllCerts = arrayOf<TrustManager>(
|
|
|
-// object : X509TrustManager {
|
|
|
-// override fun checkClientTrusted(
|
|
|
-// chain: Array<out X509Certificate>?,
|
|
|
-// authType: String?
|
|
|
-// ) {}
|
|
|
-//
|
|
|
-// override fun checkServerTrusted(
|
|
|
-// chain: Array<out X509Certificate>?,
|
|
|
-// authType: String?
|
|
|
-// ) {}
|
|
|
-//
|
|
|
-// override fun getAcceptedIssuers(): Array<X509Certificate> = arrayOf()
|
|
|
-// }
|
|
|
-// )
|
|
|
-//
|
|
|
-// val sslContext = SSLContext.getInstance("TLS")
|
|
|
-// sslContext.init(null, trustAllCerts, SecureRandom())
|
|
|
-// this.settings.javaScriptEnabled = true
|
|
|
-// // Set the SSL factory to the custom context that trusts all certificates
|
|
|
-// sslContext.socketFactory
|
|
|
-// } catch (e: Exception) {
|
|
|
-// Log.d("test_webview", "catch")
|
|
|
-// }
|
|
|
-//}
|
|
|
-//
|
|
|
-//fun createUnsafeOkHttpClient(): OkHttpClient {
|
|
|
-// val trustAllCerts = arrayOf<TrustManager>(
|
|
|
-// object : X509TrustManager {
|
|
|
-// override fun checkClientTrusted(chain: Array<X509Certificate>, authType: String) {}
|
|
|
-// override fun checkServerTrusted(chain: Array<X509Certificate>, authType: String) {}
|
|
|
-// override fun getAcceptedIssuers(): Array<X509Certificate> = arrayOf()
|
|
|
-// }
|
|
|
-// )
|
|
|
-//
|
|
|
-// val sslContext = SSLContext.getInstance("TLS")
|
|
|
-// sslContext.init(null, trustAllCerts, SecureRandom())
|
|
|
-// val sslSocketFactory = sslContext.socketFactory
|
|
|
-//
|
|
|
-// return OkHttpClient.Builder()
|
|
|
-// .sslSocketFactory(sslSocketFactory, trustAllCerts[0] as X509TrustManager)
|
|
|
-// .hostnameVerifier(HostnameVerifier { _, _ -> true })
|
|
|
-// .build()
|
|
|
-//}
|
|
|
-
|
|
|
@Composable
|
|
|
fun BoxScope.ShowExpandList(
|
|
|
navHostController: NavHostController
|