WFCCUtilities.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //
  2. // WFCCUtilities.h
  3. // WFChatClient
  4. //
  5. // Created by heavyrain on 2017/9/7.
  6. // Copyright © 2017年 WildFireChat. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "WFCCIMService.h"
  10. #import "WFCCEnums.h"
  11. @interface WFCCUtilities : NSObject
  12. /**
  13. 生成缩略图
  14. @param image 原图
  15. @param targetWidth 宽度
  16. @param targetHeight 高度
  17. @return 缩略图
  18. */
  19. + (UIImage *)generateThumbnail:(UIImage *)image
  20. withWidth:(CGFloat)targetWidth
  21. withHeight:(CGFloat)targetHeight;
  22. /**
  23. 缩小图片
  24. @param image 原图
  25. @param size 宽度
  26. @return 缩小到size范围内的Image
  27. */
  28. + (UIImage *)image:(UIImage *)image scaleInSize:(CGSize)size;
  29. /**
  30. 获取对应的沙盒路径
  31. @param localPath 文件路径
  32. @return 对应的沙盒路径
  33. */
  34. + (NSString *)getSendBoxFilePath:(NSString *)localPath;
  35. /**
  36. 获取资源路径
  37. @param componentPath 相对路径
  38. @return 资源路径
  39. */
  40. + (NSString *)getDocumentPathWithComponent:(NSString *)componentPath;
  41. + (CGSize)imageScaleSize:(CGSize)imageSize targetSize:(CGSize)targetSize thumbnailPoint:(CGPoint *)thumbnailPoint;
  42. + (UIImage *)imageWithRightOrientation:(UIImage *)aImage;
  43. + (BOOL)isExternalTarget:(NSString *)targetId;
  44. + (NSString *)getExternalDomain:(NSString *)targetId;
  45. + (NSString *)getTargetWithoutDomain:(NSString *)targetId;
  46. + (NSAttributedString *)getExternal:(NSString *)domainId withName:(NSString *)name withColor:(UIColor *)color;
  47. + (NSAttributedString *)getExternal:(NSString *)domainId withName:(NSString *)name withColor:(UIColor *)color withSize:(CGFloat)fontSize;
  48. //同步函数,只能在后台线程执行
  49. + (NSString *)getGroupGridPortrait:(NSString *)groupId
  50. width:(int)width
  51. generateIfNotExist:(BOOL)generateIfNotExist
  52. defaultUserPortrait:(UIImage *(^)(NSString *userId))defaultUserPortraitBlock;
  53. + (NSString *)getGroupGridPortrait:(NSString *)groupId
  54. memberPortraits:(NSArray<NSDictionary<NSString*, NSString*>*> *)groupMembers
  55. width:(int)PortraitWidth
  56. defaultUserPortrait:(UIImage *(^)(NSString *userId))defaultUserPortraitBlock;
  57. + (NSString *)getGroupMemberExtra:(WFCCGroupMemberSourceType)sourceType sourceTargetId:(NSString *)sourceTargetId;
  58. + (WFCCGroupMemberSourceType)getGroupMemberSourceType:(NSString *)memberExtra sourceTargetId:(NSMutableString *)sourceTargetId;
  59. + (NSString *)getUserDisplayName:(NSString *)userId inGroup:(NSString *)groupId;
  60. @end