Skip to content

Commit

Permalink
deps : update rust sdk to 0.2.68 and expose new UtdCause
Browse files Browse the repository at this point in the history
  • Loading branch information
ganfra committed Dec 3, 2024
2 parents cfb91be + bf7e978 commit 894c0f2
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ fun TimelineItemEncryptedView(
UtdCause.UnknownDevice -> {
CommonStrings.common_unable_to_decrypt_insecure_device to CompoundDrawables.ic_compound_block
}
UtdCause.HistoricalMessage -> {
CommonStrings.timeline_decryption_failure_historical_event_no_key_backup to CompoundDrawables.ic_compound_block
}
UtdCause.WithheldUnverifiedOrInsecureDevice -> {
CommonStrings.timeline_decryption_failure_withheld_unverified to CompoundDrawables.ic_compound_block
}
UtdCause.WithheldBySender -> {
CommonStrings.timeline_decryption_failure_unable_to_decrypt to CompoundDrawables.ic_compound_error
}
else -> {
CommonStrings.common_waiting_for_decryption_key to CompoundDrawables.ic_compound_time
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ open class TimelineItemEncryptedContentProvider : PreviewParameterProvider<Timel
utdCause = UtdCause.UnsignedDevice,
)
),
aTimelineItemEncryptedContent(
data = UnableToDecryptContent.Data.MegolmV1AesSha2(
sessionId = "sessionId",
utdCause = UtdCause.HistoricalMessage,
)
),
aTimelineItemEncryptedContent(
data = UnableToDecryptContent.Data.MegolmV1AesSha2(
sessionId = "sessionId",
utdCause = UtdCause.WithheldUnverifiedOrInsecureDevice,
)
),
aTimelineItemEncryptedContent(
data = UnableToDecryptContent.Data.MegolmV1AesSha2(
sessionId = "sessionId",
utdCause = UtdCause.WithheldBySender,
)
),
aTimelineItemEncryptedContent(
data = UnableToDecryptContent.Data.MegolmV1AesSha2(
sessionId = "sessionId",
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jsoup = "org.jsoup:jsoup:1.18.1"
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
molecule-runtime = "app.cash.molecule:molecule-runtime:2.0.0"
timber = "com.jakewharton.timber:timber:5.0.1"
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.67"
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.68"
matrix_richtexteditor = { module = "io.element.android:wysiwyg", version.ref = "wysiwyg" }
matrix_richtexteditor_compose = { module = "io.element.android:wysiwyg-compose", version.ref = "wysiwyg" }
sqldelight-driver-android = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,22 @@ enum class UtdCause {
SentBeforeWeJoined,
VerificationViolation,
UnsignedDevice,
UnknownDevice
UnknownDevice,

/**
* Expected utd because this is a device-historical message and
* key storage is not setup or not configured correctly.
*/
HistoricalMessage,

/**
* The key was withheld on purpose because your device is insecure and/or the
* sender trust requirement settings are not met for your device.
*/
WithheldUnverifiedOrInsecureDevice,

/**
* Key is withheld by sender.
*/
WithheldBySender,
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class UtdTracker(
UtdCause.UNKNOWN_DEVICE -> {
Error.Name.ExpectedSentByInsecureDevice
}
UtdCause.HISTORICAL_MESSAGE -> Error.Name.HistoricalMessage
}
val event = Error(
context = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ private fun RustUtdCause.map(): UtdCause {
RustUtdCause.VERIFICATION_VIOLATION -> UtdCause.VerificationViolation
RustUtdCause.UNSIGNED_DEVICE -> UtdCause.UnsignedDevice
RustUtdCause.UNKNOWN_DEVICE -> UtdCause.UnknownDevice
RustUtdCause.HISTORICAL_MESSAGE -> UtdCause.HistoricalMessage
}
}

Expand Down
3 changes: 3 additions & 0 deletions libraries/ui-strings/src/main/res/values/localazy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -365,4 +365,7 @@ Reason: %1$s."</string>
<string name="settings_version_number">"Version: %1$s (%2$s)"</string>
<string name="test_language_identifier">"en"</string>
<string name="test_untranslated_default_language_identifier">"en"</string>
<string name="timeline_decryption_failure_historical_event_no_key_backup">"Historical messages are not available on this device"</string>
<string name="timeline_decryption_failure_unable_to_decrypt">"Unable to decrypt message"</string>
<string name="timeline_decryption_failure_withheld_unverified">"This message was blocked either because you did not verify your device or because the sender needs to verify your identity."</string>
</resources>

0 comments on commit 894c0f2

Please sign in to comment.