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
Author: MPG13
Section: Tweaks
Version: 1.1-1+debug
Installed-Size: 188
Version: 1.1-16+debug
Installed-Size: 192

View file

@ -4,11 +4,21 @@
<dict>
<key>items</key>
<array>
<dict>
<key>cell</key>
<string>PSStaticTextCell</string>
<key>height</key>
<string>45</string>
<key>label</key>
<string>UnderTime</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>UnderTime Settings</string>
<string> </string>
<key>height</key>
<string>10</string>
</dict>
<dict>
<key>cell</key>
@ -22,7 +32,14 @@
<key>label</key>
<string>Enable tweak</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Date Format</string>
<key>height</key>
<string>10</string>
</dict>
<dict>
<key>cell</key>
<string>PSEditTextCell</string>
@ -37,13 +54,73 @@
<key>cell</key>
<string>PSGroupCell</string>
<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>
<key>cell</key>
<string>PSGroupCell</string>
<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>
</array>
<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>
<key>items</key>
<array>
<dict>
<key>cell</key>
<string>PSStaticTextCell</string>
<key>height</key>
<string>45</string>
<key>label</key>
<string>UnderTime</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>UnderTime Settings</string>
<string> </string>
<key>height</key>
<string>10</string>
</dict>
<dict>
<key>cell</key>
@ -22,7 +32,14 @@
<key>label</key>
<string>Enable tweak</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Date Format</string>
<key>height</key>
<string>10</string>
</dict>
<dict>
<key>cell</key>
<string>PSEditTextCell</string>
@ -37,13 +54,73 @@
<key>cell</key>
<string>PSGroupCell</string>
<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>
<key>cell</key>
<string>PSGroupCell</string>
<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>
</array>
<key>title</key>

Binary file not shown.

View file

@ -8,6 +8,8 @@
@property NSInteger textAlignment;
@end
int sizeOfFont = GetPrefInt(@"sizeOfFont");
#include <substrate.h>
#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"

View file

@ -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);
}
}
}

View file

@ -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];
}