Procházet zdrojové kódy

Version 1.6

Added support for A12 devices (and added the forgotten source code for iOS 12 :P)
beta-future-time
Gil Shahar před 5 roky
rodič
revize
427443a2c7
Žádný účet není propojen s e-mailovou adresou tvůrce revize
6 změnil soubory, kde provedl 98 přidání a 8 odebrání
  1. +2
    -2
      Makefile
  2. +72
    -2
      Tweak.xm
  3. +1
    -1
      control
  4. +20
    -0
      exacttimeprefs/ExactTimeprefs.mm
  5. +3
    -3
      exacttimeprefs/Makefile
  6. binární
      packages/com.gilshahar7.exacttime_1.6_iphoneos-arm.deb

+ 2
- 2
Makefile Zobrazit soubor

ARCHS = armv7 arm64
ARCHS = armv7 arm64 arm64e
export TARGET = iphone:clang:11.2:7.0
include $(THEOS)/makefiles/common.mk include $(THEOS)/makefiles/common.mk


TWEAK_NAME = ExactTime TWEAK_NAME = ExactTime

+ 72
- 2
Tweak.xm Zobrazit soubor

@interface NCLookHeaderContentView @interface NCLookHeaderContentView
-(void)_updateDateLabelFontForShortLook; -(void)_updateDateLabelFontForShortLook;
@end @end
//IOS 11
//IOS 11 & 12
@interface BSUIRelativeDateLabel @interface BSUIRelativeDateLabel
@property (assign,nonatomic) NSString *text; @property (assign,nonatomic) NSString *text;
-(void)sizeToFit; -(void)sizeToFit;
@interface MTPlatterHeaderContentView @interface MTPlatterHeaderContentView
-(void)_updateTextAttributesForDateLabel; -(void)_updateTextAttributesForDateLabel;
@end @end
//IOS 12
@interface PLPlatterHeaderContentView
-(void)_updateTextAttributesForDateLabel;
@end





static bool is24h; static bool is24h;
%end %end
%end %end


%group iOS12
%hook PLPlatterHeaderContentView
-(void)_updateTextAttributesForDateLabel{
%orig;
NSDate *date = MSHookIvar<NSDate *>(self, "_date");
NSInteger format = MSHookIvar<NSInteger >(self, "_dateFormatStyle");
NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
CGFloat affectTime = [[prefs objectForKey:@"affectTime"] floatValue];
if((date != nil) && (format == 1)){
BSUIRelativeDateLabel *dateLabel = MSHookIvar<BSUIRelativeDateLabel *>(self, "_dateLabel");
int timeSinceNow = (int)[date timeIntervalSinceNow];
timeSinceNow = timeSinceNow*-1;
bool addMinutes = [[prefs objectForKey:@"addMinutes"] boolValue];
bool addToCurrent = [[prefs objectForKey:@"addToCurrent"] boolValue];
int hours = timeSinceNow / 3600;
int minutes = (timeSinceNow % 3600) / 60;
if(addMinutes){
if(hours == 0){
if(minutes == 0){
}else{
dateLabel.text = [NSString stringWithFormat:@"%im ago", minutes];
}
}else{
if(minutes == 0){
dateLabel.text = [NSString stringWithFormat:@"%ih ago", hours];
} else{
dateLabel.text = [NSString stringWithFormat:@"%ih %im ago", hours, minutes];
}
}
}else if(addToCurrent){
if(hours == 0){
if(minutes == 0){
}else{
dateLabel.text = [NSString stringWithFormat:@"%im ago", minutes];
}
}else{
dateLabel.text = [NSString stringWithFormat:@"%ih ago", hours];
}
}
if((timeSinceNow/60) >= affectTime){
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
if(is24h){
[dateFormatter setDateFormat:@"HH:mm"];
}else{
[dateFormatter setDateFormat:@"h:mm a"];
}
if(addToCurrent && !([dateLabel.text isEqualToString:[dateFormatter stringFromDate:date]])){
dateLabel.text = [[dateLabel.text stringByAppendingString:@" • "] stringByAppendingString:[dateFormatter stringFromDate:date]];
}else{
dateLabel.text =[dateFormatter stringFromDate:date];
}
[dateLabel sizeToFit];
[dateFormatter release];
}
}
}
-(void)dateLabelDidChange:(id)arg1{
%orig(arg1);
[self _updateTextAttributesForDateLabel];
}
%end
%end

%ctor{ %ctor{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setLocale:[NSLocale currentLocale]]; [formatter setLocale:[NSLocale currentLocale]];
%init(iOS10); %init(iOS10);
} else if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.0 && [[[UIDevice currentDevice] systemVersion] floatValue] < 12.0) { } else if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.0 && [[[UIDevice currentDevice] systemVersion] floatValue] < 12.0) {
%init(iOS11); %init(iOS11);
}else if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 12.0 && [[[UIDevice currentDevice] systemVersion] floatValue] < 13.0) {
%init(iOS12);
} }
}
}

+ 1
- 1
control Zobrazit soubor

Package: com.gilshahar7.exacttime Package: com.gilshahar7.exacttime
Name: ExactTime Name: ExactTime
Depends: mobilesubstrate Depends: mobilesubstrate
Version: 1.4
Version: 1.6
Architecture: iphoneos-arm Architecture: iphoneos-arm
Description: Shows the exact time of a notification. Description: Shows the exact time of a notification.
Maintainer: gilshahar7 Maintainer: gilshahar7

+ 20
- 0
exacttimeprefs/ExactTimeprefs.mm Zobrazit soubor

#import <Preferences/PSListController.h>

@interface ExactTimeprefsListController: PSListController {
}
@end

@implementation ExactTimeprefsListController
- (id)specifiers {
if(_specifiers == nil) {
_specifiers = [[self loadSpecifiersFromPlistName:@"ExactTimeprefs" target:self] retain];
}
return _specifiers;
}

-(void)apply{
[self.view endEditing:YES];
}
@end

// vim:ft=objc

+ 3
- 3
exacttimeprefs/Makefile Zobrazit soubor

ARCHS = armv7 arm64
ARCHS = armv7 arm64 arm64e
export TARGET = iphone:clang:11.2:7.0
include $(THEOS)/makefiles/common.mk include $(THEOS)/makefiles/common.mk


BUNDLE_NAME = ExactTimeprefs BUNDLE_NAME = ExactTimeprefs
ExactTimeprefs_FILES = RootListController.m
ExactTimeprefs_FILES = ExactTimeprefs.mm
ExactTimeprefs_INSTALL_PATH = /Library/PreferenceBundles ExactTimeprefs_INSTALL_PATH = /Library/PreferenceBundles
ExactTimeprefs_FRAMEWORKS = UIKit ExactTimeprefs_FRAMEWORKS = UIKit
ExactTimeprefs_PRIVATE_FRAMEWORKS = Preferences ExactTimeprefs_PRIVATE_FRAMEWORKS = Preferences

binární
packages/com.gilshahar7.exacttime_1.6_iphoneos-arm.deb Zobrazit soubor


Načítá se…
Zrušit
Uložit