This commit is contained in:
MPG13 2018-07-08 20:50:09 -06:00
parent 91bbf24fcc
commit 1ba8dc48be
76 changed files with 297 additions and 181 deletions

View file

@ -8,5 +8,5 @@ Depiction: https://mpg13.github.io/repo/depicts/undertime.html
Maintainer: MPG13 <micahplacido@gmail.com>
Author: MPG13 <micahplacido@gmail.com>
Section: Tweaks
Version: 1.4.1-31+debug
Installed-Size: 196
Version: 1.5-4+debug
Installed-Size: 200

View file

@ -24,24 +24,12 @@
<key>label</key>
<string>Enable tweak</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>hideLocInd</string>
<key>label</key>
<string>Hide Location Indicator</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>First Line</string>
<string>First Line (Keep it shorter than 7 character!)</string>
<key>height</key>
<string>10</string>
</dict>
@ -49,7 +37,7 @@
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<true/>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
@ -73,11 +61,15 @@
<key>cell</key>
<string>PSEditTextCell</string>
<key>default</key>
<string>h:m</string>
<string>h:mm:ss</string>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>lineOne</string>
<key>label</key>
<string>Format:</string>
<key>noAutoCorrect</key>
<true/>
</dict>
<dict>
<key>cell</key>
@ -96,7 +88,7 @@
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Second Line</string>
<string>Second Line (Keep it shorter than 7 characters!)</string>
<key>height</key>
<string>10</string>
</dict>
@ -116,9 +108,11 @@
<key>cell</key>
<string>PSEditTextCell</string>
<key>default</key>
<string>d/M</string>
<string>E d/M</string>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>label</key>
<string>Format:</string>
<key>key</key>
<string>lineTwo</string>
</dict>
@ -160,6 +154,56 @@
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Font Alpha</string>
<key>height</key>
<string>10</string>
</dict>
<dict>
<key>cell</key>
<string>PSSliderCell</string>
<key>default</key>
<integer>1</integer>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>fontAlpha</string>
<key>max</key>
<real>1</real>
<key>min</key>
<real>0</real>
<key>showValue</key>
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSEditTextCell</string>
<key>default</key>
<string>111111</string>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>fontHex</string>
<key>label</key>
<string>Font Color (Hex): #</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>customColor</string>
<key>label</key>
<string>Custom Color Enable</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
@ -178,6 +222,14 @@
<key>label</key>
<string>Respring</string>
</dict>
<dict>
<key>height</key>
<string>30</string>
<key>cell</key>
<string>PSSpinnerCell</string>
<key>label</key>
<string>Thanks for using UnderTime!</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>

View file

@ -1 +1 @@
./packages/com.mpg13.undertime_1.4.1-31+debug_iphoneos-arm.deb
./packages/com.mpg13.undertime_1.5-4+debug_iphoneos-arm.deb

View file

@ -24,24 +24,12 @@
<key>label</key>
<string>Enable tweak</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>hideLocInd</string>
<key>label</key>
<string>Hide Location Indicator</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>First Line</string>
<string>First Line (Keep it shorter than 7 character!)</string>
<key>height</key>
<string>10</string>
</dict>
@ -49,7 +37,7 @@
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<true/>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
@ -73,11 +61,15 @@
<key>cell</key>
<string>PSEditTextCell</string>
<key>default</key>
<string>h:m</string>
<string>h:mm:ss</string>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>lineOne</string>
<key>label</key>
<string>Format:</string>
<key>noAutoCorrect</key>
<true/>
</dict>
<dict>
<key>cell</key>
@ -96,7 +88,7 @@
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Second Line</string>
<string>Second Line (Keep it shorter than 7 characters!)</string>
<key>height</key>
<string>10</string>
</dict>
@ -116,9 +108,11 @@
<key>cell</key>
<string>PSEditTextCell</string>
<key>default</key>
<string>d/M</string>
<string>E d/M</string>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>label</key>
<string>Format:</string>
<key>key</key>
<string>lineTwo</string>
</dict>
@ -160,6 +154,56 @@
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Font Alpha</string>
<key>height</key>
<string>10</string>
</dict>
<dict>
<key>cell</key>
<string>PSSliderCell</string>
<key>default</key>
<integer>1</integer>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>fontAlpha</string>
<key>max</key>
<real>1</real>
<key>min</key>
<real>0</real>
<key>showValue</key>
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSEditTextCell</string>
<key>default</key>
<string>111111</string>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>fontHex</string>
<key>label</key>
<string>Font Color (Hex): #</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>customColor</string>
<key>label</key>
<string>Custom Color Enable</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
@ -178,6 +222,14 @@
<key>label</key>
<string>Respring</string>
</dict>
<dict>
<key>height</key>
<string>30</string>
<key>cell</key>
<string>PSSpinnerCell</string>
<key>label</key>
<string>Thanks for using UnderTime!</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>

