mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-15 20:10:30 +00:00
Merge pull request #61 from neoarz/main
fix version number + light theme for notifs
This commit is contained in:
commit
d6c1101c90
3 changed files with 26 additions and 47 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<img width="225" height="225" src="/assets/StikJIT_Rounded_Corners.png" alt="Logo">
|
<img width="217" height="217" src="/assets/StikJIT_Rounded_Corners.png" alt="Logo">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ struct CustomErrorView: View {
|
||||||
var showSecondaryButton: Bool = false
|
var showSecondaryButton: Bool = false
|
||||||
var messageType: MessageType = .error
|
var messageType: MessageType = .error
|
||||||
|
|
||||||
|
@Environment(\.colorScheme) private var colorScheme
|
||||||
|
|
||||||
enum MessageType {
|
enum MessageType {
|
||||||
case error
|
case error
|
||||||
case success
|
case success
|
||||||
|
|
@ -56,19 +58,19 @@ struct CustomErrorView: View {
|
||||||
// Title - slightly smaller
|
// Title - slightly smaller
|
||||||
Text(title)
|
Text(title)
|
||||||
.font(.system(size: 18, weight: .bold, design: .rounded))
|
.font(.system(size: 18, weight: .bold, design: .rounded))
|
||||||
.foregroundColor(.white)
|
.foregroundColor(colorScheme == .dark ? .white : .black)
|
||||||
.multilineTextAlignment(.center)
|
.multilineTextAlignment(.center)
|
||||||
|
|
||||||
// Divider
|
// Divider
|
||||||
Rectangle()
|
Rectangle()
|
||||||
.frame(height: 1)
|
.frame(height: 1)
|
||||||
.foregroundColor(.white.opacity(0.2))
|
.foregroundColor(colorScheme == .dark ? .white.opacity(0.2) : .black.opacity(0.2))
|
||||||
.padding(.horizontal, 12)
|
.padding(.horizontal, 12)
|
||||||
|
|
||||||
// Message
|
// Message
|
||||||
Text(message)
|
Text(message)
|
||||||
.font(.system(size: 15, design: .rounded))
|
.font(.system(size: 15, design: .rounded))
|
||||||
.foregroundColor(.white.opacity(0.9))
|
.foregroundColor(colorScheme == .dark ? .white.opacity(0.9) : .black.opacity(0.9))
|
||||||
.multilineTextAlignment(.center)
|
.multilineTextAlignment(.center)
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
.padding(.horizontal, 12)
|
.padding(.horizontal, 12)
|
||||||
|
|
@ -83,12 +85,12 @@ struct CustomErrorView: View {
|
||||||
}) {
|
}) {
|
||||||
Text(primaryButtonText)
|
Text(primaryButtonText)
|
||||||
.font(.system(size: 16, weight: .semibold, design: .rounded))
|
.font(.system(size: 16, weight: .semibold, design: .rounded))
|
||||||
.foregroundColor(.black)
|
.foregroundColor(colorScheme == .dark ? .black : .white)
|
||||||
.frame(height: 38)
|
.frame(height: 38)
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
.background(
|
.background(
|
||||||
RoundedRectangle(cornerRadius: 10)
|
RoundedRectangle(cornerRadius: 10)
|
||||||
.fill(Color.white)
|
.fill(colorScheme == .dark ? Color.white : Color.blue)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,12 +101,12 @@ struct CustomErrorView: View {
|
||||||
}) {
|
}) {
|
||||||
Text(secondaryButtonText)
|
Text(secondaryButtonText)
|
||||||
.font(.system(size: 16, weight: .medium, design: .rounded))
|
.font(.system(size: 16, weight: .medium, design: .rounded))
|
||||||
.foregroundColor(.white)
|
.foregroundColor(colorScheme == .dark ? .white : .gray)
|
||||||
.frame(height: 38)
|
.frame(height: 38)
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
.background(
|
.background(
|
||||||
RoundedRectangle(cornerRadius: 10)
|
RoundedRectangle(cornerRadius: 10)
|
||||||
.fill(Color.gray.opacity(0.3))
|
.fill(colorScheme == .dark ? Color.gray.opacity(0.3) : Color.gray.opacity(0.15))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -121,18 +123,22 @@ struct CustomErrorView: View {
|
||||||
.frame(width: min(UIScreen.main.bounds.width - 80, 300))
|
.frame(width: min(UIScreen.main.bounds.width - 80, 300))
|
||||||
.background(
|
.background(
|
||||||
RoundedRectangle(cornerRadius: 16)
|
RoundedRectangle(cornerRadius: 16)
|
||||||
.fill(Color(UIColor.systemGray6).opacity(0.95))
|
.fill(colorScheme == .dark ?
|
||||||
|
Color(UIColor.systemGray6).opacity(0.95) :
|
||||||
|
Color(UIColor.systemGray6).opacity(0.95))
|
||||||
.overlay(
|
.overlay(
|
||||||
RoundedRectangle(cornerRadius: 16)
|
RoundedRectangle(cornerRadius: 16)
|
||||||
.stroke(Color.white.opacity(0.2), lineWidth: 1)
|
.stroke(colorScheme == .dark ?
|
||||||
|
Color.white.opacity(0.2) :
|
||||||
|
Color.black.opacity(0.1),
|
||||||
|
lineWidth: 1)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.shadow(color: Color.black.opacity(0.25), radius: 16, x: 0, y: 8)
|
.shadow(color: Color.black.opacity(colorScheme == .dark ? 0.25 : 0.15), radius: 16, x: 0, y: 8)
|
||||||
.scaleEffect(scale)
|
.scaleEffect(scale)
|
||||||
.opacity(opacity)
|
.opacity(opacity)
|
||||||
}
|
}
|
||||||
.onAppear {
|
.onAppear {
|
||||||
|
|
||||||
withAnimation(.spring(response: 0.25, dampingFraction: 0.7)) {
|
withAnimation(.spring(response: 0.25, dampingFraction: 0.7)) {
|
||||||
opacity = 1
|
opacity = 1
|
||||||
scale = 1
|
scale = 1
|
||||||
|
|
@ -141,13 +147,11 @@ struct CustomErrorView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func dismissWithAnimation() {
|
private func dismissWithAnimation() {
|
||||||
|
|
||||||
withAnimation(.easeOut(duration: 0.15)) {
|
withAnimation(.easeOut(duration: 0.15)) {
|
||||||
opacity = 0
|
opacity = 0
|
||||||
scale = 0.8
|
scale = 0.8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.15) {
|
||||||
onDismiss()
|
onDismiss()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,10 @@ struct SettingsView: View {
|
||||||
|
|
||||||
@State private var showingConsoleLogsView = false
|
@State private var showingConsoleLogsView = false
|
||||||
|
|
||||||
@State private var remoteVersion: String = "-"
|
private var appVersion: String {
|
||||||
|
let marketingVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0"
|
||||||
|
return marketingVersion
|
||||||
|
}
|
||||||
|
|
||||||
// Developer profile image URLs
|
// Developer profile image URLs
|
||||||
private let developerProfiles: [String: String] = [
|
private let developerProfiles: [String: String] = [
|
||||||
|
|
@ -438,18 +441,9 @@ struct SettingsView: View {
|
||||||
HStack {
|
HStack {
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
if remoteVersion == "-" {
|
Text("Version \(appVersion) • iOS \(UIDevice.current.systemVersion)")
|
||||||
Text("Checking version...")
|
|
||||||
.font(.footnote)
|
.font(.footnote)
|
||||||
.foregroundColor(.secondary.opacity(0.8))
|
.foregroundColor(.secondary.opacity(0.8))
|
||||||
.onAppear {
|
|
||||||
fetchVersionFromGitHub()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Text("Version \(remoteVersion) • iOS \(UIDevice.current.systemVersion)")
|
|
||||||
.font(.footnote)
|
|
||||||
.foregroundColor(.secondary.opacity(0.8))
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
|
@ -576,25 +570,6 @@ struct SettingsView: View {
|
||||||
}
|
}
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func fetchVersionFromGitHub() {
|
|
||||||
let versionURL = "https://raw.githubusercontent.com/0-Blu/StikJIT/refs/heads/main/version.txt"
|
|
||||||
|
|
||||||
guard let url = URL(string: versionURL) else { return }
|
|
||||||
|
|
||||||
URLSession.shared.dataTask(with: url) { data, response, error in
|
|
||||||
guard let data = data, error == nil else {
|
|
||||||
print("Failed to fetch version: \(error?.localizedDescription ?? "Unknown error")")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if let versionString = String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) {
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
self.remoteVersion = versionString
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.resume()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper components
|
// Helper components
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue