Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cephei breaks navigationBar.barTintColor and other properties of non Cephei Preference Bundles #56

Open
ghost opened this issue Oct 31, 2021 · 9 comments

Comments

@ghost
Copy link

ghost commented Oct 31, 2021

Good evening!
This is the current situation: If an user opens a preference bundle which is powered by Cephei and then opens another preference bundle which also modifies navigationBar properties (like barTintColor, translucent and shadowImage) then these properties get overwritten by Cephei. I found an example of this in the wild in Skitties tweak Six (LS). Additionally you can also check out how Skitty sets the barTintColor here.
CepheiNavigationBarBug
It does not seem like this is caused by a specific Cephei version since Cephei 1.15.1 also has the same breaking effects. Could you please fix this behaviour so that other peoples code doesn't break 😊
Thank you!

@kirb
Copy link
Member

kirb commented Nov 1, 2021

Thanks for reporting. Which iOS version is this on? I think this should only be possible on iOS 12 and older, because on iOS 13+ Cephei uses the much nicer public API for this rather than the hacky stuff it used to do. Though it’s possible some of that old logic is still applying to iOS 13+ for some reason, or perhaps we override the bar appearance properties when we aren’t meant to.

@kirb
Copy link
Member

kirb commented Nov 1, 2021

It could possibly also have something to do with SkittyPrefs using the old approach (setting properties on navigationBar directly) rather than the modern iOS 13+ approach (setting UINavigationBarAppearance properties on the navigationItem, see here for the exact logic Cephei uses).

@ghost
Copy link
Author

ghost commented Nov 1, 2021

Hey @kirb! I am experiencing this issue on an iPhone 11 Pro on iOS 14.3 (Taurine Jailbreak).
I did a bit of inspecting with FLEXing and all UINavigationBarAppearances and the hb_appearanceSettings of self.navigationItem and PSUIPrefsListController.navigationItem are still nil when the bug is triggered. I would guess that some faulty <iOS 12 code gets run. What's strange is that self.navigationController.navigationController.navigationBar.barTintColor does not get overwritten (It's still red in FLEXing).

@ghost
Copy link
Author

ghost commented Nov 1, 2021

Wait, I might have something here.
The id hb_appearanceSettings and UINavigationBarAppearance* standartAppearance are not nil in self.navigationController.navigationController.navigationBar (After the bug was triggered). Sadly manually changing them to nil using FLEXing does nothing.

@ghost
Copy link
Author

ghost commented Nov 5, 2021

Hey @kirb, any new progress or intel so far?

@ghost
Copy link
Author

ghost commented Nov 6, 2021

I can now say for certain, that the existente of standartAppearance in the UINavigationBar causes this behaviour. I was able to replicate it in a non Cephei project and it seems unfixable since standartAppearance can't be set to be nil again (at least not with pure Objective-C code).
There are now three ways to handle this issue:

  1. Change the Cephei logic to use the legacy way of styling the UINavigationBar (This would guarantee the most compatibility)
  2. Trying to make a fix using a hook in UINavigationBar
  3. Not fixing it (aka everyone else should use the non legacy way of styling the UINavigationBar)

It is now up to you to decide which option seems to be the most rational ☺.

@kirb
Copy link
Member

kirb commented Nov 6, 2021

Thanks heaps for confirming.

I do feel we should all be migrating to the modern APIs, so I’d rather not be downgrading back to the old method in Cephei. The old way was awful, Cephei makes a few hooks to make that work better than it does even in App Store apps, but I don’t want to rely on that going forward.

It’s worth me going over all of the appearance logic and making sure any changes only apply when an appearance settings object has been set. Just quickly re-reading Tint.x right now I already spotted a bug that when the appearance settings is nil, it falls back to a clean HBAppearanceSettings object, which then overrides self.tintColor with nil. I think a few other places are similar. Really if the appearance settings is nil, it should just return and do nothing (with an exception that before iOS 13, we still need to apply the tint color animation hack). Will keep looking into this when I get some time to.

@ghost
Copy link
Author

ghost commented Nov 6, 2021

Sounds great!
I will personally switch to the "new" API, it's just a bummer that that causes issues in other peoples projects 😞 Additionally I believe it would be fair to mention this behaviour in Cepheis documentation. I will close this issue now since you'll just have to make small optimizations and bug fixes on your end.
Have a great weekend! ✨

@ghost ghost closed this as completed Nov 6, 2021
@kirb
Copy link
Member

kirb commented Nov 6, 2021

Thanks again for posting this! I’ll reopen it so I have something to track progress of reviewing the tint logic.

@kirb kirb reopened this Nov 6, 2021
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

No branches or pull requests

1 participant