diff --git a/.theos/_/DEBIAN/control b/.theos/_/DEBIAN/control index 7148b22..160c488 100644 --- a/.theos/_/DEBIAN/control +++ b/.theos/_/DEBIAN/control @@ -6,5 +6,5 @@ Description: Customizable date under time in iX StatusBar. Maintainer: MPG13 Author: MPG13 Section: Tweaks -Version: 1.1-1+debug -Installed-Size: 188 +Version: 1.1-16+debug +Installed-Size: 192 diff --git a/.theos/_/Library/MobileSubstrate/DynamicLibraries/UnderTime.dylib b/.theos/_/Library/MobileSubstrate/DynamicLibraries/UnderTime.dylib index 9629f54..2b4b439 100755 Binary files a/.theos/_/Library/MobileSubstrate/DynamicLibraries/UnderTime.dylib and b/.theos/_/Library/MobileSubstrate/DynamicLibraries/UnderTime.dylib differ diff --git a/.theos/_/Library/PreferenceBundles/UnderTime.bundle/Root.plist b/.theos/_/Library/PreferenceBundles/UnderTime.bundle/Root.plist index 54cca89..2c1334d 100644 --- a/.theos/_/Library/PreferenceBundles/UnderTime.bundle/Root.plist +++ b/.theos/_/Library/PreferenceBundles/UnderTime.bundle/Root.plist @@ -4,11 +4,21 @@ items + + cell + PSStaticTextCell + height + 45 + label + UnderTime + cell PSGroupCell label - UnderTime Settings + + height + 10 cell @@ -22,7 +32,14 @@ label Enable tweak - + + cell + PSGroupCell + label + Date Format + height + 10 + cell PSEditTextCell @@ -37,13 +54,73 @@ cell PSGroupCell label - Forked from NeinZedd's "DateUnderTimeX". Thank him for his work! + Use nsdateformatter.com to help you format your date! cell PSGroupCell label - Use nsdateformatter.com to help you format your date! + Font Size + height + 10 + + + cell + PSSliderCell + default + 12 + defaults + com.mpg13.undertime + key + sizeOfFont + max + 18 + min + 6 + showValue + + + + cell + PSGroupCell + label + Replace the date with the time + height + 10 + + + cell + PSSwitchCell + default + + defaults + com.mpg13.undertime + key + replaceTime + label + Replace Time + + + action + respring + height + 30 + cell + PSButtonCell + label + Respring + + + cell + PSGroupCell + label + Developed partially by MPG13 | Forked from NeinZedd's "DateUnderTimeX" + + + cell + PSGroupCell + label + Respringing twice might be necessary. title diff --git a/.theos/_/Library/PreferenceBundles/UnderTime.bundle/UnderTime b/.theos/_/Library/PreferenceBundles/UnderTime.bundle/UnderTime index 907a97c..2f4d7ca 100755 Binary files a/.theos/_/Library/PreferenceBundles/UnderTime.bundle/UnderTime and b/.theos/_/Library/PreferenceBundles/UnderTime.bundle/UnderTime differ diff --git a/.theos/last_package b/.theos/last_package index 73333a6..471057d 100644 --- a/.theos/last_package +++ b/.theos/last_package @@ -1 +1 @@ -./packages/com.mpg13.undertime_1.1-1+debug_iphoneos-arm.deb +./packages/com.mpg13.undertime_1.1-16+debug_iphoneos-arm.deb diff --git a/.theos/obj/debug/UnderTime.bundle/Root.plist b/.theos/obj/debug/UnderTime.bundle/Root.plist index 54cca89..2c1334d 100644 --- a/.theos/obj/debug/UnderTime.bundle/Root.plist +++ b/.theos/obj/debug/UnderTime.bundle/Root.plist @@ -4,11 +4,21 @@ items + + cell + PSStaticTextCell + height + 45 + label + UnderTime + cell PSGroupCell label - UnderTime Settings + + height + 10 cell @@ -22,7 +32,14 @@ label Enable tweak - + + cell + PSGroupCell + label + Date Format + height + 10 + cell PSEditTextCell @@ -37,13 +54,73 @@ cell PSGroupCell label - Forked from NeinZedd's "DateUnderTimeX". Thank him for his work! + Use nsdateformatter.com to help you format your date! cell PSGroupCell label - Use nsdateformatter.com to help you format your date! + Font Size + height + 10 + + + cell + PSSliderCell + default + 12 + defaults + com.mpg13.undertime + key + sizeOfFont + max + 18 + min + 6 + showValue + + + + cell + PSGroupCell + label + Replace the date with the time + height + 10 + + + cell + PSSwitchCell + default + + defaults + com.mpg13.undertime + key + replaceTime + label + Replace Time + + + action + respring + height + 30 + cell + PSButtonCell + label + Respring + + + cell + PSGroupCell + label + Developed partially by MPG13 | Forked from NeinZedd's "DateUnderTimeX" + + + cell + PSGroupCell + label + Respringing twice might be necessary. title diff --git a/.theos/obj/debug/UnderTime.bundle/UnderTime b/.theos/obj/debug/UnderTime.bundle/UnderTime index 907a97c..2f4d7ca 100755 Binary files a/.theos/obj/debug/UnderTime.bundle/UnderTime and b/.theos/obj/debug/UnderTime.bundle/UnderTime differ diff --git a/.theos/obj/debug/UnderTime.dylib b/.theos/obj/debug/UnderTime.dylib index 9629f54..2b4b439 100755 Binary files a/.theos/obj/debug/UnderTime.dylib and b/.theos/obj/debug/UnderTime.dylib differ diff --git a/.theos/obj/debug/arm64/Tweak.xm.mm b/.theos/obj/debug/arm64/Tweak.xm.mm index dbd35fc..d2b6362 100644 --- a/.theos/obj/debug/arm64/Tweak.xm.mm +++ b/.theos/obj/debug/arm64/Tweak.xm.mm @@ -8,6 +8,8 @@ @property NSInteger textAlignment; @end +int sizeOfFont = GetPrefInt(@"sizeOfFont"); + #include #if defined(__clang__) @@ -29,29 +31,32 @@ #define _LOGOS_RETURN_RETAINED #endif -@class _UIStatusBarStringView; @class _UIStatusBarBackgroundActivityView; @class _UIStatusBarTimeItem; +@class _UIStatusBarBackgroundActivityView; @class _UIStatusBarTimeItem; @class _UIStatusBarStringView; static void (*_logos_orig$_ungrouped$_UIStatusBarStringView$setText$)(_LOGOS_SELF_TYPE_NORMAL _UIStatusBarStringView* _LOGOS_SELF_CONST, SEL, NSString *); static void _logos_method$_ungrouped$_UIStatusBarStringView$setText$(_LOGOS_SELF_TYPE_NORMAL _UIStatusBarStringView* _LOGOS_SELF_CONST, SEL, NSString *); static id (*_logos_orig$_ungrouped$_UIStatusBarTimeItem$applyUpdate$toDisplayItem$)(_LOGOS_SELF_TYPE_NORMAL _UIStatusBarTimeItem* _LOGOS_SELF_CONST, SEL, id, id); static id _logos_method$_ungrouped$_UIStatusBarTimeItem$applyUpdate$toDisplayItem$(_LOGOS_SELF_TYPE_NORMAL _UIStatusBarTimeItem* _LOGOS_SELF_CONST, SEL, id, id); static void (*_logos_orig$_ungrouped$_UIStatusBarBackgroundActivityView$setCenter$)(_LOGOS_SELF_TYPE_NORMAL _UIStatusBarBackgroundActivityView* _LOGOS_SELF_CONST, SEL, CGPoint); static void _logos_method$_ungrouped$_UIStatusBarBackgroundActivityView$setCenter$(_LOGOS_SELF_TYPE_NORMAL _UIStatusBarBackgroundActivityView* _LOGOS_SELF_CONST, SEL, CGPoint); -#line 10 "Tweak.xm" +#line 12 "Tweak.xm" static void _logos_method$_ungrouped$_UIStatusBarStringView$setText$(_LOGOS_SELF_TYPE_NORMAL _UIStatusBarStringView* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, NSString * text) { - if([text containsString:@":"]) { + if(GetPrefBool(@"Enable")) { _logos_orig$_ungrouped$_UIStatusBarStringView$setText$(self, _cmd, text); - if(GetPrefBool(@"Enable")) { + NSString *dformat = GetPrefString(@"dformat"); NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; - [dateFormatter setDateFormat:dformat]; - NSDate *now = [NSDate date]; NSString *shortDate = [dateFormatter stringFromDate:now]; shortDate = [shortDate substringToIndex:[shortDate length]]; NSString *newString = [NSString stringWithFormat:@"%@\n%@", text, shortDate]; - self.numberOfLines = 2; - self.textAlignment = 1; - [self setFont: [self.font fontWithSize:12]]; - _logos_orig$_ungrouped$_UIStatusBarStringView$setText$(self, _cmd, newString); + + [self setFont: [self.font fontWithSize:sizeOfFont]]; + if(GetPrefBool(@"replaceTime")){ + _logos_orig$_ungrouped$_UIStatusBarStringView$setText$(self, _cmd, shortDate); + } + else{ + self.textAlignment = 1; + self.numberOfLines = 2; + _logos_orig$_ungrouped$_UIStatusBarStringView$setText$(self, _cmd, newString); } } else { @@ -72,8 +77,8 @@ static id _logos_method$_ungrouped$_UIStatusBarTimeItem$applyUpdate$toDisplayIte _logos_orig$_ungrouped$_UIStatusBarTimeItem$applyUpdate$toDisplayItem$(self, _cmd, arg1, arg2); if(GetPrefBool(@"Enable")) { id returnThis = _logos_orig$_ungrouped$_UIStatusBarTimeItem$applyUpdate$toDisplayItem$(self, _cmd, arg1, arg2); - [self.shortTimeView setFont: [self.shortTimeView.font fontWithSize:12]]; - [self.pillTimeView setFont: [self.pillTimeView.font fontWithSize:12]]; + [self.shortTimeView setFont: [self.shortTimeView.font fontWithSize:sizeOfFont]]; + [self.pillTimeView setFont: [self.pillTimeView.font fontWithSize:sizeOfFont]]; return returnThis; } return 0; @@ -90,14 +95,18 @@ return 0; static void _logos_method$_ungrouped$_UIStatusBarBackgroundActivityView$setCenter$(_LOGOS_SELF_TYPE_NORMAL _UIStatusBarBackgroundActivityView* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, CGPoint point) { _logos_orig$_ungrouped$_UIStatusBarBackgroundActivityView$setCenter$(self, _cmd, point); if(GetPrefBool(@"Enable")) { - point.y = 11; - self.frame = CGRectMake(0, 0, self.frame.size.width, 31); - self.pulseLayer.frame = CGRectMake(0, 0, self.frame.size.width, 31); - _logos_orig$_ungrouped$_UIStatusBarBackgroundActivityView$setCenter$(self, _cmd, point); + if(GetPrefBool(@"replaceTime")){ + } + else{ + point.y = 11; + self.frame = CGRectMake(0, 0, self.frame.size.width, 31); + self.pulseLayer.frame = CGRectMake(0, 0, self.frame.size.width, 31); + _logos_orig$_ungrouped$_UIStatusBarBackgroundActivityView$setCenter$(self, _cmd, point); + } } } static __attribute__((constructor)) void _logosLocalInit() { {Class _logos_class$_ungrouped$_UIStatusBarStringView = objc_getClass("_UIStatusBarStringView"); MSHookMessageEx(_logos_class$_ungrouped$_UIStatusBarStringView, @selector(setText:), (IMP)&_logos_method$_ungrouped$_UIStatusBarStringView$setText$, (IMP*)&_logos_orig$_ungrouped$_UIStatusBarStringView$setText$);Class _logos_class$_ungrouped$_UIStatusBarTimeItem = objc_getClass("_UIStatusBarTimeItem"); MSHookMessageEx(_logos_class$_ungrouped$_UIStatusBarTimeItem, @selector(applyUpdate:toDisplayItem:), (IMP)&_logos_method$_ungrouped$_UIStatusBarTimeItem$applyUpdate$toDisplayItem$, (IMP*)&_logos_orig$_ungrouped$_UIStatusBarTimeItem$applyUpdate$toDisplayItem$);Class _logos_class$_ungrouped$_UIStatusBarBackgroundActivityView = objc_getClass("_UIStatusBarBackgroundActivityView"); MSHookMessageEx(_logos_class$_ungrouped$_UIStatusBarBackgroundActivityView, @selector(setCenter:), (IMP)&_logos_method$_ungrouped$_UIStatusBarBackgroundActivityView$setCenter$, (IMP*)&_logos_orig$_ungrouped$_UIStatusBarBackgroundActivityView$setCenter$);} } -#line 75 "Tweak.xm" +#line 84 "Tweak.xm" diff --git a/.theos/obj/debug/arm64/UnderTime.bundle/UnderTime b/.theos/obj/debug/arm64/UnderTime.bundle/UnderTime index cca8a1d..a6089f1 100755 Binary files a/.theos/obj/debug/arm64/UnderTime.bundle/UnderTime and b/.theos/obj/debug/arm64/UnderTime.bundle/UnderTime differ diff --git a/.theos/obj/debug/arm64/UnderTime.bundle/UnderTime.dSYM/Contents/Resources/DWARF/UnderTime b/.theos/obj/debug/arm64/UnderTime.bundle/UnderTime.dSYM/Contents/Resources/DWARF/UnderTime index df8ae0b..9979473 100644 Binary files a/.theos/obj/debug/arm64/UnderTime.bundle/UnderTime.dSYM/Contents/Resources/DWARF/UnderTime and b/.theos/obj/debug/arm64/UnderTime.bundle/UnderTime.dSYM/Contents/Resources/DWARF/UnderTime differ diff --git a/.theos/obj/debug/arm64/UnderTime.dylib b/.theos/obj/debug/arm64/UnderTime.dylib index 5a9c07f..12f0929 100755 Binary files a/.theos/obj/debug/arm64/UnderTime.dylib and b/.theos/obj/debug/arm64/UnderTime.dylib differ diff --git a/.theos/obj/debug/arm64/UnderTime.dylib.dSYM/Contents/Resources/DWARF/UnderTime.dylib b/.theos/obj/debug/arm64/UnderTime.dylib.dSYM/Contents/Resources/DWARF/UnderTime.dylib index 334a866..9526112 100644 Binary files a/.theos/obj/debug/arm64/UnderTime.dylib.dSYM/Contents/Resources/DWARF/UnderTime.dylib and b/.theos/obj/debug/arm64/UnderTime.dylib.dSYM/Contents/Resources/DWARF/UnderTime.dylib differ diff --git a/Tweak.xm b/Tweak.xm index cd315ff..0e58e32 100644 --- a/Tweak.xm +++ b/Tweak.xm @@ -7,25 +7,30 @@ @property NSInteger textAlignment; @end +int sizeOfFont = GetPrefInt(@"sizeOfFont"); + %hook _UIStatusBarStringView - (void)setText:(NSString *)text { - if([text containsString:@":"]) { + if(GetPrefBool(@"Enable")) { %orig; - if(GetPrefBool(@"Enable")) { + NSString *dformat = GetPrefString(@"dformat"); NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; - // dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]; [dateFormatter setDateFormat:dformat]; - //dateFormatter.dateStyle = dd/MM/yyyy; NSDate *now = [NSDate date]; NSString *shortDate = [dateFormatter stringFromDate:now]; shortDate = [shortDate substringToIndex:[shortDate length]]; NSString *newString = [NSString stringWithFormat:@"%@\n%@", text, shortDate]; - self.numberOfLines = 2; - self.textAlignment = 1; - [self setFont: [self.font fontWithSize:12]]; - %orig(newString); + + [self setFont: [self.font fontWithSize:sizeOfFont]]; + if(GetPrefBool(@"replaceTime")){ + %orig(shortDate); + } + else{ + self.textAlignment = 1; + self.numberOfLines = 2; + %orig(newString); } } else { @@ -46,8 +51,8 @@ %orig; if(GetPrefBool(@"Enable")) { id returnThis = %orig; - [self.shortTimeView setFont: [self.shortTimeView.font fontWithSize:12]]; - [self.pillTimeView setFont: [self.pillTimeView.font fontWithSize:12]]; + [self.shortTimeView setFont: [self.shortTimeView.font fontWithSize:sizeOfFont]]; + [self.pillTimeView setFont: [self.pillTimeView.font fontWithSize:sizeOfFont]]; return returnThis; } return 0; @@ -64,10 +69,14 @@ return 0; - (void)setCenter:(CGPoint)point { %orig; if(GetPrefBool(@"Enable")) { - 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); + if(GetPrefBool(@"replaceTime")){ + } + else{ + 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); + } } } diff --git a/important.h b/important.h index 042353d..478dc7d 100644 --- a/important.h +++ b/important.h @@ -6,7 +6,12 @@ inline bool GetPrefBool(NSString *key) return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] boolValue]; } -inline *NSString GetPrefString(NSString *key) +inline NSString* GetPrefString(NSString *key) { return [[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] objectForKey:key]; } + +inline int GetPrefInt(NSString *key) +{ +return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] intValue]; +} \ No newline at end of file