Skip to content

Commit

Permalink
no require respring. on-demand setting read.
Browse files Browse the repository at this point in the history
  • Loading branch information
r-plus committed Apr 18, 2011
1 parent bb7c99e commit c73b019
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
8 changes: 1 addition & 7 deletions FakeClockUp.plist
@@ -1,7 +1 @@
{
Filter = {
Bundles = (
"com.apple.UIKit",
);
};
}
{ Filter = { Bundles = ( "com.apple.UIKit" ); }; }
1 change: 1 addition & 0 deletions Makefile
@@ -1,3 +1,4 @@
SDKVERSION = latest
include theos/makefiles/common.mk

TWEAK_NAME = FakeClockUp
Expand Down
22 changes: 14 additions & 8 deletions Tweak.xm
Expand Up @@ -10,21 +10,27 @@ static float durMulti = 1.0;
duration *= durMulti;
%orig;
}

%end

static void LoadSettings(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
{
NSDictionary *udDict = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/jp.novi.FakeClockUp.plist"];
if (udDict) {
float durm = [[udDict objectForKey:@"duration"] floatValue];
if (durm != 0.0 && durm >= 0.001 && durm <= 20) {
durMulti = durm;
}
}
}

__attribute__((constructor))
static void FakeClockUp_initializer()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

NSDictionary *udDict = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/jp.novi.FakeClockUp.plist"];

if (udDict) {
float durm = [[udDict objectForKey:@"duration"] floatValue];
if (durm != 0.0 && durm >= 0.001 && durm <= 20) {
durMulti = durm;
}
}
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, LoadSettings, CFSTR("jp.novi.FakeClockUp.preferencechanged"), NULL, CFNotificationSuspensionBehaviorCoalesce);
LoadSettings(nil,nil,nil,nil,nil);

[pool release];
}
2 changes: 1 addition & 1 deletion layout/DEBIAN/control
@@ -1,7 +1,7 @@
Package: jp.novi.FakeClockUp
Name: FakeClockUp
Homepage: http://hitoriblog.com/?p=1967
Version: 0.1.1
Version: 0.2
Section: Tweaks
Maintainer: moyashi <hitoriblog_NO_NO_SPAM@gmail.com>
Depends: mobilesubstrate, preferenceloader
Expand Down

0 comments on commit c73b019

Please sign in to comment.