|
@@ -1,14 +1,6 @@
|
|
|
package com.vpn.fastestvpnservice.screens.accountScreensAll
|
|
|
|
|
|
-import android.content.Context
|
|
|
-import android.net.VpnService
|
|
|
-import android.os.Build
|
|
|
-import android.os.Bundle
|
|
|
import android.util.Log
|
|
|
-import android.view.LayoutInflater
|
|
|
-import android.view.View
|
|
|
-import android.view.ViewGroup
|
|
|
-import android.widget.Toast
|
|
|
import androidx.activity.ComponentActivity
|
|
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
|
import androidx.compose.foundation.LocalOverscrollConfiguration
|
|
@@ -40,7 +32,6 @@ import androidx.compose.runtime.Composable
|
|
|
import androidx.compose.runtime.CompositionLocalProvider
|
|
|
import androidx.compose.runtime.DisposableEffect
|
|
|
import androidx.compose.runtime.LaunchedEffect
|
|
|
-import androidx.compose.runtime.MutableState
|
|
|
import androidx.compose.runtime.getValue
|
|
|
import androidx.compose.runtime.livedata.observeAsState
|
|
|
import androidx.compose.runtime.mutableFloatStateOf
|
|
@@ -52,57 +43,31 @@ import androidx.compose.runtime.setValue
|
|
|
import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
-import androidx.compose.ui.platform.ComposeView
|
|
|
import androidx.compose.ui.platform.LocalContext
|
|
|
import androidx.compose.ui.platform.LocalLifecycleOwner
|
|
|
import androidx.compose.ui.res.colorResource
|
|
|
import androidx.compose.ui.res.painterResource
|
|
|
-import androidx.compose.ui.text.TextStyle
|
|
|
-import androidx.compose.ui.text.font.FontStyle
|
|
|
-import androidx.compose.ui.text.font.FontWeight
|
|
|
-import androidx.compose.ui.text.style.TextAlign
|
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
-import androidx.compose.ui.unit.sp
|
|
|
-import androidx.core.app.ActivityCompat
|
|
|
-import androidx.fragment.app.Fragment
|
|
|
import androidx.lifecycle.Lifecycle
|
|
|
import androidx.lifecycle.LifecycleEventObserver
|
|
|
import androidx.lifecycle.LifecycleOwner
|
|
|
-import androidx.lifecycle.ViewModelProvider
|
|
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
|
|
import androidx.navigation.NavHostController
|
|
|
-import androidx.navigation.compose.rememberNavController
|
|
|
-import com.android.billingclient.api.BillingClient
|
|
|
-import com.android.billingclient.api.BillingClientStateListener
|
|
|
-import com.android.billingclient.api.BillingResult
|
|
|
-import com.android.billingclient.api.PurchasesUpdatedListener
|
|
|
import com.android.billingclient.api.SkuDetails
|
|
|
import com.vpn.fastestvpnservice.MainActivity
|
|
|
import com.vpn.fastestvpnservice.R
|
|
|
-import com.vpn.fastestvpnservice.beans.DataResponse
|
|
|
-import com.vpn.fastestvpnservice.beans.ProductFeatures
|
|
|
-import com.vpn.fastestvpnservice.beans.Server
|
|
|
-import com.vpn.fastestvpnservice.beans.subscriptionList
|
|
|
-import com.vpn.fastestvpnservice.beans.subscriptionPackageList
|
|
|
import com.vpn.fastestvpnservice.customItems.SubscriptionDataItem
|
|
|
import com.vpn.fastestvpnservice.customItems.SubscriptionPackageItem
|
|
|
import com.vpn.fastestvpnservice.customItems.getSelectedPosition
|
|
|
import com.vpn.fastestvpnservice.helpers.BasePreferenceHelper
|
|
|
-import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.OnLifecycleEvent
|
|
|
import com.vpn.fastestvpnservice.screens.bottomNavBarScreens.onServer
|
|
|
import com.vpn.fastestvpnservice.sealedClass.BottomBarScreen
|
|
|
import com.vpn.fastestvpnservice.sealedClass.Screen
|
|
|
-import com.vpn.fastestvpnservice.ui.theme.FastestVPNTheme
|
|
|
import com.vpn.fastestvpnservice.ui.theme.customTypography2
|
|
|
-import com.vpn.fastestvpnservice.utils.Utils
|
|
|
-import com.vpn.fastestvpnservice.viewmodels.BillingViewModel
|
|
|
import com.vpn.fastestvpnservice.viewmodels.HomeViewModel
|
|
|
import com.vpn.fastestvpnservice.viewmodels.SubscriptionViewModel
|
|
|
import kotlinx.coroutines.delay
|
|
|
-import kotlin.random.Random
|
|
|
-import kotlin.random.nextInt
|
|
|
-
|
|
|
|
|
|
@OptIn(ExperimentalFoundationApi::class)
|
|
|
@Composable
|
|
@@ -115,13 +80,18 @@ fun SubscriptionScreen(navHostController: NavHostController, activity: Component
|
|
|
var selectedPosition: Int = 0
|
|
|
var skuDetailsList: List<SkuDetails>? = null
|
|
|
val basePreferenceHelper = BasePreferenceHelper(context)
|
|
|
- var isLoaderShow by remember { mutableStateOf(true) }
|
|
|
+// var isLoaderShow by remember { mutableStateOf(true) }
|
|
|
+ var isLoaderShow = subscriptionViewModel.mutableLiveDataProductsLoader.observeAsState().value
|
|
|
+ val isLoaderShow2 = subscriptionViewModel.mutableLiveDataProductsLoader2.observeAsState().value
|
|
|
+
|
|
|
var isSubscriptionServerClicked by remember { mutableStateOf(false) }
|
|
|
val scope = rememberCoroutineScope()
|
|
|
val homeViewModel: HomeViewModel = viewModel {
|
|
|
HomeViewModel(context, scope)
|
|
|
}
|
|
|
|
|
|
+ Log.d("test_loader_s", "$isLoaderShow $isLoaderShow2")
|
|
|
+
|
|
|
Box(
|
|
|
modifier = Modifier
|
|
|
.fillMaxSize()
|
|
@@ -136,7 +106,7 @@ fun SubscriptionScreen(navHostController: NavHostController, activity: Component
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- if (isLoaderShow) {
|
|
|
+ if (isLoaderShow == true || isLoaderShow2 == true) {
|
|
|
var progress by remember { mutableFloatStateOf(0.1F) }
|
|
|
|
|
|
LaunchedEffect(key1 = Unit) {
|
|
@@ -203,7 +173,8 @@ fun SubscriptionScreen(navHostController: NavHostController, activity: Component
|
|
|
"Products screen = ${it.size}, selectedPosition = $selectedPosition1")
|
|
|
|
|
|
if (it.size > 0) {
|
|
|
- isLoaderShow = false
|
|
|
+// isLoaderShow = false
|
|
|
+ subscriptionViewModel.mutableLiveDataProductsLoader.value = false
|
|
|
// val features = selectedPosition1.let { it1 -> it.features }
|
|
|
it.let {
|
|
|
items(items = it) {item ->
|
|
@@ -305,6 +276,7 @@ fun SubscriptionScreen(navHostController: NavHostController, activity: Component
|
|
|
basePreferenceHelper.saveServerData(it)
|
|
|
}
|
|
|
|
|
|
+ subscriptionViewModel.mutableLiveDataProductsLoader2.value = false
|
|
|
if (Screen.Subscription.isTrue)
|
|
|
{
|
|
|
if (MainActivity.isStopSubscriptionNavigation) {
|