Skip to content

Commit

Permalink
Revert "apis valid page improve maybe?"
Browse files Browse the repository at this point in the history
This reverts commit 9b4cca1.
  • Loading branch information
cranci1 committed May 24, 2024
1 parent 9b4cca1 commit 4e89004
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
Binary file not shown.
40 changes: 15 additions & 25 deletions AnimeGen/Settings/APIsValid.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import SwiftUI

struct APIData: Codable {
var supported: [String: String]
var supported: [String: Bool]
}

struct APIsSuppport: View {
Expand All @@ -20,35 +20,25 @@ struct APIsSuppport: View {
ForEach(apiData?.supported.sorted(by: { $0.key < $1.key }) ?? [], id: \.key) { (key, value) in
HStack {
Text(key)
.font(.headline)
Spacer()
if value == "true" {
if value {
Image(systemName: "checkmark.circle.fill")
.foregroundColor(.green)
} else if value == "false" {
} else {
Image(systemName: "xmark.circle.fill")
.foregroundColor(.red)
} else if value == "kinda" {
Image(systemName: "exclamationmark.triangle.fill")
.foregroundColor(.yellow)
}
}
}
}
.overlay(
VStack {
Text("Support status will not be updated instantly, but rather promptly after the APIs resume operation.")
.font(.footnote)
.foregroundColor(.gray)
.multilineTextAlignment(.center)
.padding(.horizontal)
Spacer()
}
.frame(maxWidth: .infinity, alignment: .center)
.background(Color(UIColor.systemBackground).opacity(0.95))
.cornerRadius(12)
.shadow(radius: 10)
.padding(),
Text("Support status will not be updated instantly, but rather promptly after the APIs resume operation.")
.font(.footnote)
.foregroundColor(.gray)
.multilineTextAlignment(.center)
.padding(.all, 18)
.frame(maxWidth: .infinity, alignment: .center)
.background(Color.secondary.opacity(0.1)),
alignment: .bottom
)
Button(action: {
Expand All @@ -65,15 +55,15 @@ struct APIsSuppport: View {
.font(.headline)
}
.padding()
.background(Color.blue)
.background(Color("AccentColor"))
.cornerRadius(10)
}
.padding()
}
.onAppear {
fetchData()
}
.navigationBarTitle("APIs Status", displayMode: .inline)
.navigationBarTitle("APIs Status")
}

private func fetchData() {
Expand All @@ -95,8 +85,8 @@ struct APIsSuppport: View {

let iosVersion = UIDevice.current.systemVersion
if iosVersion.starts(with: "13") {
decodedData.supported["pic.re"] = "false"
decodedData.supported["Nekos api"] = "false"
decodedData.supported["pic.re"] = false
decodedData.supported["Nekos api"] = false
}

DispatchQueue.main.async {
Expand All @@ -109,7 +99,7 @@ struct APIsSuppport: View {
}
}

struct APIsSuppport_Previews: PreviewProvider {
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
APIsSuppport()
}
Expand Down

0 comments on commit 4e89004

Please sign in to comment.