Binary file not shown.

View file

@ -1 +1 @@
31
86

View file

@ -0,0 +1 @@
4

209
Tweak.xm
View file

@ -1,94 +1,96 @@
#import "important.h"
#import <spawn.h>
@interface UIColor (fromHex)
+ (UIColor *)colorwithHexString:(NSString *)hexStr alpha:(CGFloat)alpha;
@end
@interface _UIStatusBarStringView : UIView
@property (copy) NSString *text;
@property NSInteger numberOfLines;
@property (copy) UIFont *font;
@property (copy) UIColor *color;
@property NSInteger textAlignment;
+ (id)sharedInstance;
@end
@interface PCSimpleTimer : NSObject
@property BOOL disableSystemWaking;
- (BOOL)disableSystemWaking;
- (id)initWithFireDate:(id)arg1 serviceIdentifier:(id)arg2 target:(id)arg3 selector:(SEL)arg4 userInfo:(id)arg5;
- (id)initWithTimeInterval:(double)arg1 serviceIdentifier:(id)arg2 target:(id)arg3 selector:(SEL)arg4 userInfo:(id)arg5;
- (void)invalidate;
- (BOOL)isValid;
- (void)scheduleInRunLoop:(id)arg1;
- (void)setDisableSystemWaking:(BOOL)arg1;
- (id)userInfo;
@end
@interface _UIStatusBarBackgroundActivityView : UIView
@property (copy) CALayer *pulseLayer;
@end
#define udtTimerPlist @"/private/var/mobile/Library/Preferences/com.mpg13.udtTimer.plist"
static PCSimpleTimer *udtTimer = nil;
static void udtTimerLoad();
int sizeOfFont = GetPrefInt(@"sizeOfFont");
NSString *lineTwo = GetPrefString(@"lineTwo");
NSString *lineOne = GetPrefString(@"lineOne");
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
@interface _UIStatusBarTimeItem
@interface _UIStatusBarTimeItem : UIView
@property (copy) _UIStatusBarStringView *shortTimeView;
@property (copy) _UIStatusBarStringView *pillTimeView;
@property (nonatomic, retain) NSTimer *nz9_seconds_timer;
@end
%group SPRINGBOARD
%hook SpringBoard
-(void)applicationDidFinishLaunching:(id)application
@implementation UIColor (fromHex)
+ (UIColor *)colorwithHexString:(NSString *)hexStr alpha:(CGFloat)alpha;
{
%orig;
NSLog(@"[udtTimer] SpringBoard applicationDidFinishLaunching");
udtTimerLoad();
//-----------------------------------------
// Convert hex string to an integer
//-----------------------------------------
unsigned int hexint = 0;
// Create scanner
NSScanner *scanner = [NSScanner scannerWithString:hexStr];
// Tell scanner to skip the # character
[scanner setCharactersToBeSkipped:[NSCharacterSet
characterSetWithCharactersInString:@"#"]];
[scanner scanHexInt:&hexint];
//-----------------------------------------
// Create color object, specifying alpha
//-----------------------------------------
UIColor *color =
[UIColor colorWithRed:((CGFloat) ((hexint & 0xFF0000) >> 16))/255
green:((CGFloat) ((hexint & 0xFF00) >> 8))/255
blue:((CGFloat) (hexint & 0xFF))/255
alpha:alpha];
return color;
}
%end
@end
int sizeOfFont = GetPrefInt(@"sizeOfFont");
int fontAlpha = GetPrefInt(@"fontAlpha");
NSString *lineOne = GetPrefString(@"lineOne");
NSString *lineTwo = GetPrefString(@"lineTwo");
NSString *fontColor = GetPrefString(@"fontHex");
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
%hook _UIStatusBarStringView
- (void)udtTimerFired:(NSString *)text {
- (void)setText:(NSString *)text {
if(GetPrefBool(@"Enable") && ![text containsString:@"%"] && ![text containsString:@"1x"] && ![text containsString:@"LTE"] && ![text containsString:@"4G"] && ![text containsString:@"3G"] && ![text containsString:@"2G"] && ![text containsString:@"EDGE"]) {
NSString *timeLineTwo = lineTwo;
NSString *timeLineOne = lineOne;
NSString *timeLineTwo = lineTwo;
NSDate *now = [NSDate date];
if(!GetPrefBool(@"lineTwoStandard")){
[dateFormatter setDateFormat:lineTwo];
timeLineTwo = [dateFormatter stringFromDate:now];
timeLineTwo = [timeLineTwo substringToIndex:[timeLineTwo length]];
[dateFormatter setDateFormat:lineTwo];
timeLineTwo = [dateFormatter stringFromDate:now];
timeLineTwo = [timeLineTwo substringToIndex:[timeLineTwo length]];
}
if(!GetPrefBool(@"lineOneStandard")){
[dateFormatter setDateFormat:lineOne];
timeLineOne = [dateFormatter stringFromDate:now];
timeLineOne = [timeLineOne substringToIndex:[timeLineOne length]];
[dateFormatter setDateFormat:lineOne];
timeLineOne = [dateFormatter stringFromDate:now];
timeLineOne = [timeLineOne substringToIndex:[timeLineOne length]];
}
NSString *newString;
if(GetPrefBool(@"lineOneEnable")){
newString = [NSString stringWithFormat:@"%@\n%@", timeLineOne, timeLineTwo];
newString = [NSString stringWithFormat:@"%@\n%@", timeLineOne, timeLineTwo];
}
else{
newString = [NSString stringWithFormat:@"%@\n%@", text, timeLineTwo];
newString = [NSString stringWithFormat:@"%@\n%@", text, timeLineTwo];
}
[self setFont: [self.font fontWithSize:sizeOfFont]];
if((fontColor) && (fontAlpha) && (GetPrefBool(@"customColor"))){
[self setColor:[UIColor colorwithHexString:fontColor alpha:fontAlpha]];
}
if(GetPrefBool(@"replaceTime")){
%orig(timeLineOne);
}
@ -102,51 +104,35 @@ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
%orig(text);
}
}
%end
%end
%group STATUSTIME
/*
%hook _UIStatusBarTimeItem
- (void)udtTimerFired{
if (udtTimer) {
NSLog(@"[udtTimer] udtTimerFired");
self.shortTimeView.text = @":";
self.pillTimeView.text = @":";
[self.shortTimeView setFont: [self.shortTimeView.font fontWithSize:sizeOfFont]];
[self.pillTimeView setFont: [self.pillTimeView.font fontWithSize:sizeOfFont]];
[udtTimer invalidate];
udtTimer = nil;
}}
%end
%hook _UIStatusBarTimeItem
%property (nonatomic, retain) NSTimer *nz9_seconds_timer;
- (instancetype)init {
%orig;
self.shortTimeView.text = @":";
self.pillTimeView.text = @":";
self.shortTimeView.font = [UIFont monospacedDigitSystemFontOfSize:12 weight:UIFontWeightBold];
self.pillTimeView.font = [UIFont monospacedDigitSystemFontOfSize:12 weight:UIFontWeightBold];
if(GetPrefBool(@"Enable") && ((!GetPrefBool(@"lineTwoStandard") && [lineTwo containsString:@"s"]) || (!GetPrefBool(@"lineOneStandard") && [lineOne containsString:@"s"]))) {
self.nz9_seconds_timer = [NSTimer scheduledTimerWithTimeInterval:1.0 repeats:YES block:^(NSTimer *timer) {
self.shortTimeView.text = @":";
self.pillTimeView.text = @":";
[self.shortTimeView setFont: [self.shortTimeView.font fontWithSize:sizeOfFont]];
[self.pillTimeView setFont: [self.pillTimeView.font fontWithSize:sizeOfFont]];
}];
}
return self;
}
- (id)applyUpdate:(id)arg1 toDisplayItem:(id)arg2 {
id returnThis = %orig;
self.shortTimeView.text = @":";
self.pillTimeView.text = @":";
self.shortTimeView.font = [UIFont monospacedDigitSystemFontOfSize:12 weight:UIFontWeightBold];
self.pillTimeView.font = [UIFont monospacedDigitSystemFontOfSize:12 weight:UIFontWeightBold];
[self.shortTimeView setFont: [self.shortTimeView.font fontWithSize:sizeOfFont]];
[self.pillTimeView setFont: [self.pillTimeView.font fontWithSize:sizeOfFont]];
return returnThis;
}
%end*/
%end
%hook _UIStatusBarBackgroundActivityView
@ -158,6 +144,7 @@ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
self.pulseLayer.frame = CGRectMake(0, 0, self.frame.size.width, 31);
%orig(point);
}
}
%end
@ -169,47 +156,19 @@ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
}
%end
%hook UIStatusBarBreadcrumbItemView
- (id)applyUpdate:(id)arg1 toDisplayItem:(id)arg2 {
return nil;
}
%end
static void udtTimerLoad(){
NSDictionary *userInfoDictionary = nil;
userInfoDictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:udtTimerPlist];
if (!userInfoDictionary) {
return;
}
NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
udtTimer = [[%c(PCSimpleTimer) alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:1] serviceIdentifier:@"com.mpg13.UnderTime" target:[%c(_UIStatusBarStringView) sharedInstance] selector:@selector(udtTimerFired) userInfo:data];
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy/MM/dd HH:mm:ss"];
[formatter setTimeZone:[NSTimeZone defaultTimeZone]];
[udtTimer scheduleInRunLoop:[NSRunLoop mainRunLoop]];
}
/*
%ctor {
dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateStyle = NSDateFormatterNoStyle;
dateFormatter.timeStyle = NSDateFormatterMediumStyle;
dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
%init;
}*/
%ctor{
@autoreleasepool {
if (%c(SpringBoard)) {
%init(SPRINGBOARD);
} else {
%init(STATUSTIME);
}
}
dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateStyle = NSDateFormatterNoStyle;
dateFormatter.timeStyle = NSDateFormatterMediumStyle;
dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
%init;
}

