static BOOL tweakEnBOOL; #define SETTINGSFILENEW "com.imokhles.Prefs" #define PREFERENCES_CHANGED_NOTIFICATION "com.imokhles.Prefs.preferences-changed" // non ARC static void iMoLoadPreferences() { CFPreferencesAppSynchronize(CFSTR(SETTINGSFILENEW)); tweakEnBOOL = !CFPreferencesCopyAppValue(CFSTR("Enabled"), CFSTR(SETTINGSFILENEW)) ? YES : [(id)CFBridgingRelease(CFPreferencesCopyAppValue(CFSTR("Enabled"), CFSTR(SETTINGSFILENEW))) boolValue]; } // with ARC static void iMoLoadPreferences() { CFPreferencesAppSynchronize(CFSTR(SETTINGSFILENEW)); tweakEnBOOL = !CFPreferencesCopyAppValue(CFSTR("Enabled"), CFSTR(SETTINGSFILENEW)) ? YES : [(id)CFPreferencesCopyAppValue(CFSTR("Enabled"), CFSTR(SETTINGSFILENEW)) boolValue]; } %ctor { CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)iMoLoadPreferences, CFSTR(PREFERENCES_CHANGED_NOTIFICATION), NULL, CFNotificationSuspensionBehaviorCoalesce); iMoLoadPreferences(); } // and to check value within tweak. // Example %hook SBLockScreenViewController - (void)finishUIUnlockFromSource:(int)arg1 { %orig(); if (tweakEnBOOL) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Unlock" message:@"your device unlock finished ;)" delegate:nil cancelButtonTitle:@"OK :)" otherButtonTitles:nil, nil]; [alertView show]; } } %end