mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-21 08:32:00 +00:00
parent
3fdb75e48c
commit
4ea16043da
1 changed files with 2 additions and 12 deletions
|
|
@ -174,7 +174,7 @@ struct ContributorsView: View {
|
||||||
private func loadContributors() {
|
private func loadContributors() {
|
||||||
let url = URL(string: "https://api.github.com/repos/cranci1/Sora/contributors")!
|
let url = URL(string: "https://api.github.com/repos/cranci1/Sora/contributors")!
|
||||||
|
|
||||||
URLSession.custom.dataTask(with: url) { data, response, error in
|
URLSession.shared.dataTask(with: url) { data, response, error in
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
isLoading = false
|
isLoading = false
|
||||||
|
|
||||||
|
|
@ -185,17 +185,7 @@ struct ContributorsView: View {
|
||||||
|
|
||||||
if let data = data {
|
if let data = data {
|
||||||
do {
|
do {
|
||||||
var decodedContributors = try JSONDecoder().decode([Contributor].self, from: data)
|
self.contributors = try JSONDecoder().decode([Contributor].self, from: data)
|
||||||
let artificialContributors: [Contributor] = [
|
|
||||||
Contributor(id: -1, login: "undeaDD", avatarUrl: "https://avatars.githubusercontent.com/u/8116188?v=4"),
|
|
||||||
Contributor(id: -2, login: "qooode", avatarUrl: "https://avatars.githubusercontent.com/u/71751652?v=4")
|
|
||||||
]
|
|
||||||
for artificial in artificialContributors {
|
|
||||||
if !decodedContributors.contains(where: { $0.login.lowercased() == artificial.login.lowercased() }) {
|
|
||||||
decodedContributors.append(artificial)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.contributors = decodedContributors
|
|
||||||
} catch {
|
} catch {
|
||||||
self.error = error
|
self.error = error
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue