Skip to content

Commit 63d29d0

Browse files
committed
fix revert and minor improvements
1 parent c3ebd09 commit 63d29d0

1 file changed

Lines changed: 30 additions & 26 deletions

File tree

lara/views/tweaks/MiscView.swift

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ enum FileLocation: String, CaseIterable {
4040
// case ota = "/var/Managed Preferences/mobile/com.apple.MobileAsset.plist"
4141
}
4242

43+
// this only works for keys that are false by default as of now
4344
struct tweak: Identifiable {
4445
var id: String { key }
4546
var name: String
@@ -63,28 +64,34 @@ struct MiscView: View {
6364
@ObservedObject private var mgr = laramgr.shared
6465
let fm = FileManager.default
6566
@State private var tweaks: [tweaksection] = [
66-
tweaksection(name: "SpringBoard", icon: "iphone", tweaks: [
67-
tweak(name: "Disable airdrop time limit for everyone option", path: FileLocation.airdrop.rawValue, key: "OverrideTimeLimitEveryoneMode"),
68-
tweak(name: "Disable lock after respring", path: FileLocation.springboard.rawValue, key: "SBDontLockAfterCrash"),
69-
tweak(name: "Disable screen dimming while charging", path: FileLocation.springboard.rawValue, key: "SBDontDimOrLockOnAC"),
70-
tweak(name: "Disable low battery alerts", path: FileLocation.springboard.rawValue, key: "SBHideLowPowerAlerts"),
71-
tweak(name: "Hide AC Power on lockscreen", path: FileLocation.springboard.rawValue, key: "SBHideACPower"),
72-
tweak(name: "Disable breadcrumbs", info: "Removes '< PreviousAppName' glyph in Status Bar when being forwarded to another app.", path: FileLocation.springboard.rawValue, key: "SBNeverBreadcrumb"),
73-
tweak(name: "Show supervision text on lockscreen", info: "Shows info about the device supervision status and organization at the bottom of the lock screen.", path: FileLocation.springboard.rawValue, key: "SBShowSupervisionTextOnLockScreen"),
74-
tweak(name: "Show Dynamic Island in screenshots", path: FileLocation.springboard.rawValue, key: "SBAlwaysShowSystemApertureInSnapshots"),
67+
tweaksection(name: "User Interface", icon: "eye", tweaks: [
7568
tweak(name: "Hide Dynamic Island completely", path: FileLocation.springboard.rawValue, key: "SBSuppressDynamicIslandCompletely"),
76-
tweak(name: "Enable airplay support for Stage Manager", path: FileLocation.springboard.rawValue, key: "SBExtendedDisplayOverrideSupportForAirPlayAndDontFileRadars"),
77-
tweak(name: "Show Red/Green Authentication Line on Lock Screen", path: FileLocation.springboard.rawValue, key: "SBExtendedDisplayOverrideSupportForAirPlayAndDontFileRadars")
78-
]),
79-
tweaksection(name: "Internal", icon: "gear", tweaks: [
69+
tweak(name: "Show Red/Green Authentication Line on Lock Screen", path: FileLocation.springboard.rawValue, key: "SBExtendedDisplayOverrideSupportForAirPlayAndDontFileRadars"),
8070
tweak(name: "Show Build Version in Status Bar", path: FileLocation.globalPreferences.rawValue, key: "UIStatusBarShowBuildVersion"),
8171
tweak(name: "Force Right-to-Left Layout", path: FileLocation.globalPreferences.rawValue, key: "NSForceRightToLeftWritingDirection"),
8272
tweak(name: "Force Left-to-Right Layout", path: FileLocation.globalPreferences.rawValue, key: "NSForceLeftToRightWritingDirection"),
83-
tweak(name: "Show Hidden Icons on Home Screen", info: "Shows hidden apps like Field Test and Continuity on the home screen.", path: FileLocation.globalPreferences.rawValue, key: "SBIconVisibility"),
8473
tweak(name: "Keyboard Character Flick", info: "Enables the iPad-style keyboard keyflicks on iPhones.", path: FileLocation.globalPreferences.rawValue, key: "GesturesEnabled"),
8574
tweak(name: "Disable Clock Icon Seconds Hand", path: FileLocation.globalPreferences.rawValue, key: "SBDisableClockIconSecondsHand"),
86-
tweak(name: "Disable Spotlight Searching in Websites", path: FileLocation.globalPreferences.rawValue, key: "SBSearchDisabledDomains"),
8775
tweak(name: "Show Hardware Button Hints in Screenshots", path: FileLocation.globalPreferences.rawValue, key: "SBHardwareButtonHintDropletsAlwaysVisibleInSnapshots"),
76+
tweak(name: "Hide Respring Icon", path: FileLocation.backboardd.rawValue, key: "BKHideAppleLogoOnLaunch"),
77+
tweak(name: "Disable Breadcrumbs", info: "Removes '< PreviousAppName' glyph in Status Bar when being forwarded to another app.", path: FileLocation.springboard.rawValue, key: "SBNeverBreadcrumb"),
78+
tweak(name: "Show Supervision Text on Lock Screen", info: "Shows info about the device supervision status and organization at the bottom of the lock screen.", path: FileLocation.springboard.rawValue, key: "SBShowSupervisionTextOnLockScreen")
79+
]),
80+
tweaksection(name: "System", icon: "gear", tweaks: [
81+
tweak(name: "Disable AirDrop Time Limit for Everyone Option", path: FileLocation.airdrop.rawValue, key: "OverrideTimeLimitEveryoneMode"),
82+
tweak(name: "Disable Lock After Respring", path: FileLocation.springboard.rawValue, key: "SBDontLockAfterCrash"),
83+
tweak(name: "Disable screen dimming while charging", path: FileLocation.springboard.rawValue, key: "SBDontDimOrLockOnAC"),
84+
tweak(name: "Disable low battery alerts", path: FileLocation.springboard.rawValue, key: "SBHideLowPowerAlerts"),
85+
tweak(name: "Hide AC Power on Lock Screen", path: FileLocation.springboard.rawValue, key: "SBHideACPower"),
86+
tweak(name: "Show Dynamic Island in Screenshots", path: FileLocation.springboard.rawValue, key: "SBAlwaysShowSystemApertureInSnapshots"),
87+
tweak(name: "Enable AirPlay support for Stage Manager", path: FileLocation.springboard.rawValue, key: "SBExtendedDisplayOverrideSupportForAirPlayAndDontFileRadars"),
88+
tweak(name: "Show Hidden Icons on Home Screen", info: "Shows hidden apps like Field Test and Continuity on the home screen.", path: FileLocation.globalPreferences.rawValue, key: "SBIconVisibility"),
89+
tweak(name: "Disable Spotlight Searching in Websites", path: FileLocation.globalPreferences.rawValue, key: "SBSearchDisabledDomains"),
90+
tweak(name: "Vibrate on Raise-to-Wake", path: FileLocation.coreMotion.rawValue, key: "EnableWakeGestureHaptic"),
91+
tweak(name: "Play Sound on Paste", path: FileLocation.pasteboard.rawValue, key: "PlaySoundOnPaste"),
92+
tweak(name: "Show Notifications for System Pastes", path: FileLocation.pasteboard.rawValue, key: "AnnounceAllPastes")
93+
]),
94+
tweaksection(name: "Debugging", icon: "ladybug.fill", tweaks: [
8895
tweak(name: "Metal HUD Debug", path: FileLocation.globalPreferences.rawValue, key: "MetalForceHudEnabled"),
8996
tweak(name: "iMessage Debugging", path: FileLocation.globalPreferences.rawValue, key: "iMessageDiagnosticsEnabled"),
9097
tweak(name: "Continuity Debugging", path: FileLocation.globalPreferences.rawValue, key: "IDSDiagnosticsEnabled"),
@@ -93,11 +100,7 @@ struct MiscView: View {
93100
tweak(name: "App Store Debug Gesture", path: FileLocation.appStore.rawValue, key: "debugGestureEnabled"),
94101
tweak(name: "Notes Debug Mode", path: FileLocation.notes.rawValue, key: "DebugModeEnabled"),
95102
tweak(name: "Show Touches With Debug Info", path: FileLocation.backboardd.rawValue, key: "BKDigitizerVisualizeTouches"),
96-
tweak(name: "Hide respring icon", path: FileLocation.backboardd.rawValue, key: "BKHideAppleLogoOnLaunch"),
97-
tweak(name: "Vibrate on Raise-to-Wake", path: FileLocation.coreMotion.rawValue, key: "EnableWakeGestureHaptic"),
98-
tweak(name: "Play Sound on Paste", path: FileLocation.pasteboard.rawValue, key: "PlaySoundOnPaste"),
99-
tweak(name: "Show Notifications for System Pastes", path: FileLocation.pasteboard.rawValue, key: "AnnounceAllPastes"),
100-
]),
103+
])
101104
]
102105

103106
var body: some View {
@@ -123,7 +126,7 @@ struct MiscView: View {
123126
}
124127
}
125128

126-
// yes this is almost exactly the same as dirtyZeroView, the whole view is
129+
// yes this is copied from dirtyZeroView, the whole view is
127130
private var tweaksui: some View {
128131
ForEach($tweaks) { $section in
129132
Section(header: HeaderDropdown(text: section.name, icon: section.icon, isExpanded: $section.isexpanded, useItemCount: true, itemCount: section.tweaks.count)) {
@@ -154,7 +157,6 @@ struct MiscView: View {
154157
if result.ok, let value = result.value as? Bool {
155158
tweak.state.og = value
156159
tweak.state.enabled = value
157-
mgr.logmsg("Loaded tweak \(tweak.key) at \(tweak.path) with value \(value)")
158160
} else if !(result.message == "key \(tweak.key) not found") {
159161
errormsg += "Failed to read \(tweak.path): \(result.message)\n"
160162
tweak.readfailed = true
@@ -171,7 +173,7 @@ struct MiscView: View {
171173

172174
func apply() {
173175
var errormsg = ""
174-
// check if the tweak was modified, else just leave it
176+
// only apply modified tweaks
175177
for section in tweaks {
176178
for tweak in section.tweaks where tweak.state.og != tweak.state.enabled {
177179
let result = mgr.setplistvalue(path: tweak.path, key: (tweak.key, tweak.state.enabled ? true : nil), force: true)
@@ -193,9 +195,11 @@ struct MiscView: View {
193195
var errormsg = ""
194196
for section in tweaks {
195197
for tweak in section.tweaks {
196-
let result = mgr.setplistvalue(path: tweak.path, key: (tweak.key, nil))
197-
if !result.ok {
198-
errormsg += "Failed to reset tweak \(tweak.key) at \(tweak.path): \(result.message)\n"
198+
if fm.fileExists(atPath: tweak.path) {
199+
let result = mgr.setplistvalue(path: tweak.path, key: (tweak.key, nil))
200+
if !result.ok {
201+
errormsg += "Failed to reset tweak \(tweak.key) at \(tweak.path): \(result.message)\n"
202+
}
199203
}
200204
}
201205
}

0 commit comments

Comments
 (0)