RQShareFunction.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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. @property (assign, readwrite, nonatomic) NSInteger APP_AD_CYCLE;
  48. /// 开屏广告展示概率
  49. @property (assign, readwrite, nonatomic) NSInteger APP_KP;
  50. @property (assign, readwrite, nonatomic) NSInteger APP_OPEN_COMMUNITY;
  51. /// 审核开关
  52. @property (assign, readwrite, nonatomic) NSInteger APP_SWITCH;
  53. @property (assign, readwrite, nonatomic) CGFloat RQADViewHeight;
  54. @property (assign, readwrite, nonatomic) NSInteger myErorNum;
  55. @property (assign, readwrite, nonatomic) NSInteger myCollectNum;
  56. //开启投诉地址
  57. @property (assign, readwrite, nonatomic) NSInteger SP_COMPLAINT_DQBH;
  58. // 时间转换为时间戳
  59. - (NSInteger)getTimeStampWithDate:(NSDate *)date;
  60. // 时间戳转换为时间
  61. - (NSDate *)getDateWithTimeStamp:(NSInteger)timeStamp;
  62. // 一个时间戳与当前时间的间隔(s)
  63. - (NSInteger)getIntervalsWithTimeStamp:(NSInteger)timeStamp;
  64. // 根据时间和formatter获取时间字符串
  65. - (NSString *)getTimeStrWithDate:(NSDate *)date formatter:(NSString *)formatterStr;
  66. // 一个时间戳与另一个时间戳的间隔(s)
  67. - (NSInteger)getIntervalsWithTimeStamp:(NSInteger)timeStamp anotherTimeStamp:(NSInteger)anotherTimeStamp;
  68. // 根据时间字符串和formatter获取时间戳
  69. - (NSInteger)getTimeStampWithTimeStr:(NSString *)timeStr formatter:(NSString *)formatterStr;
  70. - (NSInteger)getTimeStampWithHour:(NSInteger)hour andMinute:(NSInteger)minute andDate:(NSDate *)date;
  71. /**
  72. * 获取图片
  73. *
  74. * @author ZhangRong
  75. * @date 2018-10-17 10:55:22
  76. *
  77. * @param getPhotosWay 获取图片方式
  78. * @param size 图片尺寸比例
  79. * @param maxLength 图片内存大小限制
  80. * @param maxImagesCount 最大图片选择
  81. * @param isCheckBody 是否是活体拍照
  82. * @param photosBlock 弹窗点击事件回调
  83. */
  84. - (void)getPhotosWithGetPhotosWay:(GetPhotosWay)getPhotosWay size:(CGSize)size maxLength:(NSUInteger)maxLength maxImagesCount:(NSUInteger)maxImagesCount isCheckBody:(BOOL)isCheckBody photosBlock:(PhotosBlock)photosBlock;
  85. /**
  86. * 获取当前页面
  87. *
  88. * @author ZhangRong
  89. * @date 2018-10-17 10:59:22
  90. */
  91. - (UIViewController *)topViewController;
  92. - (UIViewController *)currentViewController;
  93. - (UIViewController *)topViewController:(UIViewController*)rootViewController;
  94. /**
  95. * 在某个页面展示弹窗
  96. *
  97. * @author ZhangRong
  98. * @date 2018-10-12 11:27:55
  99. *
  100. * @param viewController 在该页面弹出
  101. * @param title 标题
  102. * @param message 副标题(可为nil)
  103. * @param alertControllerStyle 弹窗类型
  104. * @param cancelButtonTitle 取消按钮标题
  105. * @param otherButtonTitles 按钮标题数组
  106. * @param otherButtonStyles 按钮类型数组
  107. * @param preferredActionTitle 按钮文字加粗数组(UIAlertControllerStyleAlert有效)
  108. * @param showInWindow 是否展示在keywindow上
  109. * @param completion 按钮点击回调
  110. */
  111. - (void)showAlertAtViewController:(nonnull UIViewController *)viewController
  112. WithTitle:(nullable NSString *)title
  113. message:(nullable NSString *)message
  114. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  115. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  116. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  117. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  118. preferredActionTitle:(nullable NSString *)preferredActionTitle
  119. showInWindow:(BOOL)showInWindow
  120. completion:(nullable RQAlertViewCompletion)completion;
  121. /**
  122. * 展示弹窗(设置按钮文字加粗)
  123. *
  124. * @author ZhangRong
  125. * @date 2018-10-12 11:27:55
  126. *
  127. * @param title 标题
  128. * @param message 副标题(可为nil)
  129. * @param alertControllerStyle 弹窗类型
  130. * @param cancelButtonTitle 取消按钮标题
  131. * @param otherButtonTitles 按钮标题数组
  132. * @param otherButtonStyles 按钮类型数组
  133. * @param preferredActionTitle 按钮文字加粗数组(UIAlertControllerStyleAlert有效)
  134. * @param showInWindow 是否展示在keywindow上
  135. * @param completion 按钮点击回调
  136. */
  137. - (void)showAlertWithTitle:(nullable NSString *)title
  138. message:(nullable NSString *)message
  139. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  140. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  141. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  142. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  143. preferredActionTitle:(nullable NSString *)preferredActionTitle
  144. showInWindow:(BOOL)showInWindow
  145. completion:(nullable RQAlertViewCompletion)completion;
  146. /**
  147. * 展示弹窗
  148. *
  149. * @author ZhangRong
  150. * @date 2018-10-12 11:27:55
  151. *
  152. * @param title 标题
  153. * @param message 副标题(可为nil)
  154. * @param alertControllerStyle 弹窗类型
  155. * @param cancelButtonTitle 取消按钮标题
  156. * @param otherButtonTitles 按钮标题数组
  157. * @param otherButtonStyles 按钮类型数组
  158. * @param showInWindow 是否展示在keywindow上
  159. * @param completion 按钮点击回调
  160. */
  161. - (void)showAlertWithTitle:(nullable NSString *)title
  162. message:(nullable NSString *)message
  163. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  164. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  165. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  166. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  167. showInWindow:(BOOL)showInWindow
  168. completion:(nullable RQAlertViewCompletion)completion;
  169. /// 展示文本弹窗
  170. /// @param message 文本
  171. /// @param completion 回调
  172. - (void)showAlertWithMessage:(nullable NSString *)message
  173. completion:(nullable RQAlertViewCompletion)completion;
  174. /**
  175. 第一次进入APP提示指引页面
  176. */
  177. - (void)showGuidePicture;
  178. /**
  179. 检查版本
  180. */
  181. - (void)checkVersion;
  182. /**
  183. * 展示大图
  184. *
  185. * @author ZhangRong
  186. * @date 2020-06-16 14:30:55
  187. *
  188. * @param dataSource 图片数组(Url数组)
  189. * @param currentIndex 当前标签
  190. * @param isCanSave 是否保存图片
  191. */
  192. - (void)showPhotoBrowserWithDataSource:(NSArray *)dataSource currentIndex:(NSInteger)currentIndex isCanSave:(BOOL)isCanSave;
  193. /**
  194. * Mob隐私判断
  195. *
  196. * @author ZhangRong
  197. * @date 2020-06-16 14:30:55
  198. */
  199. - (void)checkMobPolicyOnResult:(void (^_Nullable)(BOOL success))handler;
  200. /// 保存到本地数据
  201. /// @param object 值
  202. /// @param key 键
  203. - (void)saveObjectWithObject:(id)object ForKey:(NSString* )key;
  204. /// 获取本地数据
  205. /// @param key 键
  206. - (id)getObjectWithKey:(NSString *)key;
  207. // 检测抓包
  208. - (BOOL)checkProxySetting;
  209. // 前往H5
  210. - (void)gotoWebViewWithUrlStr:(NSString *)url;
  211. // 前往小程序
  212. - (void)miniwithUserName:(NSString *)userName path:(NSString *)path;
  213. @end
  214. NS_ASSUME_NONNULL_END