diff --git a/ExactTime.plist b/ExactTime.plist new file mode 100644 index 0000000..10dc654 --- /dev/null +++ b/ExactTime.plist @@ -0,0 +1 @@ +{ Filter = { Bundles = ( "com.apple.springboard" ); }; } diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..55c9f08 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +ARCHS = armv7 arm64 +include $(THEOS)/makefiles/common.mk + +TWEAK_NAME = ExactTime +ExactTime_FILES = Tweak.xm + +include $(THEOS_MAKE_PATH)/tweak.mk + +after-install:: + install.exec "killall -9 SpringBoard" diff --git a/Tweak.xm b/Tweak.xm new file mode 100644 index 0000000..bbc54c8 --- /dev/null +++ b/Tweak.xm @@ -0,0 +1,47 @@ +@interface NCNotificationDateLabel +@property (assign,nonatomic) NSString *text; +-(void)sizeToFit; +@end + +@interface NCLookHeaderContentView +-(void)_updateDateLabelFontForShortLook; +@end + +static bool is24h; + +%hook NCLookHeaderContentView +-(void)_updateDateLabelFontForShortLook{ + %orig; + NSDate *date = MSHookIvar(self, "_date"); + NSInteger format = MSHookIvar(self, "_dateFormatStyle"); + if((date != nil) && (format == 1)){ + NCNotificationDateLabel *dateLabel = MSHookIvar(self, "_dateLabel"); + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + if(is24h) + { + [dateFormatter setDateFormat:@"HH:mm"]; + }else{ + [dateFormatter setDateFormat:@"hh:mm a"]; + } + dateLabel.text = [dateFormatter stringFromDate:date]; + [dateLabel sizeToFit]; + [dateFormatter release]; + } +} +-(void)dateLabelDidChange:(id)arg1{ + %orig(arg1); + [self _updateDateLabelFontForShortLook]; +} +%end + +%ctor{ + NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; + [formatter setLocale:[NSLocale currentLocale]]; + [formatter setDateStyle:NSDateFormatterNoStyle]; + [formatter setTimeStyle:NSDateFormatterShortStyle]; + NSString *dateString = [formatter stringFromDate:[NSDate date]]; + NSRange amRange = [dateString rangeOfString:[formatter AMSymbol]]; + NSRange pmRange = [dateString rangeOfString:[formatter PMSymbol]]; + is24h = (amRange.location == NSNotFound && pmRange.location == NSNotFound); + [formatter release]; +} \ No newline at end of file diff --git a/control b/control new file mode 100644 index 0000000..a2d4fd2 --- /dev/null +++ b/control @@ -0,0 +1,9 @@ +Package: com.gilshahar7.exacttime +Name: ExactTime +Depends: mobilesubstrate +Version: 1.0 +Architecture: iphoneos-arm +Description: Shows the exact time of a notification. +Maintainer: gilshahar7 +Author: gilshahar7 +Section: Tweaks diff --git a/packages/com.gilshahar7.exacttime_0.0.1_iphoneos-arm.deb b/packages/com.gilshahar7.exacttime_0.0.1_iphoneos-arm.deb new file mode 100644 index 0000000..5764b98 Binary files /dev/null and b/packages/com.gilshahar7.exacttime_0.0.1_iphoneos-arm.deb differ diff --git a/packages/com.gilshahar7.exacttime_1.0_iphoneos-arm.deb b/packages/com.gilshahar7.exacttime_1.0_iphoneos-arm.deb new file mode 100644 index 0000000..38c9a25 Binary files /dev/null and b/packages/com.gilshahar7.exacttime_1.0_iphoneos-arm.deb differ