Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ enum class FeatureFlags(
defaultValue = { false },
isFinished = false,
),
EnableKeyShareOnInvite(
key = "feature.enableKeyShareOnInvite",
title = "Share encrypted history with new members",
description = "When inviting a user to an encrypted room that has history visibility set to \"shared\"," +
" share encrypted history with that user, and accept encrypted history when you are invited to such a room." +
"\nRequires an app restart to take effect." +
"\n\nWARNING: this feature is EXPERIMENTAL and not all security precautions are implemented. Do not enable on" +
" production accounts.",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe split the string at the beginning of the phrase instead?
""\n\nWARNING: this feature is EXPERIMENTAL and not all security precautions are implemented." + "Do not enable on production accounts."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, thanks. done.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "Kotlin way" to do that is something like:

        description = """
            When inviting a user to an encrypted room that has history visibility set to "shared",
            share encrypted history with that user, and accept encrypted history when you are invited to such a room.
            Requires an app restart to take effect.

            WARNING: this feature is EXPERIMENTAL and not all security precautions are implemented.
            Do not enable on production accounts.
            """.trimIndent(),

but sadly it also adds a line creak between set to "shared", and the next line, and we cannot put all the sentence in a single line as it breaks our line lengh limit.

Ugly alternative is could be

        description = """When inviting a user to an encrypted room that has history visibility set to "shared",""" +
            " share encrypted history with that user, and accept encrypted history when you are invited to such a room."
                .let { firstLine ->
                    """
                    $firstLine
                    Requires an app restart to take effect.

                    WARNING: this feature is EXPERIMENTAL and not all security precautions are implemented.
                    Do not enable on production accounts.
                    """.trimIndent()
                },

So... just ignore my comment!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

        description = """When inviting a user to an encrypted room that has history visibility set to "shared", """ +
            """
            share encrypted history with that user, and accept encrypted history when you are invited to such a room.
            Requires an app restart to take effect.

            WARNING: this feature is EXPERIMENTAL and not all security precautions are implemented.
            Do not enable on production accounts.
            """.trimIndent(),

works too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, I just did the same as some of the other options already in this file. I agree it's not beautiful, but it's not awful and it is consistent.

Do you want me to update this further, or are you happy with it as-is?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to assume it's ok.

defaultValue = { false },
isFinished = false,
),
Knock(
key = "feature.knock",
title = "Ask to join",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class RustMatrixClientFactory @Inject constructor(
TrustRequirement.UNTRUSTED
}
)
.enableShareHistoryOnInvite(featureFlagService.isFeatureEnabled(FeatureFlags.EnableKeyShareOnInvite))
.run {
// Apply sliding sync version settings
when (slidingSyncType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class FakeFfiClientBuilder : ClientBuilder(NoPointer) {
override fun slidingSyncVersionBuilder(versionBuilder: SlidingSyncVersionBuilder) = this
override fun userAgent(userAgent: String) = this
override fun username(username: String) = this
override fun enableShareHistoryOnInvite(enableShareHistoryOnInvite: Boolean): ClientBuilder = this

override suspend fun buildWithQrCode(qrCodeData: QrCodeData, oidcConfiguration: OidcConfiguration, progressListener: QrLoginProgressListener): Client {
return FakeFfiClient()
Expand Down
Loading