-
Notifications
You must be signed in to change notification settings - Fork 743
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
Poll Feature - Timeline #4624
Merged
Merged
Poll Feature - Timeline #4624
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
e0abd99
Merge branch 'feature/ons/poll' into feature/ons/poll_timeline
94ae3c6
Merge branch 'feature/ons/poll' into feature/ons/poll_timeline
eb15197
Merge branch 'develop' into feature/ons/poll_timeline
ebc131f
Implement new poll content.
7c26930
Allow sending vote and ending poll.
a3b11b2
Allow removing poll event.
2a3a558
Aggregate votes and poll end event.
06485cf
Implement poll in timeline ui.
32e8a7e
Remove legacy poll ui.
c62028d
Implement poll actions bottom sheet.
0a7df44
Add confirmation dialog to end poll.
435dc9f
Fix room list preview.
23ad4e5
Remove legacy implementation classes.
1df6b33
Add labs flag for polls.
0d3444b
Fix poll option checkbox color.
75b544a
Support push notification for poll creation event.
71d7270
Add room list preview for poll response and end events.
566f633
Set max length for poll options.
953fade
Merge branch 'develop' into feature/ons/poll_timeline
0f11e49
Changelog added.
04a7590
Code review fixes.
b2e599e
Merge branch 'develop' into feature/ons/poll_timeline
d5f8931
Support to show hidden poll events as formatted.
be9e592
Do not allow to vote the same option twice.
9b2a3cf
Code review fixes.
c7ad50a
Code and design review fixes.
f6dcda6
Code review fixes.
f028f98
Merge branch 'develop' into feature/ons/poll_timeline
e2bbc3f
Code review fixes.
c1ea653
Reorder classes so that it follows the poll status logical order
bmarty eac06d5
Do some renaming
bmarty 10b39cc
Do some renaming
bmarty da407ef
Avoid lateinit
bmarty f29e14f
Rename class
bmarty 0981af3
Remove unused attribute
bmarty db81ec2
Recycle View a bit more
bmarty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Poll Feature - Render in timeline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
.../main/java/org/matrix/android/sdk/api/session/room/model/message/MessageEndPollContent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2021 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.matrix.android.sdk.api.session.room.model.message | ||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.JsonClass | ||
import org.matrix.android.sdk.api.session.room.model.relation.RelationDefaultContent | ||
|
||
/** | ||
* Class representing the org.matrix.msc3381.poll.end event content | ||
*/ | ||
@JsonClass(generateAdapter = true) | ||
data class MessageEndPollContent( | ||
@Json(name = "m.relates_to") val relatesTo: RelationDefaultContent? = null | ||
) |
40 changes: 0 additions & 40 deletions
40
.../main/java/org/matrix/android/sdk/api/session/room/model/message/MessageOptionsContent.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,13 +21,15 @@ import com.squareup.moshi.JsonClass | |
import org.matrix.android.sdk.api.session.events.model.Content | ||
import org.matrix.android.sdk.api.session.room.model.relation.RelationDefaultContent | ||
|
||
/** | ||
* Ref: https://github.com/matrix-org/matrix-doc/pull/2192 | ||
*/ | ||
@JsonClass(generateAdapter = true) | ||
data class MessagePollResponseContent( | ||
@Json(name = MessageContent.MSG_TYPE_JSON_KEY) override val msgType: String = MessageType.MSGTYPE_RESPONSE, | ||
@Json(name = "body") override val body: String, | ||
/** | ||
* Local message type, not from server | ||
*/ | ||
@Transient | ||
override val msgType: String = MessageType.MSGTYPE_POLL_RESPONSE, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As we discussed, I changed it as we did for sticker events. |
||
@Json(name = "body") override val body: String = "", | ||
@Json(name = "m.relates_to") override val relatesTo: RelationDefaultContent? = null, | ||
@Json(name = "m.new_content") override val newContent: Content? = null | ||
@Json(name = "m.new_content") override val newContent: Content? = null, | ||
@Json(name = "org.matrix.msc3381.poll.response") val response: PollResponse? = null | ||
) : MessageContent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Strange to see
var
in a data class. Also there it no@Json
annotations on the fields? Is it a Content of a Matrix message? If not if should be renamed to remove theContent
suffix.EDIT: I think it is not the case, so
@JsonClass(generateAdapter = true)
can also be removed.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.
Right, nice catch. Done.
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.
Not done. We need it to be able to (de)serialize in DB as String.