Utils.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2012-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import <Foundation/Foundation.h>
  21. #import "Contact.h"
  22. @interface Utils : NSObject
  23. + (BOOL)isSameDayWithDate1:(NSDate*)date1 date2:(NSDate*)date2;
  24. + (NSString*)formatShortLastMessageDate:(NSDate*)date;
  25. + (NSString*)getClientVersion;
  26. + (NSString *)appAndBuildVersion;
  27. + (void)reverseGeocodeNearLatitude:(double)latitude longitude:(double)longitude accuracy:(double)accuracy completion:(void (^)(NSString *label))completion onError:(void(^)(NSError *error))onError;
  28. + (time_t)systemUptime;
  29. + (NSString *)timeStringForSeconds: (NSInteger) totalSeconds;
  30. + (NSString *)accessabilityTimeStringForSeconds: (NSInteger) totalSeconds;
  31. + (NSString *)accessibilityStringAtTime:(NSTimeInterval)timeInterval withPrefix:(NSString *)prefixKey;
  32. + (NSDate*)parseISO8601DateString:(NSString*)dateString;
  33. + (NSString *)formatDataLength:(CGFloat)numBytes;
  34. + (NSString *)stringFromContacts:(NSArray *)contacts;
  35. + (BOOL)isValidEmail:(NSString *)email;
  36. + (UIView *)view:(UIView *)view getSuperviewOfKind:(Class)class;
  37. + (UIViewAnimationOptions)animationOptionsFor:(NSNotification *)notification animationDuration:(NSTimeInterval*)animationDuration;
  38. + (UIImage *)makeThumbWithOverlayFor:(UIImage *)image;
  39. + (NSData*)truncatedUTF8String:(NSString*)str maxLength:(NSUInteger)maxLength;
  40. + (BOOL)hideThreemaTypeIconForContact:(Contact *)contact;
  41. + (UIImage *)threemaTypeIcon;
  42. + (NSArray *)getTrimmedMessages:(NSString *)message;
  43. + (void)sendErrorLocalNotification:(NSString *)title body:(NSString *)body userInfo:(NSDictionary *)userInfo;
  44. @end