mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
feat(branding): rebrand app identity to HealthChat
App id ch.healthchat.element, locked matrix.healthchat.ch homeserver.
This commit is contained in:
+8
-3
@@ -37,9 +37,9 @@ class DefaultEnterpriseService(
|
||||
) : EnterpriseService {
|
||||
override suspend fun isEnterpriseUser(sessionId: SessionId) = false
|
||||
override suspend fun tweakMasUrl(url: String, urlContentFetcher: ClientUrlContentFetcher) = url
|
||||
override fun accountProviderAllowList(): List<AccountProvider> = emptyList()
|
||||
override fun canConnectToAnyAccountProvider(): Boolean = true
|
||||
override suspend fun isAllowedToConnectToAccountProvider(accountProvider: AccountProvider) = true
|
||||
override fun accountProviderAllowList(): List<AccountProvider> = listOf(healthChatAccountProvider)
|
||||
override fun canConnectToAnyAccountProvider(): Boolean = false
|
||||
override suspend fun isAllowedToConnectToAccountProvider(accountProvider: AccountProvider) = healthChatAccountProvider.matches(accountProvider)
|
||||
override suspend fun isElementProEnforced(serverName: String): Boolean = withContext(dispatchers.io) {
|
||||
val temporaryMatrixClient = temporaryMatrixClientFactory.create(serverName).getOrElse { return@withContext false }
|
||||
temporaryMatrixClient.use { client ->
|
||||
@@ -77,6 +77,11 @@ class DefaultEnterpriseService(
|
||||
override fun getNoisyNotificationChannelId(sessionId: SessionId): String? = null
|
||||
}
|
||||
|
||||
/**
|
||||
* HealthChat is locked to its own homeserver: this is the only account provider users can sign in to.
|
||||
*/
|
||||
private val healthChatAccountProvider = AccountProvider.Generic(serverName = "matrix.healthchat.ch")
|
||||
|
||||
/**
|
||||
* A minimal version of the enterprise config that only contains the fields we need to check if Element Pro is enforced.
|
||||
*/
|
||||
|
||||
+10
-6
@@ -14,6 +14,7 @@ import io.element.android.compound.colors.SemanticColorsLightDark
|
||||
import io.element.android.features.enterprise.api.BugReportUrl
|
||||
import io.element.android.libraries.androidutils.json.JsonProvider
|
||||
import io.element.android.libraries.core.uri.ensureProtocol
|
||||
import io.element.android.libraries.matrix.api.accountprovider.AccountProvider
|
||||
import io.element.android.libraries.matrix.test.A_HOMESERVER_URL
|
||||
import io.element.android.libraries.matrix.test.A_SESSION_ID
|
||||
import io.element.android.libraries.matrix.test.FakeTemporaryMatrixClient
|
||||
@@ -29,21 +30,24 @@ import org.junit.Test
|
||||
|
||||
class DefaultEnterpriseServiceTest {
|
||||
@Test
|
||||
fun accountProviderAllowList() = runTest {
|
||||
fun `accountProviderAllowList contains the HealthChat homeserver only`() = runTest {
|
||||
val defaultEnterpriseService = createDefaultEnterpriseService()
|
||||
assertThat(defaultEnterpriseService.accountProviderAllowList()).isEmpty()
|
||||
assertThat(defaultEnterpriseService.accountProviderAllowList())
|
||||
.containsExactly(AccountProvider.Generic(serverName = "matrix.healthchat.ch"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `canConnectToAnyAccountProvider is always true`() = runTest {
|
||||
fun `canConnectToAnyAccountProvider is always false`() = runTest {
|
||||
val defaultEnterpriseService = createDefaultEnterpriseService()
|
||||
assertThat(defaultEnterpriseService.canConnectToAnyAccountProvider()).isTrue()
|
||||
assertThat(defaultEnterpriseService.canConnectToAnyAccountProvider()).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `isAllowedToConnectToAccountProvider is true for all account providers`() = runTest {
|
||||
fun `isAllowedToConnectToAccountProvider is true for the HealthChat homeserver only`() = runTest {
|
||||
val defaultEnterpriseService = createDefaultEnterpriseService()
|
||||
assertThat(defaultEnterpriseService.isAllowedToConnectToAccountProvider(anAccountProviderGeneric())).isTrue()
|
||||
assertThat(defaultEnterpriseService.isAllowedToConnectToAccountProvider(AccountProvider.Generic("matrix.healthchat.ch"))).isTrue()
|
||||
assertThat(defaultEnterpriseService.isAllowedToConnectToAccountProvider(AccountProvider.Generic("https://matrix.healthchat.ch/"))).isTrue()
|
||||
assertThat(defaultEnterpriseService.isAllowedToConnectToAccountProvider(anAccountProviderGeneric())).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user