View file

@ -1,7 +1,7 @@
Package: com.mpg13.undertime
Name: UnderTime
Depends: mobilesubstrate
Version: 1.4.1
Version: 1.5
Architecture: iphoneos-arm
Description: Customizable date under time in iX StatusBar.
Homepage: https://mpg13.github.io

View file

@ -24,24 +24,12 @@
<key>label</key>
<string>Enable tweak</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>hideLocInd</string>
<key>label</key>
<string>Hide Location Indicator</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>First Line</string>
<string>First Line (Keep it shorter than 7 character!)</string>
<key>height</key>
<string>10</string>
</dict>
@ -49,7 +37,7 @@
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<false/>
<true/>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
@ -73,11 +61,15 @@
<key>cell</key>
<string>PSEditTextCell</string>
<key>default</key>
<string>h:m</string>
<string>h:mm:ss</string>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>lineOne</string>
<key>label</key>
<string>Format:</string>
<key>noAutoCorrect</key>
<true/>
</dict>
<dict>
<key>cell</key>
@ -96,7 +88,7 @@
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Second Line</string>
<string>Second Line (Keep it shorter than 7 characters!)</string>
<key>height</key>
<string>10</string>
</dict>
@ -116,9 +108,11 @@
<key>cell</key>
<string>PSEditTextCell</string>
<key>default</key>
<string>d/M</string>
<string>E d/M</string>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>label</key>
<string>Format:</string>
<key>key</key>
<string>lineTwo</string>
</dict>
@ -160,6 +154,56 @@
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>label</key>
<string>Font Alpha</string>
<key>height</key>
<string>10</string>
</dict>
<dict>
<key>cell</key>
<string>PSSliderCell</string>
<key>default</key>
<integer>1</integer>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>fontAlpha</string>
<key>max</key>
<real>1</real>
<key>min</key>
<real>0</real>
<key>showValue</key>
<true/>
</dict>
<dict>
<key>cell</key>
<string>PSEditTextCell</string>
<key>default</key>
<string>111111</string>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>fontHex</string>
<key>label</key>
<string>Font Color (Hex): #</string>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>defaults</key>
<string>com.mpg13.undertime</string>
<key>key</key>
<string>customColor</string>
<key>label</key>
<string>Custom Color Enable</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
@ -178,6 +222,14 @@
<key>label</key>
<string>Respring</string>
</dict>
<dict>
<key>height</key>
<string>30</string>
<key>cell</key>
<string>PSSpinnerCell</string>
<key>label</key>
<string>Thanks for using UnderTime!</string>
</dict>
<dict>
<key>cell</key>
<string>PSGroupCell</string>