Skip to content

Commit 7e82ede

Browse files
committed
Konsist fixes
1 parent 784f5df commit 7e82ede

3 files changed

Lines changed: 22 additions & 7 deletions

File tree

libraries/featureflag/api/src/main/kotlin/io/element/android/libraries/featureflag/api/FeatureFlags.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ enum class FeatureFlags(
9090
title = "Multi accounts",
9191
description = "Allow the application to connect to multiple accounts at the same time." +
9292
"\n\nWARNING: this feature is EXPERIMENTAL and UNSTABLE.",
93-
defaultValue = { false },
93+
defaultValue = { true },
9494
isFinished = false,
9595
),
9696
QrCodeLogin(

libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,25 @@ class RustMatrixAuthenticationService(
125125
withContext(coroutineDispatchers.io) {
126126
val emptySessionPath = rotateSessionPath()
127127
runCatchingExceptions {
128-
val client = makeClient(sessionPaths = emptySessionPath) {
129-
serverNameOrHomeserverUrl(homeserver)
128+
// Try Matrix-spec discovery first (.well-known/matrix/client). If the server
129+
// doesn't expose well-known (common on internal / k3s deploys), fall back to
130+
// treating the input as a direct homeserver URL.
131+
val client = try {
132+
makeClient(sessionPaths = emptySessionPath) {
133+
serverNameOrHomeserverUrl(homeserver)
134+
}
135+
} catch (cancellation: CancellationException) {
136+
throw cancellation
137+
} catch (discoveryFailure: Exception) {
138+
Timber.w(discoveryFailure, "Discovery failed for $homeserver, falling back to direct URL")
139+
val directUrl = if (homeserver.startsWith("http://") || homeserver.startsWith("https://")) {
140+
homeserver
141+
} else {
142+
"https://$homeserver"
143+
}
144+
makeClient(sessionPaths = emptySessionPath) {
145+
homeserverUrl(directUrl)
146+
}
130147
}
131148

132149
currentClient = client

tests/konsist/src/test/kotlin/io/element/android/tests/konsist/KonsistPreviewTest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,8 @@ class KonsistPreviewTest {
160160
"TimelineItemVoiceViewUnifiedPreview",
161161
"TimelineVideoWithCaptionRowPreview",
162162
"TimelineViewMessageShieldPreview",
163-
"TimelineViewWithReadMarkerBothCountsPreview",
164-
"TimelineViewWithReadMarkerDotBadgesPreview",
165-
"TimelineViewWithReadMarkerNoBadgesPreview",
166-
"TimelineViewWithReadMarkerNumericBadgePreview",
163+
"TimelineViewWithReadMarkerBothIndicatorsPreview",
164+
"TimelineViewWithReadMarkerNoIndicatorsPreview",
167165
"UserAvatarColorsPreview",
168166
"UserProfileHeaderSectionWithVerificationViolationPreview",
169167
"VoiceItemViewPlayPreview",

0 commit comments

Comments
 (0)