mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-16 04:20:30 +00:00
Fix mounting DDI UI
This commit is contained in:
parent
daf7bc2e0c
commit
197e4e52c9
3 changed files with 15 additions and 8 deletions
|
|
@ -162,6 +162,15 @@ class MountingProgress: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
func progressCallback(progress: size_t, total: size_t, context: UnsafeMutableRawPointer?) {
|
||||
let percentage = Double(progress) / Double(total) * 100.0
|
||||
print("Mounting progress: \(percentage)%")
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.mountProgress = percentage
|
||||
}
|
||||
}
|
||||
|
||||
func pubMount() { mount() }
|
||||
|
||||
private func mount() {
|
||||
|
|
|
|||
|
|
@ -15,10 +15,7 @@ typealias ImageMounterHandle = OpaquePointer
|
|||
typealias LockdowndClientHandle = OpaquePointer
|
||||
|
||||
func progressCallback(progress: size_t, total: size_t, context: UnsafeMutableRawPointer?) {
|
||||
let percentage = Double(progress) / Double(total) * 100.0
|
||||
print("Mounting progress: \(percentage)%")
|
||||
|
||||
MountingProgress.shared.mountProgress = percentage
|
||||
MountingProgress.shared.progressCallback(progress: progress, total: total, context: context)
|
||||
}
|
||||
|
||||
func readFile(path: String) -> Data? {
|
||||
|
|
@ -50,6 +47,7 @@ func htons(_ value: UInt16) -> UInt16 {
|
|||
}
|
||||
|
||||
func isMounted() -> Bool {
|
||||
return false // MARK: REMEMBER THIS
|
||||
var addr = sockaddr_in()
|
||||
memset(&addr, 0, MemoryLayout<sockaddr_in>.size)
|
||||
addr.sin_family = sa_family_t(AF_INET)
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ struct SettingsView: View {
|
|||
.foregroundColor(.primary)
|
||||
.padding(.bottom, 4)
|
||||
|
||||
if self.mounted {
|
||||
if self.mounted || (mountProg.mountProgress == 100) {
|
||||
HStack {
|
||||
Spacer()
|
||||
Text("✓ Developer Disk Image Mounted Sucessfully!")
|
||||
|
|
@ -199,7 +199,7 @@ struct SettingsView: View {
|
|||
.font(.system(.caption, design: .rounded))
|
||||
.foregroundColor(.secondary)
|
||||
Spacer()
|
||||
Text("\(Int(MountingProgress.shared.mountProgress))%")
|
||||
Text("\(Int(mountProg.mountProgress))%")
|
||||
.font(.system(.caption, design: .rounded))
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
|
|
@ -212,8 +212,8 @@ struct SettingsView: View {
|
|||
|
||||
RoundedRectangle(cornerRadius: 6)
|
||||
.fill(Color.green)
|
||||
.frame(width: geometry.size.width * CGFloat(MountingProgress.shared.mountProgress), height: 10)
|
||||
.animation(.linear(duration: 0.3), value: MountingProgress.shared.mountProgress)
|
||||
.frame(width: geometry.size.width * CGFloat(mountProg.mountProgress), height: 10)
|
||||
.animation(.linear(duration: 0.3), value: mountProg.mountProgress)
|
||||
}
|
||||
}
|
||||
.frame(height: 10)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue