-
Notifications
You must be signed in to change notification settings - Fork 754
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
Poll Feature - Timeline #4624
Changes from 20 commits
e0abd99
94ae3c6
eb15197
ebc131f
7c26930
a3b11b2
2a3a558
06485cf
32e8a7e
c62028d
0a7df44
435dc9f
23ad4e5
1df6b33
0d3444b
75b544a
71d7270
566f633
953fade
0f11e49
04a7590
b2e599e
d5f8931
be9e592
9b2a3cf
c7ad50a
f6dcda6
f028f98
e2bbc3f
c1ea653
eac06d5
10b39cc
da407ef
f29e14f
0981af3
db81ec2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Poll Feature - Render in timeline |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* 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.events.model.RelationType | ||
|
||
/** | ||
* Class representing the org.matrix.msc3381.poll.end event content | ||
*/ | ||
@JsonClass(generateAdapter = true) | ||
data class MessageEndPollContent( | ||
@Json(name = "rel_type") val relationType: String = RelationType.REFERENCE, | ||
@Json(name = "event_id") val eventId: String | ||
) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,13 +21,11 @@ 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, | ||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,8 @@ object MessageType { | |
const val MSGTYPE_VIDEO = "m.video" | ||
const val MSGTYPE_LOCATION = "m.location" | ||
const val MSGTYPE_FILE = "m.file" | ||
const val MSGTYPE_OPTIONS = "org.matrix.options" | ||
const val MSGTYPE_RESPONSE = "org.matrix.response" | ||
const val MSGTYPE_POLL_CLOSED = "org.matrix.poll_closed" | ||
const val MSGTYPE_POLL_START = "org.matrix.msc3381.poll.start" | ||
const val MSGTYPE_POLL_RESPONSE = "org.matrix.msc3381.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. Those 2 strings are not 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. |
||
const val MSGTYPE_VERIFICATION_REQUEST = "m.key.verification.request" | ||
|
||
// Add, in local, a fake message type in order to StickerMessage can inherit Message class | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,11 +91,17 @@ interface SendService { | |
/** | ||
* Method to send a poll response. | ||
* @param pollEventId the poll currently replied to | ||
* @param optionIndex The reply index | ||
* @param optionValue The option value (for compatibility) | ||
* @param optionKey The option key | ||
* @return a [Cancelable] | ||
*/ | ||
fun sendOptionsReply(pollEventId: String, optionIndex: Int, optionValue: String): Cancelable | ||
fun registerVoteToPoll(pollEventId: String, optionKey: String): Cancelable | ||
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. why 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. It was from task title :) Changed as suggested. |
||
|
||
/** | ||
* End a poll in the room. | ||
* @param pollEventId event id of the poll | ||
* @return a [Cancelable] | ||
*/ | ||
fun endPoll(pollEventId: String): Cancelable | ||
|
||
/** | ||
* Redact (delete) the given 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.
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.