-
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff13748
commit 8379ba5
Showing
1 changed file
with
119 additions
and
91 deletions.
There are no files selected for viewing
210 changes: 119 additions & 91 deletions
210
app/src/main/java/ani/dantotsu/connections/github/Contributors.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,126 @@ | ||
fun getContributors(): Array<Developer> { | ||
var developers = arrayOf<Developer>() | ||
runBlocking(Dispatchers.IO) { | ||
val repo = getAppString(R.string.repo) | ||
val res = client.get("https://api.github.com/repos/$repo/contributors") | ||
.parsed<JsonArray>().map { | ||
Mapper.json.decodeFromJsonElement<GithubResponse>(it) | ||
} | ||
res.forEach { | ||
if (it.login == "SunglassJerry" || it.login == "itsmechinmoy") return@forEach | ||
val role = when (it.login) { | ||
"rebelonion" -> "Owner & Maintainer" | ||
"sneazy-ibo" -> "Contributor & Comment Moderator" | ||
"WaiWhat" -> "Icon Designer" | ||
else -> "Contributor" | ||
package ani.dantotsu.connections.github | ||
|
||
import ani.dantotsu.Mapper | ||
import ani.dantotsu.R | ||
import ani.dantotsu.client | ||
import ani.dantotsu.getAppString | ||
import ani.dantotsu.settings.Developer | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.runBlocking | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.json.JsonArray | ||
import kotlinx.serialization.json.decodeFromJsonElement | ||
|
||
class Contributors { | ||
|
||
fun getContributors(): Array<Developer> { | ||
var developers = arrayOf<Developer>() | ||
runBlocking(Dispatchers.IO) { | ||
val repo = getAppString(R.string.repo) | ||
val res = client.get("https://api.github.com/repos/$repo/contributors") | ||
.parsed<JsonArray>().map { | ||
Mapper.json.decodeFromJsonElement<GithubResponse>(it) | ||
} | ||
res.forEach { | ||
if (it.login == "SunglassJerry" || it.login == "itsmechinmoy") return@forEach | ||
val role = when (it.login) { | ||
"rebelonion" -> "Owner & Maintainer" | ||
"sneazy-ibo" -> "Contributor & Comment Moderator" | ||
"WaiWhat" -> "Icon Designer" | ||
else -> "Contributor" | ||
} | ||
developers = developers.plus( | ||
Developer( | ||
it.login, | ||
it.avatarUrl, | ||
role, | ||
it.htmlUrl | ||
) | ||
) | ||
} | ||
developers = developers.plus( | ||
Developer( | ||
it.login, | ||
it.avatarUrl, | ||
role, | ||
it.htmlUrl | ||
arrayOf( | ||
Developer( | ||
"MarshMeadow", | ||
"https://avatars.githubusercontent.com/u/88599122?v=4", | ||
"Beta Icon Designer & Website Maintainer", | ||
"https://github.com/MarshMeadow?tab=repositories" | ||
), | ||
Developer( | ||
"Zaxx69", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6342562-kxE8m4i7KUMK.png", | ||
"Telegram Admin", | ||
"https://anilist.co/user/6342562" | ||
), | ||
Developer( | ||
"Arif Alam", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6011177-2n994qtayiR9.jpg", | ||
"Discord & Comment Moderator", | ||
"https://anilist.co/user/6011177" | ||
), | ||
Developer( | ||
"SunglassJeery", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b5804776-FEKfP5wbz2xv.png", | ||
"Head Discord & Comment Moderator", | ||
"https://anilist.co/user/5804776" | ||
), | ||
Developer( | ||
"Excited", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6131921-toSoGWmKbRA1.png", | ||
"Comment Moderator", | ||
"https://anilist.co/user/6131921" | ||
), | ||
Developer( | ||
"Gurjshan", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6363228-rWQ3Pl3WuxzL.png", | ||
"Comment Moderator", | ||
"https://anilist.co/user/6363228" | ||
), | ||
Developer( | ||
"NekoMimi", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6244220-HOpImMGMQAxW.jpg", | ||
"Comment Moderator", | ||
"https://anilist.co/user/6244220" | ||
), | ||
Developer( | ||
"Ziadsenior", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6049773-8cjYeUOFUguv.jpg", | ||
"Comment Moderator and Arabic Translator", | ||
"https://anilist.co/user/6049773" | ||
), | ||
Developer( | ||
"Dawnusedyeet", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6237399-RHFvRHriXjwS.png", | ||
"Contributor", | ||
"https://anilist.co/user/Dawnusedyeet/" | ||
), | ||
Developer( | ||
"itsmechinmoy", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6110204-nhhnglDW5K7x.png", | ||
"Telegram Admin, Comment Moderator, Goth gf", | ||
"https://anilist.co/user/6110204" | ||
), | ||
Developer( | ||
"hastsu", | ||
"https://cdn.discordapp.com/avatars/602422545077108749/20b4a6efa4314550e4ed51cdbe4fef3d.webp?size=160", | ||
"Comment Moderator and Arabic Translator", | ||
"https://anilist.co/user/6183359" | ||
), | ||
) | ||
) | ||
} | ||
developers = developers.plus( | ||
arrayOf( | ||
Developer( | ||
"MarshMeadow", | ||
"https://avatars.githubusercontent.com/u/88599122?v=4", | ||
"Beta Icon Designer & Website Maintainer", | ||
"https://github.com/MarshMeadow?tab=repositories" | ||
), | ||
Developer( | ||
"Zaxx69", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6342562-kxE8m4i7KUMK.png", | ||
"Telegram Admin", | ||
"https://anilist.co/user/6342562" | ||
), | ||
Developer( | ||
"Arif Alam", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6011177-2n994qtayiR9.jpg", | ||
"Discord & Comment Moderator", | ||
"https://anilist.co/user/6011177" | ||
), | ||
Developer( | ||
"SunglassJeery", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b5804776-FEKfP5wbz2xv.png", | ||
"Head Discord & Comment Moderator", | ||
"https://anilist.co/user/5804776" | ||
), | ||
Developer( | ||
"Excited", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6131921-toSoGWmKbRA1.png", | ||
"Comment Moderator", | ||
"https://anilist.co/user/6131921" | ||
), | ||
Developer( | ||
"Gurjshan", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6363228-rWQ3Pl3WuxzL.png", | ||
"Comment Moderator", | ||
"https://anilist.co/user/6363228" | ||
), | ||
Developer( | ||
"NekoMimi", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6244220-HOpImMGMQAxW.jpg", | ||
"Comment Moderator", | ||
"https://anilist.co/user/6244220" | ||
), | ||
Developer( | ||
"Ziadsenior", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6049773-8cjYeUOFUguv.jpg", | ||
"Comment Moderator and Arabic Translator", | ||
"https://anilist.co/user/6049773" | ||
), | ||
Developer( | ||
"Dawnusedyeet", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6237399-RHFvRHriXjwS.png", | ||
"Contributor", | ||
"https://anilist.co/user/Dawnusedyeet/" | ||
), | ||
Developer( | ||
"hastsu", | ||
"https://cdn.discordapp.com/avatars/602422545077108749/20b4a6efa4314550e4ed51cdbe4fef3d.webp?size=160", | ||
"Comment Moderator and Arabic Translator", | ||
"https://anilist.co/user/6183359" | ||
), | ||
Developer( | ||
"itsmechinmoy", | ||
"https://s4.anilist.co/file/anilistcdn/user/avatar/large/b6110204-nhhnglDW5K7x.png", | ||
"Telegram Admin, Comment Moderator, Goth gf", | ||
"https://anilist.co/user/6110204" | ||
), | ||
) | ||
) | ||
return developers | ||
} | ||
return developers | ||
|
||
|
||
@Serializable | ||
data class GithubResponse( | ||
@SerialName("login") | ||
val login: String, | ||
@SerialName("avatar_url") | ||
val avatarUrl: String, | ||
@SerialName("html_url") | ||
val htmlUrl: String | ||
) | ||
} |