mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-11-06 02:40:58 +01:00
Few minor fixes (#1427)
## Description - Fix always showing the user list on app cold start even with auto sign in enabled - Ignore unknown JSON keys when restoring view options or filters from the database making them more backward compatible for devs switching branches - Don't show a view more card on collection detail page rows, it's not necessary ### Related issues First bug was introduced by #1367 ### Testing Emulator ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
223d2d1f71
commit
6f11a3711f
4 changed files with 16 additions and 9 deletions
|
|
@ -84,6 +84,11 @@ abstract class AppDatabase : RoomDatabase() {
|
|||
}
|
||||
|
||||
class Converters {
|
||||
private val json =
|
||||
Json {
|
||||
ignoreUnknownKeys = true
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun convertToString(id: UUID): String = id.toString().replace("-", "")
|
||||
|
||||
|
|
@ -103,24 +108,24 @@ class Converters {
|
|||
fun convertSortOrder(sort: String): SortOrder? = SortOrder.fromNameOrNull(sort)
|
||||
|
||||
@TypeConverter
|
||||
fun convertGetItemsFilter(filter: GetItemsFilter): String = Json.encodeToString(filter)
|
||||
fun convertGetItemsFilter(filter: GetItemsFilter): String = json.encodeToString(filter)
|
||||
|
||||
@TypeConverter
|
||||
fun convertGetItemsFilter(filter: String): GetItemsFilter =
|
||||
try {
|
||||
Json.decodeFromString(filter)
|
||||
json.decodeFromString(filter)
|
||||
} catch (ex: Exception) {
|
||||
Timber.e(ex, "Error parsing filter")
|
||||
GetItemsFilter()
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun convertViewOptions(viewOptions: ViewOptions?): String? = viewOptions?.let { Json.encodeToString(viewOptions) }
|
||||
fun convertViewOptions(viewOptions: ViewOptions?): String? = viewOptions?.let { json.encodeToString(viewOptions) }
|
||||
|
||||
@TypeConverter
|
||||
fun convertViewOptions(viewOptions: String?): ViewOptions? =
|
||||
try {
|
||||
viewOptions?.let { Json.decodeFromString(viewOptions) }
|
||||
viewOptions?.let { json.decodeFromString(viewOptions) }
|
||||
} catch (ex: Exception) {
|
||||
Timber.e(ex, "Error parsing view options")
|
||||
null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue