Clean after Benoit's review
This commit is contained in:
parent
2f5fdbb7e2
commit
187e2a26db
@ -1,8 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 New Vector Ltd
|
||||||
|
*
|
||||||
|
* 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 im.vector.matrix.android.api.session.events.model
|
package im.vector.matrix.android.api.session.events.model
|
||||||
|
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
object LocalEcho {
|
object LocalEcho {
|
||||||
|
|
||||||
const val PREFIX = "local."
|
private const val PREFIX = "local."
|
||||||
|
|
||||||
fun isLocalEchoId(eventId: String): Boolean = eventId.startsWith(PREFIX)
|
fun isLocalEchoId(eventId: String) = eventId.startsWith(PREFIX)
|
||||||
|
|
||||||
|
fun createLocalEchoId() = "${PREFIX}${UUID.randomUUID()}"
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ internal class LocalEchoEventFactory @Inject constructor(@UserId private val use
|
|||||||
reaction
|
reaction
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
val localId = dummyEventId()
|
val localId = LocalEcho.createLocalEchoId()
|
||||||
return Event(
|
return Event(
|
||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
originServerTs = dummyOriginServerTs(),
|
originServerTs = dummyOriginServerTs(),
|
||||||
@ -264,7 +264,7 @@ internal class LocalEchoEventFactory @Inject constructor(@UserId private val use
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createEvent(roomId: String, content: Any? = null): Event {
|
private fun createEvent(roomId: String, content: Any? = null): Event {
|
||||||
val localID = dummyEventId()
|
val localID = LocalEcho.createLocalEchoId()
|
||||||
return Event(
|
return Event(
|
||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
originServerTs = dummyOriginServerTs(),
|
originServerTs = dummyOriginServerTs(),
|
||||||
@ -280,10 +280,6 @@ internal class LocalEchoEventFactory @Inject constructor(@UserId private val use
|
|||||||
return System.currentTimeMillis()
|
return System.currentTimeMillis()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun dummyEventId(): String {
|
|
||||||
return "${LocalEcho.PREFIX}${UUID.randomUUID()}"
|
|
||||||
}
|
|
||||||
|
|
||||||
fun createReplyTextEvent(roomId: String, eventReplied: TimelineEvent, replyText: String, autoMarkdown: Boolean): Event? {
|
fun createReplyTextEvent(roomId: String, eventReplied: TimelineEvent, replyText: String, autoMarkdown: Boolean): Event? {
|
||||||
// Fallbacks and event representation
|
// Fallbacks and event representation
|
||||||
// TODO Add error/warning logs when any of this is null
|
// TODO Add error/warning logs when any of this is null
|
||||||
@ -383,7 +379,7 @@ internal class LocalEchoEventFactory @Inject constructor(@UserId private val use
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
fun createRedactEvent(roomId: String, eventId: String, reason: String?): Event {
|
fun createRedactEvent(roomId: String, eventId: String, reason: String?): Event {
|
||||||
val localID = dummyEventId()
|
val localID = LocalEcho.createLocalEchoId()
|
||||||
return Event(
|
return Event(
|
||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
originServerTs = dummyOriginServerTs(),
|
originServerTs = dummyOriginServerTs(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user