LIFE OR DEATH PR (#154)

This commit is contained in:
50/50 2025-06-06 07:23:33 +02:00 committed by GitHub
parent 92200a674d
commit 4a91aa022d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,6 +7,7 @@
import SwiftUI
import Kingfisher
import AVKit
fileprivate struct SettingsSection<Content: View>: View {
let title: String
@ -29,22 +30,6 @@ fileprivate struct SettingsSection<Content: View>: View {
VStack(spacing: 0) {
content
}
.background(.ultraThinMaterial)
.clipShape(RoundedRectangle(cornerRadius: 12))
.overlay(
RoundedRectangle(cornerRadius: 12)
.strokeBorder(
LinearGradient(
gradient: Gradient(stops: [
.init(color: Color.accentColor.opacity(0.3), location: 0),
.init(color: Color.accentColor.opacity(0), location: 1)
]),
startPoint: .top,
endPoint: .bottom
),
lineWidth: 0.5
)
)
.padding(.horizontal, 20)
if let footer = footer {
@ -60,6 +45,7 @@ fileprivate struct SettingsSection<Content: View>: View {
struct SettingsViewAbout: View {
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "ALPHA"
@State private var isAnimating = false
var body: some View {
ScrollView {
@ -95,29 +81,38 @@ struct SettingsViewAbout: View {
UIApplication.shared.open(url)
}
}) {
HStack {
KFImage(URL(string: "https://avatars.githubusercontent.com/u/100066266?v=4"))
ZStack(alignment: .trailing) {
KFImage(URL(string: "https://github.com/50n50/assets/blob/main/asset2.png?raw=true")!)
.placeholder {
ProgressView()
}
.resizable()
.frame(width: 40, height: 40)
.clipShape(Circle())
.aspectRatio(contentMode: .fill)
.frame(height: 64)
.clipShape(RoundedRectangle(cornerRadius: 8))
VStack(alignment: .leading) {
Text("cranci1")
.font(.headline)
HStack {
KFImage(URL(string: "https://avatars.githubusercontent.com/u/100066266?v=4"))
.placeholder {
ProgressView()
}
.resizable()
.frame(width: 40, height: 40)
.clipShape(Circle())
AnimatedText(
text: "cranci1",
primaryColor: Color(hexTwo: "#41127b"),
secondaryColor: Color(hexTwo: "#a78bda")
)
Spacer()
Image(systemName: "safari")
.foregroundColor(.indigo)
Text("me frfr")
.font(.subheadline)
.foregroundColor(.secondary)
}
Spacer()
Image(systemName: "safari")
.foregroundColor(.indigo)
.padding(.horizontal, 16)
.padding(.vertical, 12)
}
.padding(.horizontal, 16)
.padding(.vertical, 12)
}
}
@ -136,7 +131,8 @@ struct ContributorsView: View {
@State private var contributors: [Contributor] = []
@State private var isLoading = true
@State private var error: Error?
@State private var isAnimating = false
var body: some View {
Group {
if isLoading {
@ -152,12 +148,118 @@ struct ContributorsView: View {
.padding(.vertical, 12)
} else {
ForEach(filteredContributors) { contributor in
ContributorView(contributor: contributor)
if contributor.id != filteredContributors.last?.id {
Divider()
Button(action: {
if let url = URL(string: "https://github.com/\(contributor.login)") {
UIApplication.shared.open(url)
}
}) {
ZStack(alignment: .trailing) {
if contributor.login == "50n50" {
KFImage(URL(string: "https://github.com/50n50/assets/raw/refs/heads/main/asset.png")!)
.placeholder {
ProgressView()
}
.resizable()
.aspectRatio(contentMode: .fill)
.frame(height: 64)
.clipShape(RoundedRectangle(cornerRadius: 8))
} else if contributor.login == "xibrox" {
KFImage(URL(string: "https://raw.githubusercontent.com/50n50/assets/refs/heads/main/asset3.png")!)
.placeholder {
ProgressView()
}
.resizable()
.aspectRatio(contentMode: .fill)
.frame(height: 64)
.clipShape(RoundedRectangle(cornerRadius: 8))
} else if contributor.login == "Seeike" {
KFImage(URL(string: "https://raw.githubusercontent.com/50n50/assets/refs/heads/main/asset4.png")!)
.placeholder {
ProgressView()
}
.resizable()
.aspectRatio(contentMode: .fill)
.frame(height: 64)
.clipShape(RoundedRectangle(cornerRadius: 8))
} else if contributor.login == "realdoomsboygaming" {
KFImage(URL(string: "https://raw.githubusercontent.com/50n50/assets/refs/heads/main/asset5.png")!)
.placeholder {
ProgressView()
}
.resizable()
.aspectRatio(contentMode: .fill)
.frame(height: 64)
.clipShape(RoundedRectangle(cornerRadius: 8))
}
HStack {
KFImage(URL(string: contributor.avatarUrl))
.placeholder {
ProgressView()
}
.resizable()
.frame(width: 40, height: 40)
.clipShape(Circle())
if contributor.login == "50n50" {
AnimatedText(
text: contributor.login,
primaryColor: Color(hexTwo: "#fa4860"),
secondaryColor: Color(hexTwo: "#fccdd1")
)
} else if contributor.login == "xibrox" {
AnimatedText(
text: contributor.login,
primaryColor: .black,
secondaryColor: Color(hexTwo: "#ff0000")
)
} else if contributor.login == "Seeike" {
AnimatedText(
text: contributor.login,
primaryColor: Color(hexTwo: "#34435E"),
secondaryColor: Color(hexTwo: "#5d77ab")
)
} else if contributor.login == "realdoomsboygaming" {
AnimatedText(
text: contributor.login,
primaryColor: Color(hexTwo: "#ff0000"),
secondaryColor: Color(hexTwo: "#ffa500")
)
} else {
Text(contributor.login)
.font(.headline)
.foregroundColor(
contributor.login == "IBH-RAD" ? Color(hexTwo: "#41127b") :
.accentColor
)
}
Spacer()
Image(systemName: "safari")
.foregroundColor(.accentColor)
}
.padding(.horizontal, 16)
.padding(.vertical, 12)
}
}
.background(.ultraThinMaterial)
.clipShape(RoundedRectangle(cornerRadius: 12))
.overlay(
RoundedRectangle(cornerRadius: 12)
.strokeBorder(
LinearGradient(
gradient: Gradient(stops: [
.init(color: Color.accentColor.opacity(0.3), location: 0),
.init(color: Color.accentColor.opacity(0), location: 1)
]),
startPoint: .top,
endPoint: .bottom
),
lineWidth: 0.5
)
)
}
.padding(.vertical, 4)
}
}
.onAppear {
@ -195,42 +297,6 @@ struct ContributorsView: View {
}
}
struct ContributorView: View {
let contributor: Contributor
var body: some View {
Button(action: {
if let url = URL(string: "https://github.com/\(contributor.login)") {
UIApplication.shared.open(url)
}
}) {
HStack {
KFImage(URL(string: contributor.avatarUrl))
.placeholder {
ProgressView()
}
.resizable()
.frame(width: 40, height: 40)
.clipShape(Circle())
Text(contributor.login)
.font(.headline)
.foregroundColor(
contributor.login == "IBH-RAD" ? Color(hexTwo: "#41127b") :
contributor.login == "50n50" ? Color(hexTwo: "#fa4860") :
.accentColor
)
Spacer()
Image(systemName: "safari")
.foregroundColor(.accentColor)
}
.padding(.horizontal, 16)
.padding(.vertical, 12)
}
}
}
struct Contributor: Identifiable, Decodable {
let id: Int
let login: String
@ -243,6 +309,34 @@ struct Contributor: Identifiable, Decodable {
}
}
struct AnimatedText: View {
let text: String
let primaryColor: Color
let secondaryColor: Color
@State private var isAnimating = false
var body: some View {
Text(text)
.font(.headline)
.foregroundStyle(
LinearGradient(
colors: [
primaryColor,
secondaryColor,
primaryColor
],
startPoint: isAnimating ? .trailing : .leading,
endPoint: isAnimating ? .leading : .trailing
)
)
.onAppear {
withAnimation(.linear(duration: 2.0).repeatForever(autoreverses: false)) {
isAnimating = true
}
}
}
}
extension Color {
init(hexTwo: String) {
let hexTwo = hexTwo.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)