Skip to content

Commit d52cc17

Browse files
committed
fix: corrected linked categories
1 parent 0304f6e commit d52cc17

3 files changed

Lines changed: 9 additions & 17 deletions

File tree

mobile/androidApp/src/main/kotlin/app/myfaq/android/Theme.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class ThemeState(
4040
var mode: ThemeMode by mutableStateOf(load())
4141
private set
4242

43+
@JvmName("updateMode")
4344
fun setMode(newMode: ThemeMode) {
4445
mode = newMode
4546
prefs.edit().putString(KEY, newMode.name).apply()

mobile/shared/src/commonMain/kotlin/app/myfaq/shared/api/MyFaqApi.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ interface MyFaqApi {
3838
suspend fun categories(): List<Category>
3939

4040
// FAQs
41-
suspend fun faqsByCategory(categoryId: Int): List<FaqSummary> // paginated
41+
suspend fun faqsByCategory(categoryId: Int): List<FaqSummary>
4242

4343
suspend fun faqDetail(
4444
categoryId: Int,
@@ -92,10 +92,7 @@ class MyFaqApiImpl(
9292
.data
9393

9494
override suspend fun faqsByCategory(categoryId: Int): List<FaqSummary> =
95-
http
96-
.get("$api/faqs/$categoryId") { header("Accept-Language", language) }
97-
.body<PaginatedResponse<List<FaqSummary>>>()
98-
.data
95+
http.get("$api/faqs/$categoryId") { header("Accept-Language", language) }.body()
9996

10097
override suspend fun faqDetail(
10198
categoryId: Int,

mobile/shared/src/commonTest/kotlin/app/myfaq/shared/api/EndpointDeserializationTest.kt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class EndpointDeserializationTest {
5858
// ── FAQs ────────────────────────────────────────────────────────
5959

6060
@Test
61-
fun `faqs by category deserializes paginated response with record_ fields`() =
61+
fun `faqs by category deserializes plain array with record_ fields`() =
6262
runTest {
6363
val result = api(FAQ_LIST_JSON).faqsByCategory(1)
6464
assertEquals(2, result.size)
@@ -274,18 +274,12 @@ class EndpointDeserializationTest {
274274
}
275275
"""
276276

277-
// Paginated: faqs by category (record_* field names)
277+
// Plain array: faqs by category (record_* field names per v4.0 spec)
278278
const val FAQ_LIST_JSON = """
279-
{
280-
"success": true,
281-
"data": [
282-
{"record_id": 10, "category_id": 1, "record_title": "How do I install?", "record_preview": "Steps to install", "record_updated": "20240115120000", "record_lang": "en", "visits": 5},
283-
{"record_id": 11, "category_id": 1, "record_title": "How do I configure?", "record_preview": "Configuration guide", "record_updated": "20240120120000", "record_lang": "en", "visits": 3}
284-
],
285-
"meta": {
286-
"pagination": {"total": 2, "count": 2, "per_page": 25, "current_page": 1, "total_pages": 1}
287-
}
288-
}
279+
[
280+
{"record_id": 10, "category_id": 1, "record_title": "How do I install?", "record_preview": "Steps to install", "record_updated": "20240115120000", "record_lang": "en", "visits": 5},
281+
{"record_id": 11, "category_id": 1, "record_title": "How do I configure?", "record_preview": "Configuration guide", "record_updated": "20240120120000", "record_lang": "en", "visits": 3}
282+
]
289283
"""
290284

291285
// Non-paginated: faq detail

0 commit comments

Comments
 (0)