Skip to content

Commit

Permalink
Merge remote-tracking branch 'hborders/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
moredip committed Dec 13, 2011
2 parents e8dbc77 + 61d4bc8 commit 6699cf1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/FrankLoader.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#import "FrankServer.h"

#import <dlfcn.h>

@implementation FrankLoader

+ (void)applicationDidBecomeActive:(NSNotification *)notification{
Expand All @@ -20,6 +22,30 @@ + (void)applicationDidBecomeActive:(NSNotification *)notification{
+ (void)load{
NSLog(@"Injecting Frank loader");

NSAutoreleasePool *autoreleasePool = [[NSAutoreleasePool alloc] init];
NSString *appSupportLocation = @"/System/Library/PrivateFrameworks/AppSupport.framework/AppSupport";

NSDictionary *environment = [[NSProcessInfo processInfo] environment];
NSString *simulatorRoot = [environment objectForKey:@"IPHONE_SIMULATOR_ROOT"];
if (simulatorRoot) {
appSupportLocation = [simulatorRoot stringByAppendingString:appSupportLocation];
}

void *appSupportLibrary = dlopen([appSupportLocation fileSystemRepresentation], RTLD_LAZY);

CFStringRef (*copySharedResourcesPreferencesDomainForDomain)(CFStringRef domain) = dlsym(appSupportLibrary, "CPCopySharedResourcesPreferencesDomainForDomain");

if (copySharedResourcesPreferencesDomainForDomain) {
CFStringRef accessibilityDomain = copySharedResourcesPreferencesDomainForDomain(CFSTR("com.apple.Accessibility"));

if (accessibilityDomain) {
CFPreferencesSetValue(CFSTR("ApplicationAccessibilityEnabled"), kCFBooleanTrue, accessibilityDomain, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
CFRelease(accessibilityDomain);
}
}

[autoreleasePool drain];

[[NSNotificationCenter defaultCenter] addObserver:[self class]
selector:@selector(applicationDidBecomeActive:)
name:@"UIApplicationDidBecomeActiveNotification"
Expand Down

0 comments on commit 6699cf1

Please sign in to comment.