Update AboutModel.kt

This commit is contained in:
OTKUSteyler 2025-11-21 23:29:56 +01:00 • committed by GitHub
parent cbe6392946
commit 7680cb7b3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,68 +2,60 @@ package com.aliucord.manager.ui.screens.about
import cafe.adriel.voyager.core.model.StateScreenModel
import cafe.adriel.voyager.core.model.screenModelScope
import com.aliucord.manager.network.models.Contributor
import com.aliucord.manager.network.models.Developer
import com.aliucord.manager.network.services.HttpService
import com.aliucord.manager.network.utils.fold
import com.aliucord.manager.ui.util.toUnsafeImmutable
import com.aliucord.manager.util.launchIO
import io.ktor.client.request.url
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerialName
import kotlinx.collections.immutable.persistentListOf
class AboutModel(
private val http: HttpService,
) : StateScreenModel<AboutScreenState>(AboutScreenState.Loading) {
init {
fetchContributors()
fetchDevelopers()
}
fun fetchContributors() = screenModelScope.launchIO {
fun fetchDevelopers() = screenModelScope.launchIO {
mutableState.value = AboutScreenState.Loading
// Use a curated static list of GitHub usernames (profiles + static avatar URLs).
// This avoids pulling from a specific repo and lets us include people
// who are not contributors to any particular repository.
val staticContributors = persistentListOf(
Contributor(
username = "jonatanktk",
avatarUrl = "https://github.com/jonatanktk.png",
commits = 0,
repositories = persistentListOf<com.aliucord.manager.network.models.Contributor.Repository>()
),
Contributor(
username = "OTKUSteyler",
avatarUrl = "https://github.com/OTKUSteyler.png",
commits = 0,
repositories = persistentListOf<com.aliucord.manager.network.models.Contributor.Repository>()
),
Contributor(
username = "rushiiMachine",
avatarUrl = "https://github.com/rushiiMachine.png",
commits = 0,
repositories = persistentListOf<com.aliucord.manager.network.models.Contributor.Repository>()
),
Contributor(
username = "maisymoe",
avatarUrl = "https://github.com/maisymoe.png",
commits = 0,
repositories = persistentListOf<com.aliucord.manager.network.models.Contributor.Repository>()
),
Contributor(
val allDevelopers = persistentListOf(
Developer(
username = "kmmiio99o",
avatarUrl = "https://github.com/kmmiio99o.png",
commits = 0,
repositories = persistentListOf<com.aliucord.manager.network.models.Contributor.Repository>()
repositories = emptyList(),
role = "ShiggyCord - Creator"
),
Contributor(
Developer(
username = "C0C0B01",
avatarUrl = "https://github.com/C0C0B01.png",
commits = 0,
repositories = emptyList(),
role = "Kettu - Creator"
),
Developer(
username = "pylixonly",
avatarUrl = "https://github.com/pylixonly.png",
commits = 0,
repositories = persistentListOf<com.aliucord.manager.network.models.Contributor.Repository>()
repositories = emptyList(),
role = "Bunny - Creator"
),
Developer(
username = "maisymoe",
avatarUrl = "https://github.com/maisymoe.png",
commits = 0,
repositories = emptyList(),
role = "Creator - Vendetta"
),
Developer(
username = "rushiiMachine",
avatarUrl = "https://github.com/rushiiMachine.png",
commits = 0,
repositories = emptyList(),
role = "Manager - Creator"
)
)
mutableState.value = AboutScreenState.Loaded(staticContributors.toUnsafeImmutable())
mutableState.value = AboutScreenState.Loaded(allDevelopers.toUnsafeImmutable())
}
}