From af541b30320f93f95ad3d6c0d57f6f3d79570743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=BA=D0=B0=D1=82=D0=B5=D1=80=D0=B8=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=9C=D0=B8=D0=BD=D0=B3=D0=B5=D1=80?= Date: Mon, 31 Mar 2025 14:03:28 +0600 Subject: [PATCH] [~]fix double auth --- .../ui/authorization/AuthorizationComponent.kt | 13 ++++++++++--- .../authorization/store/AuthorizationStoreImpl.kt | 6 +++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/authorization/AuthorizationComponent.kt b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/authorization/AuthorizationComponent.kt index 3cd8b9cc..87a74d0f 100644 --- a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/authorization/AuthorizationComponent.kt +++ b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/authorization/AuthorizationComponent.kt @@ -154,9 +154,16 @@ class AuthorizationComponent( when (output) { is AuthorizationGoogleComponent.Output.OpenAuthorizationPhoneScreen -> { authorizationStore.accept(AuthorizationStore.Intent.UpdateUserInfo(output.userData)) - navigation.replaceAll( - Config.PhoneAuth - ) + when { + output.userData.phoneNumber.isEmpty() -> + navigation.replaceAll(Config.PhoneAuth) + output.userData.userName.isEmpty() || output.userData.post.isEmpty() -> + navigation.replaceAll(Config.ProfileAuth) + output.userData.telegram.isEmpty() -> + navigation.replaceAll(Config.TelegramAuth) + else -> + openContentFlow() + } } } } diff --git a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/authorization/store/AuthorizationStoreImpl.kt b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/authorization/store/AuthorizationStoreImpl.kt index f59d3f47..19675518 100644 --- a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/authorization/store/AuthorizationStoreImpl.kt +++ b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/authorization/store/AuthorizationStoreImpl.kt @@ -54,12 +54,12 @@ class AuthorizationStoreFactory( override fun executeAction(action: Action, getState: () -> AuthorizationStore.State) { when(action) { is Action.LoadUserData -> { - featchUserInfo() + fetchUserInfo() } } } - private fun featchUserInfo() { + private fun fetchUserInfo() { scope.launch(Dispatchers.IO) { getUserUseCase.execute().collect{ user -> withContext(Dispatchers.Main) { @@ -102,4 +102,4 @@ class AuthorizationStoreFactory( private sealed interface Action{ data object LoadUserData : Action } -} \ No newline at end of file +} -- GitLab