hbang / libcephei

Useful functions for tweak developers
https://hbang.github.io/libcephei
Other
207 stars 34 forks source link

Allow SFSymbols to be used from .plist #49

Closed AzzouQ closed 3 years ago

AzzouQ commented 3 years ago

This PR will allow user to set a SFSymbols as property for specifier directly from .plist using

<key>iconImageSystem</key>
<dict>
  <key>name</key>
  <string>chevron.left.slash.chevron.right</string>
  <key>scale</key>
  <integer>1</integer> <-- or <string>small</string> or <string>UIImageSymbolScaleSmall</string> -->
  <key>weight</key>
  <integer>2</integer> <-- or <string>thin</string> or <string>UIImageSymbolWeightThin</string> -->
  <key>pointSize</key>
  <float>25.0</float>
</dict>

I'm not sure about the imageSystemWeight or imageSystemScale implementation, as it's very verbose, but as I'm not jailbroken atm, it's hard to test things out. It need to be tested for the same reason 😓 Should work tho. Also I wasn't sure about the syntax here specifier.properties[@"iconImage"] = [self imageSystemFromDict:specifier.properties[@"iconImageSystem"]; so I left another one in comment, feel free to pick the one you want (or the one who works).

AzzouQ commented 3 years ago

The 3 key supported in .plist are respectively: 'iconImageSystem' for 'iconImage' 'leftImageSystem' for 'leftImage' (PSSliderCell) 'rightImageSystem' for 'rightImage' (PSSliderCell)

kirb commented 3 years ago

Did some cleanup, squashed commits, and merged in 827f413. Thanks heaps for contributing!

I had to make a few changes so this code would compile and not blow up before iOS 13, and additionally I did the cleanup we discussed. I also slipped in another param to specify a tintColor.