Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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