Skip to content

Commit 25ba4c6

Browse files
committed
Completely reworked the Na'vi data structure. Now both OfflineNavi.kt and OnlineNavi.kt will get converted into the universal Navi.kt structure which will be passed to the UI.
This new universal structure is much more performant and cleaner to handle and view. Complicated Reykunyu syntax is parsed into custom data classes, enums and lists. For offline dictionary, the conversion will happen only if the word is searched, improving performance, this also offloading heavy tasks such as Regex from the UI to the search coroutine, improving runtime performance. the online Na'vi (v2) structure is mostly completed. Just need to add the downloading logic and write a custom deserializer for the pesky etymology json. All done in a day's work :)
1 parent 9491db0 commit 25ba4c6

File tree

11 files changed

+636
-265
lines changed

11 files changed

+636
-265
lines changed

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/kip/reykunyu/data/api/NetworkApi.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.kip.reykunyu.data.api
22

33
import com.kip.reykunyu.data.dict.Language
44
import kotlinx.serialization.ExperimentalSerializationApi
5+
import kotlinx.serialization.json.Json
56
import retrofit2.Retrofit
67
import retrofit2.converter.scalars.ScalarsConverterFactory
78
import retrofit2.http.GET
@@ -17,6 +18,8 @@ private const val DICT_URL =
1718
private const val LANG_LOOKUP_DEPRECATED =
1819
"search?query={QUERY}&language={LANG}"
1920

21+
22+
//fwew search works both ways. Cool!
2023
private const val SEARCH =
2124
"fwew-search?query={QUERY}&language={LANG}"
2225

@@ -58,6 +61,13 @@ interface ReykunyuApiService {
5861
}
5962

6063
object ReykunyuApi {
64+
@OptIn(ExperimentalSerializationApi::class)
65+
val jsonFormat = Json {
66+
isLenient = true
67+
ignoreUnknownKeys = true
68+
explicitNulls = false
69+
}
70+
6171

6272
@OptIn(ExperimentalSerializationApi::class)
6373
private val retrofit = Retrofit.Builder()

0 commit comments

Comments
 (0)