diff --git a/core/designsystem/src/main/res/values/strings.xml b/core/designsystem/src/main/res/values/strings.xml
index 6209e291..92d3bd9b 100644
--- a/core/designsystem/src/main/res/values/strings.xml
+++ b/core/designsystem/src/main/res/values/strings.xml
@@ -103,6 +103,7 @@
Artist
Playlist
Podcast
+ Narrative
Uploading file
Uploading photo
diff --git a/core/model/src/main/kotlin/com/meloda/app/fast/model/api/data/AttachmentType.kt b/core/model/src/main/kotlin/com/meloda/app/fast/model/api/data/AttachmentType.kt
index 0aa2ca0d..5ffc19d7 100644
--- a/core/model/src/main/kotlin/com/meloda/app/fast/model/api/data/AttachmentType.kt
+++ b/core/model/src/main/kotlin/com/meloda/app/fast/model/api/data/AttachmentType.kt
@@ -25,7 +25,8 @@ enum class AttachmentType(var value: String) {
WIDGET("widget"),
ARTIST("artist"),
AUDIO_PLAYLIST("audio_playlist"),
- PODCAST("podcast");
+ PODCAST("podcast"),
+ NARRATIVE("narrative");
fun isMultiple(): Boolean = this in listOf(PHOTO, VIDEO, AUDIO, FILE)
diff --git a/core/model/src/main/kotlin/com/meloda/app/fast/model/api/data/VkAttachmentItemData.kt b/core/model/src/main/kotlin/com/meloda/app/fast/model/api/data/VkAttachmentItemData.kt
index 78cfc152..cee40fb0 100644
--- a/core/model/src/main/kotlin/com/meloda/app/fast/model/api/data/VkAttachmentItemData.kt
+++ b/core/model/src/main/kotlin/com/meloda/app/fast/model/api/data/VkAttachmentItemData.kt
@@ -30,7 +30,8 @@ data class VkAttachmentItemData(
@Json(name = "artist") val artist: VkArtistData?,
@Json(name = "audios") val audios: List?,
@Json(name = "audio_playlist") val audioPlaylist: VkAudioPlaylistData?,
- @Json(name = "podcast") val podcast: VkPodcastData?
+ @Json(name = "podcast") val podcast: VkPodcastData?,
+ @Json(name = "narrative") val narrative: VkNarrativeData?
) {
fun toDomain(): VkAttachment = when (AttachmentType.parse(type)) {
AttachmentType.UNKNOWN -> VkUnknownAttachment
@@ -56,5 +57,6 @@ data class VkAttachmentItemData(
AttachmentType.ARTIST -> artist?.toDomain()
AttachmentType.AUDIO_PLAYLIST -> audioPlaylist?.toDomain()
AttachmentType.PODCAST -> podcast?.toDomain()
+ AttachmentType.NARRATIVE -> narrative?.toDomain()
} ?: VkUnknownAttachment
}
diff --git a/core/model/src/main/kotlin/com/meloda/app/fast/model/api/data/VkNarrativeData.kt b/core/model/src/main/kotlin/com/meloda/app/fast/model/api/data/VkNarrativeData.kt
new file mode 100644
index 00000000..53cec2f1
--- /dev/null
+++ b/core/model/src/main/kotlin/com/meloda/app/fast/model/api/data/VkNarrativeData.kt
@@ -0,0 +1,17 @@
+package com.meloda.app.fast.model.api.data
+
+import com.meloda.app.fast.model.api.domain.VkNarrativeDomain
+import com.squareup.moshi.Json
+import com.squareup.moshi.JsonClass
+
+@JsonClass(generateAdapter = true)
+data class VkNarrativeData(
+ @Json(name = "id") val id: Int,
+ @Json(name = "title") val title: String?
+) : VkAttachmentData {
+
+ fun toDomain(): VkNarrativeDomain = VkNarrativeDomain(
+ id = id,
+ title = title
+ )
+}
diff --git a/core/model/src/main/kotlin/com/meloda/app/fast/model/api/domain/VkAttachment.kt b/core/model/src/main/kotlin/com/meloda/app/fast/model/api/domain/VkAttachment.kt
index df9a03c3..8378b747 100644
--- a/core/model/src/main/kotlin/com/meloda/app/fast/model/api/domain/VkAttachment.kt
+++ b/core/model/src/main/kotlin/com/meloda/app/fast/model/api/domain/VkAttachment.kt
@@ -3,5 +3,5 @@ package com.meloda.app.fast.model.api.domain
import com.meloda.app.fast.model.api.data.AttachmentType
interface VkAttachment {
- val type: AttachmentType get() = AttachmentType.UNKNOWN
+ val type: AttachmentType
}
diff --git a/core/model/src/main/kotlin/com/meloda/app/fast/model/api/domain/VkNarrativeDomain.kt b/core/model/src/main/kotlin/com/meloda/app/fast/model/api/domain/VkNarrativeDomain.kt
new file mode 100644
index 00000000..38e674c5
--- /dev/null
+++ b/core/model/src/main/kotlin/com/meloda/app/fast/model/api/domain/VkNarrativeDomain.kt
@@ -0,0 +1,11 @@
+package com.meloda.app.fast.model.api.domain
+
+import com.meloda.app.fast.model.api.data.AttachmentType
+
+data class VkNarrativeDomain(
+ val id: Int,
+ val title: String?
+) : VkAttachment {
+
+ override val type: AttachmentType = AttachmentType.NARRATIVE
+}
diff --git a/core/model/src/main/kotlin/com/meloda/app/fast/model/database/VkMessageEntity.kt b/core/model/src/main/kotlin/com/meloda/app/fast/model/database/VkMessageEntity.kt
index 4debac6c..8f349d42 100644
--- a/core/model/src/main/kotlin/com/meloda/app/fast/model/database/VkMessageEntity.kt
+++ b/core/model/src/main/kotlin/com/meloda/app/fast/model/database/VkMessageEntity.kt
@@ -2,8 +2,8 @@ package com.meloda.app.fast.model.database
import androidx.room.Entity
import androidx.room.PrimaryKey
-import com.meloda.app.fast.model.api.domain.VkAttachment
import com.meloda.app.fast.model.api.domain.VkMessage
+import com.meloda.app.fast.model.api.domain.VkUnknownAttachment
@Entity(tableName = "messages")
data class VkMessageEntity(
@@ -46,7 +46,7 @@ fun VkMessageEntity.asExternalModel(): VkMessage = VkMessage(
important = important,
forwards = emptyList(),//forwards.orEmpty().map(VkMessageEntity::asExternalModel),
// TODO: 05/05/2024, Danil Nikolaev: restore attachments
- attachments = attachments.orEmpty().map { object : VkAttachment {} },
+ attachments = attachments.orEmpty().map { VkUnknownAttachment },
replyMessage = null,//replyMessage?.asExternalModel(),
geoType = geoType,
user = null,
diff --git a/feature/conversations/src/main/kotlin/com/meloda/app/fast/conversations/util/ConversationDomainMapper.kt b/feature/conversations/src/main/kotlin/com/meloda/app/fast/conversations/util/ConversationDomainMapper.kt
index 17a878b6..cab80f36 100644
--- a/feature/conversations/src/main/kotlin/com/meloda/app/fast/conversations/util/ConversationDomainMapper.kt
+++ b/feature/conversations/src/main/kotlin/com/meloda/app/fast/conversations/util/ConversationDomainMapper.kt
@@ -610,6 +610,7 @@ private fun getAttachmentIconByType(attachmentType: AttachmentType): UiImage? {
AttachmentType.ARTIST -> null
AttachmentType.AUDIO_PLAYLIST -> null
AttachmentType.PODCAST -> null
+ AttachmentType.NARRATIVE -> null
}?.let(UiImage::Resource)
}
@@ -755,6 +756,7 @@ private fun getAttachmentUiText(
AttachmentType.ARTIST -> UiR.string.message_attachments_artist
AttachmentType.AUDIO_PLAYLIST -> UiR.string.message_attachments_audio_playlist
AttachmentType.PODCAST -> UiR.string.message_attachments_podcast
+ AttachmentType.NARRATIVE -> UiR.string.message_attachments_narrative
}.let(UiText::Resource)
}