Merge pull request #5626 from element-hq/bma/brandColor

Fix issue on brand color override
This commit is contained in:
Benoit Marty
2025-11-18 07:58:49 +01:00
committed by GitHub
9 changed files with 50 additions and 10 deletions

View File

@@ -2,7 +2,7 @@
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=element-x-android&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=element-x-android)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=element-x-android&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=element-x-android)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=element-x-android&metric=bugs)](https://sonarcloud.io/summary/new_code?id=element-x-android)
[![codecov](https://codecov.io/github/element-hq/element-x-android/branch/develop/graph/badge.svg?token=ecwvia7amV)](https://codecov.io/github/vector-im/element-x-android)
[![codecov](https://codecov.io/github/element-hq/element-x-android/branch/develop/graph/badge.svg?token=ecwvia7amV)](https://codecov.io/github/element-hq/element-x-android)
[![Element X Android Matrix room #element-x-android:matrix.org](https://img.shields.io/matrix/element-x-android:matrix.org.svg?label=%23element-x-android:matrix.org&logo=matrix&server_fqdn=matrix.org)](https://matrix.to/#/#element-x-android:matrix.org)
[![Localazy](https://img.shields.io/endpoint?url=https%3A%2F%2Fconnect.localazy.com%2Fstatus%2Felement%2Fdata%3Fcontent%3Dall%26title%3Dlocalazy%26logo%3Dtrue)](https://localazy.com/p/element)

View File

@@ -21,6 +21,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshots.SnapshotStateList
import androidx.compose.ui.graphics.toArgb
import dev.zacsweers.metro.Inject
import io.element.android.features.enterprise.api.EnterpriseService
import io.element.android.features.preferences.impl.developer.tracing.toLogLevel
@@ -140,7 +141,11 @@ class DeveloperSettingsPresenter(
}
is DeveloperSettingsEvents.ChangeBrandColor -> coroutineScope.launch {
showColorPicker = false
val color = event.color?.value?.toHexString(HexFormat.UpperCase)?.substring(2, 8)
val color = event.color
?.toArgb()
?.toHexString(HexFormat.UpperCase)
?.substring(2, 8)
?.padStart(7, '#')
enterpriseService.overrideBrandColor(sessionId, color)
}
is DeveloperSettingsEvents.SetShowColorPicker -> {

View File

@@ -208,7 +208,7 @@ class DeveloperSettingsPresenterTest {
assertThat(awaitItem().showColorPicker).isFalse()
skipItems(1)
overrideBrandColorResult.assertions().isCalledOnce()
.with(value(A_SESSION_ID), value("00FF00"))
.with(value(A_SESSION_ID), value("#00FF00"))
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
Files inside this package are generated automatically from the Compound project (https://github.com/vector-im/compound-design-tokens) and will be batch-replaced when new tokens are generated.
Files inside this package are generated automatically from the Compound project (https://github.com/element-hq/compound-design-tokens) and will be batch-replaced when new tokens are generated.

View File

@@ -10,7 +10,6 @@ package io.element.android.libraries.matrix.impl.auth
import dev.zacsweers.metro.AppScope
import dev.zacsweers.metro.ContributesBinding
import dev.zacsweers.metro.Inject
import io.element.android.libraries.core.extensions.runCatchingExceptions
import io.element.android.libraries.matrix.api.auth.HomeServerLoginCompatibilityChecker
import io.element.android.libraries.matrix.impl.ClientBuilderProvider
@@ -18,7 +17,6 @@ import io.element.android.libraries.matrix.impl.certificates.UserCertificatesPro
import timber.log.Timber
@ContributesBinding(AppScope::class)
@Inject
class RustHomeServerLoginCompatibilityChecker(
private val clientBuilderProvider: ClientBuilderProvider,
private val userCertificatesProvider: UserCertificatesProvider,

View File

@@ -16,7 +16,6 @@ import com.lemonappdev.konsist.api.verify.assertTrue
import dev.zacsweers.metro.Assisted
import dev.zacsweers.metro.ContributesBinding
import dev.zacsweers.metro.Inject
import org.junit.Ignore
import org.junit.Test
class KonsistDiTest {
@@ -37,7 +36,6 @@ class KonsistDiTest {
}
}
@Ignore("Disabled to give time to branch and private module to remove the annotation")
@Test
fun `class annotated with @ContributesBinding does not need to be annotated with @Inject anymore`() {
Konsist

View File

@@ -27,12 +27,13 @@ if [ -d tmpCompound ]; then
fi
mkdir tmpCompound
pushd tmpCompound
git clone --branch "${BRANCH}" https://github.com/vector-im/compound-design-tokens
git clone --branch "${BRANCH}" https://github.com/element-hq/compound-design-tokens
echo "Copying files from tokens repository..."
rm -R ../libraries/compound/src/main/res/drawable
cp -R compound-design-tokens/assets/android/res/drawable ../libraries/compound/src/main/res/
cp -R compound-design-tokens/assets/android/src/* ../libraries/compound/src/main/kotlin/io/element/android/compound/tokens/generated/
cp -R compound-design-tokens/assets/android/res/theme.iife.js ../libraries/compound/src/main/assets/theme.iife.js
popd
echo "Adding autoMirrored attribute..."