Fix some errors

This commit is contained in:
Benoit Marty
2023-06-07 16:55:37 +02:00
parent 3eeeee2c98
commit b4723bb182
9 changed files with 16 additions and 98 deletions

View File

@@ -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),

View File

@@ -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 {
}

View File

@@ -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 = { }
)
}

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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 {

View File

@@ -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)
})
}
}
}
}

View File

@@ -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)
}