RQShareFunction.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. #define RQ_SHARE_FUNCTION [RQShareFunction shareManager]
  12. NS_ASSUME_NONNULL_BEGIN
  13. //弹窗点击事件回调
  14. typedef void (^RQAlertViewCompletion) (NSUInteger selectedOtherButtonIndex);
  15. @interface RQShareFunction : NSObject
  16. @property (strong, readwrite, nonatomic) NSArray *shieldTopicIDArr;
  17. @property (strong, readwrite, nonatomic) NSArray *shieldPeopleIDArr;
  18. @property (strong, readwrite, nonatomic) NSArray *announcementIDArr;
  19. + (instancetype)shareManager;
  20. // 时间转换为时间戳
  21. - (NSInteger)getTimeStampWithDate:(NSDate *)date;
  22. // 时间戳转换为时间
  23. - (NSDate *)getDateWithTimeStamp:(NSInteger)timeStamp;
  24. // 一个时间戳与当前时间的间隔(s)
  25. - (NSInteger)getIntervalsWithTimeStamp:(NSInteger)timeStamp;
  26. - (NSString *)getCurrentTimeString;
  27. - (NSString *)getCurrentTimeStringWithTimeStamp:(NSInteger)timeStamp;
  28. /**
  29. * 获取当前页面
  30. *
  31. * @author ZhangRong
  32. * @date 2018-10-17 10:59:22
  33. */
  34. - (UIViewController *)topViewController;
  35. - (UIViewController *)currentViewController;
  36. - (UIViewController *)topViewController:(UIViewController*)rootViewController;
  37. /**
  38. * 在某个页面展示弹窗
  39. *
  40. * @author ZhangRong
  41. * @date 2018-10-12 11:27:55
  42. *
  43. * @param viewController 在该页面弹出
  44. * @param title 标题
  45. * @param message 副标题(可为nil)
  46. * @param alertControllerStyle 弹窗类型
  47. * @param cancelButtonTitle 取消按钮标题
  48. * @param otherButtonTitles 按钮标题数组
  49. * @param otherButtonStyles 按钮类型数组
  50. * @param preferredActionTitle 按钮文字加粗数组(UIAlertControllerStyleAlert有效)
  51. * @param completion 按钮点击回调
  52. */
  53. - (void)showAlertAtViewController:(nonnull UIViewController *)viewController
  54. WithTitle:(nullable NSString *)title
  55. message:(nullable NSString *)message
  56. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  57. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  58. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  59. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  60. preferredActionTitle:(nullable NSString *)preferredActionTitle
  61. completion:(nullable RQAlertViewCompletion)completion;
  62. /**
  63. * 展示弹窗(设置按钮文字加粗)
  64. *
  65. * @author ZhangRong
  66. * @date 2018-10-12 11:27:55
  67. *
  68. * @param title 标题
  69. * @param message 副标题(可为nil)
  70. * @param alertControllerStyle 弹窗类型
  71. * @param cancelButtonTitle 取消按钮标题
  72. * @param otherButtonTitles 按钮标题数组
  73. * @param otherButtonStyles 按钮类型数组
  74. * @param preferredActionTitle 按钮文字加粗数组(UIAlertControllerStyleAlert有效)
  75. * @param completion 按钮点击回调
  76. */
  77. - (void)showAlertWithTitle:(nullable NSString *)title
  78. message:(nullable NSString *)message
  79. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  80. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  81. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  82. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  83. preferredActionTitle:(nullable NSString *)preferredActionTitle
  84. completion:(nullable RQAlertViewCompletion)completion;
  85. /**
  86. * 展示弹窗
  87. *
  88. * @author ZhangRong
  89. * @date 2018-10-12 11:27:55
  90. *
  91. * @param title 标题
  92. * @param message 副标题(可为nil)
  93. * @param alertControllerStyle 弹窗类型
  94. * @param cancelButtonTitle 取消按钮标题
  95. * @param otherButtonTitles 按钮标题数组
  96. * @param otherButtonStyles 按钮类型数组
  97. * @param completion 按钮点击回调
  98. */
  99. - (void)showAlertWithTitle:(nullable NSString *)title
  100. message:(nullable NSString *)message
  101. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  102. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  103. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  104. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  105. completion:(nullable RQAlertViewCompletion)completion;
  106. /**
  107. * 展示大图
  108. *
  109. * @author ZhangRong
  110. * @date 2020-06-16 14:30:55
  111. *
  112. * @param dataSource 图片数组(Url数组)
  113. * @param currentIndex 当前标签
  114. * @param isCanSave 是否保存图片
  115. */
  116. - (void)showPhotoBrowserWithDataSource:(NSArray *)dataSource currentIndex:(NSInteger)currentIndex isCanSave:(BOOL)isCanSave;
  117. /**
  118. * Mob隐私判断
  119. *
  120. * @author ZhangRong
  121. * @date 2020-06-16 14:30:55
  122. */
  123. - (void)checkMobPolicyOnResult:(void (^_Nullable)(BOOL success))handler;
  124. @end
  125. NS_ASSUME_NONNULL_END