Update AboutModel.kt
This commit is contained in:
parent
cbe6392946
commit
7680cb7b3b
1 changed files with 32 additions and 40 deletions
|
|
@ -2,68 +2,60 @@ package com.aliucord.manager.ui.screens.about
|
||||||
|
|
||||||
import cafe.adriel.voyager.core.model.StateScreenModel
|
import cafe.adriel.voyager.core.model.StateScreenModel
|
||||||
import cafe.adriel.voyager.core.model.screenModelScope
|
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.services.HttpService
|
||||||
import com.aliucord.manager.network.utils.fold
|
|
||||||
import com.aliucord.manager.ui.util.toUnsafeImmutable
|
import com.aliucord.manager.ui.util.toUnsafeImmutable
|
||||||
import com.aliucord.manager.util.launchIO
|
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
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
|
|
||||||
class AboutModel(
|
class AboutModel(
|
||||||
private val http: HttpService,
|
private val http: HttpService,
|
||||||
) : StateScreenModel<AboutScreenState>(AboutScreenState.Loading) {
|
) : StateScreenModel<AboutScreenState>(AboutScreenState.Loading) {
|
||||||
init {
|
init {
|
||||||
fetchContributors()
|
fetchDevelopers()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fetchContributors() = screenModelScope.launchIO {
|
fun fetchDevelopers() = screenModelScope.launchIO {
|
||||||
mutableState.value = AboutScreenState.Loading
|
mutableState.value = AboutScreenState.Loading
|
||||||
|
|
||||||
// Use a curated static list of GitHub usernames (profiles + static avatar URLs).
|
val allDevelopers = persistentListOf(
|
||||||
// This avoids pulling from a specific repo and lets us include people
|
Developer(
|
||||||
// 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(
|
|
||||||
username = "kmmiio99o",
|
username = "kmmiio99o",
|
||||||
avatarUrl = "https://github.com/kmmiio99o.png",
|
avatarUrl = "https://github.com/kmmiio99o.png",
|
||||||
commits = 0,
|
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",
|
username = "pylixonly",
|
||||||
avatarUrl = "https://github.com/pylixonly.png",
|
avatarUrl = "https://github.com/pylixonly.png",
|
||||||
commits = 0,
|
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())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue