mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-15 20:10:30 +00:00
Better UI
This commit is contained in:
parent
3af63a5078
commit
11863ff763
3 changed files with 95 additions and 13 deletions
15
StikJIT/Extensions & Stuff/HapticFeedbackHelper.swift
Normal file
15
StikJIT/Extensions & Stuff/HapticFeedbackHelper.swift
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// HapticFeedbackHelper.swift
|
||||
// StikJIT
|
||||
//
|
||||
// Created by Stephen on 3/27/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct HapticFeedbackHelper {
|
||||
static func trigger() {
|
||||
let generator = UIImpactFeedbackGenerator(style: .medium)
|
||||
generator.impactOccurred()
|
||||
}
|
||||
}
|
||||
34
StikJIT/Extensions & Stuff/RoundedTextField.swift
Normal file
34
StikJIT/Extensions & Stuff/RoundedTextField.swift
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
//
|
||||
// RoundedTextField.swift
|
||||
// StikJIT
|
||||
//
|
||||
// Created by Stephen on 3/27/25.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct RoundedTextField: View {
|
||||
var placeholder: String
|
||||
@Binding var text: String
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
TextField(placeholder, text: $text)
|
||||
.font(.system(.body, design: .rounded))
|
||||
.autocapitalization(.none)
|
||||
.disableAutocorrection(true)
|
||||
.foregroundColor(.primary)
|
||||
|
||||
if !text.isEmpty {
|
||||
Button(action: { text = "" }) {
|
||||
Image(systemName: "xmark.circle.fill")
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
.background(RoundedRectangle(cornerRadius: 12).fill(Color(.secondarySystemBackground)))
|
||||
.overlay(RoundedRectangle(cornerRadius: 12).stroke(Color(.tertiaryLabel), lineWidth: 0.5))
|
||||
}
|
||||
}
|
||||
|
|
@ -8,28 +8,58 @@
|
|||
import SwiftUI
|
||||
|
||||
struct HomeView: View {
|
||||
@AppStorage("bundleID") var bundleID: String = "com.stossy11.MeloNX"
|
||||
@AppStorage("bundleID") private var bundleID: String = "com.stossy11.MeloNX"
|
||||
@State private var isProcessing = false
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 20) {
|
||||
TextField("Enter Bundle ID", text: $bundleID)
|
||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||
.padding()
|
||||
ZStack {
|
||||
Color(.systemGroupedBackground)
|
||||
.edgesIgnoringSafeArea(.all)
|
||||
|
||||
Button(action: startJITInBackground) {
|
||||
Text("Enable Jit")
|
||||
.padding()
|
||||
.background(Color.blue)
|
||||
.foregroundColor(.white)
|
||||
.cornerRadius(8)
|
||||
VStack(spacing: 25) {
|
||||
Spacer()
|
||||
VStack(spacing: 5) {
|
||||
Text("StikJIT")
|
||||
.font(.system(.largeTitle, design: .rounded))
|
||||
.fontWeight(.bold)
|
||||
|
||||
Text("Enter the app's Bundle ID and enable JIT.")
|
||||
.font(.system(.subheadline, design: .rounded))
|
||||
.foregroundStyle(.secondary)
|
||||
.multilineTextAlignment(.center)
|
||||
}
|
||||
.padding(.top, 40)
|
||||
RoundedTextField(placeholder: "Enter Bundle ID", text: $bundleID)
|
||||
.padding(.horizontal, 20)
|
||||
Button(action: {
|
||||
HapticFeedbackHelper.trigger()
|
||||
startJITInBackground()
|
||||
}) {
|
||||
Label(isProcessing ? "Enabling..." : "Enable JIT", systemImage: isProcessing ? "hourglass" : "bolt.fill")
|
||||
.font(.system(.title3, design: .rounded))
|
||||
.fontWeight(.semibold)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding()
|
||||
.background(isProcessing ? Color.gray.opacity(0.6) : Color.blue)
|
||||
.foregroundColor(.white)
|
||||
.cornerRadius(16)
|
||||
.shadow(color: .blue.opacity(0.3), radius: 8, x: 0, y: 4)
|
||||
.animation(.easeInOut(duration: 0.2), value: isProcessing)
|
||||
}
|
||||
.disabled(isProcessing)
|
||||
.padding(.horizontal, 20)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
||||
func startJITInBackground() {
|
||||
private func startJITInBackground() {
|
||||
isProcessing = true
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
guard let cBundleID = strdup(bundleID) else {
|
||||
DispatchQueue.main.async { isProcessing = false }
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +71,9 @@ struct HomeView: View {
|
|||
}
|
||||
|
||||
free(cBundleID)
|
||||
DispatchQueue.main.async {
|
||||
isProcessing = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue