diff --git a/ExactTimePhone.plist b/ExactTimePhone.plist new file mode 100644 index 0000000..7a7fd62 --- /dev/null +++ b/ExactTimePhone.plist @@ -0,0 +1 @@ +{ Filter = { Bundles = ( "com.apple.mobilephone" ); }; } diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c128265 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +export ARCHS = armv7 arm64 + +include $(THEOS)/makefiles/common.mk + +TWEAK_NAME = ExactTimePhone +ExactTimePhone_FILES = Tweak.xm +ExactTimePhone_CFLAGS = -fobjc-arc + +include $(THEOS_MAKE_PATH)/tweak.mk + +after-install:: + install.exec "killall -9 MobilePhone" diff --git a/Tweak.xm b/Tweak.xm new file mode 100644 index 0000000..5daf1d3 --- /dev/null +++ b/Tweak.xm @@ -0,0 +1,40 @@ +@interface UIDateLabel : UILabel +@property (nonatomic, strong) NSDate *date; +@end + +@interface MPRecentsTableViewCell +@property (nonatomic, strong) UIDateLabel *callerDateLabel; +@end + +static bool is24h; + + +%hook MPRecentsTableViewCell +-(void)layoutSubviews{ + %orig; + if(![self.callerDateLabel.text containsString:@":"]){ + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + if(is24h){ + [dateFormatter setDateFormat:@"\nHH:mm"]; + }else{ + [dateFormatter setDateFormat:@"\nh:mm a"]; + } + + self.callerDateLabel.textAlignment = 2; + self.callerDateLabel.numberOfLines = 2; + self.callerDateLabel.text = [self.callerDateLabel.text stringByAppendingString:[dateFormatter stringFromDate:self.callerDateLabel.date]]; + } + +} +%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); +} \ No newline at end of file diff --git a/control b/control new file mode 100644 index 0000000..5693ae9 --- /dev/null +++ b/control @@ -0,0 +1,9 @@ +Package: com.gilshahar7.exacttimephone +Name: ExactTimePhone +Depends: mobilesubstrate +Version: 1.0 +Architecture: iphoneos-arm +Description: Adds an exact time to the calls log in the stock phone app. +Maintainer: gilshahar7 +Author: gilshahar7 +Section: Tweaks diff --git a/packages/com.gilshahar7.exacttimephone_1.0_iphoneos-arm.deb b/packages/com.gilshahar7.exacttimephone_1.0_iphoneos-arm.deb new file mode 100644 index 0000000..cec9fac Binary files /dev/null and b/packages/com.gilshahar7.exacttimephone_1.0_iphoneos-arm.deb differ