Closed recoveryawareness closed 1 year ago
Sorry for the late reply! You can use this:
import Jinx
import UIKit
struct CustomTabBarHook: Hook {
typealias T = @convention(c) (
AnyObject,
Selector,
Any?
) -> Void
let `class`: AnyClass? = objc_getClass("TFNCustomTabBar") as? AnyClass
let selector: Selector = sel_registerName("longPress:")
let replacement: T = { a0, a1, a2 in
// Replacement code goes here
}
}
struct DarkColorPaletteHook: Hook {
typealias T = @convention(c) (
AnyObject,
Selector
) -> UIColor
let `class`: AnyClass? = objc_getClass("TAEDarkColorPalette") as? AnyClass
let selector: Selector = sel_registerName("backgroundColor")
let replacement: T = { a0, a1 in
.red
}
}
struct Tweak {
static func ctor() {
CustomTabBarHook().hook()
DarkColorPaletteHook().hook()
}
}
@_cdecl("jinx_entry")
func jinx_entry() {
Tweak.ctor()
}
umm what about this I forgot to add it it in my initial comment: how can I have these 4 selectors in that one hook?? I obviously want all 4 of them to return 4 different colors like in the hook below, but I couldn't figure out how to use 4 different selectors in one class with your framework, is there a chance you could give me another example please??
%hook TAEDarkColorPalette
How would I do multiple methods in one Class like below?
%hook TAEDarkColorPalette (UIColor )backgroundColor { return .black } (UIColor )secondaryBackgroundColor { return .gray } (UIColor )textColor { return .white } (UIColor )textDetailsColor { return .red } %end
Not possible yet, I am planning to add in the near future
Sorry for the delay, I have added it now. Getting orig is a bit of a pain compared to the Hook protocol, but for returning a literal value it's relatively clean.
import Jinx
import UIKit
struct DarkColorPaletteHook: HookClass {
typealias T0 = @convention(c) (AnyObject, Selector) -> UIColor
let `class`: AnyClass? = objc_getClass("TAEDarkColorPalette") as? AnyClass
let hooks: [any Groupable] = [
SubHook(
selector: sel_registerName("backgroundColor"),
type: T0.self,
replacement: { _, _ in .black}
),
SubHook(
selector: sel_registerName("secondaryBackgroundColor"),
type: T0.self,
replacement: { _, _ in .gray }
),
SubHook(
selector: sel_registerName("textColor"),
type: T0.self,
replacement: { _, _ in .white }
),
SubHook(
selector: sel_registerName("textDetailsColor"),
type: T0.self,
replacement: { _, _ in .red }
)
]
}
perfect thank you so much, I will check this out :) can I buy u a coffee?
I appreciate the gesture, but no need to donate ☺️
What do I need to do to get this working with your framework:
%hook TFNCustomTabBar -(void)longPress:(id)arg1 { //return whatever code I want here } %end
%hook TAEDarkColorPalette