Add missing device id to settings screen (#2320)
* Add missing device id to settings screen * Extract footer component * Restore `@PreviewWithLargeHeight` logic --------- Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
parent
e39711be37
commit
c2fc6db423
50 changed files with 122 additions and 83 deletions
|
|
@ -99,6 +99,7 @@ class PreferencesRootPresenter @Inject constructor(
|
|||
return PreferencesRootState(
|
||||
myUser = matrixUser.value,
|
||||
version = versionFormatter.get(),
|
||||
deviceId = matrixClient.deviceId,
|
||||
showCompleteVerification = showCompleteVerification,
|
||||
showSecureBackup = !showCompleteVerification && secureStorageFlag == true,
|
||||
showSecureBackupBadge = showSecureBackupIndicator,
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import io.element.android.libraries.matrix.api.user.MatrixUser
|
|||
data class PreferencesRootState(
|
||||
val myUser: MatrixUser?,
|
||||
val version: String,
|
||||
val deviceId: String?,
|
||||
val showCompleteVerification: Boolean,
|
||||
val showSecureBackup: Boolean,
|
||||
val showSecureBackupBadge: Boolean,
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import io.element.android.libraries.ui.strings.CommonStrings
|
|||
fun aPreferencesRootState() = PreferencesRootState(
|
||||
myUser = null,
|
||||
version = "Version 1.1 (1)",
|
||||
deviceId = "ILAKNDNASDLK",
|
||||
showCompleteVerification = true,
|
||||
showSecureBackup = true,
|
||||
showSecureBackupBadge = true,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import androidx.compose.foundation.layout.padding
|
|||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.InsertChart
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
|
|
@ -164,18 +165,38 @@ fun PreferencesRootView(
|
|||
style = ListItemStyle.Destructive,
|
||||
onClick = onSignOutClicked,
|
||||
)
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(top = 40.dp, bottom = 24.dp),
|
||||
textAlign = TextAlign.Center,
|
||||
text = state.version,
|
||||
style = ElementTheme.typography.fontBodySmRegular,
|
||||
color = ElementTheme.materialColors.secondary,
|
||||
Footer(
|
||||
version = state.version,
|
||||
deviceId = state.deviceId,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun Footer(
|
||||
version: String,
|
||||
deviceId: String?
|
||||
) {
|
||||
val text = remember(version, deviceId) {
|
||||
buildString {
|
||||
append(version)
|
||||
if (deviceId != null) {
|
||||
append("\n")
|
||||
append(deviceId)
|
||||
}
|
||||
}
|
||||
}
|
||||
Text(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(top = 40.dp, bottom = 24.dp),
|
||||
textAlign = TextAlign.Center,
|
||||
text = text,
|
||||
style = ElementTheme.typography.fontBodySmRegular,
|
||||
color = ElementTheme.materialColors.secondary,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DeveloperPreferencesView(onOpenDeveloperSettings: () -> Unit) {
|
||||
ListItem(
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class DefaultVersionFormatter @Inject constructor(
|
|||
base
|
||||
} else {
|
||||
// In case of a build not from main, we display the branch name and the revision
|
||||
"$base\n${buildMeta.gitBranchName}\n${buildMeta.gitRevision}"
|
||||
"$base\n${buildMeta.gitBranchName} (${buildMeta.gitRevision})"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class PreferencesRootPresenterTest {
|
|||
directLogoutPresenter = object : DirectLogoutPresenter {
|
||||
@Composable
|
||||
override fun present() = aDirectLogoutState
|
||||
}
|
||||
},
|
||||
)
|
||||
moleculeFlow(RecompositionMode.Immediate) {
|
||||
presenter.present()
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class VersionFormatterTest {
|
|||
gitRevision = "1234567890",
|
||||
)
|
||||
)
|
||||
assertThat(sut.get()).isEqualTo("$VERSION\nbranch\n1234567890")
|
||||
assertThat(sut.get()).isEqualTo("$VERSION\nbranch (1234567890)")
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue