Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. @interface UIDateLabel : UILabel
  2. @property (nonatomic, strong) NSDate *date;
  3. @end
  4. @interface MPRecentsTableViewCell
  5. @property (nonatomic, strong) UIDateLabel *callerDateLabel;
  6. @end
  7. static bool is24h;
  8. static NSString *settingsPath = @"/var/mobile/Library/Preferences/com.gilshahar7.exacttimeprefs.plist";
  9. static bool enabled;
  10. %hook MPRecentsTableViewCell
  11. -(void)layoutSubviews{
  12. %orig;
  13. if(enabled){
  14. if(![self.callerDateLabel.text containsString:@":"]){
  15. NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
  16. if(is24h){
  17. [dateFormatter setDateFormat:@"\nHH:mm"];
  18. }else{
  19. [dateFormatter setDateFormat:@"\nh:mm a"];
  20. }
  21. self.callerDateLabel.textAlignment = 2;
  22. self.callerDateLabel.numberOfLines = 2;
  23. self.callerDateLabel.text = [self.callerDateLabel.text stringByAppendingString:[dateFormatter stringFromDate:self.callerDateLabel.date]];
  24. }
  25. }
  26. }
  27. %end
  28. %ctor{
  29. NSMutableDictionary *prefs = [[NSMutableDictionary alloc] initWithContentsOfFile:settingsPath];
  30. enabled = [[prefs objectForKey:@"phone"] boolValue];
  31. NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
  32. [formatter setLocale:[NSLocale currentLocale]];
  33. [formatter setDateStyle:NSDateFormatterNoStyle];
  34. [formatter setTimeStyle:NSDateFormatterShortStyle];
  35. NSString *dateString = [formatter stringFromDate:[NSDate date]];
  36. NSRange amRange = [dateString rangeOfString:[formatter AMSymbol]];
  37. NSRange pmRange = [dateString rangeOfString:[formatter PMSymbol]];
  38. is24h = (amRange.location == NSNotFound && pmRange.location == NSNotFound);
  39. }