summaryrefslogtreecommitdiff
path: root/MobileCydia.mm
diff options
context:
space:
mode:
authorGrant Paul <chpwn@chpwn.com>2011-02-03 16:01:35 -0800
committerGrant Paul <chpwn@chpwn.com>2011-02-03 16:01:35 -0800
commitfae8ee564d1871cd8850b16437294d07f77dc2da (patch)
tree0bd42a01011f3ac335a489b535086ce47fa4aedc /MobileCydia.mm
parent85b4bbb939822bf185bfadcfb534c93a03cea926 (diff)
parent003fc610c40f29f5e9195a890b198e48aad14c49 (diff)
Merge branch 'restructure' into develop-1.2
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r--MobileCydia.mm46
1 files changed, 46 insertions, 0 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 8b47cc2..ccec42b 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -5010,6 +5010,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[self setNeedsDisplay];
}
+- (NSString *) accessibilityLabel {
+ return [NSString stringWithFormat:UCLocalize("COLON_DELIMITED"), name_, description_];
+}
+
- (void) setPackage:(Package *)package {
[self clearPackage];
[package parse];
@@ -5238,6 +5242,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
[switch_ setFrame:CGRectMake(frame.size.width - 102, 9, rect.size.width, rect.size.height)];
}
+- (NSString *) accessibilityLabel {
+ return name_;
+}
+
- (void) drawContentRect:(CGRect)rect {
bool highlighted(highlighted_ && !editing_);
@@ -7592,6 +7600,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
} return self;
}
+- (NSString *) accessibilityLabel {
+ return label_;
+}
+
- (void) drawContentRect:(CGRect)rect {
bool highlighted(highlighted_);
float width(rect.size.width);
@@ -9305,6 +9317,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();
@@ -9332,6 +9371,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();