forked from gilshahar7/ExactTime
Merge pull request #4 from gilshahar7/beta-future-time
Added detection for future dates
This commit is contained in:
61
.gitignore
vendored
61
.gitignore
vendored
@ -1,60 +1 @@
|
||||
# Xcode
|
||||
#
|
||||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
|
||||
|
||||
## Build generated
|
||||
build/
|
||||
DerivedData/
|
||||
|
||||
## Various settings
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata/
|
||||
|
||||
## Other
|
||||
*.moved-aside
|
||||
*.xcuserstate
|
||||
|
||||
## Obj-C/Swift specific
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.dSYM.zip
|
||||
*.dSYM
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
# We recommend against adding the Pods directory to your .gitignore. However
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
# Pods/
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Build
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
|
||||
|
||||
fastlane/report.xml
|
||||
fastlane/screenshots
|
||||
|
||||
#Code Injection
|
||||
#
|
||||
# After new code Injection tools there's a generated folder /iOSInjectionProject
|
||||
# https://github.com/johnno1962/injectionforxcode
|
||||
|
||||
iOSInjectionProject/
|
||||
.theos/
|
||||
|
81
Tweak.xm
81
Tweak.xm
@ -37,7 +37,12 @@ static NSString *settingsPath = @"/var/mobile/Library/Preferences/com.gilshahar7
|
||||
if((date != nil) && (format == 1)){
|
||||
NCNotificationDateLabel *dateLabel = MSHookIvar<NCNotificationDateLabel *>(self, "_dateLabel");
|
||||
int timeSinceNow = (int)[date timeIntervalSinceNow];
|
||||
timeSinceNow = timeSinceNow*-1;
|
||||
bool isFuture = false;
|
||||
if (timeSinceNow > 0){
|
||||
isFuture = true;
|
||||
}else{
|
||||
timeSinceNow = timeSinceNow*-1;
|
||||
}
|
||||
bool addMinutes = [[prefs objectForKey:@"addMinutes"] boolValue];
|
||||
bool addToCurrent = [[prefs objectForKey:@"addToCurrent"] boolValue];
|
||||
int hours = timeSinceNow / 3600;
|
||||
@ -46,23 +51,43 @@ static NSString *settingsPath = @"/var/mobile/Library/Preferences/com.gilshahar7
|
||||
if(hours == 0){
|
||||
if(minutes == 0){
|
||||
}else{
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %im", minutes];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%im ago", minutes];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(minutes == 0){
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %ih", hours];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%ih ago", hours];
|
||||
}
|
||||
} else{
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %ih %im", hours, minutes];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%ih %im ago", hours, minutes];
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(addToCurrent){
|
||||
if(hours == 0){
|
||||
if(minutes == 0){
|
||||
}else{
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %im", minutes];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%im ago", minutes];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %ih", hours];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%ih ago", hours];
|
||||
}
|
||||
}
|
||||
}
|
||||
if((timeSinceNow/60) >= affectTime){
|
||||
@ -100,7 +125,12 @@ static NSString *settingsPath = @"/var/mobile/Library/Preferences/com.gilshahar7
|
||||
if((date != nil) && (format == 1)){
|
||||
BSUIRelativeDateLabel *dateLabel = MSHookIvar<BSUIRelativeDateLabel *>(self, "_dateLabel");
|
||||
int timeSinceNow = (int)[date timeIntervalSinceNow];
|
||||
timeSinceNow = timeSinceNow*-1;
|
||||
bool isFuture = false;
|
||||
if (timeSinceNow > 0){
|
||||
isFuture = true;
|
||||
}else{
|
||||
timeSinceNow = timeSinceNow*-1;
|
||||
}
|
||||
bool addMinutes = [[prefs objectForKey:@"addMinutes"] boolValue];
|
||||
bool addToCurrent = [[prefs objectForKey:@"addToCurrent"] boolValue];
|
||||
int hours = timeSinceNow / 3600;
|
||||
@ -109,23 +139,43 @@ static NSString *settingsPath = @"/var/mobile/Library/Preferences/com.gilshahar7
|
||||
if(hours == 0){
|
||||
if(minutes == 0){
|
||||
}else{
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %im", minutes];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%im ago", minutes];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(minutes == 0){
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %ih", hours];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%ih ago", hours];
|
||||
}
|
||||
} else{
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %ih %im", hours, minutes];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%ih %im ago", hours, minutes];
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(addToCurrent){
|
||||
if(hours == 0){
|
||||
if(minutes == 0){
|
||||
}else{
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %im", minutes];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%im ago", minutes];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %ih", hours];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%ih ago", hours];
|
||||
}
|
||||
}
|
||||
}
|
||||
if((timeSinceNow/60) >= affectTime){
|
||||
@ -163,7 +213,12 @@ static NSString *settingsPath = @"/var/mobile/Library/Preferences/com.gilshahar7
|
||||
if((date != nil) && (format == 1)){
|
||||
BSUIRelativeDateLabel *dateLabel = MSHookIvar<BSUIRelativeDateLabel *>(self, "_dateLabel");
|
||||
int timeSinceNow = (int)[date timeIntervalSinceNow];
|
||||
timeSinceNow = timeSinceNow*-1;
|
||||
bool isFuture = false;
|
||||
if (timeSinceNow > 0){
|
||||
isFuture = true;
|
||||
}else{
|
||||
timeSinceNow = timeSinceNow*-1;
|
||||
}
|
||||
bool addMinutes = [[prefs objectForKey:@"addMinutes"] boolValue];
|
||||
bool addToCurrent = [[prefs objectForKey:@"addToCurrent"] boolValue];
|
||||
int hours = timeSinceNow / 3600;
|
||||
@ -172,23 +227,43 @@ static NSString *settingsPath = @"/var/mobile/Library/Preferences/com.gilshahar7
|
||||
if(hours == 0){
|
||||
if(minutes == 0){
|
||||
}else{
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %im", minutes];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%im ago", minutes];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(minutes == 0){
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %ih", hours];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%ih ago", hours];
|
||||
}
|
||||
} else{
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %ih %im", hours, minutes];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%ih %im ago", hours, minutes];
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(addToCurrent){
|
||||
if(hours == 0){
|
||||
if(minutes == 0){
|
||||
}else{
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %im", minutes];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%im ago", minutes];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(isFuture){
|
||||
dateLabel.text = [NSString stringWithFormat:@"in %ih", hours];
|
||||
}else{
|
||||
dateLabel.text = [NSString stringWithFormat:@"%ih ago", hours];
|
||||
}
|
||||
}
|
||||
}
|
||||
if((timeSinceNow/60) >= affectTime){
|
||||
|
2
control
2
control
@ -1,7 +1,7 @@
|
||||
Package: com.gilshahar7.exacttime
|
||||
Name: ExactTime
|
||||
Depends: mobilesubstrate
|
||||
Version: 1.7
|
||||
Version: 1.8
|
||||
Architecture: iphoneos-arm
|
||||
Description: Shows the exact time of a notification.
|
||||
Maintainer: gilshahar7
|
||||
|
BIN
packages/com.gilshahar7.exacttime_1.8_iphoneos-arm.deb
Normal file
BIN
packages/com.gilshahar7.exacttime_1.8_iphoneos-arm.deb
Normal file
Binary file not shown.
Reference in New Issue
Block a user