Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a6cfd96 authored by Chaohui Wang's avatar Chaohui Wang
Browse files

Fix app version name RTL issue

Before fix, the version name under app label has this issue and the
version name at the footer of page does not has this issue because it's
BidiFormatter wrapped.

Always BidiFormatter wrap the version name to fix this issue.

Fix: 283407883
Test: Visual
Change-Id: I2c73c69caf80e90e4eaadeb42bc4afe62fa05cf0
parent af4534f6
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ class AppInfoProvider(private val packageInfo: PackageInfo) {
    private fun AppVersion() {
        if (packageInfo.versionName == null) return
        Spacer(modifier = Modifier.height(4.dp))
        SettingsBody(packageInfo.versionName)
        SettingsBody(packageInfo.versionNameBidiWrapped)
    }

    @Composable
@@ -84,10 +84,15 @@ class AppInfoProvider(private val packageInfo: PackageInfo) {
        if (packageInfo.versionName == null) return
        Divider()
        Box(modifier = Modifier.padding(SettingsDimension.itemPadding)) {
            val versionName = BidiFormatter.getInstance().unicodeWrap(packageInfo.versionName)
            SettingsBody(stringResource(R.string.version_text, versionName))
            SettingsBody(stringResource(R.string.version_text, packageInfo.versionNameBidiWrapped))
        }
    }

    private companion object {
        /** Wrapped the version name, so its directionality still keep same when RTL. */
        val PackageInfo.versionNameBidiWrapped: String
            get() = BidiFormatter.getInstance().unicodeWrap(versionName)
    }
}

@Composable