RQShareFunction.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. #import "UITextField+RQExtension.h"
  10. #import "LocalNotificationManager.h"
  11. #import "SLShotViewController.h"
  12. #define RQ_SHARE_FUNCTION [RQShareFunction shareManager]
  13. //获取图片方式
  14. typedef NS_ENUM(NSInteger, GetPhotosWay) {
  15. GetPhotosWay_Camera = 0,
  16. GetPhotosWay_Album,
  17. };
  18. typedef void(^PhotosBlock)(NSArray *imagesArr , NSArray * imagesDataStrArr);
  19. NS_ASSUME_NONNULL_BEGIN
  20. //弹窗点击事件回调
  21. typedef void (^RQAlertViewCompletion) (NSUInteger selectedOtherButtonIndex);
  22. @interface RQShareFunction : NSObject
  23. @property (strong, readwrite, nonatomic) NSArray *shieldTopicIDArr;
  24. @property (strong, readwrite, nonatomic) NSArray *shieldPeopleIDArr;
  25. @property (strong, readwrite, nonatomic) NSArray *announcementIDArr;
  26. @property (assign, readwrite, nonatomic) CGFloat RQADViewHeight;
  27. @property (assign, readwrite, nonatomic) NSInteger myErorNum;
  28. @property (assign, readwrite, nonatomic) NSInteger myCollectNum;
  29. + (instancetype)shareManager;
  30. // 时间转换为时间戳
  31. - (NSInteger)getTimeStampWithDate:(NSDate *)date;
  32. // 时间戳转换为时间
  33. - (NSDate *)getDateWithTimeStamp:(NSInteger)timeStamp;
  34. // 一个时间戳与当前时间的间隔(s)
  35. - (NSInteger)getIntervalsWithTimeStamp:(NSInteger)timeStamp;
  36. - (NSString *)getCurrentTimeString;
  37. - (NSString *)getCurrentTimeStringWithTimeStamp:(NSInteger)timeStamp;
  38. // 根据时间字符串和formatter获取时间戳(s)
  39. - (NSInteger)getTimeStampWithTimeStr:(NSString *)timeStr formatter:(NSString *)formatterStr;
  40. /**
  41. * 获取当前页面
  42. *
  43. * @author ZhangRong
  44. * @date 2018-10-17 10:59:22
  45. */
  46. - (UIViewController *)topViewController;
  47. - (UIViewController *)currentViewController;
  48. - (UIViewController *)topViewController:(UIViewController*)rootViewController;
  49. /**
  50. * 在某个页面展示弹窗
  51. *
  52. * @author ZhangRong
  53. * @date 2018-10-12 11:27:55
  54. *
  55. * @param viewController 在该页面弹出
  56. * @param title 标题
  57. * @param message 副标题(可为nil)
  58. * @param alertControllerStyle 弹窗类型
  59. * @param cancelButtonTitle 取消按钮标题
  60. * @param otherButtonTitles 按钮标题数组
  61. * @param otherButtonStyles 按钮类型数组
  62. * @param preferredActionTitle 按钮文字加粗数组(UIAlertControllerStyleAlert有效)
  63. * @param completion 按钮点击回调
  64. */
  65. - (void)showAlertAtViewController:(nonnull UIViewController *)viewController
  66. WithTitle:(nullable NSString *)title
  67. message:(nullable NSString *)message
  68. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  69. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  70. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  71. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  72. preferredActionTitle:(nullable NSString *)preferredActionTitle
  73. completion:(nullable RQAlertViewCompletion)completion;
  74. /**
  75. * 展示弹窗(设置按钮文字加粗)
  76. *
  77. * @author ZhangRong
  78. * @date 2018-10-12 11:27:55
  79. *
  80. * @param title 标题
  81. * @param message 副标题(可为nil)
  82. * @param alertControllerStyle 弹窗类型
  83. * @param cancelButtonTitle 取消按钮标题
  84. * @param otherButtonTitles 按钮标题数组
  85. * @param otherButtonStyles 按钮类型数组
  86. * @param preferredActionTitle 按钮文字加粗数组(UIAlertControllerStyleAlert有效)
  87. * @param completion 按钮点击回调
  88. */
  89. - (void)showAlertWithTitle:(nullable NSString *)title
  90. message:(nullable NSString *)message
  91. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  92. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  93. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  94. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  95. preferredActionTitle:(nullable NSString *)preferredActionTitle
  96. completion:(nullable RQAlertViewCompletion)completion;
  97. /**
  98. * 展示弹窗
  99. *
  100. * @author ZhangRong
  101. * @date 2018-10-12 11:27:55
  102. *
  103. * @param title 标题
  104. * @param message 副标题(可为nil)
  105. * @param alertControllerStyle 弹窗类型
  106. * @param cancelButtonTitle 取消按钮标题
  107. * @param otherButtonTitles 按钮标题数组
  108. * @param otherButtonStyles 按钮类型数组
  109. * @param completion 按钮点击回调
  110. */
  111. - (void)showAlertWithTitle:(nullable NSString *)title
  112. message:(nullable NSString *)message
  113. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  114. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  115. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  116. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  117. completion:(nullable RQAlertViewCompletion)completion;
  118. - (void)showAlertAtViewController:(nonnull UIViewController *)viewController
  119. WithTitle:(nullable NSString *)title
  120. message:(nullable NSString *)message
  121. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  122. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  123. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  124. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  125. preferredActionTitle:(nullable NSString *)preferredActionTitle
  126. showInWindow:(BOOL)showInWindow
  127. completion:(nullable RQAlertViewCompletion)completion;
  128. - (void)showAlertWithTitle:(nullable NSString *)title
  129. message:(nullable NSString *)message
  130. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  131. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  132. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  133. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  134. showInWindow:(BOOL)showInWindow
  135. completion:(nullable RQAlertViewCompletion)completion;
  136. /**
  137. * 展示大图
  138. *
  139. * @author ZhangRong
  140. * @date 2020-06-16 14:30:55
  141. *
  142. * @param dataSource 图片数组(Url数组)
  143. * @param currentIndex 当前标签
  144. * @param isCanSave 是否保存图片
  145. */
  146. - (void)showPhotoBrowserWithDataSource:(NSArray *)dataSource currentIndex:(NSInteger)currentIndex isCanSave:(BOOL)isCanSave;
  147. /**
  148. * Mob隐私判断
  149. *
  150. * @author ZhangRong
  151. * @date 2020-06-16 14:30:55
  152. */
  153. - (void)checkMobPolicyOnResult:(void (^_Nullable)(BOOL success))handler;
  154. /// 保存到本地数据
  155. /// @param object 值
  156. /// @param key 键
  157. - (void)saveObjectWithObject:(id)object ForKey:(NSString* )key;
  158. /// 获取本地数据
  159. /// @param key 键
  160. - (id)getObjectWithKey:(NSString *)key;
  161. // 检测抓包
  162. - (BOOL)checkProxySetting;
  163. // 前往H5
  164. - (void)gotoWebViewWithUrlStr:(NSString *)url;
  165. // 前往小程序
  166. - (void)miniwithUserName:(NSString *)userName path:(NSString *)path;
  167. /**
  168. * 获取图片
  169. *
  170. * @author ZhangRong
  171. * @date 2018-10-17 10:55:22
  172. *
  173. * @param getPhotosWay 获取图片方式
  174. * @param size 图片尺寸比例
  175. * @param maxLength 图片内存大小限制
  176. * @param maxImagesCount 最大图片选择
  177. * @param isCheckBody 是否是活体拍照
  178. * @param photosBlock 弹窗点击事件回调
  179. */
  180. - (void)getPhotosWithGetPhotosWay:(GetPhotosWay)getPhotosWay size:(CGSize)size maxLength:(NSUInteger)maxLength maxImagesCount:(NSUInteger)maxImagesCount isCheckBody:(BOOL)isCheckBody photosBlock:(PhotosBlock)photosBlock;
  181. @end
  182. NS_ASSUME_NONNULL_END