GT3Utils.h 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. //
  2. // GTUtils.h
  3. // GTFramework
  4. //
  5. // Created by LYJ on 15/5/18.
  6. // Copyright (c) 2015年 gt. All rights reserved.
  7. //
  8. #ifndef GTFramework_GTUtils_h
  9. #define GTFramework_GTUtils_h
  10. #if __has_feature(objc_generics)
  11. #define GT3_GENERICS(class, ...) class<__VA_ARGS__>
  12. #define GT3_GENERICS_TYPE(type) type
  13. #else
  14. #define GT3_GENERICS(class, ...) class
  15. #define GT3_GENERICS_TYPE(type) id
  16. #endif
  17. #import <UIKit/UIKit.h>
  18. /**
  19. 极验验证状态的枚举量
  20. */
  21. typedef NS_ENUM(NSInteger, GT3CaptchaState) {
  22. /** 验证未激活 */
  23. GT3CaptchaStateInactive = 0,
  24. /** 验证激活 */
  25. GT3CaptchaStateActive,
  26. /** 验证初始化中 */
  27. GT3CaptchaStateInitial,
  28. /** 验证等待交互中 */
  29. GT3CaptchaStateWaiting,
  30. /** 验证检测数据中 */
  31. GT3CaptchaStateCollecting,
  32. /** 验证结果判定中 */
  33. GT3CaptchaStateComputing,
  34. /** 验证通过 */
  35. GT3CaptchaStateSuccess,
  36. /** 验证失败 */
  37. GT3CaptchaStateFail,
  38. /** 验证取消 */
  39. GT3CaptchaStateCancel,
  40. /** 验证发生错误 */
  41. GT3CaptchaStateError
  42. };
  43. /**
  44. * 验证集群节点
  45. */
  46. typedef NS_ENUM(NSInteger, GT3CaptchaServiceNode) {
  47. /** 中国服务集群*/
  48. GT3CaptchaServiceNodeCN = 0,
  49. /** 北美服务集群*/
  50. GT3CaptchaServiceNodeNA,
  51. /** 默认服务集群*/
  52. GT3CaptchaServiceNodeDefault = GT3CaptchaServiceNodeCN
  53. };
  54. /**
  55. * 验证模式枚举量
  56. */
  57. typedef NS_ENUM(NSInteger, GT3CaptchaMode) {
  58. /** 验证默认模式*/
  59. GT3CaptchaModeDefault,
  60. /** 验证宕机模式*/
  61. GT3CaptchaModeFailback,
  62. GT3CaptchaModeNoLogo,
  63. GT3CaptchaModeLogo
  64. };
  65. /**
  66. * 视图上结果的更新策略
  67. */
  68. typedef NS_ENUM(NSInteger, GT3SecondaryCaptchaPolicy) {
  69. /** 二次验证通过 */
  70. GT3SecondaryCaptchaPolicyAllow,
  71. /** 二次验证拒绝 */
  72. GT3SecondaryCaptchaPolicyForbidden
  73. };
  74. /**
  75. * 图形验证的语言选项
  76. */
  77. typedef NS_ENUM(NSInteger, GT3LanguageType) {
  78. /** Simplified Chinese 简体中文 */
  79. GT3LANGTYPE_ZH_CN = 0,
  80. /** Traditional Chinese 繁体中文 */
  81. GT3LANGTYPE_ZH_TW,
  82. /** Traditional Chinese 繁体中文 */
  83. GT3LANGTYPE_ZH_HK,
  84. /** Korean 韩语 */
  85. GT3LANGTYPE_KO_KR,
  86. /** Japenese 日语 */
  87. GT3LANGTYPE_JA_JP,
  88. /** English 英语 */
  89. GT3LANGTYPE_EN,
  90. /** Indonesian 印度尼西亚语 */
  91. GT3LANGTYPE_ID,
  92. /** Arabic 阿拉伯语 */
  93. GT3LANGTYPE_AR,
  94. /** German 德语 */
  95. GT3LANGTYPE_DE,
  96. /** Spanish 西班牙语 */
  97. GT3LANGTYPE_ES,
  98. /** French 法语 */
  99. GT3LANGTYPE_FR,
  100. /** Portuguese 葡萄牙语 */
  101. GT3LANGTYPE_PT_PT,
  102. /** Russian 俄语 */
  103. GT3LANGTYPE_RU,
  104. /** System language 跟随系统语言*/
  105. GT3LANGTYPE_AUTO = 999
  106. };
  107. /**
  108. * 活动指示器类型
  109. */
  110. typedef NS_ENUM(NSInteger, GT3ActivityIndicatorType) {
  111. /** Geetest Defualt Indicator Type */
  112. GT3IndicatorTypeDefault = 0,
  113. /** System Indicator Type */
  114. GT3IndicatorTypeSystem,
  115. /** Cirle */
  116. GT3IndicatorTypeCirle,
  117. /** Custom Indicator Type */
  118. GT3IndicatorTypeCustom
  119. };
  120. /**
  121. * 验证默认回调
  122. */
  123. typedef void(^GT3CaptchaDefaultBlock)(void);
  124. /**
  125. * 自定义状态指示器的动画实现block
  126. *
  127. * @param layer 状态指示器视图的layer
  128. * @param size layer的大小,默认 {64, 64}
  129. * @param color layer的颜色,默认 蓝色 [UIColor colorWithRed:0.3 green:0.6 blue:0.9 alpha:1]
  130. */
  131. typedef void(^GT3IndicatorAnimationViewBlock)(CALayer *layer, CGSize size, UIColor *color);
  132. #endif