-
Notifications
You must be signed in to change notification settings - Fork 160
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 messages list #3392
Conversation
…anch in the navigation
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, thanks!
Only a few remarks, and I have found a small bug, which is not blocking I think.
val actionListState: ActionListState, | ||
val eventSink: (PinnedMessagesListEvents) -> Unit, | ||
) : PinnedMessagesListState { | ||
val loadedPinnedMessagesCount = timelineItems.count { timelineItem -> timelineItem is TimelineItem.Event } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have other TimelineItem types in timelineItems
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we do have day divider as virtual items
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, thanks.
aLoadingPinnedMessagesListState(), | ||
anEmptyPinnedMessagesListState(), | ||
aLoadedPinnedMessagesListState( | ||
timelineItems = aTimelineItemList(aTimelineItemTextContent()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use a better list to have a more realistic preview:
is a bit wrong.
And maybe include a Poll to check the rendering of this code.
is TimelineItemAction.ViewSource -> true | ||
else -> false | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clever way to build the actions, hence in this case, I think "Unpin" could be displayed before "Forward" (as per the design by the way)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed a bit to fix the ordering
if (pushToBackstack) { | ||
backstack.push(target) | ||
} else { | ||
backstack.singleTop(target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not have any effect if the target
is already in the stack.
To repro the issue:
- Navigate to the All pinned event
- on pinned event X, select
View in timeline
- Repeat 1 and 2 (using the same event): nothing happen.
To fix, maybe add a random int field in NavTarget.Room
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, good catch
import io.element.android.features.messages.impl.actionlist.model.TimelineItemAction | ||
import io.element.android.features.messages.impl.actionlist.model.TimelineItemActionPostProcessor | ||
|
||
object PinnedMessagesListTimelineActionPostProcessor : TimelineItemActionPostProcessor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it be a regular class instead?
interface Callback : Plugin { | ||
fun onRoomDetailsClick() | ||
fun onUserDataClick(userId: UserId) | ||
fun onPermalinkClick(data: PermalinkData) | ||
fun onPermalinkClick(data: PermalinkData, pushToBackstack: Boolean = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe safer to avoid default values for parameters. I let you decide.
enum class Mode { | ||
LIVE, | ||
FOCUSED_ON_EVENT, | ||
FOCUSED_ON_PINNED_EVENTS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FOCUSED_ON_PINNED_EVENTS
is a bit confusing to me. In this mode, only the Pinned Events will be in the items, right? So maybe rename to PINNED_EVENTS
, or PINNED_EVENTS_ONLY
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's because this is a focused timeline underneath, but I agree it's a bit confusing.
Quality Gate failedFailed conditions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update!
cancelAndIgnoreRemainingEvents() | ||
assert(unpinEventLambda) | ||
|
||
assert(successUnpinEventLambda) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assertion should be done earlier, else the test does not check the order of the lambda invocation.
), | ||
aTimelineItemEvent( | ||
isMine = true, | ||
content = aTimelineItemFileContent("A pinned file?"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
Content
Add the Pinned messages list screen and all the ways to navigate (from it and to it).
Motivation and context
Closes #3214
Screenshots / GIFs
See recorded screenshots in the PR.
Tests
Tested devices
Checklist