Move MessageType to its own file.
This commit is contained in:
parent
d79affb3a4
commit
f6bd33231d
2 changed files with 72 additions and 53 deletions
|
|
@ -17,11 +17,7 @@
|
||||||
package io.element.android.libraries.matrix.api.timeline.item.event
|
package io.element.android.libraries.matrix.api.timeline.item.event
|
||||||
|
|
||||||
import io.element.android.libraries.matrix.api.core.UserId
|
import io.element.android.libraries.matrix.api.core.UserId
|
||||||
import io.element.android.libraries.matrix.api.media.AudioInfo
|
|
||||||
import io.element.android.libraries.matrix.api.media.FileInfo
|
|
||||||
import io.element.android.libraries.matrix.api.media.ImageInfo
|
import io.element.android.libraries.matrix.api.media.ImageInfo
|
||||||
import io.element.android.libraries.matrix.api.media.MediaSource
|
|
||||||
import io.element.android.libraries.matrix.api.media.VideoInfo
|
|
||||||
import io.element.android.libraries.matrix.api.poll.PollAnswer
|
import io.element.android.libraries.matrix.api.poll.PollAnswer
|
||||||
import io.element.android.libraries.matrix.api.poll.PollKind
|
import io.element.android.libraries.matrix.api.poll.PollKind
|
||||||
|
|
||||||
|
|
@ -98,10 +94,6 @@ data class FailedToParseStateContent(
|
||||||
|
|
||||||
data object UnknownContent : EventContent
|
data object UnknownContent : EventContent
|
||||||
|
|
||||||
sealed interface MessageType
|
|
||||||
|
|
||||||
data object UnknownMessageType : MessageType
|
|
||||||
|
|
||||||
enum class MessageFormat {
|
enum class MessageFormat {
|
||||||
HTML, UNKNOWN
|
HTML, UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
@ -111,51 +103,6 @@ data class FormattedBody(
|
||||||
val body: String
|
val body: String
|
||||||
)
|
)
|
||||||
|
|
||||||
data class EmoteMessageType(
|
|
||||||
val body: String,
|
|
||||||
val formatted: FormattedBody?
|
|
||||||
) : MessageType
|
|
||||||
|
|
||||||
data class ImageMessageType(
|
|
||||||
val body: String,
|
|
||||||
val source: MediaSource,
|
|
||||||
val info: ImageInfo?
|
|
||||||
) : MessageType
|
|
||||||
|
|
||||||
data class LocationMessageType(
|
|
||||||
val body: String,
|
|
||||||
val geoUri: String,
|
|
||||||
val description: String?,
|
|
||||||
) : MessageType
|
|
||||||
|
|
||||||
data class AudioMessageType(
|
|
||||||
val body: String,
|
|
||||||
val source: MediaSource,
|
|
||||||
val info: AudioInfo?
|
|
||||||
) : MessageType
|
|
||||||
|
|
||||||
data class VideoMessageType(
|
|
||||||
val body: String,
|
|
||||||
val source: MediaSource,
|
|
||||||
val info: VideoInfo?
|
|
||||||
) : MessageType
|
|
||||||
|
|
||||||
data class FileMessageType(
|
|
||||||
val body: String,
|
|
||||||
val source: MediaSource,
|
|
||||||
val info: FileInfo?
|
|
||||||
) : MessageType
|
|
||||||
|
|
||||||
data class NoticeMessageType(
|
|
||||||
val body: String,
|
|
||||||
val formatted: FormattedBody?
|
|
||||||
) : MessageType
|
|
||||||
|
|
||||||
data class TextMessageType(
|
|
||||||
val body: String,
|
|
||||||
val formatted: FormattedBody?
|
|
||||||
) : MessageType
|
|
||||||
|
|
||||||
enum class MembershipChange {
|
enum class MembershipChange {
|
||||||
NONE,
|
NONE,
|
||||||
ERROR,
|
ERROR,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023 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 io.element.android.libraries.matrix.api.timeline.item.event
|
||||||
|
|
||||||
|
import io.element.android.libraries.matrix.api.media.AudioInfo
|
||||||
|
import io.element.android.libraries.matrix.api.media.FileInfo
|
||||||
|
import io.element.android.libraries.matrix.api.media.ImageInfo
|
||||||
|
import io.element.android.libraries.matrix.api.media.MediaSource
|
||||||
|
import io.element.android.libraries.matrix.api.media.VideoInfo
|
||||||
|
|
||||||
|
sealed interface MessageType
|
||||||
|
|
||||||
|
data object UnknownMessageType : MessageType
|
||||||
|
|
||||||
|
data class EmoteMessageType(
|
||||||
|
val body: String,
|
||||||
|
val formatted: FormattedBody?
|
||||||
|
) : MessageType
|
||||||
|
|
||||||
|
data class ImageMessageType(
|
||||||
|
val body: String,
|
||||||
|
val source: MediaSource,
|
||||||
|
val info: ImageInfo?
|
||||||
|
) : MessageType
|
||||||
|
|
||||||
|
data class LocationMessageType(
|
||||||
|
val body: String,
|
||||||
|
val geoUri: String,
|
||||||
|
val description: String?,
|
||||||
|
) : MessageType
|
||||||
|
|
||||||
|
data class AudioMessageType(
|
||||||
|
val body: String,
|
||||||
|
val source: MediaSource,
|
||||||
|
val info: AudioInfo?
|
||||||
|
) : MessageType
|
||||||
|
|
||||||
|
data class VideoMessageType(
|
||||||
|
val body: String,
|
||||||
|
val source: MediaSource,
|
||||||
|
val info: VideoInfo?
|
||||||
|
) : MessageType
|
||||||
|
|
||||||
|
data class FileMessageType(
|
||||||
|
val body: String,
|
||||||
|
val source: MediaSource,
|
||||||
|
val info: FileInfo?
|
||||||
|
) : MessageType
|
||||||
|
|
||||||
|
data class NoticeMessageType(
|
||||||
|
val body: String,
|
||||||
|
val formatted: FormattedBody?
|
||||||
|
) : MessageType
|
||||||
|
|
||||||
|
data class TextMessageType(
|
||||||
|
val body: String,
|
||||||
|
val formatted: FormattedBody?
|
||||||
|
) : MessageType
|
||||||
Loading…
Add table
Add a link
Reference in a new issue