From c49c91fa9f5f678a1f17596770aed1a87cb7f36e Mon Sep 17 00:00:00 2001 From: NeinZedd9 Date: Mon, 19 Mar 2018 12:29:11 -0700 Subject: [PATCH] Add files via upload --- DateUnderTimeX.plist | 5 +++ Makefile | 9 +++++ Tweak.xm | 80 ++++++++++++++++++++++++++++++++++++++++++++ control | 9 +++++ 4 files changed, 103 insertions(+) create mode 100644 DateUnderTimeX.plist create mode 100644 Makefile create mode 100644 Tweak.xm create mode 100644 control diff --git a/DateUnderTimeX.plist b/DateUnderTimeX.plist new file mode 100644 index 0000000..dec8769 --- /dev/null +++ b/DateUnderTimeX.plist @@ -0,0 +1,5 @@ +{ + Filter = { + Classes = ( "_UIStatusBarStringView", "_UIStatusBarTimeItem", "_UIStatusBarNavigationItem" ); + }; +} diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..601c8a7 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +include $(THEOS)/makefiles/common.mk + +TWEAK_NAME = DateUnderTimeX +DateUnderTimeX_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..03cba74 --- /dev/null +++ b/Tweak.xm @@ -0,0 +1,80 @@ +@interface _UIStatusBarStringView : UIView +@property (copy) NSString *text; +@property NSInteger numberOfLines; +@property (copy) UIFont *font; +@property NSInteger textAlignment; +@end + +%hook _UIStatusBarStringView + +- (void)setText:(NSString *)text { + if([text containsString:@":"]) { + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]; + dateFormatter.dateStyle = NSDateFormatterShortStyle; + NSDate *now = [NSDate date]; + NSString *shortDate = [dateFormatter stringFromDate:now]; + shortDate = [shortDate substringToIndex:[shortDate length]-3]; + NSString *newString = [NSString stringWithFormat:@"%@\n%@", text, shortDate]; + self.numberOfLines = 2; + self.textAlignment = 1; + [self setFont: [self.font fontWithSize:12]]; + %orig(newString); + } + else { + %orig(text); + } +} + +- (void)setCenter:(CGPoint)point { + if([self.text containsString:@":"]) { + point.x = 26.83333333333; + point.y = 6.666666666666; + } + %orig(point); +} + +%end + +@interface _UIStatusBarTimeItem +@property (copy) _UIStatusBarStringView *shortTimeView; +@property (copy) _UIStatusBarStringView *pillTimeView; +@end + +%hook _UIStatusBarTimeItem + +- (id)applyUpdate:(id)arg1 toDisplayItem:(id)arg2 { + id returnThis = %orig; + [self.shortTimeView setFont: [self.shortTimeView.font fontWithSize:12]]; + [self.pillTimeView setFont: [self.pillTimeView.font fontWithSize:12]]; + return returnThis; +} + +%end + +@interface _UIStatusBarBackgroundActivityView : UIView +@property (copy) CALayer *pulseLayer; +@end + +%hook _UIStatusBarBackgroundActivityView + +- (void)setCenter:(CGPoint)point { + point.y = 11; + self.frame = CGRectMake(0, 0, self.frame.size.width, 31); + self.pulseLayer.frame = CGRectMake(0, 0, self.frame.size.width, 31); + %orig(point); +} + +%end + +%hook _UIStatusBarNavigationItem + +- (id)applyStyleAttributes:(id)arg1 toDisplayItem:(id)arg2 { + return nil; +} + +- (id)applyUpdate:(id)arg1 toDisplayItem:(id)arg2 { + return nil; +} + +%end diff --git a/control b/control new file mode 100644 index 0000000..576ecd8 --- /dev/null +++ b/control @@ -0,0 +1,9 @@ +Package: com.neinzedd9.dateundertimex +Name: DateUnderTimeX +Depends: mobilesubstrate +Version: 1.1.1 +Architecture: iphoneos-arm +Description: Adds the date under the status bar on iPhone X. +Maintainer: NeinZedd9 +Author: NeinZedd9 +Section: Tweaks