diff --git a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/components/GoogleSignInButton.kt b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/components/GoogleSignInButton.kt index 8f8c22167251f84c2c88edc602fa6204cbbfc8ea..d0e42c0def167b60d7edc9af00c3157b8538233c 100644 --- a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/components/GoogleSignInButton.kt +++ b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/components/GoogleSignInButton.kt @@ -1,18 +1,17 @@ package band.effective.office.elevator.components +import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.Button -import androidx.compose.material.ButtonDefaults import androidx.compose.material.Icon import androidx.compose.material.Text +import androidx.compose.material.TextButton import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import band.effective.office.elevator.EffectiveTheme import band.effective.office.elevator.MainRes @@ -20,28 +19,27 @@ import dev.icerock.moko.resources.compose.painterResource import dev.icerock.moko.resources.compose.stringResource @Composable -internal fun GoogleSignInButton(modifier: Modifier, onClick: () -> Unit) { - Button( +internal fun GoogleSignInButton( + modifier: Modifier = Modifier, + onClick: () -> Unit, +) { + TextButton( modifier = modifier.fillMaxWidth(), onClick = onClick, shape = RoundedCornerShape(40.dp), - colors = ButtonDefaults.buttonColors( - backgroundColor = Color.Transparent, - contentColor = EffectiveTheme.colors.text.accent - ), elevation = Elevation() ) { - Icon( + Image( painter = painterResource(MainRes.images.ic_google), contentDescription = null, modifier = Modifier.size(24.dp), - tint = EffectiveTheme.colors.text.primary ) Spacer(modifier = Modifier.width(8.dp)) Text( modifier = Modifier.padding(6.dp), text = stringResource(MainRes.strings.sign_in_google), - style = EffectiveTheme.typography.mMedium + style = EffectiveTheme.typography.mMedium, + color = EffectiveTheme.colors.text.accent, ) } } diff --git a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/authorization/authorization_google/AuthorizationGoogleScreen.kt b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/authorization/authorization_google/AuthorizationGoogleScreen.kt index c383b8a081ba977484888f0575d0d0cde24016a7..c984f27dd11a0fdabffd51e18351da5610232f82 100644 --- a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/authorization/authorization_google/AuthorizationGoogleScreen.kt +++ b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/authorization/authorization_google/AuthorizationGoogleScreen.kt @@ -1,6 +1,5 @@ package band.effective.office.elevator.ui.authorization.authorization_google -import androidx.compose.foundation.Canvas import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.border @@ -13,21 +12,18 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Icon import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.blur -import androidx.compose.ui.geometry.Offset import androidx.compose.ui.unit.dp import band.effective.office.elevator.EffectiveTheme import band.effective.office.elevator.MainRes import band.effective.office.elevator.components.EffectiveGradient import band.effective.office.elevator.components.GoogleSignInButton import band.effective.office.elevator.expects.showToast -import band.effective.office.elevator.orange60 -import band.effective.office.elevator.purple60 import band.effective.office.elevator.ui.authorization.authorization_google.store.AuthorizationGoogleStore import dev.icerock.moko.resources.compose.painterResource import dev.icerock.moko.resources.compose.stringResource @@ -70,7 +66,7 @@ private fun AuthorizationGoogleScreenContent(onEvent: (AuthorizationGoogleStore. .background( color = EffectiveTheme.colors.background.primary.copy(alpha = 0.6f), shape = RoundedCornerShape(20.dp) - ) + ) .border( width = 1.dp, shape = RoundedCornerShape(20.dp), @@ -99,7 +95,6 @@ private fun AuthorizationGoogleScreenContent(onEvent: (AuthorizationGoogleStore. } GoogleSignInButton( - modifier = Modifier, onClick = { onEvent(AuthorizationGoogleStore.Intent.SignInButtonClicked) } ) } diff --git a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/ProfileComponent.kt b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/ProfileComponent.kt index ab89a77674c9c7d0a2d2d97a435704df3e633c91..07b9644dbcef22c76e0943a84b8ce0c13e0b6f8b 100644 --- a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/ProfileComponent.kt +++ b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/ProfileComponent.kt @@ -8,8 +8,10 @@ import com.arkivanov.decompose.router.stack.StackNavigation import com.arkivanov.decompose.router.stack.bringToFront import com.arkivanov.decompose.router.stack.childStack import com.arkivanov.decompose.router.stack.pop +import com.arkivanov.decompose.router.stack.popWhile import com.arkivanov.decompose.router.stack.push import com.arkivanov.decompose.router.stack.replaceAll +import com.arkivanov.decompose.router.stack.replaceCurrent import com.arkivanov.decompose.value.Value import com.arkivanov.essenty.parcelable.Parcelable import com.arkivanov.essenty.parcelable.Parcelize diff --git a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/editProfile/ProfileEditScreen.kt b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/editProfile/ProfileEditScreen.kt index 36d526ee23e96e78216015bc15d9e95728b605fd..02d7764b57caeb64512c1bb258a24ab949a49427 100644 --- a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/editProfile/ProfileEditScreen.kt +++ b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/editProfile/ProfileEditScreen.kt @@ -234,7 +234,6 @@ private fun ProfileEditScreenContent( phoneNumberText, telegramText ) - onReturnToProfile() }, buttonText = stringResource(MainRes.strings.save), ) diff --git a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/editProfile/store/ProfileEditStoreFactory.kt b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/editProfile/store/ProfileEditStoreFactory.kt index f3859a3af4b4bbfa80be7d53fe1a46f2db3277e1..711744b653533f42e46b91443a9aa18f733f272a 100644 --- a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/editProfile/store/ProfileEditStoreFactory.kt +++ b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/editProfile/store/ProfileEditStoreFactory.kt @@ -1,6 +1,5 @@ package band.effective.office.elevator.ui.profile.editProfile.store -import band.effective.office.elevator.MainRes import band.effective.office.elevator.domain.models.User import band.effective.office.elevator.domain.useCase.GetUserUseCase import band.effective.office.elevator.domain.useCase.UpdateUserUseCase @@ -54,10 +53,10 @@ internal class ProfileEditStoreFactory( data class PostError(val message: StringResource) : Msg data class TelegramError(val message: StringResource) : Msg - data object ValidPhone: Msg - data object ValidName: Msg - data object ValidPost: Msg - data object ValidTelegram: Msg + data object ValidPhone : Msg + data object ValidName : Msg + data object ValidPost : Msg + data object ValidTelegram : Msg } private inner class ExecutorImpl : @@ -98,7 +97,9 @@ internal class ProfileEditStoreFactory( is Either.Success -> { dispatch(Msg.ProfileData(user = updatedUser)) publish(Label.SavedChange) + returnToProfile() } + is Either.Error -> { publish(Label.ServerError) } @@ -115,6 +116,7 @@ internal class ProfileEditStoreFactory( dispatch(Msg.TelegramError(result.message)) false } + ExtendedUserInfoValidator.Result.Valid -> { dispatch(Msg.ValidTelegram) true @@ -128,6 +130,7 @@ internal class ProfileEditStoreFactory( dispatch(Msg.PostError(result.message)) false } + ExtendedUserInfoValidator.Result.Valid -> { dispatch(Msg.ValidPost) true @@ -141,6 +144,7 @@ internal class ProfileEditStoreFactory( dispatch(Msg.NameError(result.message)) false } + ExtendedUserInfoValidator.Result.Valid -> { dispatch(Msg.ValidName) true @@ -154,6 +158,7 @@ internal class ProfileEditStoreFactory( dispatch(Msg.PhoneError(result.message)) false } + ExtendedUserInfoValidator.Result.Valid -> { dispatch(Msg.ValidPhone) true @@ -198,11 +203,12 @@ internal class ProfileEditStoreFactory( override fun State.reduce(msg: Msg): State { return when (this) { State.Loading -> { - when(msg) { + when (msg) { is Msg.ProfileData -> State.Data(user = msg.user) else -> this } } + is State.Data -> { when (msg) { is Msg.ProfileData -> State.Data(user = msg.user) diff --git a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/mainProfile/store/ProfileStoreFactory.kt b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/mainProfile/store/ProfileStoreFactory.kt index 2d218440edc969f6591ddccffabd196a298ae990..7672d44e4b28a18a2bc21d86ca2f8d925d19f2e4 100644 --- a/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/mainProfile/store/ProfileStoreFactory.kt +++ b/composeApp/src/commonMain/kotlin/band/effective/office/elevator/ui/profile/mainProfile/store/ProfileStoreFactory.kt @@ -1,6 +1,5 @@ package band.effective.office.elevator.ui.profile.mainProfile.store -import band.effective.office.elevator.domain.GoogleSignIn import band.effective.office.elevator.domain.models.User import band.effective.office.elevator.domain.useCase.AuthorizationUseCase import band.effective.office.elevator.domain.useCase.GetUserUseCase diff --git a/composeApp/src/commonMain/moko-resources/images/ic_google.svg b/composeApp/src/commonMain/moko-resources/images/ic_google.svg deleted file mode 100644 index bee2d7f87a4dea69adeb51708c36d03bb2ffca8f..0000000000000000000000000000000000000000 --- a/composeApp/src/commonMain/moko-resources/images/ic_google.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/composeApp/src/commonMain/moko-resources/images/ic_google@1x.png b/composeApp/src/commonMain/moko-resources/images/ic_google@1x.png new file mode 100644 index 0000000000000000000000000000000000000000..49aee3bd90c4af9ccd2f219ed21bd3dab662f35c Binary files /dev/null and b/composeApp/src/commonMain/moko-resources/images/ic_google@1x.png differ