summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrant Paul <chpwn@chpwn.com>2011-02-03 15:40:19 -0800
committerGrant Paul <chpwn@chpwn.com>2011-02-03 15:40:19 -0800
commit79b42fd1b46eab09474ab4530e6959a52676b079 (patch)
tree35be39a93cd4a8ab70c88395b8309aac609078d1
parent0c1cb67a559b2077dddedf7eab3251a3e4cc0812 (diff)
Fix VoiceOver (at least on 4.x). Does not cause issues on other firmwares, since if the fix does not work it will just bail out (checks all methods, etc).
-rw-r--r--MobileCydia.mm34
1 files changed, 34 insertions, 0 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 5a5afed..ee88c00 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -9089,6 +9089,33 @@ MSHook(void, UIHardware$_playSystemSound$, Class self, SEL _cmd, int sound) {
}
}
+Class $UIApplication;
+
+MSHook(void, UIApplication$_updateApplicationAccessibility, UIApplication *self, SEL _cmd) {
+ static BOOL initialized = NO;
+ static BOOL started = NO;
+
+ NSDictionary *dict([[[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.apple.Accessibility.plist"] autorelease]);
+ BOOL enabled = [[dict objectForKey:@"VoiceOverTouchEnabled"] boolValue] || [[dict objectForKey:@"VoiceOverTouchEnabledByiTunes"] boolValue];
+
+ if ([self respondsToSelector:@selector(_accessibilityBundlePrincipalClass)]) {
+ id bundle = [self performSelector:@selector(_accessibilityBundlePrincipalClass)];
+ if (![bundle respondsToSelector:@selector(_accessibilityStopServer)]) return;
+ if (![bundle respondsToSelector:@selector(_accessibilityStartServer)]) return;
+
+ if (initialized && !enabled) {
+ initialized = NO;
+ [bundle performSelector:@selector(_accessibilityStopServer)];
+ } else if (enabled) {
+ initialized = YES;
+ if (!started) {
+ started = YES;
+ [bundle performSelector:@selector(_accessibilityStartServer)];
+ }
+ }
+ }
+}
+
int main(int argc, char *argv[]) { _pooled
_trace();
@@ -9116,6 +9143,13 @@ int main(int argc, char *argv[]) { _pooled
_UIHardware$_playSystemSound$ = reinterpret_cast<void (*)(Class, SEL, int)>(method_getImplementation(UIHardware$_playSystemSound$));
method_setImplementation(UIHardware$_playSystemSound$, reinterpret_cast<IMP>(&$UIHardware$_playSystemSound$));
}
+
+ $UIApplication = objc_getClass("UIApplication");
+ Method UIApplication$_updateApplicationAccessibility(class_getInstanceMethod($UIApplication, @selector(_updateApplicationAccessibility)));
+ if (UIApplication$_updateApplicationAccessibility != NULL) {
+ _UIApplication$_updateApplicationAccessibility = reinterpret_cast<void (*)(UIApplication *, SEL)>(method_getImplementation(UIApplication$_updateApplicationAccessibility));
+ method_setImplementation(UIApplication$_updateApplicationAccessibility, reinterpret_cast<IMP>(&$UIApplication$_updateApplicationAccessibility));
+ }
/* }}} */
/* Set Locale {{{ */
Locale_ = CFLocaleCopyCurrent();