Created
November 5, 2012 13:57
-
-
Save S1ReX/4017301 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static BOOL _enabled = YES; | |
%hook SBAssistantUserUtteranceController | |
- (BOOL)isCorrectable | |
{ | |
if (_enabled) | |
return NO; | |
else | |
return %orig; | |
} | |
%end | |
static void noCorrectSettings() { | |
NSDictionary *prefrences = [[NSDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.sirex.sirimod.plist"]; | |
_enabled = (BOOL)[[prefrences objectForKey:@"noCorrect"] boolValue]; | |
[prefrences release]; | |
} | |
%hook SBAssistantBasicViewController | |
- (id)view | |
{ | |
if (_enabled) | |
return nil; | |
else | |
return %orig; | |
} | |
%end | |
static void LoadSettings() { | |
NSDictionary *prefrences = [[NSDictionary alloc] initWithContentsOfFile:@"/User/Library/Preferences/com.sirex.sirimod.plist"]; | |
_enabled = (BOOL)[[prefrences objectForKey:@"invisibleSiri"] boolValue]; | |
[prefrences release]; | |
} | |
static void SettingsChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { | |
LoadSettings(); | |
} | |
%ctor { | |
LoadSettings(); | |
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, SettingsChanged, CFSTR("com.sirex.sirimod/updated"), NULL, CFNotificationSuspensionBehaviorCoalesce); | |
noCorrectSettings(); | |
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, SettingsChanged, CFSTR("com.sirex.sirimod/updated"), NULL, CFNotificationSuspensionBehaviorCoalesce); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment