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

[Feature] Pinned message : banner logic #3275

Merged
merged 19 commits into from
Aug 8, 2024

Conversation

ganfra
Copy link
Member

@ganfra ganfra commented Aug 6, 2024

Content

Branch logic to display pinned messages banner.

Motivation and context

Handles #3213

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 Aug 6, 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/g462eQ

@ganfra ganfra changed the title [Feature] Pinned message banner logic [Feature] Pinned message : banner logic Aug 6, 2024
@ganfra ganfra added the PR-Wip For anything that isn't ready to ship and will be enabled at a later date label Aug 7, 2024
@ganfra ganfra added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Aug 7, 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 7, 2024
@ganfra ganfra marked this pull request as ready for review August 7, 2024 14:45
@ganfra ganfra requested a review from a team as a code owner August 7, 2024 14:45
@ganfra ganfra requested review from jmartinesp and removed request for a team August 7, 2024 14:45
Copy link

codecov bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 69.36620% with 87 lines in your changes missing coverage. Please review.

Project coverage is 76.11%. Comparing base (839d419) to head (331413e).
Report is 2 commits behind head on develop.

Files Patch % Lines
...atter/impl/DefaultPinnedMessagesBannerFormatter.kt 0.00% 39 Missing and 1 partial ⚠️
...ges/impl/pinned/banner/PinnedMessagesBannerView.kt 79.01% 6 Missing and 11 partials ⚠️
...ages/impl/pinned/IsPinnedMessagesFeatureEnabled.kt 0.00% 10 Missing ⚠️
...l/pinned/banner/PinnedMessagesBannerItemFactory.kt 64.28% 2 Missing and 3 partials ⚠️
...mpl/pinned/banner/PinnedMessagesBannerPresenter.kt 91.22% 1 Missing and 4 partials ⚠️
...es/impl/pinned/banner/PinnedMessagesBannerState.kt 80.00% 0 Missing and 4 partials ⚠️
...ent/android/features/messages/impl/MessagesView.kt 70.00% 1 Missing and 2 partials ⚠️
...id/features/messages/impl/timeline/TimelineView.kt 60.00% 1 Missing and 1 partial ⚠️
...pinned/banner/PinnedMessagesBannerStateProvider.kt 95.45% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3275      +/-   ##
===========================================
- Coverage    76.18%   76.11%   -0.08%     
===========================================
  Files         1656     1662       +6     
  Lines        39021    39215     +194     
  Branches      7571     7627      +56     
===========================================
+ Hits         29730    29848     +118     
- Misses        5365     5426      +61     
- Partials      3926     3941      +15     

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

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

LGTM, a couple of minor comments, but nothing important.


@ContributesTo(SessionScope::class)
Copy link
Member

Choose a reason for hiding this comment

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

Good catch.

Comment on lines 80 to 83
if (currentPinnedMessageIndex > 0) {
currentPinnedMessageIndex--
} else {
currentPinnedMessageIndex = 0
currentPinnedMessageIndex = pinnedItems.value.size - 1
Copy link
Member

Choose a reason for hiding this comment

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

Not a big deal, but maybe this could be done with just (currentPinnedMessageIndex - 1).floorMod(pinnedItems.value.size).

sealed interface PinnedMessagesBannerState {
data object Hidden : PinnedMessagesBannerState
sealed interface Visible : PinnedMessagesBannerState
data class Loading(val realPinnedMessagesCount: Int) : Visible
Copy link
Member

Choose a reason for hiding this comment

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

expectedPinnedMessageCount maybe?

import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.withStyle

internal fun CharSequence.prefixWith(prefix: String): AnnotatedString {
Copy link
Member

Choose a reason for hiding this comment

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

👌

@ganfra ganfra enabled auto-merge August 8, 2024 12:52
@ganfra ganfra added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Aug 8, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Aug 8, 2024
Copy link

sonarcloud bot commented Aug 8, 2024

@ganfra ganfra merged commit 9cdec78 into develop Aug 8, 2024
28 checks passed
@ganfra ganfra deleted the feature/fga/pinned_message_banner_logic branch August 8, 2024 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Wip For anything that isn't ready to ship and will be enabled at a later date
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants