Browse Source

darktheme webview url of termsncond added..

Khubaib 11 months ago
parent
commit
ee2452a68e

+ 7 - 5
app/src/main/java/com/vpn/fastestvpnservice/constants/AppConstant.kt

@@ -7,15 +7,17 @@ class AppConstant {
         const val SIGN_UP_WEBVIEW_URL = "https://fastestvpn.com/buy-vpn"
         const val UPGRADE_WEBVIEW_URL = "https://fastestvpn.com/buy-vpn"
 
-        const val FAQ_WEBVIEW_URL = "https://fastestvpn.com/faq?device=android"
+        const val FAQ_WEBVIEW_URL = "https://fastestvpn.com/faq?device=ios"
         const val CHANGE_PASSWORD_URL = "https://fastestvpn.com/password/reset"
-        const val POLICY_WEBVIEW_URL = "https://fastestvpn.com/privacy-policy?device=android"
-        const val TERMS_WEBVIEW_URL = "https://fastestvpn.com/terms-of-service?device=android"
-        const val ABOUT_WEBVIEW_URL = "https://fastestvpn.com/about?device=android"
-        const val CHAT_WEBVIEW_URL = "https://api.fastestvpn.com/v2/chat?device=android&email="
+        const val POLICY_WEBVIEW_URL = "https://fastestvpn.com/privacy-policy?device=ios"
+        const val TERMS_WEBVIEW_URL = "https://fastestvpn.com/terms-of-service?device=ios"
+        const val ABOUT_WEBVIEW_URL = "https://fastestvpn.com/about?device=ios"
+        const val CHAT_WEBVIEW_URL = "https://api.fastestvpn.com/v2/chat?device=ios&email="
 
         //Api Base Url
         const val BASE_URL = "https://api.fastestvpn.com/v2/"
+        const val BASE_WEBVIEW_URL = "https://fastestvpn.com/"
+
         var IS_DEBUG = false
 
         // Params

+ 21 - 16
app/src/main/java/com/vpn/fastestvpnservice/screens/helpScreensAll/TermsAndConditionsScreen.kt

@@ -52,6 +52,8 @@ import androidx.compose.ui.viewinterop.AndroidView
 import androidx.navigation.NavHostController
 import androidx.navigation.compose.rememberNavController
 import com.vpn.fastestvpnservice.R
+import com.vpn.fastestvpnservice.beans.isDarkTheme
+import com.vpn.fastestvpnservice.constants.AppConstant
 import com.vpn.fastestvpnservice.constants.PrivacyPolicyDesc
 import com.vpn.fastestvpnservice.constants.TermsAndConditionsDesc
 import com.vpn.fastestvpnservice.sealedClass.BottomBarScreen
@@ -66,26 +68,25 @@ fun TermsAndConditions(
     val configuration = LocalConfiguration.current
     val screenHeight = configuration.screenHeightDp.dp
     val screenWidth = configuration.screenWidthDp.dp
+    var showLoader by remember { mutableStateOf(true) }
 
     Box(
         modifier = Modifier
             .fillMaxWidth()
-            .background(
-                colorResource(id = R.color.white)
-            )
             .fillMaxSize()
+            .background(MaterialTheme.colorScheme.onPrimary)
     ) {
-        var showLoader by remember { mutableStateOf(true) }
 
         ShowHeaderTnC(navHostController = navHostController, isFromSignUpScreen)
 
         Box(modifier = Modifier
             .padding(top = 60.dp)
             .fillMaxSize()
-            .background(Color.Transparent)
+            .background(MaterialTheme.colorScheme.onPrimary)
         ) {
+            val tncUrl = if (isDarkTheme.value) "${AppConstant.BASE_WEBVIEW_URL}terms-of-service?skin=dark"
+            else "${AppConstant.BASE_WEBVIEW_URL}terms-of-service?device=ios"
 
-            val tncUrl = "https://fastestvpn.com/terms-of-service?device=ios"
             AndroidView(factory = {
                 WebView(it).apply {
                     layoutParams = ViewGroup.LayoutParams(
@@ -117,23 +118,27 @@ fun TermsAndConditions(
                     it.loadUrl(tncUrl)
                 }
             )
+        }
 
-            if (showLoader) {
-                var progress by remember { mutableFloatStateOf(0.1F) }
+        if (showLoader) {
+            var progress by remember { mutableFloatStateOf(0.1F) }
 
-                LaunchedEffect(key1 = Unit) {
-                    for (i in 1..100) {
-                        progress = i.toFloat()/100F
-                        delay(25)
-                    }
+            LaunchedEffect(key1 = Unit) {
+                for (i in 1..100) {
+                    progress = i.toFloat()/100F
+                    delay(25)
                 }
+            }
 
+            Box(modifier = Modifier
+                .fillMaxSize()
+                .background(MaterialTheme.colorScheme.onPrimary)) {
                 CircularProgressIndicator(
                     progress = progress,
                     modifier = Modifier
                         .align(Alignment.Center)
                         .size(50.dp),
-                    colorResource(id = R.color.dark_blue_gray_text),
+                    colorResource(id = R.color.appYellow),
                     strokeWidth = 5.dp,
                 )
             }
@@ -167,7 +172,7 @@ fun BoxScope.ShowHeaderTnC(
         Icon(
             painter = painterResource(id = R.drawable.backarrow3x),
             contentDescription = "Arrow-Back",
-            tint = colorResource(id = R.color.dark_blue_gray_text),
+            tint = MaterialTheme.colorScheme.primary,
             modifier = Modifier.size(18.dp, 12.dp)
         )
     }
@@ -180,7 +185,7 @@ fun BoxScope.ShowHeaderTnC(
         color = colorResource(id = R.color.transparent)
     ) {
         Text(text = "Terms and Conditions",
-            color = colorResource(id = R.color.dark_blue_gray_text),
+            color = MaterialTheme.colorScheme.primary,
             style = MaterialTheme.typography.bodyMedium,
             modifier = Modifier.fillMaxHeight()