فهرست منبع

fix: update navigation to signup

Bax 4 روز پیش
والد
کامیت
11b47cda97

+ 2 - 2
mobile_app/wabi/.idea/deploymentTargetSelector.xml

@@ -4,10 +4,10 @@
     <selectionStates>
       <SelectionState runConfigName="app">
         <option name="selectionMode" value="DROPDOWN" />
-        <DropdownSelection timestamp="2024-11-21T15:48:06.690092200Z">
+        <DropdownSelection timestamp="2024-11-21T16:23:24.477613900Z">
           <Target type="DEFAULT_BOOT">
             <handle>
-              <DeviceId pluginId="PhysicalDevice" identifier="serial=RF8R80XPK2W" />
+              <DeviceId pluginId="LocalEmulator" identifier="path=C:\Users\bax\.android\avd\Medium_Phone_API_30.avd" />
             </handle>
           </Target>
         </DropdownSelection>

+ 2 - 0
mobile_app/wabi/app/src/main/java/com/example/wabi/domain/repository/UserData.kt

@@ -4,9 +4,11 @@ import android.annotation.SuppressLint
 import android.content.Context
 import androidx.compose.runtime.MutableState
 import androidx.compose.runtime.mutableStateOf
+import com.example.wabi.domain.navigation.Routes
 
 @SuppressLint("StaticFieldLeak")
 object UserData {
     var context: Context? = null
     val isSession: MutableState<Boolean> = mutableStateOf(false)
+    var currentScreen: String = Routes.BASKET
 }

+ 2 - 2
mobile_app/wabi/app/src/main/java/com/example/wabi/view/MainActivity.kt

@@ -63,12 +63,12 @@ class MainActivity : ComponentActivity() {
                         )
 
                         if (PrefManager.onboard) {
-                            PrefManager.onboard = true
+                            PrefManager.onboard = false
                             visibleBB.value = false
                             navHostController.navigate(Routes.ONBOARD)
                         } else {
                             visibleBB.value = true
-                            navHostController.navigate(Routes.BASKET)
+                            navHostController.navigate(UserData.currentScreen)
                         }
                     }
                 }

+ 1 - 2
mobile_app/wabi/app/src/main/java/com/example/wabi/view/screens/onboard/items/OnBoardState.kt

@@ -27,8 +27,7 @@ fun OnBoardState(onboardItem: OnBoardItem, modifier: Modifier = Modifier) {
         Column(
             modifier = modifier
                 .background(color = WabiTheme.colors.onBoardLight)
-                .fillMaxWidth()
-                .padding(20.dp),
+                .fillMaxWidth(),
             verticalArrangement = Arrangement.Center,
             horizontalAlignment = Alignment.CenterHorizontally
         ) {

+ 5 - 1
mobile_app/wabi/app/src/main/java/com/example/wabi/view/screens/signIn/SignIn.kt

@@ -19,6 +19,8 @@ import androidx.compose.ui.Modifier
 import androidx.compose.ui.unit.dp
 import androidx.hilt.navigation.compose.hiltViewModel
 import androidx.navigation.NavHostController
+import com.example.wabi.domain.navigation.Routes
+import com.example.wabi.domain.repository.UserData
 import com.example.wabi.ui.theme.WabiTheme
 import com.example.wabi.view.common_elements.button.ButtonLink
 import com.example.wabi.view.common_elements.button.MainButton
@@ -32,6 +34,8 @@ fun SignIn(navController: NavHostController, vm: SignInViewModel = hiltViewModel
     val data = vm.data
     val printError = remember { mutableStateOf(false) }
 
+    UserData.currentScreen = Routes.SIGNIN
+
     Column(
         modifier = Modifier
             .fillMaxSize()
@@ -84,7 +88,7 @@ fun SignIn(navController: NavHostController, vm: SignInViewModel = hiltViewModel
                     vm.goToRegistration(navController = navController)
                 },
                 textContent = "Зарегистирируйтесь!",
-                modifierButton = Modifier.offset(y = -15.dp),
+                modifierButton = Modifier.offset(y = (-15).dp),
                 colorContent = WabiTheme.colors.mainColor
             )
             MainButton(

+ 5 - 3
mobile_app/wabi/app/src/main/java/com/example/wabi/view/screens/signIn/SignInViewModel.kt

@@ -43,8 +43,10 @@ class SignInViewModel @Inject constructor(
     }
 
     fun goToRegistration(navController: NavHostController) {
-        nav.NextScreen(
-            navController = navController, whereFrom = Routes.SIGNIN, where = Routes.SIGNUP
-        )
+        viewModelScope.launch {
+            nav.NextScreen(
+                navController = navController, whereFrom = Routes.SIGNIN, where = Routes.SIGNUP
+            )
+        }
     }
 }

+ 3 - 0
mobile_app/wabi/app/src/main/java/com/example/wabi/view/screens/signUp/SignUp.kt

@@ -6,12 +6,15 @@ import androidx.compose.runtime.Composable
 import androidx.compose.ui.Modifier
 import androidx.hilt.navigation.compose.hiltViewModel
 import androidx.navigation.NavHostController
+import com.example.wabi.domain.navigation.Routes
+import com.example.wabi.domain.repository.UserData
 
 
 @Composable
 fun SignUp(navController: NavHostController, vm: SignUpViewModel = hiltViewModel()) {
 
     // val states = listOf()
+    UserData.currentScreen = Routes.SIGNUP
 
     Column(
         modifier = Modifier.fillMaxWidth()