From b4723bb1827eb2c58b6fbc2b0dc2195f0f8b158c Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 7 Jun 2023 16:55:37 +0200 Subject: [PATCH] Fix some errors --- .../item/AccountProviderView.kt | 8 +-- .../ChangeAccountProviderEvents.kt | 20 ------ .../form/ChangeAccountProviderFormView.kt | 5 +- .../form/network/WellKnown.kt | 2 +- .../form/network/WellKnownBaseConfig.kt | 2 +- .../form/network/WellknownAPI.kt | 1 + .../form/network/WellknownRequest.kt | 2 +- .../impl/loginpassword/LoginPasswordView.kt | 12 ++-- .../atomic/atoms/SeparatorAtom.kt | 62 ------------------- 9 files changed, 16 insertions(+), 98 deletions(-) delete mode 100644 features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/ChangeAccountProviderEvents.kt delete mode 100644 libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/atomic/atoms/SeparatorAtom.kt diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/item/AccountProviderView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/item/AccountProviderView.kt index eb2f67947e..ae3aea8878 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/item/AccountProviderView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/accountprovider/item/AccountProviderView.kt @@ -38,9 +38,9 @@ import io.element.android.features.login.impl.R import io.element.android.libraries.designsystem.ElementTextStyles import io.element.android.libraries.designsystem.atomic.atoms.RoundedIconAtom import io.element.android.libraries.designsystem.atomic.atoms.RoundedIconAtomSize -import io.element.android.libraries.designsystem.atomic.atoms.SeparatorAtom import io.element.android.libraries.designsystem.preview.ElementPreviewDark import io.element.android.libraries.designsystem.preview.ElementPreviewLight +import io.element.android.libraries.designsystem.theme.components.Divider import io.element.android.libraries.designsystem.theme.components.Icon import io.element.android.libraries.designsystem.theme.components.Text @@ -56,7 +56,7 @@ fun AccountProviderView( Column(modifier = modifier .fillMaxWidth() .clickable { onClick() }) { - SeparatorAtom() + Divider() Column( modifier = Modifier .fillMaxWidth() @@ -82,7 +82,7 @@ fun AccountProviderView( ) } Text( - modifier = modifier + modifier = Modifier .padding(start = 16.dp) .weight(1f), text = item.title, @@ -102,7 +102,7 @@ fun AccountProviderView( } if (item.subtitle != null) { Text( - modifier = modifier + modifier = Modifier .padding(start = 46.dp, bottom = 12.dp, end = 26.dp), text = item.subtitle, style = ElementTextStyles.Regular.subheadline.copy(textAlign = TextAlign.Start), diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/ChangeAccountProviderEvents.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/ChangeAccountProviderEvents.kt deleted file mode 100644 index 0579006dfc..0000000000 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/ChangeAccountProviderEvents.kt +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2023 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.features.login.impl.changeaccountprovider - -sealed interface ChangeAccountProviderEvents { -} diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/ChangeAccountProviderFormView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/ChangeAccountProviderFormView.kt index 9e00d9c47d..311eb21684 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/ChangeAccountProviderFormView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/ChangeAccountProviderFormView.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -@file:OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class, ExperimentalMaterial3Api::class) +@file:OptIn(ExperimentalMaterial3Api::class, ExperimentalLayoutApi::class) package io.element.android.features.login.impl.changeaccountprovider.form @@ -71,7 +71,7 @@ import io.element.android.libraries.designsystem.theme.components.Text fun ChangeAccountProviderFormView( state: ChangeAccountProviderFormState, modifier: Modifier = Modifier, - onBackPressed: () -> Unit, + onBackPressed: () -> Unit = {}, onAccountProviderClicked: (AccountProvider) -> Unit = {}, ) { val eventSink = state.eventSink @@ -197,6 +197,5 @@ fun ChangeAccountProviderFormViewDarkPreview(@PreviewParameter(ChangeAccountProv private fun ContentToPreview(state: ChangeAccountProviderFormState) { ChangeAccountProviderFormView( state = state, - onBackPressed = { } ) } diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellKnown.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellKnown.kt index a78f41a266..60006e7530 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellKnown.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellKnown.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020 The Matrix.org Foundation C.I.C. + * Copyright (c) 2023 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellKnownBaseConfig.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellKnownBaseConfig.kt index b0d33e1854..619b656d22 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellKnownBaseConfig.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellKnownBaseConfig.kt @@ -1,5 +1,5 @@ /* - * Copyright 2020 The Matrix.org Foundation C.I.C. + * Copyright (c) 2023 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellknownAPI.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellknownAPI.kt index 13153cfabb..0362a67c60 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellknownAPI.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellknownAPI.kt @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package io.element.android.features.login.impl.changeaccountprovider.form.network import retrofit2.http.GET diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellknownRequest.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellknownRequest.kt index a8d911ee86..709eea0255 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellknownRequest.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeaccountprovider/form/network/WellknownRequest.kt @@ -24,7 +24,7 @@ class WellknownRequest @Inject constructor( private val retrofitFactory: RetrofitFactory, ) { /** - * Return true if the wellknown can be retrieved and is valid + * Return true if the wellknown can be retrieved and is valid. * @param baseUrl for instance https://matrix.org */ suspend fun execute(baseUrl: String): Boolean { diff --git a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/loginpassword/LoginPasswordView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/loginpassword/LoginPasswordView.kt index c7decb8cb7..958ab94ae3 100644 --- a/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/loginpassword/LoginPasswordView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/loginpassword/LoginPasswordView.kt @@ -139,13 +139,13 @@ fun LoginPasswordView( submit = ::submit ) } - } - } - if (state.loginAction is Async.Failure) { - LoginErrorDialog(error = state.loginAction.error, onDismiss = { - state.eventSink(LoginPasswordEvents.ClearError) - }) + if (state.loginAction is Async.Failure) { + LoginErrorDialog(error = state.loginAction.error, onDismiss = { + state.eventSink(LoginPasswordEvents.ClearError) + }) + } + } } } diff --git a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/atomic/atoms/SeparatorAtom.kt b/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/atomic/atoms/SeparatorAtom.kt deleted file mode 100644 index fe15ae5480..0000000000 --- a/libraries/designsystem/src/main/kotlin/io/element/android/libraries/designsystem/atomic/atoms/SeparatorAtom.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2023 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.libraries.designsystem.atomic.atoms - -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.dp -import io.element.android.libraries.designsystem.preview.ElementPreviewDark -import io.element.android.libraries.designsystem.preview.ElementPreviewLight -import io.element.android.libraries.designsystem.theme.LocalColors - -@Composable -fun SeparatorAtom( - modifier: Modifier = Modifier, - horizontalPadding: Dp = 0.dp, -) { - Spacer( - modifier = modifier - .height(0.5f.dp) - .fillMaxWidth() - .padding(horizontal = horizontalPadding) - .background( - color = LocalColors.current.quinary, - ) - ) -} - -@Preview -@Composable -internal fun SeparatorAtomLightPreview() = - ElementPreviewLight { ContentToPreview() } - -@Preview -@Composable -internal fun SeparatorAtomDarkPreview() = - ElementPreviewDark { ContentToPreview() } - -@Composable -private fun ContentToPreview() { - SeparatorAtom(horizontalPadding = 20.dp) -}