ATParameters.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. //
  2. // ATParameters.h
  3. // ATrack
  4. //
  5. // Created by 卡迩 on 2018/4/23.
  6. // Copyright © 2018年 Alipay. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. extern NSString *const ATUserIdDidChangeNotification; /**< 用户切换通知名*/
  10. extern NSString *const ATUserIdDidChangeNotificationInfoOldUserIdKey; /**< 用户切换通知userInfo中老的userId key值*/
  11. extern NSString *const ATUserIdDidChangeNotificationInfoNewUserIdKey; /**< 用户切换通知userInfo中新的userId key值*/
  12. /**
  13. * 全局参数
  14. */
  15. @interface ATParameters : NSObject
  16. /**
  17. * 设置全局参数,仅内存缓存. 有全局参数透传需要时可使用.
  18. * @param obj 参数值
  19. * @param key 参数key
  20. */
  21. - (void)setParameter:(id)obj forKey:(NSString *)key;
  22. /**
  23. * 获取key对应的全局参数值
  24. * @param key 参数key值
  25. */
  26. - (id)parameterForKey:(NSString *)key;
  27. @end
  28. @interface ATParameters (/**DeviceInfo*/)
  29. @property (nonatomic, strong) NSString *utdid; /**< 设备ID*/
  30. @property (nonatomic, strong) NSString *deviceModel; /**< 设备类型*/
  31. @property (nonatomic, strong) NSString *systemName; /**< 系统类型*/
  32. @property (nonatomic, strong) NSString *systemVersion; /**< 系统版本*/
  33. @property (nonatomic, strong) NSString *networkType; /**< 网络类型*/
  34. @property (nonatomic, strong) NSString *language; /**< App语言*/
  35. @property (nonatomic, strong) NSString *hpVersion; /**< 已安装的Hotpatch版本*/
  36. @property (nonatomic, strong) NSString *resolution; /**< 设备屏幕分辨率*/
  37. @property (nonatomic, strong) NSString* appSession; /**< App前后台状态*/
  38. @end
  39. @interface ATParameters (/**GlobalState*/)
  40. @property (atomic, copy) NSString *appState; /**< App前后台状态*/
  41. @property (atomic, copy) NSString *sessionId; /**< 会话ID*/
  42. @property (atomic, copy) NSString *pageSerialNo; /**< 页面序列号*/
  43. @property (atomic, copy) NSString *lastViewId; /**< 上一个页面ID*/
  44. @property (atomic, copy) NSString *currentViewId; /**< 当前页面ID*/
  45. @property (atomic, copy) NSString *lastPageTitle; /**< 上一个页面title*/
  46. @property (atomic, copy) NSString *currentPageTitle;/**< 当前页面title*/
  47. @property (atomic, copy) NSString *currentTrackId; /**< 最近一次点击事件ID*/
  48. @property (atomic, copy) NSString *currentTrackToken;/**< 最近一次点击事件token*/
  49. @property (nonatomic, assign) unsigned long long tokenTimestamp;/**< 最近一次点击事件时间戳*/
  50. @property (atomic, copy) NSString *lastAppId; /**< 上一个microApp ID*/
  51. @property (atomic, copy) NSString *currentAppId; /**< 当前microApp ID*/
  52. @property (nonatomic, strong) NSString *currentAutoRefer;/**< 当前自动化埋点维护的refer*/
  53. @property (nonatomic, strong) NSString *foundationExtended;/**< 基础扩展*/
  54. @property (nonatomic, strong) NSString *sourceId; /**< 营销来源ID*/
  55. @end
  56. @interface ATParameters (/**Customizable*/)
  57. @property (nonatomic, strong) NSString *platformId; /**< ProductID,默认取InfoPlist中的"Product ID",需向埋点平台申请*/
  58. @property (nonatomic, strong) NSString *clientVersion; /**< App版本号,默认取InfoPlist中的@"Product Version"*/
  59. @property (nonatomic, strong) NSString *clientId; /**< 默认实现为从APMobileIdentifier获取,如果没有APMobileIdentifier,会返回@""*/
  60. @property (nonatomic, strong) NSString *userId; /**< 用户ID,修改该值会触发ATUserIdDidChangeNotification通知*/
  61. @property (nonatomic, strong) NSString *idfa; /**< IDFA值,默认返回nil*/
  62. @property (nonatomic, strong) NSString *uploadUrl; /**< 埋点上报地址,默认@"https://mdap.alipay.com/loggw/logUpload.do"*/
  63. @property (nonatomic, strong) NSString *configUrl; /**< 埋点配置拉取地址,默认@"https://mdap.alipay.com/loggw/logConfig.do"*/
  64. @property (nonatomic, assign) NSUInteger maxLengthOfLine;/**< 单行日志最大长度,默认16K*/
  65. @property (nonatomic, assign) NSUInteger maxSizeOfLog; /**< 本地log文件占用最大大小,超过大小后清理所有文件的1/4,默认30MB*/
  66. @property (nonatomic, assign) NSUInteger maxLengthOfCustom; /**< 单行自定义日志最大长度,默认256K*/
  67. #ifdef SDK_IS4_ALIPAY
  68. @property (nonatomic, strong) NSDictionary *configABTestInfo; /**<APConfig ABTestInfo 默认返回nil */
  69. @property (nonatomic, strong) NSDictionary *currentApplicationParams;
  70. #endif
  71. @end
  72. @interface ATParameters()
  73. @property (nonatomic, assign) CFAbsoluteTime lastUUIDUpdateTime;/**< 最近一个更新sessionId的时间戳*/
  74. @end
  75. @interface ATParameters (/**Update*/)
  76. /**
  77. * 通知\c ATParameters 页面即将打开
  78. * @param viewId 页面ID
  79. * @param appId microAppID
  80. * @param title 页面title
  81. */
  82. - (void)viewWillAppear:(NSString *)viewId
  83. appId:(NSString *)appId
  84. title:(NSString *)title;
  85. @end