Skip to content

Fix Cowabunga Tweaks UI#257

Merged
lunginspector merged 2 commits into
rooootdev:mainfrom
jurre111:fix-sb-ui
May 22, 2026
Merged

Fix Cowabunga Tweaks UI#257
lunginspector merged 2 commits into
rooootdev:mainfrom
jurre111:fix-sb-ui

Conversation

@jurre111
Copy link
Copy Markdown
Contributor

Fixes the buggy leminware.

Copilot AI review requested due to automatic review settings May 21, 2026 21:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the “SB Customizer” (SpringBoard Tools) UI/flow under Tweaks, primarily by refactoring the SpringBoard customizer view and wiring it to the shared laramgr so it can trigger actions like respring.

Changes:

  • Pass mgr into SpringBoardView from TweaksView.
  • Rebuild SpringBoardView from a custom grid/card UI into a NavigationStack + List UI with per-option segmented selection and (when applicable) color/blur controls.
  • Update apply/reset behavior and show an alert with an optional respring action after applying.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
lara/views/tweaks/TweaksView.swift Routes “SB Customizer” to SpringBoardView(mgr: mgr) so the view can use shared manager actions.
lara/views/tweaks/sbcustomizer/SpringBoardView.swift Refactors the SpringBoard Tools UI and refactors tweak application/overwrite logic into the view.
Comments suppressed due to low confidence (3)

lara/views/tweaks/sbcustomizer/SpringBoardView.swift:162

  • load() updates tweakOptions[i].value, but the subsequent conditional checks option.value from the pre-mutation copy in the loop. This can cause color/blur state not to load when the stored value is "Color". Use tweakOptions[i].value / tweakOptions[i].selectedOption for the check (or compute the updated value once and reuse it).
        for (i, option) in tweakOptions.enumerated() {
            tweakOptions[i].value = getDefaultStr(forKey: option.key)
            tweakOptions[i].selectedOption = tweakOptions[i].value
            if option.sbType != nil {
                if option.value == "Color" {
                    tweakOptions[i].color = SpringboardColorManager.getColor(forType: option.sbType!)
                    tweakOptions[i].blur = SpringboardColorManager.getBlur(forType: option.sbType!)
                }

lara/views/tweaks/sbcustomizer/SpringBoardView.swift:286

  • overwriteFile returns true from inside the for path in ... loop, so only the first replacement path is processed and the succeeded aggregation is effectively bypassed. Remove the early return and instead iterate all paths, updating succeeded based on each overwrite result, and return only after the loop completes.
            if replacementPaths[fileIdentifier] != nil {
                var succeeded = true
                for path in replacementPaths[fileIdentifier]! {
                    if fileIdentifier == "HomeBar" && value as? Bool == false {
                        if let url: URL = Bundle.main.url(forResource: "HomeBarAssets", withExtension: "car") {
                            do {
                                let replacementCar = try Data(contentsOf: url)
                                //try MDC.overwriteFile(at: "/System/Library/PrivateFrameworks/" + path, with: replacementCar)
                            } catch {
                                print(error.localizedDescription)
                                succeeded = false
                            }
                        } else {
                            print("Home bar file not found!")
                            return false
                        }
                    } else {
                        let randomGarbage = Data("###".utf8)
                        
                        let result = laramgr.shared.lara_overwritefile(target: "/System/Library/PrivateFrameworks/" + path, data: randomGarbage)
                        
                        if result.ok {
                            print("i hope it worked")
                        } else {
                            print("it didn't")
                        }
                        
                        return true
                    }

lara/views/tweaks/sbcustomizer/SpringBoardView.swift:286

  • The overwrite result is not used to determine success: even when result.ok is false, the function still returns true and does not set succeeded = false. Please propagate result.ok into succeeded (and avoid reporting success on failure).
                        let result = laramgr.shared.lara_overwritefile(target: "/System/Library/PrivateFrameworks/" + path, data: randomGarbage)
                        
                        if result.ok {
                            print("i hope it worked")
                        } else {
                            print("it didn't")
                        }
                        
                        return true
                    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lara/views/tweaks/sbcustomizer/SpringBoardView.swift
if succeeded {
print("Successfully applied tweak \"" + option.title + "\"")
} else {
print("Failed to apply tweak \"" + option.title + "\"!!!")
Comment on lines +256 to 293
if typeOfFile == OverwritingFileTypes.springboard {
// springboard tweak being applied
if replacementPaths[fileIdentifier] != nil {
var succeeded = true
for path in replacementPaths[fileIdentifier]! {
if fileIdentifier == "HomeBar" && value as? Bool == false {
if let url: URL = Bundle.main.url(forResource: "HomeBarAssets", withExtension: "car") {
do {
let replacementCar = try Data(contentsOf: url)
//try MDC.overwriteFile(at: "/System/Library/PrivateFrameworks/" + path, with: replacementCar)
} catch {
print(error.localizedDescription)
succeeded = false
}
} else {
print("Home bar file not found!")
return false
}
HStack {
Text("Blur: \(Int(option.blur))")
.frame(width: 125)
Spacer()
Slider(value: $option.blur, in: 0...150, step: 1.0)
.padding(.horizontal)
}
}

// MARK: Disabled Text
} else if option.selectedOption == "Disabled" {
Image(systemName: "x.circle")
.foregroundColor(.red)
.font(.system(size: 40))
}

Spacer()

Button(action: {
// save
UserDefaults.standard.set(option.selectedOption, forKey: option.key)
option.value = option.selectedOption
if option.selectedOption == "Color" || option.selectedOption == "Blur" {
do {
try SpringboardColorManager.createColor(forType: option.sbType!, color: CIColor(color: UIColor(option.color)), blur: Int(option.blur), asTemp: false)
print("Success")
} catch {
print(error.localizedDescription)
}
}

// close menu
if flippedOption!.title == option.title {
withAnimation(Animation.easeInOut(duration: CardAnimationSpeed)) {
flippedOption = nil
option.animate3d.toggle()
} else {
let randomGarbage = Data("###".utf8)

let result = laramgr.shared.lara_overwritefile(target: "/System/Library/PrivateFrameworks/" + path, data: randomGarbage)

if result.ok {
print("i hope it worked")
} else {
print("it didn't")
}

return true
}
}) {
Text("Save")
}
//.buttonStyle(TintedButton(color: .blue, fullwidth: true))
.padding(25)
return succeeded
}
.background(Color(.secondarySystemBackground))
.cornerRadius(10)
}

return true
}
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@jurre111
Copy link
Copy Markdown
Contributor Author

Yeah it's not perfect, but at least it's usable now. Kinda needs a rewrite...

@lunginspector lunginspector merged commit 668143a into rooootdev:main May 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants