Skip to content

Commit 0218c45

Browse files
committed
Add verification of MobileGestalt keys and current overrides functionality
1 parent 7fc41e4 commit 0218c45

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

lara/classes/MobileGestaltManager.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,21 @@ public class MobileGestaltManager: ObservableObject {
100100
return false
101101
}
102102

103+
// Return current in-memory overrides
104+
public func getCurrentOverrides() -> [String: String] {
105+
return overrides
106+
}
107+
108+
// Verify a key exists in the system MobileGestalt cache stored on disk (via KFS)
109+
public func verifyKeyInSystemCache(key: String) -> Bool? {
110+
let systemPath = "/var/containers/Shared/SystemGroup/systemgroup.com.apple.mobilegestaltcache/Library/Caches/com.apple.MobileGestalt.plist"
111+
guard laramgr.shared.kfsready else { return nil }
112+
guard let data = laramgr.shared.kfsread(path: systemPath) else { return nil }
113+
guard let mg = try? PropertyListSerialization.propertyList(from: data, options: [], format: nil) as? [String: Any] else { return nil }
114+
let cacheExtra = mg["CacheExtra"] as? [String: Any] ?? [:]
115+
return cacheExtra[key] != nil
116+
}
117+
103118
// Apply current overrides to MobileGestalt system cache plist via KFS
104119
public func applyOverridesToSystemCache() -> Bool {
105120
// system cache path used by EditorView

lara/views/MobileGestaltView.swift

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ struct MobileGestaltView: View {
1111
@State private var showRespringPrompt = false
1212
@State private var statusMessage: String? = nil
1313
@State private var showStatusAlert = false
14+
@State private var verificationResult: String? = nil
1415

1516
var body: some View {
1617
VStack {
@@ -116,7 +117,15 @@ struct MobileGestaltView: View {
116117
manager.refresh()
117118
if ok {
118119
statusMessage = "Applied overrides to system cache."
120+
// verify a representative key (Dynamic Island obfuscated key from EditorView)
121+
let dynKey = "YlEtTtHlNesRBMal1CqRaA"
122+
if let verified = manager.verifyKeyInSystemCache(key: dynKey) {
123+
verificationResult = verified ? "Verified: Dynamic Island key present in system cache." : "Verification: key not found in system cache."
124+
} else {
125+
verificationResult = "Verification unavailable (KFS read failed)."
126+
}
119127
showRespringPrompt = true
128+
showStatusAlert = true
120129
} else {
121130
statusMessage = "Failed to apply overrides."
122131
showStatusAlert = true
@@ -152,7 +161,12 @@ struct MobileGestaltView: View {
152161
.alert("Status", isPresented: $showStatusAlert) {
153162
Button("OK") { showStatusAlert = false }
154163
} message: {
155-
Text(statusMessage ?? "")
164+
VStack(alignment: .leading) {
165+
Text(statusMessage ?? "")
166+
if let v = verificationResult {
167+
Text(v).foregroundColor(.secondary)
168+
}
169+
}
156170
}
157171
}
158172
}

0 commit comments

Comments
 (0)