RQShareFunction.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. //
  2. // RQShareFunction.h
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2018/10/16.
  6. // Copyright © 2018 Danson. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #define RQ_SHARE_FUNCTION [RQShareFunction shareManager]
  10. NS_ASSUME_NONNULL_BEGIN
  11. //弹窗点击事件回调
  12. typedef void (^RQAlertViewCompletion) (NSUInteger selectedOtherButtonIndex);
  13. //获取图片方式
  14. typedef NS_ENUM(NSInteger, GetPhotosWay) {
  15. GetPhotosWay_Camera = 0,
  16. GetPhotosWay_Album,
  17. };
  18. typedef void(^PhotosBlock)(NSArray *imagesArr , NSArray * imagesDataStrArr);
  19. @interface RQShareFunction : NSObject
  20. + (instancetype)shareManager;
  21. #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_12_0
  22. // 当前模式
  23. @property (assign, readwrite, nonatomic) UIUserInterfaceStyle currentUserInterfaceStyle API_AVAILABLE(ios(13.0), tvos(13.0));
  24. #endif
  25. @property (copy, readonly, nonatomic) NSArray *typeOneCityCodeArr;// 类型一的地市编号:3501,3502
  26. @property (copy, readonly, nonatomic) NSArray *typeTwoCityCodeArr;// 类型二的地市编号:3503
  27. // 时间转换为时间戳
  28. - (NSInteger)getTimeStampWithDate:(NSDate *)date;
  29. // 时间戳转换为时间
  30. - (NSDate *)getDateWithTimeStamp:(NSInteger)timeStamp;
  31. // 一个时间戳与当前时间的间隔(s)
  32. - (NSInteger)getIntervalsWithTimeStamp:(NSInteger)timeStamp;
  33. /**
  34. * 获取图片
  35. *
  36. * @author ZhangRong
  37. * @date 2018-10-17 10:55:22
  38. *
  39. * @param getPhotosWay 获取图片方式
  40. * @param size 图片尺寸比例
  41. * @param maxLength 图片内存大小限制
  42. * @param maxImagesCount 最大图片选择
  43. * @param photosBlock 弹窗点击事件回调
  44. */
  45. - (void)getPhotosWithGetPhotosWay:(GetPhotosWay)getPhotosWay size:(CGSize)size maxLength:(NSUInteger)maxLength maxImagesCount:(NSUInteger)maxImagesCount photosBlock:(PhotosBlock)photosBlock;
  46. /**
  47. * 获取当前页面
  48. *
  49. * @author ZhangRong
  50. * @date 2018-10-17 10:59:22
  51. */
  52. - (UIViewController *)topViewController;
  53. - (UIViewController *)currentViewController;
  54. - (UIViewController *)topViewController:(UIViewController*)rootViewController;
  55. /**
  56. * 在某个页面展示弹窗
  57. *
  58. * @author ZhangRong
  59. * @date 2018-10-12 11:27:55
  60. *
  61. * @param viewController 在该页面弹出
  62. * @param title 标题
  63. * @param message 副标题(可为nil)
  64. * @param alertControllerStyle 弹窗类型
  65. * @param cancelButtonTitle 取消按钮标题
  66. * @param otherButtonTitles 按钮标题数组
  67. * @param otherButtonStyles 按钮类型数组
  68. * @param preferredActionTitle 按钮文字加粗数组(UIAlertControllerStyleAlert有效)
  69. * @param completion 按钮点击回调
  70. */
  71. - (void)showAlertAtViewController:(nonnull UIViewController *)viewController
  72. WithTitle:(nullable NSString *)title
  73. message:(nullable NSString *)message
  74. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  75. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  76. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  77. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  78. preferredActionTitle:(nullable NSString *)preferredActionTitle
  79. completion:(nullable RQAlertViewCompletion)completion;
  80. /**
  81. * 展示弹窗(设置按钮文字加粗)
  82. *
  83. * @author ZhangRong
  84. * @date 2018-10-12 11:27:55
  85. *
  86. * @param title 标题
  87. * @param message 副标题(可为nil)
  88. * @param alertControllerStyle 弹窗类型
  89. * @param cancelButtonTitle 取消按钮标题
  90. * @param otherButtonTitles 按钮标题数组
  91. * @param otherButtonStyles 按钮类型数组
  92. * @param preferredActionTitle 按钮文字加粗数组(UIAlertControllerStyleAlert有效)
  93. * @param completion 按钮点击回调
  94. */
  95. - (void)showAlertWithTitle:(nullable NSString *)title
  96. message:(nullable NSString *)message
  97. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  98. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  99. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  100. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  101. preferredActionTitle:(nullable NSString *)preferredActionTitle
  102. completion:(nullable RQAlertViewCompletion)completion;
  103. /**
  104. * 展示弹窗
  105. *
  106. * @author ZhangRong
  107. * @date 2018-10-12 11:27:55
  108. *
  109. * @param title 标题
  110. * @param message 副标题(可为nil)
  111. * @param alertControllerStyle 弹窗类型
  112. * @param cancelButtonTitle 取消按钮标题
  113. * @param otherButtonTitles 按钮标题数组
  114. * @param otherButtonStyles 按钮类型数组
  115. * @param completion 按钮点击回调
  116. */
  117. - (void)showAlertWithTitle:(nullable NSString *)title
  118. message:(nullable NSString *)message
  119. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  120. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  121. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  122. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  123. completion:(nullable RQAlertViewCompletion)completion;
  124. /**
  125. 第一次进入APP提示指引页面
  126. */
  127. - (void)showGuidePicture;
  128. /**
  129. 检查版本
  130. */
  131. - (void)checkVersion;
  132. /**
  133. * 展示大图
  134. *
  135. * @author ZhangRong
  136. * @date 2020-06-16 14:30:55
  137. *
  138. * @param dataSource 图片数组(Url数组)
  139. * @param currentIndex 当前标签
  140. * @param isCanSave 是否保存图片
  141. */
  142. - (void)showPhotoBrowserWithDataSource:(NSArray *)dataSource currentIndex:(NSInteger)currentIndex isCanSave:(BOOL)isCanSave;
  143. /**
  144. * Mob隐私判断
  145. *
  146. * @author ZhangRong
  147. * @date 2020-06-16 14:30:55
  148. */
  149. - (void)checkMobPolicyOnResult:(void (^_Nullable)(BOOL success))handler;
  150. @end
  151. NS_ASSUME_NONNULL_END