support for articles; ui & ux & logic fixes for 2fa and captcha screens; fix mentions;
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package com.meloda.app.fast.model
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
|
||||
@Immutable
|
||||
sealed class BaseError {
|
||||
|
||||
data object SessionExpired : BaseError()
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ enum class AttachmentType(var value: String) {
|
||||
ARTIST("artist"),
|
||||
AUDIO_PLAYLIST("audio_playlist"),
|
||||
PODCAST("podcast"),
|
||||
NARRATIVE("narrative");
|
||||
NARRATIVE("narrative"),
|
||||
ARTICLE("article");
|
||||
|
||||
fun isMultiple(): Boolean = this in listOf(PHOTO, VIDEO, AUDIO, FILE)
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.meloda.app.fast.model.api.data
|
||||
|
||||
import com.meloda.app.fast.model.api.domain.VkArticleDomain
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class VkArticleData(
|
||||
@Json(name = "id") val id: Int
|
||||
) : VkAttachmentData {
|
||||
|
||||
fun toDomain(): VkArticleDomain = VkArticleDomain(
|
||||
id = id
|
||||
)
|
||||
}
|
||||
+3
-1
@@ -31,7 +31,8 @@ data class VkAttachmentItemData(
|
||||
@Json(name = "audios") val audios: List<VkAudioData>?,
|
||||
@Json(name = "audio_playlist") val audioPlaylist: VkAudioPlaylistData?,
|
||||
@Json(name = "podcast") val podcast: VkPodcastData?,
|
||||
@Json(name = "narrative") val narrative: VkNarrativeData?
|
||||
@Json(name = "narrative") val narrative: VkNarrativeData?,
|
||||
@Json(name = "article") val article: VkArticleData?
|
||||
) {
|
||||
fun toDomain(): VkAttachment = when (AttachmentType.parse(type)) {
|
||||
AttachmentType.UNKNOWN -> VkUnknownAttachment
|
||||
@@ -58,5 +59,6 @@ data class VkAttachmentItemData(
|
||||
AttachmentType.AUDIO_PLAYLIST -> audioPlaylist?.toDomain()
|
||||
AttachmentType.PODCAST -> podcast?.toDomain()
|
||||
AttachmentType.NARRATIVE -> narrative?.toDomain()
|
||||
AttachmentType.ARTICLE -> article?.toDomain()
|
||||
} ?: VkUnknownAttachment
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ data class VkGroupData(
|
||||
@Json(name = "id") val id: Int,
|
||||
@Json(name = "name") val name: String,
|
||||
@Json(name = "screen_name") val screenName: String,
|
||||
@Json(name = "is_closed") val isClosed: Int,
|
||||
@Json(name = "is_closed") val isClosed: Int?,
|
||||
@Json(name = "type") val type: String,
|
||||
@Json(name = "is_admin") val isAdmin: Int,
|
||||
@Json(name = "is_member") val isMember: Int,
|
||||
@Json(name = "is_advertiser") val isAdvertiser: Int,
|
||||
@Json(name = "is_admin") val isAdmin: Int?,
|
||||
@Json(name = "is_member") val isMember: Int?,
|
||||
@Json(name = "is_advertiser") val isAdvertiser: Int?,
|
||||
@Json(name = "photo_50") val photo50: String?,
|
||||
@Json(name = "photo_100") val photo100: String?,
|
||||
@Json(name = "photo_200") val photo200: String?,
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.meloda.app.fast.model.api.domain
|
||||
|
||||
import com.meloda.app.fast.model.api.data.AttachmentType
|
||||
|
||||
data class VkArticleDomain(
|
||||
val id: Int
|
||||
) : VkAttachment {
|
||||
|
||||
override val type: AttachmentType = AttachmentType.ARTICLE
|
||||
}
|
||||
Reference in New Issue
Block a user