Skip to content

Commit 8be6bad

Browse files
committed
SignedOutView: iterate on design.
1 parent 257927f commit 8be6bad

File tree

9 files changed

+118
-24
lines changed

9 files changed

+118
-24
lines changed

features/signedout/impl/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ dependencies {
3838
implementation(projects.libraries.matrix.api)
3939
implementation(projects.libraries.matrixui)
4040
implementation(projects.libraries.designsystem)
41+
implementation(projects.libraries.uiStrings)
4142

4243
testImplementation(libs.test.junit)
4344
testImplementation(libs.coroutines.test)

features/signedout/impl/src/main/kotlin/io/element/android/features/signedout/impl/SignedOutPresenter.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ import dagger.assisted.Assisted
2626
import dagger.assisted.AssistedFactory
2727
import dagger.assisted.AssistedInject
2828
import io.element.android.libraries.architecture.Presenter
29+
import io.element.android.libraries.core.meta.BuildMeta
2930
import io.element.android.libraries.sessionstorage.api.SessionStore
3031
import kotlinx.coroutines.launch
3132

3233
class SignedOutPresenter @AssistedInject constructor(
3334
@Assisted private val sessionId: String, /* Cannot inject SessionId */
3435
private val sessionStore: SessionStore,
36+
private val buildMeta: BuildMeta,
3537
) : Presenter<SignedOutState> {
3638

3739
@AssistedFactory
@@ -56,6 +58,7 @@ class SignedOutPresenter @AssistedInject constructor(
5658
}
5759

5860
return SignedOutState(
61+
appName = buildMeta.applicationName,
5962
signedOutSession = signedOutSession,
6063
eventSink = ::handleEvents
6164
)

features/signedout/impl/src/main/kotlin/io/element/android/features/signedout/impl/SignedOutState.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import io.element.android.libraries.sessionstorage.api.SessionData
2020

2121
// Do not use default value, so no member get forgotten in the presenters.
2222
data class SignedOutState(
23+
val appName: String,
2324
val signedOutSession: SessionData?,
2425
val eventSink: (SignedOutEvents) -> Unit,
2526
)

features/signedout/impl/src/main/kotlin/io/element/android/features/signedout/impl/SignedOutStateProvider.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ open class SignedOutStateProvider : PreviewParameterProvider<SignedOutState> {
3030
}
3131

3232
fun aSignedOutState() = SignedOutState(
33+
appName = "AppName",
34+
signedOutSession = aSessionData(),
3335
eventSink = {},
34-
signedOutSession = aSessionData()
3536
)
3637

3738
fun aSessionData(

features/signedout/impl/src/main/kotlin/io/element/android/features/signedout/impl/SignedOutView.kt

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,20 @@
1717
package io.element.android.features.signedout.impl
1818

1919
import androidx.activity.compose.BackHandler
20-
import androidx.compose.foundation.background
20+
import androidx.annotation.DrawableRes
2121
import androidx.compose.foundation.layout.Box
2222
import androidx.compose.foundation.layout.fillMaxSize
2323
import androidx.compose.foundation.layout.fillMaxWidth
2424
import androidx.compose.foundation.layout.imePadding
2525
import androidx.compose.foundation.layout.padding
2626
import androidx.compose.foundation.layout.size
2727
import androidx.compose.foundation.layout.systemBarsPadding
28-
import androidx.compose.foundation.shape.CircleShape
2928
import androidx.compose.material.icons.Icons
3029
import androidx.compose.material.icons.filled.AccountCircle
31-
import androidx.compose.material3.MaterialTheme
3230
import androidx.compose.runtime.Composable
3331
import androidx.compose.ui.BiasAlignment
3432
import androidx.compose.ui.Modifier
33+
import androidx.compose.ui.res.stringResource
3534
import androidx.compose.ui.tooling.preview.PreviewParameter
3635
import androidx.compose.ui.unit.dp
3736
import io.element.android.libraries.designsystem.atomic.molecules.ButtonColumnMolecule
@@ -44,8 +43,8 @@ import io.element.android.libraries.designsystem.preview.PreviewsDayNight
4443
import io.element.android.libraries.designsystem.theme.components.Button
4544
import io.element.android.libraries.designsystem.theme.components.Icon
4645
import io.element.android.libraries.designsystem.theme.temporaryColorBgSpecial
47-
import io.element.android.libraries.designsystem.utils.CommonDrawables
4846
import io.element.android.libraries.theme.ElementTheme
47+
import io.element.android.libraries.ui.strings.CommonStrings
4948
import kotlinx.collections.immutable.persistentListOf
5049

5150
@Composable
@@ -59,7 +58,7 @@ fun SignedOutView(
5958
.fillMaxSize()
6059
.systemBarsPadding()
6160
.imePadding(),
62-
header = { SignedOutHeader() },
61+
header = { SignedOutHeader(state) },
6362
content = { SignedOutContent() },
6463
footer = {
6564
SignedOutFooter(
@@ -70,12 +69,13 @@ fun SignedOutView(
7069
}
7170

7271
@Composable
73-
private fun SignedOutHeader() {
72+
private fun SignedOutHeader(state: SignedOutState) {
7473
IconTitleSubtitleMolecule(
7574
modifier = Modifier.padding(top = 60.dp, bottom = 12.dp),
76-
title = "You’re signed out",
77-
subTitle = "It can be due to various reasons:",
78-
iconImageVector = Icons.Filled.AccountCircle
75+
title = stringResource(id = R.string.screen_signed_out_title),
76+
subTitle = stringResource(id = R.string.screen_signed_out_subtitle, state.appName),
77+
iconImageVector = Icons.Filled.AccountCircle,
78+
iconTint = ElementTheme.colors.iconSecondary,
7979
)
8080
}
8181

@@ -93,16 +93,16 @@ private fun SignedOutContent(
9393
InfoListOrganism(
9494
items = persistentListOf(
9595
InfoListItem(
96-
message = "You’ve changed your password on another session.",
97-
iconComposable = { CheckIcon() },
96+
message = stringResource(id = R.string.screen_signed_out_reason_1),
97+
iconComposable = { Icon(R.drawable.ic_lock_outline) },
9898
),
9999
InfoListItem(
100-
message = "You have deleted this session from another session.",
101-
iconComposable = { CheckIcon() },
100+
message = stringResource(id = R.string.screen_signed_out_reason_2),
101+
iconComposable = { Icon(R.drawable.ic_devices) },
102102
),
103103
InfoListItem(
104-
message = "The administrator of your server has invalidated your access for security reason.",
105-
iconComposable = { CheckIcon() },
104+
message = stringResource(id = R.string.screen_signed_out_reason_3),
105+
iconComposable = { Icon(R.drawable.ic_do_disturb_alt) },
106106
),
107107
),
108108
textStyle = ElementTheme.typography.fontBodyMdMedium,
@@ -113,15 +113,16 @@ private fun SignedOutContent(
113113
}
114114

115115
@Composable
116-
private fun CheckIcon(modifier: Modifier = Modifier) {
116+
private fun Icon(
117+
@DrawableRes iconResourceId: Int,
118+
modifier: Modifier = Modifier,
119+
) {
117120
Icon(
118121
modifier = modifier
119-
.size(20.dp)
120-
.background(color = MaterialTheme.colorScheme.background, shape = CircleShape)
121-
.padding(2.dp),
122-
resourceId = CommonDrawables.ic_compound_check,
122+
.size(20.dp),
123+
resourceId = iconResourceId,
123124
contentDescription = null,
124-
tint = ElementTheme.colors.textActionAccent,
125+
tint = ElementTheme.colors.iconSecondary,
125126
)
126127
}
127128

@@ -134,7 +135,7 @@ private fun SignedOutFooter(
134135
modifier = modifier,
135136
) {
136137
Button(
137-
text = "Sign in again",
138+
text = stringResource(id = CommonStrings.action_sign_in_again),
138139
onClick = onSignInAgain,
139140
modifier = Modifier.fillMaxWidth(),
140141
)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!--
2+
~ Copyright (c) 2023 New Vector Ltd
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:width="20dp"
19+
android:height="20dp"
20+
android:viewportWidth="20"
21+
android:viewportHeight="20">
22+
<group>
23+
<clip-path
24+
android:pathData="M0,0h20v20h-20z"/>
25+
<path
26+
android:pathData="M3.333,5.833C3.333,5.375 3.708,5 4.167,5H17.5C17.958,5 18.333,4.625 18.333,4.167C18.333,3.708 17.958,3.333 17.5,3.333H3.333C2.417,3.333 1.667,4.083 1.667,5V14.167H1.25C0.558,14.167 0,14.725 0,15.417C0,16.108 0.558,16.667 1.25,16.667H11.667V14.167H3.333V5.833ZM19.167,6.667H14.167C13.708,6.667 13.333,7.042 13.333,7.5V15.833C13.333,16.292 13.708,16.667 14.167,16.667H19.167C19.625,16.667 20,16.292 20,15.833V7.5C20,7.042 19.625,6.667 19.167,6.667ZM18.333,14.167H15V8.333H18.333V14.167Z"
27+
android:fillColor="@android:color/white"/>
28+
</group>
29+
</vector>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!--
2+
~ Copyright (c) 2023 New Vector Ltd
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:width="20dp"
19+
android:height="20dp"
20+
android:viewportWidth="20"
21+
android:viewportHeight="20">
22+
<group>
23+
<clip-path
24+
android:pathData="M0,0h20v20h-20z"/>
25+
<path
26+
android:pathData="M10,1.667C5.417,1.667 1.666,5.417 1.666,10C1.666,14.583 5.417,18.333 10,18.333C14.583,18.333 18.333,14.583 18.333,10C18.333,5.417 14.583,1.667 10,1.667ZM3.333,10C3.333,6.333 6.333,3.333 10,3.333C11.5,3.333 12.917,3.833 14.083,4.75L4.75,14.083C3.833,12.917 3.333,11.5 3.333,10ZM10,16.667C8.5,16.667 7.083,16.167 5.917,15.25L15.25,5.917C16.167,7.083 16.667,8.5 16.667,10C16.667,13.667 13.667,16.667 10,16.667Z"
27+
android:fillColor="@android:color/white"/>
28+
</group>
29+
</vector>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!--
2+
~ Copyright (c) 2023 New Vector Ltd
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
17+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:width="20dp"
19+
android:height="20dp"
20+
android:viewportWidth="20"
21+
android:viewportHeight="20">
22+
<group>
23+
<clip-path
24+
android:pathData="M0,0h20v20h-20z"/>
25+
<path
26+
android:pathData="M15,6.667H14.167V5C14.167,2.7 12.3,0.833 10,0.833C7.7,0.833 5.833,2.7 5.833,5V6.667H5C4.083,6.667 3.333,7.417 3.333,8.333V16.667C3.333,17.583 4.083,18.333 5,18.333H15C15.917,18.333 16.667,17.583 16.667,16.667V8.333C16.667,7.417 15.917,6.667 15,6.667ZM7.5,5C7.5,3.617 8.617,2.5 10,2.5C11.384,2.5 12.5,3.617 12.5,5V6.667H7.5V5ZM14.167,16.667H5.833C5.375,16.667 5,16.292 5,15.833V9.167C5,8.708 5.375,8.333 5.833,8.333H14.167C14.625,8.333 15,8.708 15,9.167V15.833C15,16.292 14.625,16.667 14.167,16.667ZM10,14.167C10.917,14.167 11.667,13.417 11.667,12.5C11.667,11.583 10.917,10.833 10,10.833C9.083,10.833 8.333,11.583 8.333,12.5C8.333,13.417 9.083,14.167 10,14.167Z"
27+
android:fillColor="@android:color/white"/>
28+
</group>
29+
</vector>

features/signedout/impl/src/main/res/values/localazy.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<string name="screen_signed_out_reason_1">"You’ve changed your password on another session"</string>
44
<string name="screen_signed_out_reason_2">"You have deleted the session from another session"</string>
55
<string name="screen_signed_out_reason_3">"Your server’s administrator has invalidated your access"</string>
6-
<string name="screen_signed_out_subtitle">"You might have been signed out for one of the reasons listed below. Please sign in again to continue using Element."</string>
6+
<string name="screen_signed_out_subtitle">"You might have been signed out for one of the reasons listed below. Please sign in again to continue using %s."</string>
77
<string name="screen_signed_out_title">"You’re signed out"</string>
88
</resources>

0 commit comments

Comments
 (0)