custom call to action

This commit is contained in:
lillian rose winter 2019-11-26 08:42:55 -06:00
parent 2ea70658ea
commit 7ec1e2f73e
2 changed files with 52 additions and 0 deletions

20
Tweak.x
View File

@ -11,6 +11,8 @@
#import "Headers.h"
NSString *ctaText = @"hanahaki"; //this is for the custom CTA
%hook NSObject
@interface NSObject (customObject)
- (BOOL)isSettingOn:(NSString *)keyStr;
@ -132,3 +134,21 @@
%orig(arg1);
}
%end
// CUSTOM CALL TO ACTION (press home to unlock)
%hook SBUICallToActionLabel
- (void)setText:(id)arg1 forLanguage:(id)arg2 animated:(bool)arg3 {
NSObject *object = [[NSObject alloc] init];
BOOL isSettingOn = [object isSettingOn:@"customctaction"];
if (isSettingOn) {
NSDictionary *pref = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"/var/mobile/Library/Preferences/toys.lily.hanahakiprefs.plist"]];
ctaText = [[pref objectForKey:@"customctatext"] stringValue];
return %orig(ctaText, arg2, arg3);
}
else {
return %orig(arg1, arg2, arg3);
}
}
%end

View File

@ -50,6 +50,38 @@
<key>label</key>
<string>rounded screen corners</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>lock screen</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>defaults</key>
<string>toys.lily.hanahakiprefs</string>
<key>key</key>
<string>customctaction</string>
<key>label</key>
<string>custom "press home to unlock" text</string>
</dict>
<dict>
<key>cell</key>
<string>PSEditTextCell</string>
<key>default</key>
<string>Press Home to Unlock</string>
<key>bestGuess</key>
<string>Press Home to Unlock</string>
<key>defaults</key>
<string>toys.lily.hanahakiprefs</string>
<key>key</key>
<string>customctatext</string>
<key>label</key>
<string>custom text</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>