feat: implement Android data models in Kotlin

- Add FeedItem, Feed, FeedSubscription models with Moshi JSON support
- Add SearchResult, SearchFilters models with sealed classes for enums
- Add NotificationPreferences, ReadingPreferences models
- Add Room Entity annotations for database readiness
- Add TypeConverters for Date and List<String> serialization
- Add Parcelize for passing models between Activities/Fragments
- Write comprehensive unit tests for serialization/deserialization
- Write tests for copy(), equals/hashCode, and toString functionality
This commit is contained in:
2026-03-29 15:40:38 -04:00
parent fade9fd5b1
commit fdd4fd8a46
18 changed files with 1540 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
package com.rssuper.models
import android.os.Parcelable
import androidx.room.Entity
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.rssuper.converters.DateConverter
import com.rssuper.converters.StringListConverter
import kotlinx.parcelize.Parcelize
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import java.util.Date
@JsonClass(generateAdapter = true)
@Parcelize
@TypeConverters(DateConverter::class, StringListConverter::class)
@Entity(tableName = "feed_items")
data class FeedItem(
@PrimaryKey
val id: String,
@Json(name = "title")
val title: String,
@Json(name = "link")
val link: String? = null,
@Json(name = "description")
val description: String? = null,
@Json(name = "content")
val content: String? = null,
@Json(name = "author")
val author: String? = null,
@Json(name = "published")
val published: Date? = null,
@Json(name = "updated")
val updated: Date? = null,
@Json(name = "categories")
val categories: List<String>? = null,
@Json(name = "enclosure")
val enclosure: Enclosure? = null,
@Json(name = "guid")
val guid: String? = null,
@Json(name = "subscriptionTitle")
val subscriptionTitle: String? = null
) : Parcelable
@JsonClass(generateAdapter = true)
@Parcelize
data class Enclosure(
@Json(name = "url")
val url: String,
@Json(name = "type")
val type: String,
@Json(name = "length")
val length: Long? = null
) : Parcelable