|
@@ -67,6 +67,8 @@ import com.vpn.fastestvpnservice.beans.filterList
|
|
|
import com.vpn.fastestvpnservice.beans.isDarkTheme
|
|
|
import com.vpn.fastestvpnservice.constants.smartConnect
|
|
|
import com.vpn.fastestvpnservice.helpers.BasePreferenceHelper
|
|
|
+import com.vpn.fastestvpnservice.navigation.isHomeScreenPressed
|
|
|
+import com.vpn.fastestvpnservice.navigation.selectedItemIndex
|
|
|
import com.vpn.fastestvpnservice.screens.serverListViewModelSplash
|
|
|
import com.vpn.fastestvpnservice.sealedClass.Screen
|
|
|
import com.vpn.fastestvpnservice.sealedClass.ScreenTV
|
|
@@ -96,6 +98,7 @@ fun LoginTV(navHostController: NavHostController) {
|
|
|
val focusRequester2 = remember { FocusRequester() }
|
|
|
val focusRequester3 = remember { FocusRequester() }
|
|
|
val snackBarStateRed = remember { SnackbarHostState() }
|
|
|
+ val status = loginViewModel.liveDataLoginStatus.observeAsState().value
|
|
|
|
|
|
LaunchedEffect(key1 = Unit) {
|
|
|
focusRequester1.requestFocus()
|
|
@@ -113,15 +116,14 @@ fun LoginTV(navHostController: NavHostController) {
|
|
|
{
|
|
|
ShowCustomSnackBar(snackBarStateRed, R.color.Red, R.color.white)
|
|
|
|
|
|
- if (loginViewModel.liveDataLoginStatus.value == true) {
|
|
|
- Toast.makeText(context, "Inside Status", Toast.LENGTH_SHORT).show()
|
|
|
+ if (status == true) {
|
|
|
var progress by remember { mutableFloatStateOf(0.1F) }
|
|
|
|
|
|
LaunchedEffect(key1 = Unit) {
|
|
|
while (true) {
|
|
|
for (i in 1..100) {
|
|
|
progress = i.toFloat()/100F
|
|
|
- delay(150)
|
|
|
+ delay(100)
|
|
|
}
|
|
|
progress = 0.1F
|
|
|
}
|
|
@@ -315,6 +317,7 @@ fun ColumnScope.LoginButtonTV(
|
|
|
val coroutineScope = rememberCoroutineScope()
|
|
|
val customValidation = CustomValidation()
|
|
|
val prefHelper = BasePreferenceHelper(context)
|
|
|
+ val status = loginViewModel.liveDataLoginStatus.observeAsState().value
|
|
|
|
|
|
Button(
|
|
|
modifier = Modifier
|
|
@@ -351,13 +354,12 @@ fun ColumnScope.LoginButtonTV(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (loginViewModel.liveDataLoginStatus.value == false) {
|
|
|
+ if (status == false) {
|
|
|
if (customValidation.isValidText(email, "Email") &&
|
|
|
customValidation.isValidText(password, "Password") &&
|
|
|
customValidation.isValidPassword(password)) {
|
|
|
|
|
|
if (email.isNotEmpty() && password.isNotEmpty()) {
|
|
|
- Toast.makeText(context, "Inside Login", Toast.LENGTH_SHORT).show()
|
|
|
loginViewModel.setLoginStatus(true)
|
|
|
loginViewModel.loginRequest(
|
|
|
email,
|
|
@@ -413,7 +415,7 @@ fun ColumnScope.LoginButtonTV(
|
|
|
modifier = Modifier
|
|
|
.background(Color.Transparent)
|
|
|
.align(Alignment.Center),
|
|
|
- text = "Sign In ${loginViewModel.liveDataLoginStatus.value}",
|
|
|
+ text = "Sign In",
|
|
|
style = MaterialTheme.typography.titleMedium,
|
|
|
color = if (isButtonFocused) colorResource(id = R.color.blue_text) else colorResource(id = R.color.white),
|
|
|
// color = MaterialTheme.colorScheme.primaryContainer
|
|
@@ -512,6 +514,9 @@ fun ColumnScope.LoginButtonTV(
|
|
|
serverListViewModelSplash.setRecommendedSmartServers()
|
|
|
serverListViewModelSplash.setCountryData()
|
|
|
|
|
|
+ selectedItemIndex.value = 0
|
|
|
+ isHomeScreenPressed.value = true
|
|
|
+
|
|
|
navHostController.popBackStack()
|
|
|
navHostController.navigate(ScreenTV.BottomBarTV.route)
|
|
|
}
|