How to assign an Activator action from the settings panel
I am following this tutorial http://www.iphonedevwiki.net/index.php/Libactivator to change the activation method in the settings panel (Settings app). This does not work. But I change the activation method via Activator (download and install from Cydia source), it works correctly. So where is my mistake?
Control
Package: com.example.mytweak
Name: MyTweak
Description: A simple MobileSubstrate tweak!
Version: 0.0.1
Priority: optional
Section: Tweaks
Architecture: iphoneos-arm
Depends: mobilesubstrate, libactivator
Maintainer: Maintainer name
Author: Author name
Makefile
include theos/makefiles/common.mk
TWEAK_NAME = MyTweak
MyTweak_FILES = Tweak.xm
MyTweak_FRAMEWORKS = UIKit AVFoundation
MyTweak_LIBRARIES = activator
include $(THEOS_MAKE_PATH)/tweak.mk
internal-stage::
#PreferenceLoader plist
$(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END)
$(ECHO_NOTHING)cp Preferences.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/MyTweak.plist$(ECHO_END)
after-install::
install.exec "killall -9 SpringBoard"
MyTweak.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Filter</key>
<dict>
<key>Bundles</key>
<array>
<string>com.apple.springboard</string>
</array>
</dict>
</dict>
</plist>
Preferences.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>entry</key>
<dict>
<key>cell</key>
<string>PSLinkCell</string>
<key>defaults</key>
<string>com.example.mytweak</string>
<key>label</key>
<string>MyTweak</string>
<key>key</key>
<string>enabled</string>
<key>default</key>
<true/>
<key>icon</key>
<string>/Applications/Preferences.app/icon-table@2x.png</string>
<key>PostNotification</key>
<string>com.example.mytweak/preferences.changed</string>
<key>items</key>
<array>
<dict>
<key>cell</key>
<string>PSLinkCell</string>
<key>label</key>
<string>Activation Methods</string>
<key>isController</key>
<true/>
<key>bundle</key>
<string>LibActivator</string>
<key>activatorListener</key>
<string>com.example.mytweak</string>
</dict>
</array>
</dict>
</dict>
</plist>
Tweak.xm
#import <libactivator/libactivator.h>
@interface MyTweakListener : NSObject <LAListener>
@end
@implementation MyTweakListener
- (void)activator:(LAActivator *)activator receiveEvent:(LAEvent *)event {
// Do something
[event setHandled:YES];
}
- (void)activator:(LAActivator *)activator abortEvent:(LAEvent *)event {
// Do something
}
+ (void)load {
if ([LASharedActivator isRunningInsideSpringBoard]) {
[LASharedActivator registerListener:[self new] forName:@"MyTweak"];
}
}
@end
+3
source to share
1 answer
I tried many solutions and I found the right solution. I need to change the LAListener execution
# 1: add a header for the listener
- (NSString *)activator:(LAActivator *)activator requiresLocalizedTitleForListenerName:(NSString *)listenerName {
return @"onClan Assistive Touch";
}
# 2: change listener name
before:
+ (void)load {
if ([LASharedActivator isRunningInsideSpringBoard]) {
[LASharedActivator registerListener:[self new] forName:@"MyTweak"];
}
}
after:
+ (void)load {
if ([LASharedActivator isRunningInsideSpringBoard]) {
[LASharedActivator registerListener:[self new] forName:@"com.example.mytweak"];
}
}
+2
source to share