RQShareFunction.h 9.0 KB

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