Skip to content

Commit 9cb8537

Browse files
committed
Move MessageType to its own file.
1 parent 2962032 commit 9cb8537

File tree

2 files changed

+72
-53
lines changed

2 files changed

+72
-53
lines changed

libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/item/event/EventContent.kt

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717
package io.element.android.libraries.matrix.api.timeline.item.event
1818

1919
import io.element.android.libraries.matrix.api.core.UserId
20-
import io.element.android.libraries.matrix.api.media.AudioInfo
21-
import io.element.android.libraries.matrix.api.media.FileInfo
2220
import io.element.android.libraries.matrix.api.media.ImageInfo
23-
import io.element.android.libraries.matrix.api.media.MediaSource
24-
import io.element.android.libraries.matrix.api.media.VideoInfo
2521
import io.element.android.libraries.matrix.api.poll.PollAnswer
2622
import io.element.android.libraries.matrix.api.poll.PollKind
2723

@@ -98,10 +94,6 @@ data class FailedToParseStateContent(
9894

9995
data object UnknownContent : EventContent
10096

101-
sealed interface MessageType
102-
103-
data object UnknownMessageType : MessageType
104-
10597
enum class MessageFormat {
10698
HTML, UNKNOWN
10799
}
@@ -111,51 +103,6 @@ data class FormattedBody(
111103
val body: String
112104
)
113105

114-
data class EmoteMessageType(
115-
val body: String,
116-
val formatted: FormattedBody?
117-
) : MessageType
118-
119-
data class ImageMessageType(
120-
val body: String,
121-
val source: MediaSource,
122-
val info: ImageInfo?
123-
) : MessageType
124-
125-
data class LocationMessageType(
126-
val body: String,
127-
val geoUri: String,
128-
val description: String?,
129-
) : MessageType
130-
131-
data class AudioMessageType(
132-
val body: String,
133-
val source: MediaSource,
134-
val info: AudioInfo?
135-
) : MessageType
136-
137-
data class VideoMessageType(
138-
val body: String,
139-
val source: MediaSource,
140-
val info: VideoInfo?
141-
) : MessageType
142-
143-
data class FileMessageType(
144-
val body: String,
145-
val source: MediaSource,
146-
val info: FileInfo?
147-
) : MessageType
148-
149-
data class NoticeMessageType(
150-
val body: String,
151-
val formatted: FormattedBody?
152-
) : MessageType
153-
154-
data class TextMessageType(
155-
val body: String,
156-
val formatted: FormattedBody?
157-
) : MessageType
158-
159106
enum class MembershipChange {
160107
NONE,
161108
ERROR,
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
* Copyright (c) 2023 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.element.android.libraries.matrix.api.timeline.item.event
18+
19+
import io.element.android.libraries.matrix.api.media.AudioInfo
20+
import io.element.android.libraries.matrix.api.media.FileInfo
21+
import io.element.android.libraries.matrix.api.media.ImageInfo
22+
import io.element.android.libraries.matrix.api.media.MediaSource
23+
import io.element.android.libraries.matrix.api.media.VideoInfo
24+
25+
sealed interface MessageType
26+
27+
data object UnknownMessageType : MessageType
28+
29+
data class EmoteMessageType(
30+
val body: String,
31+
val formatted: FormattedBody?
32+
) : MessageType
33+
34+
data class ImageMessageType(
35+
val body: String,
36+
val source: MediaSource,
37+
val info: ImageInfo?
38+
) : MessageType
39+
40+
data class LocationMessageType(
41+
val body: String,
42+
val geoUri: String,
43+
val description: String?,
44+
) : MessageType
45+
46+
data class AudioMessageType(
47+
val body: String,
48+
val source: MediaSource,
49+
val info: AudioInfo?
50+
) : MessageType
51+
52+
data class VideoMessageType(
53+
val body: String,
54+
val source: MediaSource,
55+
val info: VideoInfo?
56+
) : MessageType
57+
58+
data class FileMessageType(
59+
val body: String,
60+
val source: MediaSource,
61+
val info: FileInfo?
62+
) : MessageType
63+
64+
data class NoticeMessageType(
65+
val body: String,
66+
val formatted: FormattedBody?
67+
) : MessageType
68+
69+
data class TextMessageType(
70+
val body: String,
71+
val formatted: FormattedBody?
72+
) : MessageType

0 commit comments

Comments
 (0)