Skip to content

Commit

Permalink
temporally disabling daemon as it might result into app stability iss…
Browse files Browse the repository at this point in the history
…ues.
  • Loading branch information
Constantin Clerc committed Dec 21, 2023
1 parent 796ef01 commit e7cba50
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Binary file not shown.
8 changes: 4 additions & 4 deletions Geranium/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ struct ContentView: View {
Label("Home", systemImage: "house.fill")
}
// TOBEDONE
DaemonView()
.tabItem {
Label("Daemons", systemImage: "flag.fill")
}
// DaemonView()
// .tabItem {
// Label("Daemons", systemImage: "flag.fill")
// }
// TOBEFIXED (idk if it actually works ?
LocSimView()
.tabItem {
Expand Down
14 changes: 7 additions & 7 deletions Geranium/DaemonMan/DaemonDisabler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ import Foundation
func daemonManagement(key: String, value: Bool, plistPath: String) {
var result = ""
// copy plist
// is that catgpt ?
let appTmpDirURL = FileManager.default.temporaryDirectory.appendingPathComponent(Bundle.main.bundleIdentifier ?? "")
let error = RootHelper.copy(from: URL(fileURLWithPath: plistPath), to: URL(fileURLWithPath: "\(appTmpDirURL)/disabled.plist"))
guard let plistData = FileManager.default.contents(atPath: "\(appTmpDirURL)/disabled.plist"),
let error = RootHelper.copy(from: URL(fileURLWithPath: plistPath), to: URL(fileURLWithPath: "/var/mobile/Documents/disabled.plist"))
guard let plistData = FileManager.default.contents(atPath: "/var/mobile/Documents/disabled.plist"),
var plistDictionary = try? PropertyListSerialization.propertyList(from: plistData, options: [], format: nil) as? NSMutableDictionary
else {
print("Error")
return
}
plistDictionary[key] = value

print("new data being transmitted")
if let newData = try? PropertyListSerialization.data(fromPropertyList: plistDictionary, format: .xml, options: 0) {
do {
try newData.write(to: URL(fileURLWithPath: "\(appTmpDirURL)/disabled.plist"))
try newData.write(to: URL(fileURLWithPath: "/var/mobile/Documents/disabled.plist"))
} catch {
print("Error \(error)")
}
} else {
print("Error data convert")
}
// we need to do shit with roothelper
print("roothelper")
result = RootHelper.removeItem(at: URL(fileURLWithPath: plistPath))
print(result)
result = RootHelper.move(from: URL(fileURLWithPath :"\(appTmpDirURL)/disabled.plist"), to: URL(fileURLWithPath: plistPath))
print("roothelper2")
result = RootHelper.move(from: URL(fileURLWithPath :"/var/mobile/Documents/disabled.plist"), to: URL(fileURLWithPath: plistPath))
}

0 comments on commit e7cba50

Please sign in to comment.