RQShareFunction.h 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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. 活体回调
  13. @param success 是否成功
  14. */
  15. typedef void(^BDCheckBodyCompletedBlock)(BOOL success);
  16. //弹窗点击事件回调
  17. typedef void (^RQAlertViewCompletion) (NSUInteger selectedOtherButtonIndex);
  18. //获取图片方式
  19. typedef NS_ENUM(NSInteger, GetPhotosWay) {
  20. GetPhotosWay_Camera = 0,
  21. GetPhotosWay_Album,
  22. };
  23. typedef NS_ENUM(NSInteger, LoginFlagType) {
  24. LoginFlagType_Default = 0, // 默认值
  25. LoginFlagType_SignIn = 1, // 签到
  26. LoginFlagType_Process = 2, // 培训过程
  27. LoginFlagType_SignOut = 3 // 签退
  28. };
  29. typedef void(^PhotosBlock)(NSArray *imagesArr , NSArray * imagesDataStrArr);
  30. @interface RQShareFunction : NSObject
  31. + (instancetype)shareManager;
  32. #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_12_0
  33. // 当前模式
  34. @property (assign, readwrite, nonatomic) UIUserInterfaceStyle currentUserInterfaceStyle API_AVAILABLE(ios(13.0), tvos(13.0));
  35. #endif
  36. // 个人中心功能模块类型一(预约相关,模拟相关,资讯相关)(开启地市:福州-3501,厦门-3502)
  37. @property (copy, readonly, nonatomic) NSArray *personalTypeOneCityCodeArr;
  38. // 个人中心功能模块类型一(预约相关,资讯相关)(开启地市:温州-3303)
  39. @property (copy, readonly, nonatomic) NSArray *personalTypeTwoCityCodeArr;
  40. // 学车计时功能模块类型一(理论计时,实操计时,模拟计时,我的学时)(开启地市:福州-3501,厦门-3502,温州-3303)
  41. @property (copy, readonly, nonatomic) NSArray *timingTypeOneCityCodeArr;
  42. // 学车计时功能模块类型二(理论计时,我的学时)(开启地市:莆田-3503)
  43. @property (copy, readonly, nonatomic) NSArray *timingTypeTwoCityCodeArr;
  44. // 理论计时类型一 (在科目二,科目三可以进行科目四的理论计时) (开启地市:福州-3501,莆田-3503)
  45. @property (copy, readonly, nonatomic) NSArray *theoryOfTimingTypeOneCityCodeArr;
  46. // 理论计时类型二地市编号:null (在科目二可以进行科目四的理论计时)(开启地市:)
  47. @property (copy, readonly, nonatomic) NSArray *theoryOfTimingTypeTwoCityCodeArr;
  48. // 理论计时类型三 (在科目三可以进行科目四的理论计时)(开启地市:厦门-3502)
  49. @property (copy, readonly, nonatomic) NSArray *theoryOfTimingTypeThreeCityCodeArr;
  50. @property (strong, readwrite, nonatomic) NSArray *shieldTopicIDArr;
  51. @property (strong, readwrite, nonatomic) NSArray *shieldPeopleIDArr;
  52. @property (strong, readwrite, nonatomic) NSArray *announcementIDArr;
  53. @property (assign, readwrite, nonatomic) BOOL APP_AD;
  54. @property (assign, readwrite, nonatomic) NSInteger APP_CLOSE;
  55. @property (assign, readwrite, nonatomic) NSInteger APP_AD_CYCLE;
  56. // 时间转换为时间戳
  57. - (NSInteger)getTimeStampWithDate:(NSDate *)date;
  58. // 时间戳转换为时间
  59. - (NSDate *)getDateWithTimeStamp:(NSInteger)timeStamp;
  60. // 一个时间戳与当前时间的间隔(s)
  61. - (NSInteger)getIntervalsWithTimeStamp:(NSInteger)timeStamp;
  62. // 根据时间和formatter获取时间字符串
  63. - (NSString *)getTimeStrWithDate:(NSDate *)date formatter:(NSString *)formatterStr;
  64. // 一个时间戳与另一个时间戳的间隔(s)
  65. - (NSInteger)getIntervalsWithTimeStamp:(NSInteger)timeStamp anotherTimeStamp:(NSInteger)anotherTimeStamp;
  66. // 根据时间字符串和formatter获取时间戳
  67. - (NSInteger)getTimeStampWithTimeStr:(NSString *)timeStr formatter:(NSString *)formatterStr;
  68. /**
  69. * 获取图片
  70. *
  71. * @author ZhangRong
  72. * @date 2018-10-17 10:55:22
  73. *
  74. * @param getPhotosWay 获取图片方式
  75. * @param size 图片尺寸比例
  76. * @param maxLength 图片内存大小限制
  77. * @param maxImagesCount 最大图片选择
  78. * @param photosBlock 弹窗点击事件回调
  79. */
  80. - (void)getPhotosWithGetPhotosWay:(GetPhotosWay)getPhotosWay size:(CGSize)size maxLength:(NSUInteger)maxLength maxImagesCount:(NSUInteger)maxImagesCount photosBlock:(PhotosBlock)photosBlock;
  81. /**
  82. * 获取当前页面
  83. *
  84. * @author ZhangRong
  85. * @date 2018-10-17 10:59:22
  86. */
  87. - (UIViewController *)topViewController;
  88. - (UIViewController *)currentViewController;
  89. - (UIViewController *)topViewController:(UIViewController*)rootViewController;
  90. /**
  91. * 在某个页面展示弹窗
  92. *
  93. * @author ZhangRong
  94. * @date 2018-10-12 11:27:55
  95. *
  96. * @param viewController 在该页面弹出
  97. * @param title 标题
  98. * @param message 副标题(可为nil)
  99. * @param alertControllerStyle 弹窗类型
  100. * @param cancelButtonTitle 取消按钮标题
  101. * @param otherButtonTitles 按钮标题数组
  102. * @param otherButtonStyles 按钮类型数组
  103. * @param preferredActionTitle 按钮文字加粗数组(UIAlertControllerStyleAlert有效)
  104. * @param completion 按钮点击回调
  105. */
  106. - (void)showAlertAtViewController:(nonnull UIViewController *)viewController
  107. WithTitle:(nullable NSString *)title
  108. message:(nullable NSString *)message
  109. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  110. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  111. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  112. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  113. preferredActionTitle:(nullable NSString *)preferredActionTitle
  114. completion:(nullable RQAlertViewCompletion)completion;
  115. /**
  116. * 展示弹窗(设置按钮文字加粗)
  117. *
  118. * @author ZhangRong
  119. * @date 2018-10-12 11:27:55
  120. *
  121. * @param title 标题
  122. * @param message 副标题(可为nil)
  123. * @param alertControllerStyle 弹窗类型
  124. * @param cancelButtonTitle 取消按钮标题
  125. * @param otherButtonTitles 按钮标题数组
  126. * @param otherButtonStyles 按钮类型数组
  127. * @param preferredActionTitle 按钮文字加粗数组(UIAlertControllerStyleAlert有效)
  128. * @param completion 按钮点击回调
  129. */
  130. - (void)showAlertWithTitle:(nullable NSString *)title
  131. message:(nullable NSString *)message
  132. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  133. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  134. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  135. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  136. preferredActionTitle:(nullable NSString *)preferredActionTitle
  137. completion:(nullable RQAlertViewCompletion)completion;
  138. /**
  139. * 展示弹窗
  140. *
  141. * @author ZhangRong
  142. * @date 2018-10-12 11:27:55
  143. *
  144. * @param title 标题
  145. * @param message 副标题(可为nil)
  146. * @param alertControllerStyle 弹窗类型
  147. * @param cancelButtonTitle 取消按钮标题
  148. * @param otherButtonTitles 按钮标题数组
  149. * @param otherButtonStyles 按钮类型数组
  150. * @param completion 按钮点击回调
  151. */
  152. - (void)showAlertWithTitle:(nullable NSString *)title
  153. message:(nullable NSString *)message
  154. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  155. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  156. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  157. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  158. completion:(nullable RQAlertViewCompletion)completion;
  159. /// 展示文本弹窗
  160. /// @param message 文本
  161. /// @param completion 回调
  162. - (void)showAlertWithMessage:(nullable NSString *)message
  163. completion:(nullable RQAlertViewCompletion)completion;
  164. /**
  165. 第一次进入APP提示指引页面
  166. */
  167. - (void)showGuidePicture;
  168. /**
  169. 检查版本
  170. */
  171. - (void)checkVersion;
  172. /**
  173. * 展示大图
  174. *
  175. * @author ZhangRong
  176. * @date 2020-06-16 14:30:55
  177. *
  178. * @param dataSource 图片数组(Url数组)
  179. * @param currentIndex 当前标签
  180. * @param isCanSave 是否保存图片
  181. */
  182. - (void)showPhotoBrowserWithDataSource:(NSArray *)dataSource currentIndex:(NSInteger)currentIndex isCanSave:(BOOL)isCanSave;
  183. /**
  184. * Mob隐私判断
  185. *
  186. * @author ZhangRong
  187. * @date 2020-06-16 14:30:55
  188. */
  189. - (void)checkMobPolicyOnResult:(void (^_Nullable)(BOOL success))handler;
  190. /// 保存到本地数据
  191. /// @param object 值
  192. /// @param key 键
  193. - (void)saveObjectWithObject:(id)object ForKey:(NSString* )key;
  194. /// 获取本地数据
  195. /// @param key 键
  196. - (id)getObjectWithKey:(NSString *)key;
  197. // 检测抓包
  198. - (BOOL)checkProxySetting;
  199. @end
  200. NS_ASSUME_NONNULL_END