Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeline UI | MessageShield Support #3240

Merged
merged 14 commits into from
Aug 16, 2024
Merged

Conversation

BillCarsonFr
Copy link
Member

@BillCarsonFr BillCarsonFr commented Jul 24, 2024

Fixes https://github.com/element-hq/crypto-internal/issues/345
Depends on matrix-org/matrix-rust-sdk#3679
Design: https://www.figma.com/design/2aqj9A5WRvGY3tcdTrBek4/Unencrypted-message-warning-in-Timeline?node-id=910-77038&t=pF5GGduo3EsrFG2Q-0

Content

Show E2E message shields.

image image image

Motivation and context

Screenshots / GIFs

Tests

  • Step 1
  • Step 2
  • Step ...

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 23
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off
  • You've made a self review of your PR

Copy link
Contributor

github-actions bot commented Jul 24, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/hkC7Xz

@BillCarsonFr BillCarsonFr added the PR-Feature For a new feature label Jul 25, 2024
@BillCarsonFr BillCarsonFr force-pushed the feature/valere/message_shields branch from 1f0c532 to b3b90a3 Compare July 25, 2024 08:01
@BillCarsonFr BillCarsonFr marked this pull request as ready for review July 25, 2024 08:22
@BillCarsonFr BillCarsonFr requested a review from a team as a code owner July 25, 2024 08:22
@BillCarsonFr BillCarsonFr requested review from jmartinesp and removed request for a team July 25, 2024 08:22
Copy link

sonarcloud bot commented Jul 25, 2024

@frebib
Copy link
Contributor

frebib commented Jul 25, 2024

I tried this out for nothing more than sheer curiosity, and there were a couple things I noticed that were a bit weird (aside from the fact that literally every encrypted message was marked as unauthentic)

  • The bubble on messages received from other users (on the left hand side) are the same colour as the background (at least in dark mode) so it looks pretty odd and like there is a lot of whitespace
  • The bubble sits above the timestamp, which balloons the timeline a LOT vertically, because there's an empty line at the bottom of every message where there wasn't one before

@bmarty bmarty marked this pull request as draft August 12, 2024 10:32
private fun TimelineItem.Event.shieldPosition(): MessageShieldPosition {
val shield = this.messageShield ?: return MessageShieldPosition.None

// sdk returns raw human readable strings, add i18n support
Copy link
Member

@bmarty bmarty Aug 14, 2024

Choose a reason for hiding this comment

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

@jorge Could the SDK return an enum instead?
Same for the color, it should be a enum (if the first enum is not enough) with a notion of criticity. "color" is a concept for the application (UI) level.

Copy link
Member

Choose a reason for hiding this comment

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

I think you should discuss this with @pixlwave (and not poor @jorge 😅 ).

Copy link
Member

Choose a reason for hiding this comment

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

Ah yeah I fixed this… You can now switch on the ShieldState::code which is an enum 😁

On EXI we map ShieldState to this EncryptionAuthenticity representation for our sanity.

Copy link
Member

Choose a reason for hiding this comment

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

@bmarty For completeness here is the view we use for the timestamp with send/encryption warnings: TimelineItemSendInfoLabel

And the PRs element-hq/element-x-ios#3051, element-hq/element-x-ios#3100 and element-hq/element-x-ios#3116

Copy link
Member

@pixlwave pixlwave Aug 14, 2024

Choose a reason for hiding this comment

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

with a notion of criticity. "color" is a concept for the application (UI) level.

FWIW, both myself and @stefanceriu raised this here and here but the crypto team don't want to change it 🤷‍♂️

@bmarty bmarty self-assigned this Aug 14, 2024
@bmarty bmarty added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Aug 14, 2024
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Aug 14, 2024
is MessageShield.UnverifiedIdentity -> CompoundIcons.Admin()
is MessageShield.UnknownDevice,
is MessageShield.UnsignedDevice -> CompoundIcons.HelpSolid()
is MessageShield.SentInClear -> CompoundIcons.KeyOff()
Copy link
Member

Choose a reason for hiding this comment

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

TODO: need to check this mapping.

Copy link
Member

@pixlwave pixlwave Aug 14, 2024

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Thanks. I have updated the code.
But there is no shield at all, which is against the SDK recommendation here and here.

Now I have this (from the Preview):

image

@BillCarsonFr can you confirm please?

Also handle click on the timeline and information displayed on long click.
@bmarty bmarty force-pushed the feature/valere/message_shields branch from 711b484 to faf1e7d Compare August 14, 2024 15:40
@bmarty bmarty added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Aug 14, 2024
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Aug 14, 2024
@bmarty bmarty marked this pull request as ready for review August 14, 2024 16:06
@bmarty
Copy link
Member

bmarty commented Aug 14, 2024

Updated, maybe need to add a feature flag as per iOS app (?)

@pixlwave
Copy link
Member

Maybe need to add a feature flag as per iOS app

Tbh the only reason I've kept the iOS flag around is so we could enable this on both apps at the same time. So entirely up do you, if you don't want to add one I'll remove it from iOS when this PR is merged.

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 95.52239% with 6 lines in your changes missing coverage. Please review.

Project coverage is 82.61%. Comparing base (ca81e46) to head (cbc59e0).
Report is 35 commits behind head on develop.

Files Patch % Lines
...ies/designsystem/components/dialogs/AlertDialog.kt 80.00% 2 Missing and 2 partials ⚠️
...atures/messages/impl/timeline/TimelinePresenter.kt 75.00% 0 Missing and 1 partial ⚠️
.../impl/timeline/components/ATimelineItemEventRow.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3240      +/-   ##
===========================================
+ Coverage    82.56%   82.61%   +0.05%     
===========================================
  Files         1662     1666       +4     
  Lines        38992    39121     +129     
  Branches      4724     4746      +22     
===========================================
+ Hits         32193    32320     +127     
+ Misses        5133     5132       -1     
- Partials      1666     1669       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bmarty bmarty added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Aug 16, 2024
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Aug 16, 2024
@bmarty bmarty added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Aug 16, 2024
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Aug 16, 2024
@bmarty bmarty added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Aug 16, 2024
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Aug 16, 2024
Copy link

sonarcloud bot commented Aug 16, 2024

@bmarty bmarty added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Aug 16, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Aug 16, 2024
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

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

Implementation should be equivalent to iOS, let's merge and iterate if necessary.

@bmarty bmarty enabled auto-merge August 16, 2024 12:04
@bmarty bmarty merged commit 21f2c5a into develop Aug 16, 2024
29 checks passed
@bmarty bmarty deleted the feature/valere/message_shields branch August 16, 2024 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Feature For a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants