update to 1.2

This commit is contained in:
MPG13 2018-05-28 14:30:17 -06:00
parent 68fd17b7b9
commit bf32b2cb11
15 changed files with 220 additions and 43 deletions

View file

@ -6,5 +6,5 @@ Description: Customizable date under time in iX StatusBar.
Maintainer: MPG13 Maintainer: MPG13
Author: MPG13 Author: MPG13
Section: Tweaks Section: Tweaks
Version: 1.1-1+debug Version: 1.1-16+debug
Installed-Size: 188 Installed-Size: 192

View file

@ -4,11 +4,21 @@
<dict> <dict>
<key>items</key> <key>items</key>
<array> <array>
<dict>
<key>cell</key>
<string>PSStaticTextCell</string>
<key>height</key>
<string>45</string>
<key>label</key>
<string>UnderTime</string>
</dict>
<dict> <dict>
<key>cell</key> <key>cell</key>
<string>PSGroupCell</string> <string>PSGroupCell</string>
<key>label</key> <key>label</key>
<string>UnderTime Settings</string> <string> </string>
<key>height</key>
<string>10</string>
</dict> </dict>
<dict> <dict>
<key>cell</key> <key>cell</key>
@ -22,7 +32,14 @@
<key>label</key> <key>label</key>
<string>Enable tweak</string> <string>Enable tweak</string>
</dict> </dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Date Format</string>
<key>height</key>
<string>10</string>
</dict>
<dict> <dict>
<key>cell</key> <key>cell</key>
<string>PSEditTextCell</string> <string>PSEditTextCell</string>
@ -37,13 +54,73 @@
<key>cell</key> <key>cell</key>
<string>PSGroupCell</string> <string>PSGroupCell</string>
<key>label</key> <key>label</key>
<string>Forked from NeinZedd's "DateUnderTimeX". Thank him for his work!</string> <string>Use nsdateformatter.com to help you format your date!</string>
</dict> </dict>
<dict> <dict>
<key>cell</key> <key>cell</key>
<string>PSGroupCell</string> <string>PSGroupCell</string>
<key>label</key> <key>label</key>
<string>Use nsdateformatter.com to help you format your date!</string> <string>Font Size</string>
<key>height</key>
<string>10</string>
</dict>
<dict>
<key>cell</key>
<string>PSSliderCell</string>
<key>default</key>
<integer>12</integer>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>sizeOfFont</string>
<key>max</key>
<real>18</real>
<key>min</key>
<real>6</real>
<key>showValue</key>
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Replace the date with the time</string>
<key>height</key>
<string>10</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>replaceTime</string>
<key>label</key>
<string>Replace Time</string>
</dict>
<dict>
<key>action</key>
<string>respring</string>
<key>height</key>
<string>30</string>
<key>cell</key>
<string>PSButtonCell</string>
<key>label</key>
<string>Respring</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Developed partially by MPG13 | Forked from NeinZedd's "DateUnderTimeX"</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Respringing twice might be necessary.</string>
</dict> </dict>
</array> </array>
<key>title</key> <key>title</key>

View file

@ -1 +1 @@
./packages/com.mpg13.undertime_1.1-1+debug_iphoneos-arm.deb ./packages/com.mpg13.undertime_1.1-16+debug_iphoneos-arm.deb

View file

@ -4,11 +4,21 @@
<dict> <dict>
<key>items</key> <key>items</key>
<array> <array>
<dict>
<key>cell</key>
<string>PSStaticTextCell</string>
<key>height</key>
<string>45</string>
<key>label</key>
<string>UnderTime</string>
</dict>
<dict> <dict>
<key>cell</key> <key>cell</key>
<string>PSGroupCell</string> <string>PSGroupCell</string>
<key>label</key> <key>label</key>
<string>UnderTime Settings</string> <string> </string>
<key>height</key>
<string>10</string>
</dict> </dict>
<dict> <dict>
<key>cell</key> <key>cell</key>
@ -22,7 +32,14 @@
<key>label</key> <key>label</key>
<string>Enable tweak</string> <string>Enable tweak</string>
</dict> </dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Date Format</string>
<key>height</key>
<string>10</string>
</dict>
<dict> <dict>
<key>cell</key> <key>cell</key>
<string>PSEditTextCell</string> <string>PSEditTextCell</string>
@ -37,13 +54,73 @@
<key>cell</key> <key>cell</key>
<string>PSGroupCell</string> <string>PSGroupCell</string>
<key>label</key> <key>label</key>
<string>Forked from NeinZedd's "DateUnderTimeX". Thank him for his work!</string> <string>Use nsdateformatter.com to help you format your date!</string>
</dict> </dict>
<dict> <dict>
<key>cell</key> <key>cell</key>
<string>PSGroupCell</string> <string>PSGroupCell</string>
<key>label</key> <key>label</key>
<string>Use nsdateformatter.com to help you format your date!</string> <string>Font Size</string>
<key>height</key>
<string>10</string>
</dict>
<dict>
<key>cell</key>
<string>PSSliderCell</string>
<key>default</key>
<integer>12</integer>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>sizeOfFont</string>
<key>max</key>
<real>18</real>
<key>min</key>
<real>6</real>
<key>showValue</key>
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Replace the date with the time</string>
<key>height</key>
<string>10</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>replaceTime</string>
<key>label</key>
<string>Replace Time</string>
</dict>
<dict>
<key>action</key>
<string>respring</string>
<key>height</key>
<string>30</string>
<key>cell</key>
<string>PSButtonCell</string>
<key>label</key>
<string>Respring</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Developed partially by MPG13 | Forked from NeinZedd's "DateUnderTimeX"</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Respringing twice might be necessary.</string>
</dict> </dict>
</array> </array>
<key>title</key> <key>title</key>

Binary file not shown.

View file

@ -8,6 +8,8 @@
@property NSInteger textAlignment; @property NSInteger textAlignment;
@end @end
int sizeOfFont = GetPrefInt(@"sizeOfFont");
#include <substrate.h> #include <substrate.h>
#if defined(__clang__) #if defined(__clang__)
@ -29,28 +31,31 @@
#define _LOGOS_RETURN_RETAINED #define _LOGOS_RETURN_RETAINED
#endif #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); 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) { 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:@":"]) {
_logos_orig$_ungrouped$_UIStatusBarStringView$setText$(self, _cmd, text);
if(GetPrefBool(@"Enable")) { if(GetPrefBool(@"Enable")) {
_logos_orig$_ungrouped$_UIStatusBarStringView$setText$(self, _cmd, text);
NSString *dformat = GetPrefString(@"dformat"); NSString *dformat = GetPrefString(@"dformat");
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:dformat]; [dateFormatter setDateFormat:dformat];
NSDate *now = [NSDate date]; NSDate *now = [NSDate date];
NSString *shortDate = [dateFormatter stringFromDate:now]; NSString *shortDate = [dateFormatter stringFromDate:now];
shortDate = [shortDate substringToIndex:[shortDate length]]; shortDate = [shortDate substringToIndex:[shortDate length]];
NSString *newString = [NSString stringWithFormat:@"%@\n%@", text, shortDate]; NSString *newString = [NSString stringWithFormat:@"%@\n%@", text, shortDate];
self.numberOfLines = 2;
[self setFont: [self.font fontWithSize:sizeOfFont]];
if(GetPrefBool(@"replaceTime")){
_logos_orig$_ungrouped$_UIStatusBarStringView$setText$(self, _cmd, shortDate);
}
else{
self.textAlignment = 1; self.textAlignment = 1;
[self setFont: [self.font fontWithSize:12]]; self.numberOfLines = 2;
_logos_orig$_ungrouped$_UIStatusBarStringView$setText$(self, _cmd, newString); _logos_orig$_ungrouped$_UIStatusBarStringView$setText$(self, _cmd, newString);
} }
} }
@ -72,8 +77,8 @@ static id _logos_method$_ungrouped$_UIStatusBarTimeItem$applyUpdate$toDisplayIte
_logos_orig$_ungrouped$_UIStatusBarTimeItem$applyUpdate$toDisplayItem$(self, _cmd, arg1, arg2); _logos_orig$_ungrouped$_UIStatusBarTimeItem$applyUpdate$toDisplayItem$(self, _cmd, arg1, arg2);
if(GetPrefBool(@"Enable")) { if(GetPrefBool(@"Enable")) {
id returnThis = _logos_orig$_ungrouped$_UIStatusBarTimeItem$applyUpdate$toDisplayItem$(self, _cmd, arg1, arg2); id returnThis = _logos_orig$_ungrouped$_UIStatusBarTimeItem$applyUpdate$toDisplayItem$(self, _cmd, arg1, arg2);
[self.shortTimeView setFont: [self.shortTimeView.font fontWithSize:12]]; [self.shortTimeView setFont: [self.shortTimeView.font fontWithSize:sizeOfFont]];
[self.pillTimeView setFont: [self.pillTimeView.font fontWithSize:12]]; [self.pillTimeView setFont: [self.pillTimeView.font fontWithSize:sizeOfFont]];
return returnThis; return returnThis;
} }
return 0; 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) { 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); _logos_orig$_ungrouped$_UIStatusBarBackgroundActivityView$setCenter$(self, _cmd, point);
if(GetPrefBool(@"Enable")) { if(GetPrefBool(@"Enable")) {
if(GetPrefBool(@"replaceTime")){
}
else{
point.y = 11; point.y = 11;
self.frame = CGRectMake(0, 0, self.frame.size.width, 31); self.frame = CGRectMake(0, 0, self.frame.size.width, 31);
self.pulseLayer.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); _logos_orig$_ungrouped$_UIStatusBarBackgroundActivityView$setCenter$(self, _cmd, point);
} }
} }
}
static __attribute__((constructor)) void _logosLocalInit() { 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$);} } {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"

View file

@ -7,24 +7,29 @@
@property NSInteger textAlignment; @property NSInteger textAlignment;
@end @end
int sizeOfFont = GetPrefInt(@"sizeOfFont");
%hook _UIStatusBarStringView %hook _UIStatusBarStringView
- (void)setText:(NSString *)text { - (void)setText:(NSString *)text {
if([text containsString:@":"]) {
%orig;
if(GetPrefBool(@"Enable")) { if(GetPrefBool(@"Enable")) {
%orig;
NSString *dformat = GetPrefString(@"dformat"); NSString *dformat = GetPrefString(@"dformat");
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
// dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
[dateFormatter setDateFormat:dformat]; [dateFormatter setDateFormat:dformat];
//dateFormatter.dateStyle = dd/MM/yyyy;
NSDate *now = [NSDate date]; NSDate *now = [NSDate date];
NSString *shortDate = [dateFormatter stringFromDate:now]; NSString *shortDate = [dateFormatter stringFromDate:now];
shortDate = [shortDate substringToIndex:[shortDate length]]; shortDate = [shortDate substringToIndex:[shortDate length]];
NSString *newString = [NSString stringWithFormat:@"%@\n%@", text, shortDate]; NSString *newString = [NSString stringWithFormat:@"%@\n%@", text, shortDate];
self.numberOfLines = 2;
[self setFont: [self.font fontWithSize:sizeOfFont]];
if(GetPrefBool(@"replaceTime")){
%orig(shortDate);
}
else{
self.textAlignment = 1; self.textAlignment = 1;
[self setFont: [self.font fontWithSize:12]]; self.numberOfLines = 2;
%orig(newString); %orig(newString);
} }
} }
@ -46,8 +51,8 @@
%orig; %orig;
if(GetPrefBool(@"Enable")) { if(GetPrefBool(@"Enable")) {
id returnThis = %orig; id returnThis = %orig;
[self.shortTimeView setFont: [self.shortTimeView.font fontWithSize:12]]; [self.shortTimeView setFont: [self.shortTimeView.font fontWithSize:sizeOfFont]];
[self.pillTimeView setFont: [self.pillTimeView.font fontWithSize:12]]; [self.pillTimeView setFont: [self.pillTimeView.font fontWithSize:sizeOfFont]];
return returnThis; return returnThis;
} }
return 0; return 0;
@ -64,11 +69,15 @@ return 0;
- (void)setCenter:(CGPoint)point { - (void)setCenter:(CGPoint)point {
%orig; %orig;
if(GetPrefBool(@"Enable")) { if(GetPrefBool(@"Enable")) {
if(GetPrefBool(@"replaceTime")){
}
else{
point.y = 11; point.y = 11;
self.frame = CGRectMake(0, 0, self.frame.size.width, 31); self.frame = CGRectMake(0, 0, self.frame.size.width, 31);
self.pulseLayer.frame = CGRectMake(0, 0, self.frame.size.width, 31); self.pulseLayer.frame = CGRectMake(0, 0, self.frame.size.width, 31);
%orig(point); %orig(point);
} }
} }
}
%end %end

View file

@ -6,7 +6,12 @@ inline bool GetPrefBool(NSString *key)
return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] boolValue]; 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]; return [[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] objectForKey:key];
} }
inline int GetPrefInt(NSString *key)
{
return [[[NSDictionary dictionaryWithContentsOfFile:PLIST_PATH] valueForKey:key] intValue];
}