发行人
This commit is contained in:
		
							parent
							
								
									1975509d84
								
							
						
					
					
						commit
						1f77ee6558
					
				|  | @ -0,0 +1,8 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 682e47faf0ce541438fcbc953bedfab9 | ||||||
|  | folderAsset: yes | ||||||
|  | DefaultImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,375 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrack+Game.h
 | ||||||
|  | //  Applog
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2019/4/10.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import "BDAutoTrack.h" | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAGameLevel; | ||||||
|  | 
 | ||||||
|  | /*!
 | ||||||
|  |  BDAutoTrack 内置游戏上报API | ||||||
|  |  */ | ||||||
|  | @interface BDAutoTrack (Game) | ||||||
|  | 
 | ||||||
|  | /*! @abstract 初始化注册
 | ||||||
|  |  @param method 注册方式,@"wechat"、@"qq",强制添加 | ||||||
|  |  @param isSuccess 状态,强制添加 | ||||||
|  |  @discussion 上报参数:@{@"method":method,@"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | - (void)registerEventByMethod:(NSString *)method | ||||||
|  |                     isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 初始化登录
 | ||||||
|  |  @param method 登录方式,@"wechat"、@"qq" | ||||||
|  |  @param isSuccess 状态 | ||||||
|  |  @discussion 上报参数:@{@"method":method,@"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | - (void)loginEventByMethod:(NSString *)method | ||||||
|  |                  isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 绑定社交账号
 | ||||||
|  |  @param type 账号类型 | ||||||
|  |  @param isSuccess 状态 | ||||||
|  |  @discussion 上报参数:@{@"account_type":type,@"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | - (void)accessAccountEventByType:(NSString *)type | ||||||
|  |                        isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 进行任务
 | ||||||
|  |  @param questID 任务id | ||||||
|  |  @param type 任务类型 | ||||||
|  |  @param name 教学/任务/副本名 | ||||||
|  |  @param number 第几个任务 | ||||||
|  |  @param desc 其他描述 | ||||||
|  |  @param isSuccess 状态 | ||||||
|  |  @discussion 上报参数:@{@"quest_id":questID, | ||||||
|  |                      @"quest_type":type, | ||||||
|  |                      @"quest_name":name, | ||||||
|  |                      @"quest_no":@(number), | ||||||
|  |                      @"description":desc, | ||||||
|  |                      @"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | - (void)questEventWithQuestID:(NSString *)questID | ||||||
|  |                     questType:(NSString *)type | ||||||
|  |                     questName:(NSString *)name | ||||||
|  |                    questNumer:(NSUInteger)number | ||||||
|  |                   description:(NSString *)desc | ||||||
|  |                     isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 升级
 | ||||||
|  |  @param level 当前等级 | ||||||
|  |  @discussion 上报参数:@{@"level":@(level)} | ||||||
|  |  */ | ||||||
|  | - (void)updateLevelEventWithLevel:(NSUInteger)level; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 创建角色
 | ||||||
|  |  @param roleID 角色id | ||||||
|  |  @discussion 上报参数:@{@"gamerole_id":roleID} | ||||||
|  |  */ | ||||||
|  | - (void)createGameRoleEventByID:(NSString *)roleID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 查看内容/商品详情
 | ||||||
|  |  @param type 内容类型 | ||||||
|  |  @param name 内容名 | ||||||
|  |  @param contentID 内容id | ||||||
|  |  @discussion 上报参数:@{@"content_type":type, | ||||||
|  |                          @"content_name":name, | ||||||
|  |                          @"content_id":contentID} | ||||||
|  |  */ | ||||||
|  | - (void)viewContentEventWithContentType:(NSString *)type | ||||||
|  |                             contentName:(NSString *)name | ||||||
|  |                               contentID:(NSString *)contentID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 加入购买/购物车
 | ||||||
|  |  @param type 内容类型 | ||||||
|  |  @param name 内容名 | ||||||
|  |  @param contentID 内容id | ||||||
|  |  @param number 内容数量 | ||||||
|  |  @param isSuccess 是否成功 | ||||||
|  |  @discussion 上报参数:@{@"content_type":type, | ||||||
|  |                      @"content_name":name, | ||||||
|  |                      @"content_id":contentID, | ||||||
|  |                      @"content_num":number, | ||||||
|  |                      @"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | - (void)addCartEventWithContentType:(NSString *)type | ||||||
|  |                         contentName:(NSString *)name | ||||||
|  |                           contentID:(NSString *)contentID | ||||||
|  |                       contentNumber:(NSUInteger)number | ||||||
|  |                           isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 提交购买/下单
 | ||||||
|  |  @param type 内容类型 | ||||||
|  |  @param name 内容名 | ||||||
|  |  @param contentID 内容id | ||||||
|  |  @param number 内容数量 | ||||||
|  |  @param isVirtualCurrency 是否使用的是虚拟货币 | ||||||
|  |  @param virtualCurrency 虚拟币币种 | ||||||
|  |  @param currency 真实货币类型 | ||||||
|  |  @param amount 货币金额 | ||||||
|  |  @param isSuccess 是否成功 | ||||||
|  |  @discussion 上报参数:@{@"content_type":type, | ||||||
|  |                          @"content_name":name, | ||||||
|  |                          @"content_id":contentID, | ||||||
|  |                          @"content_num":number, | ||||||
|  |                          @"is_virtual_currency":@(isVirtualCurrency), | ||||||
|  |                          @"virtual_currency":virtualCurrency, | ||||||
|  |                          @"currency":currency, | ||||||
|  |                          @"is_success":@(isSuccess), | ||||||
|  |                          @"currency_amount":@(amount)} | ||||||
|  |  */ | ||||||
|  | - (void)checkoutEventWithContentType:(NSString *)type | ||||||
|  |                          contentName:(NSString *)name | ||||||
|  |                            contentID:(NSString *)contentID | ||||||
|  |                        contentNumber:(NSUInteger)number | ||||||
|  |                    isVirtualCurrency:(BOOL)isVirtualCurrency | ||||||
|  |                      virtualCurrency:(NSString *)virtualCurrency | ||||||
|  |                             currency:(NSString *)currency | ||||||
|  |                      currency_amount:(unsigned long long)amount | ||||||
|  |                            isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 支付
 | ||||||
|  |  @param type 内容类型 | ||||||
|  |  @param name 内容名 | ||||||
|  |  @param contentID 内容id | ||||||
|  |  @param number 内容数量 | ||||||
|  |  @param channel 支付渠道 | ||||||
|  |  @param currency 币种 | ||||||
|  |  @param amount 货币金额,不能为0 | ||||||
|  |  @param isSuccess 是否成功 | ||||||
|  |  @discussion 上报参数:@{@"content_type":type, | ||||||
|  |                      @"content_name":name, | ||||||
|  |                      @"content_id":contentID, | ||||||
|  |                      @"content_num":@(number), | ||||||
|  |                      @"payment_channel":channel, | ||||||
|  |                      @"currency":currency, | ||||||
|  |                      @"is_success":@(isSuccess), | ||||||
|  |                      @"currency_amount":@(amount)} | ||||||
|  |  */ | ||||||
|  | - (void)purchaseEventWithContentType:(NSString *)type | ||||||
|  |                          contentName:(NSString *)name | ||||||
|  |                            contentID:(NSString *)contentID | ||||||
|  |                        contentNumber:(NSUInteger)number | ||||||
|  |                       paymentChannel:(NSString *)channel | ||||||
|  |                             currency:(NSString *)currency | ||||||
|  |                      currency_amount:(unsigned long long)amount | ||||||
|  |                            isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 添加支付渠道
 | ||||||
|  |  @param channel 支付渠道 | ||||||
|  |  @param isSuccess 是否成功 | ||||||
|  |  @discussion 上报参数:@{@"payment_channel":channel, | ||||||
|  |                         @"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | - (void)accessPaymentChannelEventByChannel:(NSString *)channel | ||||||
|  |                                  isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 添加至收藏
 | ||||||
|  |  @param type 内容类型 | ||||||
|  |  @param name 内容名 | ||||||
|  |  @param contentID 内容id | ||||||
|  |  @param number 内容数量 | ||||||
|  |  @param isSuccess 是否成功 | ||||||
|  |  @discussion 上报参数:@{@"content_type":type, | ||||||
|  |                      @"content_name":name, | ||||||
|  |                      @"content_id":contentID, | ||||||
|  |                      @"content_num":@(number), | ||||||
|  |                      @"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | - (void)addToFavouriteEventWithContentType:(NSString *)type | ||||||
|  |                                contentName:(NSString *)name | ||||||
|  |                                  contentID:(NSString *)contentID | ||||||
|  |                              contentNumber:(NSUInteger)number | ||||||
|  |                                  isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /*!
 | ||||||
|  |  特别说明: | ||||||
|  |     先调用[BDAutoTrack startTrackWithConfig:config]; | ||||||
|  |     之后调用BDAutoTrack的游戏埋点接口 | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | @interface BDAutoTrack (SharedGame) | ||||||
|  | 
 | ||||||
|  | /*! @abstract 初始化注册
 | ||||||
|  |  @param method 注册方式,@"wechat"、@"qq",强制添加 | ||||||
|  |  @param isSuccess 状态,强制添加 | ||||||
|  |  @discussion 上报参数:@{@"method":method,@"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | + (void)registerEventByMethod:(NSString *)method | ||||||
|  |                     isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 初始化登录
 | ||||||
|  |  @param method 登录方式,@"wechat"、@"qq" | ||||||
|  |  @param isSuccess 状态 | ||||||
|  |  @discussion 上报参数:@{@"method":method,@"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | + (void)loginEventByMethod:(NSString *)method | ||||||
|  |                  isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 绑定社交账号
 | ||||||
|  |  @param type 账号类型 | ||||||
|  |  @param isSuccess 状态 | ||||||
|  |  @discussion 上报参数:@{@"account_type":type,@"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | + (void)accessAccountEventByType:(NSString *)type | ||||||
|  |                        isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 进行任务
 | ||||||
|  |  @param questID 任务id | ||||||
|  |  @param type 任务类型 | ||||||
|  |  @param name 教学/任务/副本名 | ||||||
|  |  @param number 第几个任务 | ||||||
|  |  @param desc 其他描述 | ||||||
|  |  @param isSuccess 状态 | ||||||
|  |  @discussion 上报参数:@{@"quest_id":questID, | ||||||
|  |                      @"quest_type":type, | ||||||
|  |                      @"quest_name":name, | ||||||
|  |                      @"quest_no":@(number), | ||||||
|  |                      @"description":desc, | ||||||
|  |                      @"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | + (void)questEventWithQuestID:(NSString *)questID | ||||||
|  |                     questType:(NSString *)type | ||||||
|  |                     questName:(NSString *)name | ||||||
|  |                    questNumer:(NSUInteger)number | ||||||
|  |                   description:(NSString *)desc | ||||||
|  |                     isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 升级
 | ||||||
|  |  @param level 当前等级 | ||||||
|  |  @discussion 上报参数:@{@"level":@(level)} | ||||||
|  |  */ | ||||||
|  | + (void)updateLevelEventWithLevel:(NSUInteger)level; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 创建角色
 | ||||||
|  |  @param roleID 角色id | ||||||
|  |  @discussion 上报参数:@{@"gamerole_id":roleID} | ||||||
|  |  */ | ||||||
|  | + (void)createGameRoleEventByID:(NSString *)roleID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 查看内容/商品详情
 | ||||||
|  |  @param type 内容类型 | ||||||
|  |  @param name 内容名 | ||||||
|  |  @param contentID 内容id | ||||||
|  |  @discussion 上报参数:@{@"content_type":type, | ||||||
|  |                          @"content_name":name, | ||||||
|  |                          @"content_id":contentID} | ||||||
|  |  */ | ||||||
|  | + (void)viewContentEventWithContentType:(NSString *)type | ||||||
|  |                             contentName:(NSString *)name | ||||||
|  |                               contentID:(NSString *)contentID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 加入购买/购物车
 | ||||||
|  |  @param type 内容类型 | ||||||
|  |  @param name 内容名 | ||||||
|  |  @param contentID 内容id | ||||||
|  |  @param number 内容数量 | ||||||
|  |  @param isSuccess 是否成功 | ||||||
|  |  @discussion 上报参数:@{@"content_type":type, | ||||||
|  |                      @"content_name":name, | ||||||
|  |                      @"content_id":contentID, | ||||||
|  |                      @"content_num":number, | ||||||
|  |                      @"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | + (void)addCartEventWithContentType:(NSString *)type | ||||||
|  |                         contentName:(NSString *)name | ||||||
|  |                           contentID:(NSString *)contentID | ||||||
|  |                       contentNumber:(NSUInteger)number | ||||||
|  |                           isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 提交购买/下单
 | ||||||
|  |  @param type 内容类型 | ||||||
|  |  @param name 内容名 | ||||||
|  |  @param contentID 内容id | ||||||
|  |  @param number 内容数量 | ||||||
|  |  @param isVirtualCurrency 是否使用的是虚拟货币 | ||||||
|  |  @param virtualCurrency 虚拟币币种 | ||||||
|  |  @param currency 真实货币类型 | ||||||
|  |  @param amount 货币金额 | ||||||
|  |  @param isSuccess 是否成功 | ||||||
|  |  @discussion 上报参数:@{@"content_type":type, | ||||||
|  |                          @"content_name":name, | ||||||
|  |                          @"content_id":contentID, | ||||||
|  |                          @"content_num":number, | ||||||
|  |                          @"is_virtual_currency":@(isVirtualCurrency), | ||||||
|  |                          @"virtual_currency":virtualCurrency, | ||||||
|  |                          @"currency":currency, | ||||||
|  |                          @"is_success":@(isSuccess), | ||||||
|  |                          @"currency_amount":@(amount)} | ||||||
|  |  */ | ||||||
|  | + (void)checkoutEventWithContentType:(NSString *)type | ||||||
|  |                          contentName:(NSString *)name | ||||||
|  |                            contentID:(NSString *)contentID | ||||||
|  |                        contentNumber:(NSUInteger)number | ||||||
|  |                    isVirtualCurrency:(BOOL)isVirtualCurrency | ||||||
|  |                      virtualCurrency:(NSString *)virtualCurrency | ||||||
|  |                             currency:(NSString *)currency | ||||||
|  |                      currency_amount:(unsigned long long)amount | ||||||
|  |                            isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 支付
 | ||||||
|  |  @param type 内容类型 | ||||||
|  |  @param name 内容名 | ||||||
|  |  @param contentID 内容id | ||||||
|  |  @param number 内容数量 | ||||||
|  |  @param channel 支付渠道 | ||||||
|  |  @param currency 币种 | ||||||
|  |  @param amount 货币金额,不能为0 | ||||||
|  |  @param isSuccess 是否成功 | ||||||
|  |  @discussion 上报参数:@{@"content_type":type, | ||||||
|  |                      @"content_name":name, | ||||||
|  |                      @"content_id":contentID, | ||||||
|  |                      @"content_num":@(number), | ||||||
|  |                      @"payment_channel":channel, | ||||||
|  |                      @"currency":currency, | ||||||
|  |                      @"is_success":@(isSuccess), | ||||||
|  |                      @"currency_amount":@(amount)} | ||||||
|  |  */ | ||||||
|  | + (void)purchaseEventWithContentType:(NSString *)type | ||||||
|  |                          contentName:(NSString *)name | ||||||
|  |                            contentID:(NSString *)contentID | ||||||
|  |                        contentNumber:(NSUInteger)number | ||||||
|  |                       paymentChannel:(NSString *)channel | ||||||
|  |                             currency:(NSString *)currency | ||||||
|  |                      currency_amount:(unsigned long long)amount | ||||||
|  |                            isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 添加支付渠道
 | ||||||
|  |  @param channel 支付渠道 | ||||||
|  |  @param isSuccess 是否成功 | ||||||
|  |  @discussion 上报参数:@{@"payment_channel":channel, | ||||||
|  |                         @"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | + (void)accessPaymentChannelEventByChannel:(NSString *)channel | ||||||
|  |                                  isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 添加至收藏
 | ||||||
|  |  @param type 内容类型 | ||||||
|  |  @param name 内容名 | ||||||
|  |  @param contentID 内容id | ||||||
|  |  @param number 内容数量 | ||||||
|  |  @param isSuccess 是否成功 | ||||||
|  |  @discussion 上报参数:@{@"content_type":type, | ||||||
|  |                      @"content_name":name, | ||||||
|  |                      @"content_id":contentID, | ||||||
|  |                      @"content_num":@(number), | ||||||
|  |                      @"is_success":@(isSuccess)} | ||||||
|  |  */ | ||||||
|  | + (void)addToFavouriteEventWithContentType:(NSString *)type | ||||||
|  |                                contentName:(NSString *)name | ||||||
|  |                                  contentID:(NSString *)contentID | ||||||
|  |                              contentNumber:(NSUInteger)number | ||||||
|  |                                  isSuccess:(BOOL)isSuccess; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 7eadf2257911d499db869faf3b776e92 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,320 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrack- GameTrack.h
 | ||||||
|  | //  Applog
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2019/7/17.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import "BDAutoTrack.h" | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | FOUNDATION_EXTERN NSString * const kGTGameParameterLevel; | ||||||
|  | 
 | ||||||
|  | /*!
 | ||||||
|  |  BDAutoTrack 内置联运游戏上报API | ||||||
|  |  事件名称都有 gt 前缀 | ||||||
|  |  具体参数参照接口人发送的文档 | ||||||
|  |  */ | ||||||
|  | @interface BDAutoTrack (GameTrack) | ||||||
|  | 
 | ||||||
|  | #pragma mark - AD | ||||||
|  | /**
 | ||||||
|  |  广告按钮点击:gt_ad_button_click | ||||||
|  |  ad_type     string  广告类型:激励视频、插屏、banner等,直接使用汉字或者英文进行标识 | ||||||
|  |  ad_position_type  string  广告点位类型:按照提供分类接入 | ||||||
|  |  ad_position string  广告点位:复活、翻倍、试用、buff、奖励道具、新道具、减CD等,直接使用文字或者英文进行标识 | ||||||
|  |  触发条件:用户点击app内各广告位button时。 | ||||||
|  |  */ | ||||||
|  | - (void)adButtonClickEventWithADType:(NSString *)adType | ||||||
|  |                         positionType:(NSString *)positionType | ||||||
|  |                             position:(NSString *)position | ||||||
|  |                          otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  广告开始展示:gt_ad_show | ||||||
|  |  ad_type           string  广告类型:激励视频、插屏、banner等,直接使用汉字或者英文进行标识 | ||||||
|  |  ad_position_type  string  广告点位类型:按照提供分类接入 | ||||||
|  |  ad_position       string  广告点位:复活、翻倍、试用、buff、奖励道具、新道具、减CD等,直接使用文字或者英文进行标识 | ||||||
|  |  触发条件:用户点击并观看广告时。穿山甲广告有回调,可以直接获取。 | ||||||
|  |  */ | ||||||
|  | - (void)adShowEventWithADType:(NSString *)adType | ||||||
|  |                  positionType:(NSString *)positionType | ||||||
|  |                      position:(NSString *)position | ||||||
|  |                   otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  广告结束展示:gt_ad_show_end | ||||||
|  |  ad_type           string  广告类型:激励视频、插屏、banner等,直接使用汉字或者英文进行标识 | ||||||
|  |  ad_position_type  string  广告点位类型:按照提供分类接入 | ||||||
|  |  ad_position       string  广告点位:复活、翻倍、试用、buff、奖励道具、新道具、减CD等,直接使用文字或者英文进行标识 | ||||||
|  |  result            string  广告观看结果:跳过、成功、失败等,使用英文进行标识.  跳过标记为skip, 成功标记为success,失败为fail | ||||||
|  |  触发条件:用户观看广告结束时。 | ||||||
|  |  */ | ||||||
|  | - (void)adShowEndEventWithADType:(NSString *)adType | ||||||
|  |                     positionType:(NSString *)positionType | ||||||
|  |                         position:(NSString *)position | ||||||
|  |                           result:(NSString *)result | ||||||
|  |                      otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | #pragma mark - Level | ||||||
|  | /**
 | ||||||
|  |  (总等级)升级和经验:gt_levelup | ||||||
|  |  lev             int 当前玩家等级 | ||||||
|  |  get_exp     int 获得经验 | ||||||
|  |  method      string  获得经验途径:闯关成功、引导完成、领取奖励等,使用汉字或者英文进行标识 | ||||||
|  |  aflev          int 用户获得经验后等级,如获得经验未导致升级,则lev=aflev,如导致升级,则lev<aflev | ||||||
|  |  触发条件:用户获得经验或者等级发生变化时。 | ||||||
|  |  */ | ||||||
|  | - (void)levelUpEventWithLevel:(NSInteger)level | ||||||
|  |                           exp:(NSInteger)exp | ||||||
|  |                        method:(NSString *)method | ||||||
|  |                    afterLevel:(NSInteger)afterLevel | ||||||
|  |                   otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | #pragma mark - play | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  开始玩法:gt_start_play | ||||||
|  |  ectype_name string  针对闯关性质玩法,标注关卡名称 | ||||||
|  |  触发条件:用户开始玩法时。 | ||||||
|  |  */ | ||||||
|  | - (void)startPlayEventWithName:(NSString *)ecTypeName | ||||||
|  |                    otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  结束玩法:gt_end_play | ||||||
|  |  ectype_name string  针对闯关性质玩法,标注关卡名称 | ||||||
|  |  result      string  玩法的结果:未完成、成功、失败等,使用英文进行标识.  未完成标记为uncompleted, 成功标记为success,失败为fail | ||||||
|  |  duration    int 消耗时间,单位秒 | ||||||
|  |  触发条件:用户结束玩法时,涵盖中途退出、完成但失败和完成且成功。 | ||||||
|  |  */ | ||||||
|  | - (void)endPlayEventWithName:(NSString *)ecTypeName | ||||||
|  |                       result:(NSString *)result | ||||||
|  |                      duration:(NSInteger)duration | ||||||
|  |                   otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | #pragma mark - coins | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  获得游戏币:gt_get_coins | ||||||
|  |  coin_type    string    货币类型:元宝、绑元、金币、银币等,使用文字或者英文进行标识 | ||||||
|  |  method    string    获得途径:观看激励视频、闯关成功、活动奖励等,使用文字或者英文进行标识 | ||||||
|  |  coin_num    int    获得数量 | ||||||
|  |  触发条件:用户获得游戏币,导致游戏币增加时 | ||||||
|  |  */ | ||||||
|  | - (void)getCoinsEventWitType:(NSString *)coinType | ||||||
|  |                       method:(NSString *)method | ||||||
|  |                   coinNumber:(NSInteger)number | ||||||
|  |                  otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  消耗游戏币:gt_cost_coins | ||||||
|  |  coin_type    string    货币类型:元宝、绑元、金币、银币等,使用文字或者英文进行标识 | ||||||
|  |  method    string    消耗途径:复活、购买道具、解锁关卡等,使用文字或者英文进行标识 | ||||||
|  |  coin_num    int    消耗数量 | ||||||
|  |  触发条件:用户消耗游戏币,导致游戏币减少时。 | ||||||
|  |  */ | ||||||
|  | - (void)costCoinsEventWitType:(NSString *)coinType | ||||||
|  |                        method:(NSString *)method | ||||||
|  |                    coinNumber:(NSInteger)number | ||||||
|  |                   otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | #pragma mark - Purchase | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  内购充值相关:purchase | ||||||
|  |  content_type  string  内购充值内容类型 | ||||||
|  |  content_name  string  内购充值内容名称 | ||||||
|  |  content_id    string  内购充值内容id | ||||||
|  |  content_num   int 内购充值内容的数量 | ||||||
|  |  payment_channel string  支付渠道:例如 支付宝,微信等 | ||||||
|  |  currency      string  支付货币类型 | ||||||
|  |  is_success    string  支付是否成功 | ||||||
|  |  currency_amount int 支付的金额,单位元 | ||||||
|  |  触发条件:用户完成内购充值并获得对应的游戏内货币和道具时 | ||||||
|  |  */ | ||||||
|  | - (void)purchaseEventWithContentType:(NSString *)contentType | ||||||
|  |                          contentName:(NSString *)contentName | ||||||
|  |                            contentID:(NSString *)contentID | ||||||
|  |                           contentNum:(NSInteger)contentNum | ||||||
|  |                              channel:(NSString *)channel | ||||||
|  |                             currency:(NSString *)currency | ||||||
|  |                            isSuccess:(NSString *)isSuccess | ||||||
|  |                       currencyAmount:(NSInteger)currencyAmount | ||||||
|  |                          otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | #pragma mark - InitInfo | ||||||
|  | /**
 | ||||||
|  |  初始化信息:gt_init_info | ||||||
|  |  lev    int    玩家等级 | ||||||
|  |  coin_type    string    获得货币的类型 | ||||||
|  |  coin_left    int    用户身上剩余的货币数量 | ||||||
|  |  role_id    string    玩家角色id-cp侧 | ||||||
|  |  触发条件:用户启动游戏,初始化完成时上报 | ||||||
|  |  */ | ||||||
|  | - (void)gameInitInfoEventWithLevel:(NSInteger)level | ||||||
|  |                           coinType:(NSString *)coinType | ||||||
|  |                           coinLeft:(NSInteger)coinLeft | ||||||
|  |                        otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /*!
 | ||||||
|  |  BDAutoTrack 内置联运游戏上报API | ||||||
|  |  事件名称都有 gt 前缀 | ||||||
|  |  具体参数参照接口人发送的文档 | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /*!
 | ||||||
|  |  特别说明: | ||||||
|  |     先调用[BDAutoTrack startTrackWithConfig:config]; | ||||||
|  |     之后调用BDAutoTrack的游戏埋点接口 | ||||||
|  | */ | ||||||
|  | @interface BDAutoTrack (SharedGameTrack) | ||||||
|  | 
 | ||||||
|  | #pragma mark - AD | ||||||
|  | /**
 | ||||||
|  |  广告按钮点击:gt_ad_button_click | ||||||
|  |  ad_type     string  广告类型:激励视频、插屏、banner等,直接使用汉字或者英文进行标识 | ||||||
|  |  ad_position_type  string  广告点位类型:按照提供分类接入 | ||||||
|  |  ad_position string  广告点位:复活、翻倍、试用、buff、奖励道具、新道具、减CD等,直接使用文字或者英文进行标识 | ||||||
|  |  触发条件:用户点击app内各广告位button时。 | ||||||
|  |  */ | ||||||
|  | + (void)adButtonClickEventWithADType:(NSString *)adType | ||||||
|  |                         positionType:(NSString *)positionType | ||||||
|  |                             position:(NSString *)position | ||||||
|  |                          otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  广告开始展示:gt_ad_show | ||||||
|  |  ad_type           string  广告类型:激励视频、插屏、banner等,直接使用汉字或者英文进行标识 | ||||||
|  |  ad_position_type  string  广告点位类型:按照提供分类接入 | ||||||
|  |  ad_position       string  广告点位:复活、翻倍、试用、buff、奖励道具、新道具、减CD等,直接使用文字或者英文进行标识 | ||||||
|  |  触发条件:用户点击并观看广告时。穿山甲广告有回调,可以直接获取。 | ||||||
|  |  */ | ||||||
|  | + (void)adShowEventWithADType:(NSString *)adType | ||||||
|  |                  positionType:(NSString *)positionType | ||||||
|  |                      position:(NSString *)position | ||||||
|  |                   otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  广告结束展示:gt_ad_show_end | ||||||
|  |  ad_type           string  广告类型:激励视频、插屏、banner等,直接使用汉字或者英文进行标识 | ||||||
|  |  ad_position_type  string  广告点位类型:按照提供分类接入 | ||||||
|  |  ad_position       string  广告点位:复活、翻倍、试用、buff、奖励道具、新道具、减CD等,直接使用文字或者英文进行标识 | ||||||
|  |  result            string  广告观看结果:跳过、成功、失败等,使用英文进行标识.  跳过标记为skip, 成功标记为success,失败为fail | ||||||
|  |  触发条件:用户观看广告结束时。 | ||||||
|  |  */ | ||||||
|  | + (void)adShowEndEventWithADType:(NSString *)adType | ||||||
|  |                     positionType:(NSString *)positionType | ||||||
|  |                         position:(NSString *)position | ||||||
|  |                           result:(NSString *)result | ||||||
|  |                      otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | #pragma mark - Level | ||||||
|  | /**
 | ||||||
|  |  (总等级)升级和经验:gt_levelup | ||||||
|  |  lev             int 当前玩家等级 | ||||||
|  |  get_exp     int 获得经验 | ||||||
|  |  method      string  获得经验途径:闯关成功、引导完成、领取奖励等,使用汉字或者英文进行标识 | ||||||
|  |  aflev          int 用户获得经验后等级,如获得经验未导致升级,则lev=aflev,如导致升级,则lev<aflev | ||||||
|  |  触发条件:用户获得经验或者等级发生变化时。 | ||||||
|  |  */ | ||||||
|  | + (void)levelUpEventWithLevel:(NSInteger)level | ||||||
|  |                           exp:(NSInteger)exp | ||||||
|  |                        method:(NSString *)method | ||||||
|  |                    afterLevel:(NSInteger)afterLevel | ||||||
|  |                   otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | #pragma mark - play | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  开始玩法:gt_start_play | ||||||
|  |  ectype_name string  针对闯关性质玩法,标注关卡名称 | ||||||
|  |  触发条件:用户开始玩法时。 | ||||||
|  |  */ | ||||||
|  | + (void)startPlayEventWithName:(NSString *)ecTypeName | ||||||
|  |                    otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  结束玩法:gt_end_play | ||||||
|  |  ectype_name string  针对闯关性质玩法,标注关卡名称 | ||||||
|  |  result      string  玩法的结果:未完成、成功、失败等,使用英文进行标识.  未完成标记为uncompleted, 成功标记为success,失败为fail | ||||||
|  |  duration    int 消耗时间,单位秒 | ||||||
|  |  触发条件:用户结束玩法时,涵盖中途退出、完成但失败和完成且成功。 | ||||||
|  |  */ | ||||||
|  | + (void)endPlayEventWithName:(NSString *)ecTypeName | ||||||
|  |                       result:(NSString *)result | ||||||
|  |                      duration:(NSInteger)duration | ||||||
|  |                   otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | #pragma mark - coins | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  获得游戏币:gt_get_coins | ||||||
|  |  coin_type    string    货币类型:元宝、绑元、金币、银币等,使用文字或者英文进行标识 | ||||||
|  |  method    string    获得途径:观看激励视频、闯关成功、活动奖励等,使用文字或者英文进行标识 | ||||||
|  |  coin_num    int    获得数量 | ||||||
|  |  触发条件:用户获得游戏币,导致游戏币增加时 | ||||||
|  |  */ | ||||||
|  | + (void)getCoinsEventWitType:(NSString *)coinType | ||||||
|  |                       method:(NSString *)method | ||||||
|  |                   coinNumber:(NSInteger)number | ||||||
|  |                  otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  消耗游戏币:gt_cost_coins | ||||||
|  |  coin_type    string    货币类型:元宝、绑元、金币、银币等,使用文字或者英文进行标识 | ||||||
|  |  method    string    消耗途径:复活、购买道具、解锁关卡等,使用文字或者英文进行标识 | ||||||
|  |  coin_num    int    消耗数量 | ||||||
|  |  触发条件:用户消耗游戏币,导致游戏币减少时。 | ||||||
|  |  */ | ||||||
|  | + (void)costCoinsEventWitType:(NSString *)coinType | ||||||
|  |                        method:(NSString *)method | ||||||
|  |                    coinNumber:(NSInteger)number | ||||||
|  |                   otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | #pragma mark - Purchase | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  内购充值相关:purchase | ||||||
|  |  content_type  string  内购充值内容类型 | ||||||
|  |  content_name  string  内购充值内容名称 | ||||||
|  |  content_id    string  内购充值内容id | ||||||
|  |  content_num   int 内购充值内容的数量 | ||||||
|  |  payment_channel string  支付渠道:例如 支付宝,微信等 | ||||||
|  |  currency      string  支付货币类型 | ||||||
|  |  is_success    string  支付是否成功 | ||||||
|  |  currency_amount int 支付的金额,单位元 | ||||||
|  |  触发条件:用户完成内购充值并获得对应的游戏内货币和道具时 | ||||||
|  |  */ | ||||||
|  | + (void)purchaseEventWithContentType:(NSString *)contentType | ||||||
|  |                          contentName:(NSString *)contentName | ||||||
|  |                            contentID:(NSString *)contentID | ||||||
|  |                           contentNum:(NSInteger)contentNum | ||||||
|  |                              channel:(NSString *)channel | ||||||
|  |                             currency:(NSString *)currency | ||||||
|  |                            isSuccess:(NSString *)isSuccess | ||||||
|  |                       currencyAmount:(NSInteger)currencyAmount | ||||||
|  |                          otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | #pragma mark - InitInfo | ||||||
|  | /**
 | ||||||
|  |  初始化信息:gt_init_info | ||||||
|  |  lev    int    玩家等级 | ||||||
|  |  coin_type    string    获得货币的类型 | ||||||
|  |  coin_left    int    用户身上剩余的货币数量 | ||||||
|  |  role_id    string    玩家角色id-cp侧 | ||||||
|  |  触发条件:用户启动游戏,初始化完成时上报 | ||||||
|  |  */ | ||||||
|  | + (void)gameInitInfoEventWithLevel:(NSInteger)level | ||||||
|  |                           coinType:(NSString *)coinType | ||||||
|  |                           coinLeft:(NSInteger)coinLeft | ||||||
|  |                        otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: f27291c50e3fc4199bdbe27c9352db6b | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,22 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrack+LaunchFrom.h
 | ||||||
|  | //  RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/6/3.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import "BDAutoTrack.h" | ||||||
|  | #import "BDCommonDefine.h" | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface BDAutoTrack (LaunchFrom) | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  @abstract 初始化之后,支持设置APP的启动方式,会体现的上报的数据中,参考<RangersAppLog/BDCommonDefine.h> | ||||||
|  |  */ | ||||||
|  | + (void)setLaunchFrom:(BDAutoTrackLaunchFrom)from; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 4f05c96f3f93a4ed0b89cf264af8d984 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,98 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrack+OhayooGameTrack.h
 | ||||||
|  | //  RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by 陈奕 on 2019/11/26.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import "BDAutoTrack.h" | ||||||
|  | 
 | ||||||
|  | typedef NSString * OhayooCustomHeaderKey NS_TYPED_ENUM; | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | /* ohayoo custom header key. 均以"ohayoo_"开头 */ | ||||||
|  | FOUNDATION_EXTERN OhayooCustomHeaderKey OhayooCustomHeaderKeyPackageChannel; | ||||||
|  | FOUNDATION_EXTERN OhayooCustomHeaderKey OhayooCustomHeaderKeyZoneID; | ||||||
|  | FOUNDATION_EXTERN OhayooCustomHeaderKey OhayooCustomHeaderKeyServerID; | ||||||
|  | FOUNDATION_EXTERN OhayooCustomHeaderKey OhayooCustomHeaderKeySDKOpenID; | ||||||
|  | FOUNDATION_EXTERN OhayooCustomHeaderKey OhayooCustomHeaderKeyUserType; | ||||||
|  | FOUNDATION_EXTERN OhayooCustomHeaderKey OhayooCustomHeaderKeyRoleID; | ||||||
|  | FOUNDATION_EXTERN OhayooCustomHeaderKey OhayooCustomHeaderKeyLevel; | ||||||
|  | 
 | ||||||
|  | #pragma mark - OhayooGameTrack | ||||||
|  | 
 | ||||||
|  | @interface BDAutoTrack (OhayooGameTrack) | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  | 初始化信息:gt_init_info | ||||||
|  | lev         int 当前玩家等级 | ||||||
|  | scene_id    int 当前场景id | ||||||
|  | scene_lev   int 当前场景的用户等级 | ||||||
|  | coin_type   string  获得货币的类型 | ||||||
|  | coin_left   int 用户身上剩余的货币数量 | ||||||
|  | roleId      string 角色id | ||||||
|  | 触发条件:用户启动游戏,初始化完成时上报 | ||||||
|  |   | ||||||
|  |  @discussion 上报参数比GameTrack的多了 sceneID sceneLev | ||||||
|  | */ | ||||||
|  | - (void)gameInitInfoEventWithLevel:(NSInteger)level | ||||||
|  |                            sceneID:(NSInteger)sceneID | ||||||
|  |                           sceneLev:(NSInteger)sceneLev | ||||||
|  |                           coinType:(NSString *)coinType | ||||||
|  |                           coinLeft:(NSInteger)coinLeft | ||||||
|  |                             roleId:(NSString *)roleId | ||||||
|  |                        otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  @abstract 将相应ohayoo字段设置到custom header中的辅助方法。实际上是调用`setCustomHeaderValue:forKey:`。 | ||||||
|  |  @discussion 使用示例: | ||||||
|  |  @code | ||||||
|  |  [BDAutoTrack ohayooHeaderSetObject:@"channel_123" forKey:OhayooCustomHeaderKeyPackageChannel]; | ||||||
|  |  @code | ||||||
|  |  */ | ||||||
|  | - (void)ohayooHeaderSetObject:(NSObject *)object forKey:(OhayooCustomHeaderKey)key; | ||||||
|  | 
 | ||||||
|  | - (void)ohayooHeaderRemoveObjectForKey:(OhayooCustomHeaderKey)key; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | #pragma mark - SharedOhayooGameTrack | ||||||
|  | @interface BDAutoTrack (SharedOhayooGameTrack) | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  | 初始化信息:gt_init_info | ||||||
|  | lev         int 当前玩家等级 | ||||||
|  | scene_id    int 当前场景id | ||||||
|  | scene_lev   int 当前场景的用户等级 | ||||||
|  | coin_type   string  获得货币的类型 | ||||||
|  | coin_left   int 用户身上剩余的货币数量 | ||||||
|  | roleId      string 角色id | ||||||
|  | 触发条件:用户启动游戏,初始化完成时上报 | ||||||
|  |   | ||||||
|  | @discussion 上报参数比GameTrack的多了 sceneID sceneLev | ||||||
|  | */ | ||||||
|  | + (void)gameInitInfoEventWithLevel:(NSInteger)level | ||||||
|  |                            sceneID:(NSInteger)sceneID | ||||||
|  |                           sceneLev:(NSInteger)sceneLev | ||||||
|  |                           coinType:(NSString *)coinType | ||||||
|  |                           coinLeft:(NSInteger)coinLeft | ||||||
|  |                             roleId:(NSString *)roleId | ||||||
|  |                        otherParams:(nullable NSDictionary *)otherParams; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  @abstract 将相应ohayoo字段设置到custom header中的辅助方法。实际上是调用`setCustomHeaderValue:forKey:`。 | ||||||
|  |  @discussion 使用示例: | ||||||
|  |  @code | ||||||
|  |  [BDAutoTrack ohayooHeaderSetObject:@"channel_123" forKey:OhayooCustomHeaderKeyPackageChannel]; | ||||||
|  |  @code | ||||||
|  |  */ | ||||||
|  | + (void)ohayooHeaderSetObject:(NSObject *)object forKey:(OhayooCustomHeaderKey)key; | ||||||
|  | 
 | ||||||
|  | + (void)ohayooHeaderRemoveObjectForKey:(OhayooCustomHeaderKey)key; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 7e985f289bb1640c29bb6778318cb455 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,83 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrack+Profile.h
 | ||||||
|  | //  Applog
 | ||||||
|  | //
 | ||||||
|  | //  Created by 朱元清 on 2020/9/11.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import "BDAutoTrack.h" | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface BDAutoTrack (Profile) | ||||||
|  | 
 | ||||||
|  | #pragma mark 实例方法 | ||||||
|  | /// @abstract 设置一组profile属性
 | ||||||
|  | /// @discussion 参数字典的值只能是以下类型:字符串、整型、浮点型、字符串数组
 | ||||||
|  | /// @param profileDict 字典。包含一个或多个要设置的profile属性和值
 | ||||||
|  | - (void)profileSet:(NSDictionary *)profileDict; | ||||||
|  | 
 | ||||||
|  | /// @abstract 设置一组profile属性。若一个接口是通过重复调用该接口无效。
 | ||||||
|  | /// @discussion 与profileSet接口不同的是:若某profile已成功通过setOnce接口设置,那么对该profile再次调用setOnce接口无效。
 | ||||||
|  | /// 一个通过setOnce设置的profile被unset后,无法再次通过setOnce设置。
 | ||||||
|  | /// 参数字典的值只能是以下类型:字符串、整型、浮点型、字符串数组
 | ||||||
|  | /// @param profileDict 字典。包含一个或多个要设置的profile属性和值
 | ||||||
|  | - (void)profileSetOnce:(NSDictionary *)profileDict; | ||||||
|  | 
 | ||||||
|  | /// @abstract unset一个之前被profileSet或profileSetOnce接口设置的profile
 | ||||||
|  | /// @param profileName 要unset的profile的名称
 | ||||||
|  | - (void)profileUnset:(NSString *)profileName; | ||||||
|  | 
 | ||||||
|  | /// @abstract 为数值类型的profile属性做自增操作
 | ||||||
|  | /// @discussion 只能自增整数(可以为负整数)。如果传入浮点数,SDK将忽略。
 | ||||||
|  | /// @param profileDict 字典。包含一个或多个要设置的数值类型profile属性和要增加的值。
 | ||||||
|  | - (void)profileIncrement:(NSDictionary <NSString *, NSNumber *> *)profileDict; | ||||||
|  | 
 | ||||||
|  | /// @abstract 为数组类型的profile属性添加一个值
 | ||||||
|  | /// @discussion 参数字典的值只能为字符串或者字符串数组。e.g.
 | ||||||
|  | /// @code
 | ||||||
|  | /// NSDitcionary *profileDict = @{
 | ||||||
|  | ///     @"needs": @"洗衣机",
 | ||||||
|  | ///     @"favorites": @[@"海尔", @"海信", @"美的"]
 | ||||||
|  | /// }
 | ||||||
|  | /// [track profileAppend:profileDict];
 | ||||||
|  | /// @param profileDict 字典。包含一个或多个要设置的数组类型的profile属性和要添加的值
 | ||||||
|  | - (void)profileAppend:(NSDictionary *)profileDict; | ||||||
|  | 
 | ||||||
|  | #pragma mark 类方法 | ||||||
|  | /// @abstract 设置一组profile属性
 | ||||||
|  | /// @discussion 参数字典的值只能是以下类型:字符串、整型、浮点型、字符串数组
 | ||||||
|  | /// @param profileDict 字典。包含一个或多个要设置的profile属性和值
 | ||||||
|  | + (void)profileSet:(NSDictionary *)profileDict; | ||||||
|  | 
 | ||||||
|  | /// @abstract 设置一组profile属性。若一个接口是通过重复调用该接口无效。
 | ||||||
|  | /// @discussion 与profileSet接口不同的是:若某profile已成功通过setOnce接口设置,那么对该profile再次调用setOnce接口无效。
 | ||||||
|  | /// 一个通过setOnce设置的profile被unset后,无法再次通过setOnce设置。
 | ||||||
|  | /// 参数字典的值只能是以下类型:字符串、整型、浮点型、字符串数组
 | ||||||
|  | /// @param profileDict 字典。包含一个或多个要设置的profile属性和值
 | ||||||
|  | + (void)profileSetOnce:(NSDictionary *)profileDict; | ||||||
|  | 
 | ||||||
|  | /// @abstract unset一个之前被profileSet或profileSetOnce接口设置的profile
 | ||||||
|  | /// @param profileName 要unset的profile的名称
 | ||||||
|  | + (void)profileUnset:(NSString *)profileName; | ||||||
|  | 
 | ||||||
|  | /// @abstract 为数值类型的profile属性做自增操作
 | ||||||
|  | /// @discussion 只能自增整数(可以为负整数)。如果传入浮点数,SDK将忽略。
 | ||||||
|  | /// @param profileDict 字典。包含一个或多个要设置的数值类型profile属性和要增加的值。
 | ||||||
|  | + (void)profileIncrement:(NSDictionary <NSString *, NSNumber *> *)profileDict; | ||||||
|  | 
 | ||||||
|  | /// @abstract 为数组类型的profile属性添加一个值
 | ||||||
|  | /// @discussion 参数字典的值只能为字符串或者字符串数组。e.g.
 | ||||||
|  | /// @code
 | ||||||
|  | /// NSDitcionary *profileDict = @{
 | ||||||
|  | ///     @"needs": @"洗衣机",
 | ||||||
|  | ///     @"favorites": @[@"海尔", @"海信", @"美的"]
 | ||||||
|  | /// }
 | ||||||
|  | /// [BDAutoTrack profileAppend:profileDict];
 | ||||||
|  | /// @param profileDict 字典。包含一个或多个要设置的数组类型的profile属性和要添加的值
 | ||||||
|  | + (void)profileAppend:(NSDictionary *)profileDict; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 2ab224ea962a6464d9342d828f100bdc | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,308 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrack+SharedInstance.h
 | ||||||
|  | //  Pods
 | ||||||
|  | //
 | ||||||
|  | //  Created by 朱元清 on 2020/9/11.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | #import "BDCommonDefine.h" | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | /// 以下是单例方法
 | ||||||
|  | #pragma mark - SharedInstance | ||||||
|  | 
 | ||||||
|  | /*! @abstract
 | ||||||
|  | BDAutoTrack 里面引用住一个BDAutoTrack单例,方便通过类名来调用SDK方法。 | ||||||
|  | 特别说明:先调用`[BDAutoTrack startTrackWithConfig:config];`再调用BDAutoTrack的其他 类方法接口 | ||||||
|  | 
 | ||||||
|  | 使用示例: | ||||||
|  | BDAutoTrackConfig *config = [BDAutoTrackConfig configWithAppID:@"xxx" LaunchOptions:launchOptions]; | ||||||
|  | config.xxx = xxx; | ||||||
|  | ... | ||||||
|  | // 初始化
 | ||||||
|  | [BDAutoTrack startTrackWithConfig:config] | ||||||
|  | 
 | ||||||
|  | // 初始化完成之后,再调用其他接口进一步设置user unique ID等属性
 | ||||||
|  | [BDAutoTrack setCurrentUserUniqueID:@"123"]; | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | /*! @discussion 设置注册成功和ABTest拉取成功回调,推荐使用通知方法。可以参考 <RangersAppLog/BDAutoTrackNotifications.h>注释。
 | ||||||
|  | */ | ||||||
|  | @interface BDAutoTrack (SharedInstance) | ||||||
|  | 
 | ||||||
|  | /*! @abstract
 | ||||||
|  | SDK版本号. Depreceted, please use SDKVersion. | ||||||
|  |  */ | ||||||
|  | @property (class, nonatomic, copy, readonly) NSString *sdkVersion APPLOG_API_DEPRECATED_WITH_REPLACEMENT("SDKVersion"); | ||||||
|  | 
 | ||||||
|  | /*! @abstract
 | ||||||
|  | 针对每个AppID 设备唯一rangers Device ID. 非数字,随机字符串,一般情况请不要存储,从SDK接口获取即可。 | ||||||
|  | @discussion 特别说明,rangersDeviceID是字符串,不是数字 | ||||||
|  | */ | ||||||
|  | @property (class, nonatomic, copy, readonly, nullable) NSString *rangersDeviceID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract
 | ||||||
|  |  安装ID,是数字字符串,可以转化为数字。 | ||||||
|  |  */ | ||||||
|  | @property (class, nonatomic, copy, readonly, nullable) NSString *installID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract
 | ||||||
|  |  数说ID,一般情况下,一个自然人的ssid是一致的。 | ||||||
|  |  */ | ||||||
|  | @property (class, nonatomic, copy, readonly, nullable) NSString *ssID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract
 | ||||||
|  |  通过[BDAutoTrack setCurrentUserUniqueID:]接口传入到SDK内部的uuid | ||||||
|  |  */ | ||||||
|  | @property (class, nonatomic, copy, readonly, nullable) NSString *userUniqueID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 初始化的AppID
 | ||||||
|  |  */ | ||||||
|  | @property (class, nonatomic, copy, readonly) NSString *appID; | ||||||
|  | 
 | ||||||
|  | #pragma mark - 初始化与启动单例 | ||||||
|  | /*!
 | ||||||
|  |  * @abstract 初始化并启动SDK单例。 | ||||||
|  |  * @param config 配置对象。其中AppID AppName Channel是必须的。 | ||||||
|  |  * @discussion | ||||||
|  |  * 调用时机: | ||||||
|  |  *    1、必须在应用启动时调用,即在 application:didFinishLaunchingWithOptions: 中调用, | ||||||
|  |  *    2、必须在主线程中调用 | ||||||
|  |  *    3、必须在 SDK 其他方法调用之前调用 | ||||||
|  |  * 本方法是一个便捷方法,相当于下面两个调用: | ||||||
|  |  * @code | ||||||
|  |  * [BDAutoTrack sharedTrackWithConfig:config]; | ||||||
|  |  * [BDAutoTrack startTrack]; | ||||||
|  | */ | ||||||
|  | + (void)startTrackWithConfig:(BDAutoTrackConfig *)config; | ||||||
|  | 
 | ||||||
|  | /*!
 | ||||||
|  |  * @abstract 初始化单例。 | ||||||
|  |  * @param config 配置对象。其中AppID AppName Channel是必须的。 | ||||||
|  |  * @discussion | ||||||
|  |  * 调用时机: | ||||||
|  |  *    1、必须在应用启动时调用,即在 application:didFinishLaunchingWithOptions: 中调用, | ||||||
|  |  *    2、必须在主线程中调用 | ||||||
|  |  *    3、必须在 SDK 其他方法调用之前调用 | ||||||
|  |  * 一般与`+ [BDAutoTrack startTrack]`一起使用。 | ||||||
|  |  * @code | ||||||
|  |  * [BDAutoTrack sharedTrackWithConfig:config]; | ||||||
|  |  * [BDAutoTrack startTrack]; | ||||||
|  |  */ | ||||||
|  | + (void)sharedTrackWithConfig:(BDAutoTrackConfig *)config; | ||||||
|  | 
 | ||||||
|  | /*!
 | ||||||
|  |  * @abstract 启动SDK单例。 | ||||||
|  |  * @discussion | ||||||
|  |  * 调用时机: | ||||||
|  |  *    1、必须在应用启动时调用,即在 application:didFinishLaunchingWithOptions: 中调用, | ||||||
|  |  *    2、必须在主线程中调用 | ||||||
|  |  *    3、必须在 SDK 其他方法调用之前调用 | ||||||
|  |  */ | ||||||
|  | + (void)startTrack; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @abstract | ||||||
|  |  * 若已初始化,则返回之前初始化好的单例;否则返回nil。(本身不会做初始化) | ||||||
|  |  * | ||||||
|  |  * @discussion | ||||||
|  |  * 调用这个方法之前,必须先调用 `+ [BDAutoTrack sharedTrackWithConfig:]` | ||||||
|  |  * | ||||||
|  |  * @return 返回之前初始化好的单例 | ||||||
|  |  */ | ||||||
|  | + (instancetype)sharedTrack; | ||||||
|  | 
 | ||||||
|  | #pragma mark - | ||||||
|  | /*! @abstract userAgent 在初始化之后设置
 | ||||||
|  |  @discussion 每次启动SDK的时候设置一次,发生变化的时候设置即可。一般不会发生变化,只需要设置一次即可 | ||||||
|  |  @param userAgent 日志上报HTTP/HTTPS 请求里面的 userAgent | ||||||
|  |  */ | ||||||
|  | + (void)setUserAgent:(nullable NSString *)userAgent; | ||||||
|  | 
 | ||||||
|  | /*! @abstract UserUniqueID发生变化时设置 在初始化之后设置
 | ||||||
|  |  @discussion SDK会保存,因此只需要变化的时候设置。 | ||||||
|  |  @param uniqueID 用户id,如无特殊需求,请勿传 空字符串 或者 全是空格的字符串。若为nil或空字符串则登出,相当于调用`clearUserUniqueID`。 | ||||||
|  |  @return 是否成功设置或登出。 | ||||||
|  |  */ | ||||||
|  | + (BOOL)setCurrentUserUniqueID:(nullable NSString *)uniqueID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 登出 logout
 | ||||||
|  |  @discussion 登出 logout | ||||||
|  |  */ | ||||||
|  | + (void)clearUserUniqueID; | ||||||
|  | 
 | ||||||
|  | /// 请参考对应实例方法的文档
 | ||||||
|  | + (BOOL)sendRegisterRequestWithRegisteringUserUniqueID:(nullable NSString *)registeringUserUniqueID; | ||||||
|  | + (BOOL)sendRegisterRequest APPLOG_API_AVALIABLE(5.6.3); | ||||||
|  | 
 | ||||||
|  | /*! @abstract 设置上报Host地区,在初始化之后设置,初始化之前请在config中设置
 | ||||||
|  |  @discussion 发生变化可以更新,不需要一直重复设置 | ||||||
|  |  @param serviceVendor 地区 | ||||||
|  |  */ | ||||||
|  | + (void)setServiceVendor:(BDAutoTrackServiceVendor)serviceVendor; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 设置自定义的URL回调 在初始化之后设置
 | ||||||
|  |  @param requestURLBlock 回调block,设置一次即可,不需要多次设置 | ||||||
|  |  @discussion requestURLBlock 会覆盖之前的初始化或者上一次设置的回调,如果为nil会清空回调 | ||||||
|  |  @discussion block在初始化之后 设置一次即可,每次拉取请求都会回调,请勿一直重复设置 | ||||||
|  |  */ | ||||||
|  | + (void)setRequestURLBlock:(nullable BDAutoTrackRequestURLBlock)requestURLBlock; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 设置自定义的URL回调
 | ||||||
|  |  @param requestHostBlock 回调block,设置一次即可,不需要多次设置 | ||||||
|  |  @discussion requestHostBlock 会覆盖之前的初始化或者上一次设置的回调,如果为nil会清空回调 | ||||||
|  |  @discussion requestURLBlock会优先于requestHostBlock | ||||||
|  |  */ | ||||||
|  | + (void)setRequestHostBlock:(nullable BDAutoTrackRequestHostBlock)requestHostBlock; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 地区 在初始化之后设置
 | ||||||
|  |  @discussion 如果设置过,会保存值,直到下次改变或者清空 | ||||||
|  |  @discussion 如果没有值,默认会读取 `[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]` | ||||||
|  |  @discussion 发生变化时候请调用 `+[BDAutoTrack setAppRegion:]`更新值 | ||||||
|  |  */ | ||||||
|  | + (void)setAppRegion:(nullable NSString *)appRegion; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 语言 在初始化之后设置
 | ||||||
|  |  @discussion 如果设置过,会保存值,直到下次改变或者清空 | ||||||
|  |  @discussion 如果没有值,默认会读取 `[[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]` | ||||||
|  |  @discussion 发生变化时候请调用 `+[BDAutoTrack setAppLauguage:]`更新值 | ||||||
|  |  */ | ||||||
|  | + (void)setAppLauguage:(nullable NSString *)appLauguage; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 用户触点 在初始化之后设置
 | ||||||
|  | @discussion 如果设置过,会保存值,直到下次改变或者清空 | ||||||
|  | @discussion 如果没有值,或值为空字符串,则不会上报 | ||||||
|  | @discussion 发生变化时候请调用 `+[BDAutoTrack setAppTouchPoint:]`更新值 | ||||||
|  | */ | ||||||
|  | + (void)setAppTouchPoint:(NSString *)appTouchPoint; | ||||||
|  | 
 | ||||||
|  | /************** 设置CustomHeader(持久化,会影响下次启动) ***************/ | ||||||
|  | /**
 | ||||||
|  |  @abstract 添加自定义上报信息. SDK | ||||||
|  |  @param value 自定义上报value,一般需要传NSString或者数字,或者nil | ||||||
|  |  @param key 自定义上报key | ||||||
|  |  @code | ||||||
|  |  /// 新增或者修改,仅发生变化的时候使用
 | ||||||
|  |  [track setCustomHeaderValue:@"male" forKey:@"gender"]; | ||||||
|  |  [track setCustomHeaderValue:@(29) forKey:@"age"]; | ||||||
|  | 
 | ||||||
|  |  /// 删除
 | ||||||
|  |  [track removeCustomHeaderValueForKey:@"gender"]; | ||||||
|  |  [track removeCustomHeaderValueForKey:@"age"]; | ||||||
|  |  */ | ||||||
|  | + (void)setCustomHeaderValue:(nullable id)value forKey:(NSString *)key; | ||||||
|  | 
 | ||||||
|  | /// 将字典中的KV添加进自定义上报信息。已有的键将会被覆盖。
 | ||||||
|  | /// @param dictionary 值一般为字符串或数字
 | ||||||
|  | + (void)setCustomHeaderWithDictionary:(NSDictionary<NSString *, id> *)dictionary; | ||||||
|  | 
 | ||||||
|  | /// 删除CustomHeader中的一条KV。
 | ||||||
|  | + (void)removeCustomHeaderValueForKey:(NSString *)key; | ||||||
|  | 
 | ||||||
|  | /************** 设置CustomHeader(非持久化,只作用于本次启动) ***************/ | ||||||
|  | /*! @abstract 添加自定义上报信息
 | ||||||
|  |  @param customHeaderBlock 自定义上报信息 | ||||||
|  |  @discussion customHeaderBlock 一次App启动设置一次即可;App重启需要重新设置,因为SDK不会保存上次设置的值;会覆盖之前的初始化的或者上一次设置的,如果为nil会清空回调 | ||||||
|  |  @discussion block在初始化之后设置一次即可,每次都会回调,不会把block返回参数保存,而导致获取不到变化的值,请勿一直重复设置 | ||||||
|  |   | ||||||
|  |   [BDAutoTrack setCustomHeaderBlock:^NSDictionary<NSString *,id> * _Nonnull{ | ||||||
|  |      return @{@"gender":[UserInfo GetGender], | ||||||
|  |             @"age":@([UserInfo GetAge]), | ||||||
|  |             }; | ||||||
|  |   }]; | ||||||
|  |  */ | ||||||
|  | + (void)setCustomHeaderBlock:(nullable BDAutoTrackCustomHeaderBlock)customHeaderBlock;  | ||||||
|  | 
 | ||||||
|  | /*! @abstract 日志上报,在初始化之后设置才能调用
 | ||||||
|  |  @param event 事件名称,不能为nil或空字符串 | ||||||
|  |  @param params 事件参数。可以为空或者nil,但是param如果非空,需要可序列化成json | ||||||
|  |  @discussion params 请参考文档中的日志格式要求,或者使用 [NSJSONSerialization isValidJSONObject:] 来检查params是否可序列化 | ||||||
|  |  @result 是否成功,如果失败,则表示此日志不会被上报。原因是无法序列化。 | ||||||
|  |  */ | ||||||
|  | + (BOOL)eventV3:(NSString *)event params:(nullable NSDictionary *)params; | ||||||
|  | 
 | ||||||
|  | #pragma mark - ALink | ||||||
|  | + (void)setALinkRoutingDelegate:(id<BDAutoTrackAlinkRouting>)ALinkRoutingDelegate; | ||||||
|  | 
 | ||||||
|  | + (BOOL)continueALinkActivityWithURL:(NSURL *)ALinkURL; | ||||||
|  | 
 | ||||||
|  | #pragma mark - ABTest | ||||||
|  | 
 | ||||||
|  | /*! @abstract 获取ABTest的配置值,在初始化之后设置才能调用
 | ||||||
|  |  @param key ABTest的key | ||||||
|  |  @param defaultValue 默认值,如果没有配置,或者未开启ABTest则返回默认值 | ||||||
|  |  @discussion 未开启ABTest或者ABTest配置了默认值,都是返回默认值,因此建议监听ABTestFinishBlock来判断是否开启了ABTest | ||||||
|  |  @discussion 通过此接口读取会触发曝光统计 | ||||||
|  |  @discussion 推荐使用通知来监听ABTest配置是否拉取成功,请参考 <RangersAppLog/BDAutoTrackNotifications.h>注释 | ||||||
|  |  @result 返回ABTest的配置值 | ||||||
|  |  */ | ||||||
|  | + (nullable id)ABTestConfigValueForKey:(NSString *)key defaultValue:(nullable id)defaultValue; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 本地缓存已加载时同`ABTestConfigValueForKey:defaultValue:`。本地缓存未加载时将阻塞等待其加载完成。
 | ||||||
|  |  @discussion 本地缓存一般在初始化后30-100ms内加载完成。 | ||||||
|  |  此方法旨在便于业务在初始化后立即获取到已缓存的AB实验数据,可能耗时较长。 | ||||||
|  |  */ | ||||||
|  | + (nullable id)ABTestConfigValueSyncForKey:(NSString *)key defaultValue:(nullable id)defaultValue; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 获取ABTest 额外的vids
 | ||||||
|  | @param versions 额外的vids。格式比如 @"1,2,3"。是逗号(英文)分割,逗号之间是数字 | ||||||
|  | @discussion 如果要清空上次设置,直接传nil;每次设置都会覆盖上次设置 | ||||||
|  | */ | ||||||
|  | + (void)setExternalABVersion:(nullable NSString *)versions; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 获取ABTest相关配置,在初始化之后设置才能调用
 | ||||||
|  | @result 返回ABTest的vid值 | ||||||
|  |  @discussion 此值不需要设置到上报的event中,SDK会自动给每个event添加 | ||||||
|  |  */ | ||||||
|  | + (nullable NSString *)abVids; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 获取ABTest相关配置,在初始化之后设置才能调用
 | ||||||
|  |  @result 返回ABTest的所有的vids值 | ||||||
|  |  @discussion 此接口不会触发曝光,可以随意读取 | ||||||
|  |  */ | ||||||
|  | + (nullable NSString *)allAbVids; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 获取ABTest相关配置,在初始化之后设置才能调用
 | ||||||
|  |  @result 返回ABTest的所有的Configs值 | ||||||
|  |  @discussion 此接口不会触发曝光,可以随意读取。 | ||||||
|  |  @discussion 如果正常为了做实验,请勿使用此接口,请使用-[BDAutoTrack ABTestConfigValueForKey:defaultValue:]接口 | ||||||
|  |  */ | ||||||
|  | + (nullable NSDictionary *)allABTestConfigs; | ||||||
|  | 
 | ||||||
|  | + (nullable NSDictionary *)allABTestConfigs2; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 本地缓存已加载时同`abVids`。本地缓存未加载时将阻塞等待其加载完成。
 | ||||||
|  |  @discussion 本地缓存一般在初始化后30-100ms内加载完成。 | ||||||
|  |  此方法旨在便于业务在初始化后立即获取到已缓存的AB实验数据,可能耗时较长。 | ||||||
|  |  */ | ||||||
|  | + (nullable NSString *)abVidsSync; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 本地缓存已加载时同`allAbVids`。本地缓存未加载时将阻塞等待其加载完成。
 | ||||||
|  |  @discussion 本地缓存一般在初始化后30-100ms内加载完成。 | ||||||
|  |  此方法旨在便于业务在初始化后立即获取到已缓存的AB实验数据,可能耗时较长。 | ||||||
|  |  */ | ||||||
|  | + (nullable NSString *)allAbVidsSync; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 本地缓存已加载时同`allABTestConfigs`。本地缓存未加载时将阻塞等待其加载完成。
 | ||||||
|  |  @discussion 本地缓存一般在初始化后30-100ms内加载完成。 | ||||||
|  |  此方法旨在便于业务在初始化后立即获取到已缓存的AB实验数据,可能耗时较长。 | ||||||
|  |  */ | ||||||
|  | + (nullable NSDictionary *)allABTestConfigsSync; | ||||||
|  | 
 | ||||||
|  | #pragma mark - main app only | ||||||
|  | 
 | ||||||
|  | /*! @abstract 主动触发上报。SDK有频率限制,每10s最多可以触发一次
 | ||||||
|  | */ | ||||||
|  | + (void)flush; | ||||||
|  | 
 | ||||||
|  | #pragma mark - private API | ||||||
|  | 
 | ||||||
|  | /*! @abstract 调用用户激活接口,在初始化之后设置才能调用
 | ||||||
|  |  一般情况下,请勿调用,除非知晓调用可能的问题 | ||||||
|  |  */ | ||||||
|  | + (void)activeUser; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: b3e9765fce68f4b17a0893a51879dbc4 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrack+Special.h
 | ||||||
|  | //  RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2019/6/2.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import "BDAutoTrack.h" | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | /*!
 | ||||||
|  |  BDAutoTrack  内部支持上报接口,外部客户请勿调用 | ||||||
|  |  */ | ||||||
|  | @interface BDAutoTrack (Special) | ||||||
|  | 
 | ||||||
|  | + (NSDictionary *)specialParamsWitAppID:(NSString *)appID | ||||||
|  |                                 appName:(NSString *)appName | ||||||
|  |                                    type:(NSString *)productType __attribute__((deprecated("推荐使多实例上报"))); | ||||||
|  | 
 | ||||||
|  | - (BOOL)eventV3:(NSString *)event params:(nullable NSDictionary *)params specialParams:(NSDictionary *)specialParams __attribute__((deprecated("推荐使多实例上报"))); | ||||||
|  | 
 | ||||||
|  | - (BOOL)customEvent:(NSString *)category params:(NSDictionary *)params __attribute__((deprecated("推荐使多实例上报"))); | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: bb213d85c3cd846d88983598f8c15299 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,329 @@ | ||||||
|  | //
 | ||||||
|  | //  BDTracker.h
 | ||||||
|  | //  Applog
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2019/1/20.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | #import "BDCommonDefine.h" | ||||||
|  | #import "BDAutoTrackConfig+AppLog.h" | ||||||
|  | #import "BDAutoTrackAlinkRouting.h" | ||||||
|  | 
 | ||||||
|  | @class BDAutoTrackConfig; | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | /*!
 | ||||||
|  |  BDAutoTrack日志上报功能的类 | ||||||
|  |  */ | ||||||
|  | @interface BDAutoTrack : NSObject | ||||||
|  | 
 | ||||||
|  | /*! @abstract
 | ||||||
|  |  针对每个AppID 设备唯一rangers Device ID. 非数字,随机字符串,一般情况请不要存储,从SDK接口获取即可。 | ||||||
|  |  @discussion 特别说明,rangersDeviceID是字符串,不是数字 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, copy, readonly, nullable) NSString *rangersDeviceID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract
 | ||||||
|  |  安装ID,是数字字符串,可以转化为数字。 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, copy, readonly, nullable) NSString *installID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract
 | ||||||
|  |  数说ID,一般情况下,一个自然人的ssid是一致的。 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, copy, readonly, nullable) NSString *ssID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract
 | ||||||
|  |  通过[BDAutoTrack setCurrentUserUniqueID:]接口传入到SDK内部的uuid | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, copy, readonly, nullable) NSString *userUniqueID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract SDK是否已启动,默认为NO,调用`startTrack`或其便捷方法后为YES。
 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, readonly, assign) BOOL started; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 初始化的AppID
 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, copy, readonly) NSString *appID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 返回SDK版本号。e.g. 6.1.0
 | ||||||
|  |  */ | ||||||
|  | + (NSString *)SDKVersion; | ||||||
|  | 
 | ||||||
|  | + (instancetype)new __attribute__((unavailable())); | ||||||
|  | - (instancetype)init __attribute__((unavailable())); | ||||||
|  | /*! @abstract 初始化方法,初始化一个Track实例
 | ||||||
|  |  @param config 初始化配置,AppID AppName Channel是必须的 | ||||||
|  |  @discussion 初始化接口可以重复调用,会返回同一个实例,推荐返回之后,引用住这个实例,下次上报方便使用。 | ||||||
|  |  @result 一个Track实例 | ||||||
|  |  */ | ||||||
|  | + (nullable instancetype)trackWithConfig:(BDAutoTrackConfig *)config; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 根据App ID获取一个已经初始化过的Track实例
 | ||||||
|  |  @param appID AppID | ||||||
|  |  @discussion 此接口需要先调用 `[BDAutoTrack trackWithConfig:]`初始化过实例,才能获取到 | ||||||
|  |  @result 一个Track实例 | ||||||
|  |  */ | ||||||
|  | + (nullable instancetype)trackWithAppID:(NSString *)appID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 开始埋点和无埋点上报
 | ||||||
|  |  @discussion 需要在`[BDAutoTrack trackWithConfig:]`初始化之后手动调用此方法。调用此方法之前,可以做一些额外的配置 | ||||||
|  |  */ | ||||||
|  | - (void)startTrack; | ||||||
|  | 
 | ||||||
|  | /*! @abstract userAgent
 | ||||||
|  |  @discussion 每次启动SDK的时候设置一次,发生变化的时候设置即可。一般不会发生变化,只需要设置一次即可 | ||||||
|  |  @param userAgent 日志上报HTTP/HTTPS 请求里面的 userAgent | ||||||
|  |  */ | ||||||
|  | - (void)setUserAgent:(nullable NSString *)userAgent; | ||||||
|  | 
 | ||||||
|  | /*! @abstract UserUniqueID发生变化时设置
 | ||||||
|  |  @discussion 有值,则设置为ID值;登出 请调用 [BDAutoTrack clearUserUniqueID] 或者传 nil | ||||||
|  |  @discussion SDK会保存,因此只需要变化的时候设置。 | ||||||
|  |  @param uniqueID 用户id,如无特殊需求,请勿传 空字符串 或者 全是空格的字符串 | ||||||
|  |  @return 是否成功设置或登出。 | ||||||
|  |  */ | ||||||
|  | - (BOOL)setCurrentUserUniqueID:(nullable NSString *)uniqueID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 登出 logout
 | ||||||
|  |  @discussion 登出 logout | ||||||
|  |  */ | ||||||
|  | - (void)clearUserUniqueID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 手动发起注册请求,一般不需要调用。
 | ||||||
|  |  @discussion | ||||||
|  |  SDK在以下情况会自动调用此方法: | ||||||
|  |  1. 初始化阶段 | ||||||
|  |  2. 用户通过`setServiceVendor:`方法更改serviceVendor | ||||||
|  |  3. 用户通过`setCurrentUserUniqueID:`更改userUniqueID | ||||||
|  |   | ||||||
|  |  @discussion 用户一般不需要调用此方法,除非因特殊原因需要手动发起注册(一般无必要) | ||||||
|  |  @param registeringUserUniqueID  要注册的用户ID. 如为nil则使用当前的UserUniqueID. | ||||||
|  |  @return 是否成功发起注册请求 | ||||||
|  |  */ | ||||||
|  | - (BOOL)sendRegisterRequestWithRegisteringUserUniqueID:(nullable NSString *)registeringUserUniqueID APPLOG_API_AVALIABLE(6.2.3); | ||||||
|  | 
 | ||||||
|  | /// 同 `sendRegisterRequestWithRegisteringUserUniqueID: nil`
 | ||||||
|  | - (BOOL)sendRegisterRequest APPLOG_API_AVALIABLE(5.6.3); | ||||||
|  | 
 | ||||||
|  | /*! @abstract 设置上报Host地区,有国内、新加坡、美东三个选项
 | ||||||
|  |  @discussion 发生变化可以更新,不需要一直重复设置 | ||||||
|  |  @discussion 当新设serviceVendor与旧值不一致时,会重新发起注册请求 | ||||||
|  |  @param serviceVendor 地区 | ||||||
|  |  */ | ||||||
|  | - (void)setServiceVendor:(BDAutoTrackServiceVendor)serviceVendor; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 设置自定义的URL回调
 | ||||||
|  |  @param requestURLBlock 回调block,设置一次即可,不需要多次设置 | ||||||
|  |  @discussion requestURLBlock 会覆盖之前的初始化或者上一次设置的回调,如果为nil会清空回调 | ||||||
|  |  @discussion block在初始化之前 设置一次即可,每次拉取请求都会回调,请勿一直重复设置 | ||||||
|  |  */ | ||||||
|  | - (void)setRequestURLBlock:(nullable BDAutoTrackRequestURLBlock)requestURLBlock; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 设置自定义的URL回调
 | ||||||
|  |  @param requestHostBlock 回调block,设置一次即可,不需要多次设置 | ||||||
|  |  @discussion requestHostBlock 会覆盖之前的初始化或者上一次设置的回调,如果为nil会清空回调 | ||||||
|  |  @discussion requestURLBlock会优先于requestHostBlock | ||||||
|  |  */ | ||||||
|  | - (void)setRequestHostBlock:(nullable BDAutoTrackRequestHostBlock)requestHostBlock; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 地区
 | ||||||
|  |  @discussion 如果设置过,会保存值,直到下次改变或者清空 | ||||||
|  |  @discussion 如果没有值,默认会读取 `[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]` | ||||||
|  |  @discussion 发生变化时候请调用 `+[BDAutoTrack setAppRegion:]`更新值 | ||||||
|  |  */ | ||||||
|  | - (void)setAppRegion:(nullable NSString *)appRegion; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 语言
 | ||||||
|  |  @discussion 如果设置过,会保存值,直到下次改变或者清空 | ||||||
|  |  @discussion 如果没有值,默认会读取 `[[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode]` | ||||||
|  |  @discussion 发生变化时候请调用 `+[BDAutoTrack setAppLauguage:]`更新值 | ||||||
|  |  */ | ||||||
|  | - (void)setAppLauguage:(nullable NSString *)appLauguage; | ||||||
|  | 
 | ||||||
|  | /************** 设置CustomHeader(持久化,会影响下次启动) ***************/ | ||||||
|  | /**
 | ||||||
|  |  @abstract 添加自定义上报信息 | ||||||
|  |  @param value 自定义上报value,一般需要传NSString或者数字,或者nil | ||||||
|  |  @param key 自定义上报key | ||||||
|  |  @code | ||||||
|  |  /// 新增或者修改,仅发生变化的时候使用
 | ||||||
|  |  [track setCustomHeaderValue:@"male" forKey:@"gender"]; | ||||||
|  |  [track setCustomHeaderValue:@(29) forKey:@"age"]; | ||||||
|  | 
 | ||||||
|  |  /// 删除
 | ||||||
|  |  [track removeCustomHeaderValueForKey:@"gender"]; | ||||||
|  |  [track removeCustomHeaderValueForKey:@"age"]; | ||||||
|  |  */ | ||||||
|  | - (void)setCustomHeaderValue:(nullable id)value forKey:(NSString *)key; | ||||||
|  | 
 | ||||||
|  | /// 将字典中的KV添加进自定义上报信息。已有的键将会被覆盖。
 | ||||||
|  | /// @param dictionary 值一般为字符串或数字
 | ||||||
|  | - (void)setCustomHeaderWithDictionary:(NSDictionary<NSString *, id> *)dictionary; | ||||||
|  | 
 | ||||||
|  | /// 删除CustomHeader中的一条KV。
 | ||||||
|  | - (void)removeCustomHeaderValueForKey:(NSString *)key; | ||||||
|  | 
 | ||||||
|  | /************** 设置CustomHeader(非持久化,只作用于本次启动) ***************/ | ||||||
|  | /*! @abstract 添加自定义上报信息
 | ||||||
|  |  @param customHeaderBlock 自定义上报信息 | ||||||
|  |  @discussion customHeaderBlock 一次App启动设置一次即可;App重启需要重新设置,因为SDK不会保存上次设置的值;会覆盖之前的初始化的或者上一次设置的,如果为nil会清空回调 | ||||||
|  |  @discussion block在初始化之前设置一次即可,每次都会回调,不会把block返回参数保存,而导致获取不到变化的值,请勿一直重复设置 | ||||||
|  |   | ||||||
|  |  [track setCustomHeaderBlock:^NSDictionary<NSString *,id> * _Nonnull{ | ||||||
|  |     return @{@"gender":[UserInfo GetGender], | ||||||
|  |            @"age":@([UserInfo GetAge]), | ||||||
|  |            }; | ||||||
|  |  }]; | ||||||
|  |  */ | ||||||
|  | - (void)setCustomHeaderBlock:(nullable BDAutoTrackCustomHeaderBlock)customHeaderBlock; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 日志上报
 | ||||||
|  |  @param event 事件名称,不能为nil或空字符串 | ||||||
|  |  @param params 事件参数。可以为空或者nil,但是param如果非空,需要可序列化成json | ||||||
|  |  @discussion params 请参考文档中的日志格式要求,或者使用 [NSJSONSerialization isValidJSONObject:] 来检查params是否可序列化 | ||||||
|  |  @result 是否成功,如果失败,则表示此日志不会被上报。原因是无法序列化。 | ||||||
|  |  */ | ||||||
|  | - (BOOL)eventV3:(NSString *)event params:(nullable NSDictionary *)params; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 日志上报
 | ||||||
|  | @param event 事件名称,不能为nil或空字符串 | ||||||
|  | @result 是否成功 | ||||||
|  | */ | ||||||
|  | - (BOOL)eventV3:(NSString *)event; | ||||||
|  | 
 | ||||||
|  | #pragma mark - ABTest | ||||||
|  | 
 | ||||||
|  | /*! @abstract 获取ABTest的配置值
 | ||||||
|  |  @param key ABTest的key | ||||||
|  |  @param defaultValue 默认值,如果没有配置,或者未开启ABTest则返回默认值 | ||||||
|  |  @discussion 未开启ABTest或者ABTest配置了默认值,都是返回默认值,因此建议监听BDAutoTrackNotificationABTestSuccess来判断是否开启了ABTest | ||||||
|  |  @discussion 通过此接口读取会触发曝光统计 | ||||||
|  |  @result 返回ABTest的配置值 | ||||||
|  |  */ | ||||||
|  | - (nullable id)ABTestConfigValueForKey:(NSString *)key defaultValue:(nullable id)defaultValue; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 本地缓存已加载时同`ABTestConfigValueForKey:defaultValue:`。本地缓存未加载时将阻塞等待其加载完成。
 | ||||||
|  |  @discussion 本地缓存一般在初始化后30-100ms内加载完成。 | ||||||
|  |  此方法旨在便于业务在初始化后立即获取到已缓存的AB实验数据,可能耗时较长。 | ||||||
|  |  */ | ||||||
|  | - (nullable id)ABTestConfigValueSyncForKey:(NSString *)key defaultValue:(nullable id)defaultValue; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 获取ABTest 额外的vids
 | ||||||
|  | @param versions 额外的vids。格式比如 @"1,2,3"。是逗号(英文)分割,逗号之间是数字 | ||||||
|  | @discussion 如果要清空上次设置,直接传nil;每次设置都会覆盖上次设置 | ||||||
|  | */ | ||||||
|  | - (void)setExternalABVersion:(nullable NSString *)versions; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 获取ABTest相关配置
 | ||||||
|  | @result 返回ABTest的vids值 | ||||||
|  |  @discussion 此值不需要设置到上报的event中,SDK会自动给每个event添加 | ||||||
|  |  */ | ||||||
|  | - (nullable NSString *)abVids; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 获取ABTest相关配置
 | ||||||
|  |  @result 返回ABTest的所有的vids值 | ||||||
|  |  @discussion 此接口不会触发曝光,可以随意读取 | ||||||
|  |  */ | ||||||
|  | - (nullable NSString *)allAbVids; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 获取ABTest相关配置
 | ||||||
|  |  @result 返回ABTest的所有的Configs值 | ||||||
|  |  @discussion 此接口不会触发曝光,可以随意读取。 | ||||||
|  |  @discussion 如果正常为了做实验,请勿使用此接口,请使用-[BDAutoTrack ABTestConfigValueForKey:defaultValue:]接口 | ||||||
|  |  */ | ||||||
|  | - (nullable NSDictionary *)allABTestConfigs; | ||||||
|  | 
 | ||||||
|  | /// `allABTestConfigs` version 2. Align with web and Android.
 | ||||||
|  | /// return raw key-value in server response.
 | ||||||
|  | - (nullable NSDictionary *)allABTestConfigs2; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 本地缓存已加载时同`abVids`。本地缓存未加载时将阻塞等待其加载完成。
 | ||||||
|  |  @discussion 本地缓存一般在初始化后30-100ms内加载完成。 | ||||||
|  |  此方法旨在便于业务在初始化后立即获取到已缓存的AB实验数据,可能耗时较长。 | ||||||
|  |  */ | ||||||
|  | - (nullable NSString *)abVidsSync; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 本地缓存已加载时同`allAbVids`。本地缓存未加载时将阻塞等待其加载完成。
 | ||||||
|  |  @discussion 本地缓存一般在初始化后30-100ms内加载完成。 | ||||||
|  |  此方法旨在便于业务在初始化后立即获取到已缓存的AB实验数据,可能耗时较长。 | ||||||
|  |  */ | ||||||
|  | - (nullable NSString *)allAbVidsSync; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 本地缓存已加载时同`allABTestConfigs`。本地缓存未加载时将阻塞等待其加载完成。
 | ||||||
|  |  @discussion 本地缓存一般在初始化后30-100ms内加载完成。 | ||||||
|  |  此方法旨在便于业务在初始化后立即获取到已缓存的AB实验数据,可能耗时较长。 | ||||||
|  |  */ | ||||||
|  | - (nullable NSDictionary *)allABTestConfigsSync; | ||||||
|  | 
 | ||||||
|  | #pragma mark - ALink | ||||||
|  | /* 如果你的应用不使用ALink功能,可忽略此节。 */ | ||||||
|  | /*! 设置路由代理对象。路由代理对象负责接受SDK回传的路由数据,并根据数据做页面路由。
 | ||||||
|  |  @discussion 如应用不使用ALink功能,可忽略。 | ||||||
|  |  */ | ||||||
|  | - (void)setALinkRoutingDelegate:(id<BDAutoTrackAlinkRouting>)ALinkRoutingDelegate; | ||||||
|  | 
 | ||||||
|  | /*! 此方法内部会判断参数是否为有效的ALink。如果是则会异步请求路由数据,并回传给路由代理对象。
 | ||||||
|  |  @discussion 如果你的应用没有使用UIScene,你应该在`application: openURL: options:`和`application: continueUserActivity: restorationHandler:`处调用此方法。 | ||||||
|  |  如果你的应用使用了UIScene,请参考没有使用UIScene的情况,并结合你应用的具体情况,判断在何处调用此方法,一般可以在`scene: openURLContexts:`和`scene:continueUserActivity:`处调用此方法。 | ||||||
|  |  如应用不使用ALink功能,可忽略。 | ||||||
|  |  @param ALinkURL 深度链接URL。可以是Universal Link 或 Custom URL Scheme | ||||||
|  |  @return 是否是有效的ALink | ||||||
|  |  @code | ||||||
|  |  - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options { | ||||||
|  |      if([BDAdapter handleURL:url scene:nil]) { | ||||||
|  |          return YES; | ||||||
|  |      } | ||||||
|  |      if ([BDAutoTrack continueALinkActivityWithURL:url]) { | ||||||
|  |          return YES; | ||||||
|  |      } | ||||||
|  | 
 | ||||||
|  |      /// your handle code
 | ||||||
|  | 
 | ||||||
|  |      return NO; | ||||||
|  |  } | ||||||
|  | 
 | ||||||
|  |  - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler { | ||||||
|  |      if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) { | ||||||
|  |          NSURL *universalLinkURL = userActivity.webpageURL; | ||||||
|  |          if ([universalLinkURL.host isEqualToString:@"myapphost.com"]) { | ||||||
|  |              // 如你的应用有多个Universal Links域名,可以先判断是否是其他域名。
 | ||||||
|  |              return YES; | ||||||
|  |          } | ||||||
|  |          else if ([BDAutoTrack continueALinkActivityWithURL:userActivity.webpageURL]) {  // 多半是ALink,交给AppLog SDK来处理。如果不是ALink,SDK也会返回NO。
 | ||||||
|  |              return YES; | ||||||
|  |          } | ||||||
|  |          return NO; | ||||||
|  |      } | ||||||
|  |       | ||||||
|  |      return YES; | ||||||
|  |  } | ||||||
|  |  */ | ||||||
|  | - (BOOL)continueALinkActivityWithURL:(NSURL *)ALinkURL; | ||||||
|  | 
 | ||||||
|  | #pragma mark - private API | ||||||
|  | 
 | ||||||
|  | /*! @abstract 调用用户激活接口。一般情况下,请勿调用,除非知晓调用可能的问题。
 | ||||||
|  |  */ | ||||||
|  | - (void)activeUser; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | #pragma mark - Special | ||||||
|  | 
 | ||||||
|  | @interface BDAutoTrack (SharedSpecial) | ||||||
|  | 
 | ||||||
|  | + (BOOL)eventV3:(NSString *)event params:(nullable NSDictionary *)params specialParams:(NSDictionary *)specialParams; | ||||||
|  | 
 | ||||||
|  | + (BOOL)customEvent:(NSString *)category params:(NSDictionary *)params; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | 
 | ||||||
|  | /// 单例的类方法
 | ||||||
|  | #import "BDAutoTrack+SharedInstance.h" | ||||||
|  | #import "BDAutoTrack+Profile.h" | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: edc7ff870c0e54c5c833da7b35984b6d | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,24 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrackAlinkRouting.h
 | ||||||
|  | //  RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by 朱元清 on 2021/3/2.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | static NSErrorDomain const RALALinkErrorDomain = @"RALALinkErrorDomain"; | ||||||
|  | 
 | ||||||
|  | @protocol BDAutoTrackAlinkRouting <NSObject> | ||||||
|  | @required | ||||||
|  | 
 | ||||||
|  | - (void)onAttributionData:(nullable NSDictionary *)routingInfo error:(nullable NSError *)error; | ||||||
|  | 
 | ||||||
|  | - (void)onALinkData:(nullable NSDictionary *)routingInfo error:(nullable NSError *)error; | ||||||
|  | 
 | ||||||
|  | - (bool)shouldALinkSDKAccessPasteBoard; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 53d8b3e8c9d3344ad951895692901918 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,41 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrackCacheRemover.h
 | ||||||
|  | //  RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by 朱元清 on 2020/11/2.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | #import "RangersAppLog.h" | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  本文件包含SDK缓存的接口。仅限于开发调试阶段清除SDK缓存之用途。生产环境禁止使用! | ||||||
|  |  本文件接口主要是为了自动化测试中快速删除缓存。 | ||||||
|  |  如果您不是自动化测试,建议通过在手机或模拟器上删除应用的方式来清除缓存,更方便快捷;不必使用本文件的接口。 | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface BDAutoTrackCacheRemover : NSObject | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /*********************************** SDK私有缓存 ************************************/ | ||||||
|  | /// 永久删除 SDK 私有缓存(包括deviceID\ssID\installID\userUniqueID\ABTest配置等信息)
 | ||||||
|  | - (void)removeDefaultsForAppID:(NSString *)appID; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /*********************************** StandardDefaults ************************************/ | ||||||
|  | /// 临时将应用层移除出StandardDefaults的搜索列表
 | ||||||
|  | - (void)removeCurrentBundleFromStandardDefaultsSearchList; | ||||||
|  | 
 | ||||||
|  | /// 永久删除 StandardDefaults 的应用层缓存
 | ||||||
|  | - (void)removeCurrentBundleFromStandardDefaults; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /*********************************** KeyChain ************************************/ | ||||||
|  | /// 删除SDK再 keychian 中的缓存
 | ||||||
|  | - (void)removeKeychainForAppID:(NSString *)appID serviceVendor:(BDAutoTrackServiceVendor)vendor; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: e3d654ff7da404509bd195334dd72b79 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,58 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrackConfig+AppLog.h
 | ||||||
|  | //  RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/3/25.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import "BDAutoTrackConfig.h" | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface BDAutoTrackConfig (AppLog) | ||||||
|  | 
 | ||||||
|  | /*! @abstract 是否开启事件上报,默认YES,关闭后任何事件包括用户自定义事件都不会上报
 | ||||||
|  |  @discussion 有些客户只需要ABTest功能,不需要任何事件上报,包括曝光事件,可以通过这个关闭 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, assign) BOOL trackEventEnabled; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 是否开启无埋点。同时需要在Tea配置。
 | ||||||
|  |  @discussion 如果设置NO且Tea平台配置NO,则不会采集无埋点事件 | ||||||
|  |  @discussion 如果设置NO且Tea平台配置YES,则拉取配置成功后开始采集无埋点事件 | ||||||
|  |  @discussion 如果设置YES且Tea平台配置NO,则拉取配置成功后停止采集无埋点事件 | ||||||
|  |  @discussion 如果设置YES且Tea平台配置YES,则采集无埋点事件 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, assign) BOOL autoTrackEnabled; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 当无埋点开关开启时,是否采集H5页面的无埋点事件,默认开(YES)
 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic) BOOL H5AutoTrackEnabled; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 游戏模式,开启游戏模式会默认上报游戏心跳事件 */ | ||||||
|  | @property (nonatomic, assign) BOOL gameModeEnable; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 是否自动激活。默认YES,一般情况请不要修改 */ | ||||||
|  | @property (nonatomic, assign) BOOL autoActiveUser; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 采集事件的时候输出日志,在控制台中可以查看
 | ||||||
|  |  @discussion 需要同时设置logger,因为NSLog低效,且在iOS 13中有问题。release版本请设置为NO | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, assign) BOOL showDebugLog; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 采集事件的时候输出日志,在控制台中可以查看
 | ||||||
|  |  @discussion logger为nil,则不会输出日志 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, copy, nullable) BDAutoTrackLogger logger; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 日志上报是否加密。用于debug情况可以抓包调试 */ | ||||||
|  | @property (nonatomic, assign) BOOL logNeedEncrypt; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 是否自动拉配置。默认YES,一般情况请不要修改。仅私有化部署情况,可能不需要自动拉取配置 */ | ||||||
|  | @property (nonatomic, assign) BOOL autoFetchSettings; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 是否开AB。默认YES,一般情况请不要修改 */ | ||||||
|  | @property (nonatomic, assign) BOOL abEnable; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 2739e46b6f6b0463c9128c53d15244d9 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,104 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrackConfig.h
 | ||||||
|  | //  RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/3/25.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | #import "BDCommonDefine.h" | ||||||
|  | #import "BDAutoTrackEncryptionDelegate.h" | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface BDAutoTrackConfig : NSObject | ||||||
|  | 
 | ||||||
|  | /*! @abstract channel默认 @"App Store", Release版本只有 @"App Store", debug版本可以任意设置. */ | ||||||
|  | @property (nonatomic, copy) NSString *channel; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 申请appID时候填写的英文名称 */ | ||||||
|  | @property (nonatomic, copy, nullable) NSString *appName; | ||||||
|  | 
 | ||||||
|  | /*! @abstract AppID,非空,必须设置 */ | ||||||
|  | @property (nonatomic, copy) NSString *appID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 默认国内,初始化时一定要传正确的值
 | ||||||
|  |  @discussion 发生变化时候请调用 `+[BDAutoTrack setServiceVendor:]`更新值 | ||||||
|  |  @discussion 会影响注册和日志上报。所以如果发生变化后,下次启动初始化请传入正确的值 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, copy) BDAutoTrackServiceVendor serviceVendor; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 如有初始的UserUniqueID,可以在此设置。
 | ||||||
|  |  @discussion 此属性解决了一些业务需要在SDK初始化时就设置UserUniqueID的需求。 | ||||||
|  |  @discussion Note: 在应用第一次启动时,SDK会在初始化时设置UserUniqueID为此属性的值。 | ||||||
|  |  后续用户登出后,UserUniqueID会变为nil,此时SDK不会重新把UserUniqueID设置为此属性的值。 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, copy, nullable) NSString *initialUserUniqueID; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 是否开启 WKWebView 的 H5 打通功能,开启后,若WebView页面的JS AppLog SDK侧也配置开启H5Bridge,则H5 埋点将可以从 Native 端上报。默认关闭。
 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic) BOOL enableH5Bridge; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 是否开启ALink的延迟场景。默认开启。 */ | ||||||
|  | @property (nonatomic) BOOL enableDeferredALink; | ||||||
|  | 
 | ||||||
|  | /*! H5Bridge功能域名白名单。只有名单中的页面会开启Bridge。支持通配符。
 | ||||||
|  |  * @code | ||||||
|  |  * config.H5BridgeAllowedDomainPatterns = @[@"*.myapp.com", @"myapp.com"]; | ||||||
|  | */ | ||||||
|  | @property (nonatomic, copy) NSArray<NSString *> *H5BridgeAllowedDomainPatterns; | ||||||
|  | 
 | ||||||
|  | /*! 当切换用户时,清除AB Versions缓存。默认为开(YES)。
 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic) BOOL clearABCacheOnUserChange; | ||||||
|  | 
 | ||||||
|  | /*! 应用启动选项 */ | ||||||
|  | @property (nonatomic, readonly) NSDictionary<UIApplicationLaunchOptionsKey, id> *launchOptions; | ||||||
|  | 
 | ||||||
|  | /*! @abstract Define custom encryption method (or custom encryption key)
 | ||||||
|  |  @discussion SDK不持有该对象。传入前须确保该对象在SDK使用期间不被释放,请勿传入临时对象。 | ||||||
|  |  SDK will not hold the delegate. Please ensure the delegate's liveness during SDK's usage. Do not pass temporary object. | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, weak) id<BDAutoTrackEncryptionDelegate> encryptionDelegate; | ||||||
|  | 
 | ||||||
|  | - (instancetype)init NS_UNAVAILABLE; | ||||||
|  | + (instancetype)new NS_UNAVAILABLE; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 根据App ID获取一个config
 | ||||||
|  | @param appID 注册应用时获取的AppID | ||||||
|  | @param launchOptions 应用启动选项,一般直接传入`application:didFinishLaunchingWithOptions:`的`launchOptions`参数即可 | ||||||
|  | */ | ||||||
|  | + (instancetype)configWithAppID:(NSString *)appID launchOptions:(nullable NSDictionary<UIApplicationLaunchOptionsKey,id> *)launchOptions APPLOG_API_AVALIABLE(6.0.0); | ||||||
|  | 
 | ||||||
|  | /*! @abstract 根据App ID获取一个config
 | ||||||
|  | @param appID AppID | ||||||
|  | @result 一个config实例, 其他参数非必填,或者有默认值,可以直接通过setter 设置 | ||||||
|  | @discussion 如果您要使用ALink功能,请勿使用此API。此API已过时,后续版本将下掉,请及时使用新API。 | ||||||
|  | */ | ||||||
|  | + (instancetype)configWithAppID:(NSString *)appID APPLOG_API_DEPRECATED_WITH_REPLACEMENT("configWithAppID:launchOptions:"); | ||||||
|  | 
 | ||||||
|  | /*!
 | ||||||
|  |  使用示例1: | ||||||
|  |   BDAutoTrackConfig *config = [BDAutoTrackConfig configWithSecondAppID:appid]; | ||||||
|  |  // 初始化完成之后,可以调用其他接口
 | ||||||
|  |  BDAutoTrack *track = [BDAutoTrack trackWithConfig:config] | ||||||
|  | 
 | ||||||
|  |  // 设置一些属性等配置
 | ||||||
|  |  [track setCurrentUserUniqueID:@"123"]; | ||||||
|  | 
 | ||||||
|  |  // 开始上报
 | ||||||
|  |  [track satrtTrack]; | ||||||
|  | 
 | ||||||
|  |  // 用变量引用住track用于上报
 | ||||||
|  |  [track eventV3:xxx params:xxx]; | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /*! @abstract 根据App ID获取一个config
 | ||||||
|  | @param appID AppID | ||||||
|  | @result 一个config实例, 此config默认设置了不会激活和拉取settings。可用于第三方SDK需要上报一些事件,但是不需要激活等 | ||||||
|  | */ | ||||||
|  | + (instancetype)configWithSecondAppID:(NSString *)appID; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: cd2437fc66a8f4da4a39e872de48dd96 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,25 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrackEncryptionDelegate.h
 | ||||||
|  | //  RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by 朱元清 on 2021/8/9.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @protocol BDAutoTrackEncryptionDelegate <NSObject> | ||||||
|  | @required | ||||||
|  | /// Encrypt data for HTTP request. Use your custom encryption method by implementing this protocol and inject it into BDAutoTracker in its initialization.
 | ||||||
|  | /// Only takes effect when `logNeedEncypt` is YES.
 | ||||||
|  | /// The following data will be passed to this method:
 | ||||||
|  | /// (1) All HTTP POST body data
 | ||||||
|  | /// (2) Some HTTP query data
 | ||||||
|  | /// @param data data before encryption
 | ||||||
|  | /// @param error in-out param. Set it when encryption fails.
 | ||||||
|  | - (NSData *)encryptData:(NSData *)data error:(NSError * __autoreleasing *)error; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: f8a5af045d53b4beba81fa7704965d4b | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,23 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrackIDFA.h
 | ||||||
|  | //  RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/8/28.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import "BDCommonDefine.h" | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface BDAutoTrackIDFA : NSObject | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  if you want to use idfa, you should request Authorization | ||||||
|  |  */ | ||||||
|  | + (BDAutoTrackAuthorizationStatus)authorizationStatus; | ||||||
|  | + (void)requestAuthorizationWithHandler:(nullable BDAutoTrackAuthorizationHandler)completion; | ||||||
|  | + (nullable NSString *)trackingIdentifier; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 9365f75dd91b74df1a34c2379441b6b3 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,107 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrackConstants.h
 | ||||||
|  | //  Pods-BDAutoTracker_Example
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2019/5/16.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | #ifndef BDAutoTrackNotifictaion_H | ||||||
|  | #define BDAutoTrackNotifictaion_H | ||||||
|  | /*! @abstract UIViewController 切换事件通知
 | ||||||
|  |  userInfo | ||||||
|  |  @{ kBDAutoTrackViewControllerFormer:NSStringFromClass(from.class), | ||||||
|  |     kBDAutoTrackViewControllerAfter:NSStringFromClass(to.class), | ||||||
|  |     kBDAutoTrackSwitchIsBack:@(isBack) | ||||||
|  |  }; | ||||||
|  | @discussion 通知在主线程,一般情况下监听后,请勿同步进行耗时操作 | ||||||
|  | */ | ||||||
|  | FOUNDATION_EXTERN NSString * const BDAutoTrackVCSwitchEventNotification; | ||||||
|  | 
 | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackViewControllerFormer; | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackViewControllerAfter; | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackSwitchIsBack; | ||||||
|  | 
 | ||||||
|  | /*! @abstract SDK 注册成功通知
 | ||||||
|  |  userInfo | ||||||
|  |  @{ kBDAutoTrackNotificationAppID                       :appID, | ||||||
|  |     kBDAutoTrackNotificationRangersDeviceID    :did, | ||||||
|  |     kBDAutoTrackNotificationSSID                        :ssid, | ||||||
|  |     kBDAutoTrackNotificationInstallID                   :iid | ||||||
|  |     kBDAutoTrackNotificationUserUniqueID          :uuid | ||||||
|  |     kBDAutoTrackNotificationDataSource:  BDAutoTrackNotificationDataSourceLocalCache | BDAutoTrackNotificationDataSourceServer | ||||||
|  |     kBDAutoTrackNotificationIsNewUser : 1 | 0 | ||||||
|  |  }; | ||||||
|  | @discussion 通知在子线程,uuid可能为 nil. | ||||||
|  | @discussion 初始化 SDK 的时候,如果本地已经有 ID 值,会有一次通知 | ||||||
|  |  触发重新注册请求后,请求成功会有另一次通知 | ||||||
|  |  触发条件: | ||||||
|  |     1. -[BDAuTrack startTrack] | ||||||
|  |     2. -[BDAuTrack setCurrentUserUniqueID:] 且与上次不一致,包括 nil | ||||||
|  |     3. -[BDAuTrack setServiceVendor:] 且与上次不一致 | ||||||
|  | */ | ||||||
|  | FOUNDATION_EXTERN NSString * const BDAutoTrackNotificationRegisterSuccess; | ||||||
|  | 
 | ||||||
|  | /*!
 | ||||||
|  |  @abstract SDK 注册请求失败通知。SDK在注册阶段默认有3次重试策略。每一次注册请求的失败都会触发此通知,并携带剩余的重试次数。 | ||||||
|  |  userInfo | ||||||
|  |  @{ | ||||||
|  |      @"message": @"register request failure", | ||||||
|  |      @"remainingRetry": 剩余重试机会(次数) | ||||||
|  |  }; | ||||||
|  |  */ | ||||||
|  | FOUNDATION_EXTERN NSString * const BDAutoTrackNotificationRegisterFailure; | ||||||
|  | 
 | ||||||
|  | /*! @abstract SDK 激活成功通知
 | ||||||
|  |  userInfo | ||||||
|  |  @{ kBDAutoTrackNotificationAppID           :appID, | ||||||
|  |  }; | ||||||
|  | @discussion 通知在子线程,每次触发注册成功后,会触发激活请求 | ||||||
|  | */ | ||||||
|  | FOUNDATION_EXTERN NSString * const BDAutoTrackNotificationActiveSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract SDK ABTest配置拉取成功通知
 | ||||||
|  |  userInfo | ||||||
|  |  @{ kBDAutoTrackNotificationAppID           :appID, | ||||||
|  |     kBDAutoTrackNotificationData            :data, | ||||||
|  |  }; | ||||||
|  | @discussion 通知在子线程,每次触发注册成功后,且该 App ID 配置了 ABTest 功能,会触发 ABTest 配置拉取。 | ||||||
|  |  收到通知成功后,则可以开始读取 ABTest 值,如果未收到通知,则读取的 ABTest 为上次拉取成功的值。 | ||||||
|  |  这里重点说明不需要去解析data的结构,简单check一下data.count == 0 即可 | ||||||
|  |  如果需要获取所有的ABTest配置,请使用 -[BDAutoTrack allABTestConfigs] 接口 | ||||||
|  | */ | ||||||
|  | FOUNDATION_EXTERN NSString * const BDAutoTrackNotificationABTestSuccess; | ||||||
|  | 
 | ||||||
|  | /*! @abstract SDK通知的userInfo的 key 定义
 | ||||||
|  |  若无特别说明,值类型为NSString。 | ||||||
|  | */ | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackNotificationAppID; | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackNotificationRangersDeviceID; | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackNotificationSSID; | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackNotificationInstallID; | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackNotificationUserUniqueID; | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackNotificationData; | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackNotificationIsNewUser;   // 设备注册服务返回,标识是否是新设备. 值为NSNumber(1/0)。
 | ||||||
|  | 
 | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackNotificationDataSource;  // 通知来源
 | ||||||
|  | 
 | ||||||
|  | typedef NSString * const BDAutoTrackNotificationDataSource NS_TYPED_ENUM; | ||||||
|  | FOUNDATION_EXTERN BDAutoTrackNotificationDataSource BDAutoTrackNotificationDataSourceLocalCache;  // 通知的数据来自于恢复本地缓存
 | ||||||
|  | FOUNDATION_EXTERN BDAutoTrackNotificationDataSource BDAutoTrackNotificationDataSourceServer;      // 通知的数据来自于服务器响应
 | ||||||
|  | 
 | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackNotificationDataSourceURL;  // 若通知的数据来自于服务器响应,则userInfo会含有此键。其值是请求URL
 | ||||||
|  | 
 | ||||||
|  | /*! @abstract SDK ABTestVid发生变化时候的通知
 | ||||||
|  |  userInfo | ||||||
|  |  @{ kBDAutoTrackNotificationAppID           :appID, | ||||||
|  |     kBDAutoTrackNotificationABTestVids            :vids, | ||||||
|  |     kBDAutoTrackNotificationABTestExternalVids:externalVids | ||||||
|  |  }; | ||||||
|  | @discussion 通知在子线程,每次Vid发生变化时触发。需要该 App ID 配置了 ABTest 功能,否则不会有通知。 | ||||||
|  | */ | ||||||
|  | FOUNDATION_EXTERN NSString * const BDAutoTrackNotificationABTestVidsChanged; | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackNotificationABTestVids; | ||||||
|  | FOUNDATION_EXTERN NSString * const kBDAutoTrackNotificationABTestExternalVids; | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: cd3423c00671a47deaae93d979b64706 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,48 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrackSchemeHandler.h
 | ||||||
|  | //  RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2019/9/24.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | #import "BDCommonDefine.h" | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | /* 如果是iOS 13中重写UISceneDelegate的回调,则按照i以下code
 | ||||||
|  | - (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts { | ||||||
|  |     for (UIOpenURLContext *context in URLContexts) { | ||||||
|  |         NSURL *URL = context.URL; | ||||||
|  |         if ([[BDAutoTrackSchemeHandler sharedHandler] handleURL:URL appID:@"appid" scene:scene]) { | ||||||
|  |             continue; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         /// your handle code for the URL
 | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 如果是iOS 13一下,重写UIApplicationDelegate的回调方法,则参考以下code | ||||||
|  | - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options { | ||||||
|  |     if ([[BDAutoTrackSchemeHandler sharedHandler] handleURL:url appID:@"appid" scene:nil]) { | ||||||
|  |         return YES; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /// your handle code
 | ||||||
|  | 
 | ||||||
|  |     return NO; | ||||||
|  | } | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | @interface BDAutoTrackSchemeHandler : NSObject<BDAutoTrackSchemeHandler> | ||||||
|  | 
 | ||||||
|  | + (instancetype)sharedHandler; | ||||||
|  | 
 | ||||||
|  | - (BOOL)handleURL:(NSURL *)URL appID:(NSString *)appID scene:(nullable id)scene; | ||||||
|  | 
 | ||||||
|  | - (void)registerHandler:(id<BDAutoTrackSchemeHandler>)handler; | ||||||
|  | - (void)unregisterHandler:(id<BDAutoTrackSchemeHandler>)handler; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: bea89bec20a2e4e2aa094b891f85b1f7 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,11 @@ | ||||||
|  | //
 | ||||||
|  | //  BDAutoTrackURLHostItemCN.h
 | ||||||
|  | //  RangersAppLog-RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by 朱元清 on 2020/8/6.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import "BDCommonEnumDefine.h" | ||||||
|  | 
 | ||||||
|  | FOUNDATION_EXPORT BDAutoTrackServiceVendor const BDAutoTrackServiceVendorCN; | ||||||
|  | 
 | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 7557f5c9eedea4450a6face29b8d1581 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,71 @@ | ||||||
|  | //
 | ||||||
|  | //  BDCommonDefine.h
 | ||||||
|  | //  RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/3/25.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | #import "BDCommonEnumDefine.h" | ||||||
|  | 
 | ||||||
|  | #define APPLOG_API_AVALIABLE(x) | ||||||
|  | #define APPLOG_API_DEPRECATED __deprecated | ||||||
|  | #define APPLOG_API_DEPRECATED_WITH_REPLACEMENT(msg) __deprecated_msg("please use '" msg "'") | ||||||
|  | // 编译时断言
 | ||||||
|  | #define APPLOG_STATIC_ASSERT(COND,MSG) typedef char static_assertion_##MSG[(COND)?1:-1] | ||||||
|  | 
 | ||||||
|  | #ifndef BDCommonDefine_h | ||||||
|  | #define BDCommonDefine_h | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  request IDFA handler | ||||||
|  |  */ | ||||||
|  | typedef void (^BDAutoTrackAuthorizationHandler)(BDAutoTrackAuthorizationStatus status); | ||||||
|  | 
 | ||||||
|  | /*! @abstract 日志输出
 | ||||||
|  |  @param log 输出的日志 | ||||||
|  |  @discussion 请使用自己的日志SDK输出日志 | ||||||
|  |  */ | ||||||
|  | typedef void(^BDAutoTrackLogger)(NSString * _Nullable log); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /*! @abstract 自定义请求链接,把相关请求发送到对应的自定义的URL上
 | ||||||
|  |  @param vendor 地区 | ||||||
|  |  @param requestURLType 上面的六个枚举值 | ||||||
|  |  @discussion 一般情况不需要实现;如果实现,针对想改变的枚举值返回一个准确的URL,其他不想修改的返回nil即可 | ||||||
|  |  @result 返回自定义的URL | ||||||
|  |  */ | ||||||
|  | typedef NSString * _Nullable (^BDAutoTrackRequestURLBlock)(BDAutoTrackServiceVendor vendor, BDAutoTrackRequestURLType requestURLType); | ||||||
|  | 
 | ||||||
|  | /*! @abstract 自定义请求链接的Host,把相关请求发送到对应的自定义的Host上,path仍然按照SDK规则拼接
 | ||||||
|  |  @param vendor 地区 | ||||||
|  |  @param requestURLType 上面的六个枚举值 | ||||||
|  |  @discussion 一般情况不需要实现;如果实现,返回值类似  https://github.com/
 | ||||||
|  |  @result 返回自定义的URL | ||||||
|  |  */ | ||||||
|  | typedef NSString * _Nullable (^BDAutoTrackRequestHostBlock)(BDAutoTrackServiceVendor vendor, BDAutoTrackRequestURLType requestURLType); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /*! @abstract 自定义上报信息
 | ||||||
|  |  @discussion 每次上报都会回调,设置一次即可,格式要求同日志要求,需要可序列化;如果无法序列化,会被丢弃 | ||||||
|  |  @result NSDictionary custom数据 | ||||||
|  |  */ | ||||||
|  | typedef NSDictionary<NSString*, id> *_Nonnull (^BDAutoTrackCustomHeaderBlock)(void); | ||||||
|  | 
 | ||||||
|  | @protocol BDAutoTrackSchemeHandler <NSObject> | ||||||
|  | 
 | ||||||
|  | /*! @abstract 处理scheme
 | ||||||
|  |  @discussion 请参考下面接口调用示例 | ||||||
|  |  @param URL scheme的完整URL,透传参数 | ||||||
|  |  @param appID 初始化SDK的AppID | ||||||
|  |  @param scene 适配iOS 13的参数,透传参数 | ||||||
|  |  @result 返回YES,表示已经处理了该URL,NO表示没有处理 | ||||||
|  | */ | ||||||
|  | - (BOOL)handleURL:(NSURL *)URL appID:(NSString *)appID scene:(nullable id)scene; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | #endif /* BDCommonDefine_h */ | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: e4f710d39d4b041cda10fd769fdae974 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,65 @@ | ||||||
|  | //
 | ||||||
|  | //  BDCommonEnumDefine.h
 | ||||||
|  | //  RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by 朱元清 on 2020/8/10.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | #ifndef BDCommonEnumDefine_h | ||||||
|  | #define BDCommonEnumDefine_h | ||||||
|  | 
 | ||||||
|  | /*! @abstract 日志上报地区属性
 | ||||||
|  |  @discussion 上报地区请勿擅自选择,需要与申请服务的地区一致,或者咨询接口人确认 | ||||||
|  |  */ | ||||||
|  | typedef NSString* BDAutoTrackServiceVendor NS_EXTENSIBLE_STRING_ENUM; | ||||||
|  | FOUNDATION_EXTERN BDAutoTrackServiceVendor const BDAutoTrackServiceVendorPrivate;  // 私有化,此时一定要设置BDAutoTrackRequestURLBlock
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /*!
 | ||||||
|  |  请求URL type | ||||||
|  |  */ | ||||||
|  | typedef NSInteger BDAutoTrackRequestURLType NS_TYPED_ENUM; | ||||||
|  | 
 | ||||||
|  | FOUNDATION_EXTERN BDAutoTrackRequestURLType const BDAutoTrackRequestURLRegister;              // 注册
 | ||||||
|  | FOUNDATION_EXTERN BDAutoTrackRequestURLType const BDAutoTrackRequestURLActivate;              // 激活
 | ||||||
|  | FOUNDATION_EXTERN BDAutoTrackRequestURLType const BDAutoTrackRequestURLSettings;              // 基本配置
 | ||||||
|  | FOUNDATION_EXTERN BDAutoTrackRequestURLType const BDAutoTrackRequestURLABTest;                // ABTest配置
 | ||||||
|  | FOUNDATION_EXTERN BDAutoTrackRequestURLType const BDAutoTrackRequestURLLog;                   // 日志上报
 | ||||||
|  | FOUNDATION_EXTERN BDAutoTrackRequestURLType const BDAutoTrackRequestURLLogBackup;             // 日志上报备用
 | ||||||
|  | FOUNDATION_EXTERN BDAutoTrackRequestURLType const BDAutoTrackRequestURLProfile;               // profile事件上报专用
 | ||||||
|  | FOUNDATION_EXTERN BDAutoTrackRequestURLType const BDAutoTrackRequestURLALinkLinkData;         // ALink 获取链接参数
 | ||||||
|  | FOUNDATION_EXTERN BDAutoTrackRequestURLType const BDAutoTrackRequestURLALinkAttributionData;  // ALink 获取归因
 | ||||||
|  | 
 | ||||||
|  | typedef NS_ENUM(NSUInteger, BDAutoTrackLaunchFrom) { | ||||||
|  |     /// 初始状态
 | ||||||
|  |     BDAutoTrackLaunchFromInitialState = 0, | ||||||
|  |     /// 用户手动点击进入app
 | ||||||
|  |     BDAutoTrackLaunchFromUserClick, | ||||||
|  |     /// 用户通过push点击进入app
 | ||||||
|  |     BDAutoTrackLaunchFromRemotePush, | ||||||
|  |     /// 用户通过widget点击进入app
 | ||||||
|  |     BDAutoTrackLaunchFromWidget, | ||||||
|  |     /// 用户通过sptlight点击进入app
 | ||||||
|  |     BDAutoTrackLaunchFromSpotlight, | ||||||
|  |     /// 用户通过外部app唤醒进入app
 | ||||||
|  |     BDAutoTrackLaunchFromExternal, | ||||||
|  |     /// 用户手动切回前台
 | ||||||
|  |     BDAutoTrackLaunchFromBackground, | ||||||
|  |     /// from siri
 | ||||||
|  |     BDAutoTrackLaunchFromSiri, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  IDFA Authorization Status | ||||||
|  |  */ | ||||||
|  | typedef NS_ENUM(NSInteger, BDAutoTrackAuthorizationStatus) { | ||||||
|  |     BDAutoTrackAuthorizationStatusNotDetermined = 0, | ||||||
|  |     BDAutoTrackAuthorizationStatusRestricted, | ||||||
|  |     BDAutoTrackAuthorizationStatusDenied, | ||||||
|  |     BDAutoTrackAuthorizationStatusAuthorized | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | #endif /* BDCommonEnumDefine_h */ | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 7b3718b05caa441beb29ffba6f700ad8 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,45 @@ | ||||||
|  | //
 | ||||||
|  | //  BDKeyWindowTracker.h
 | ||||||
|  | //  RangersAppLog
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2019/8/12.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <UIKit/UIKit.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | UIKIT_EXTERN NSString * const BDDefaultScene; | ||||||
|  | 
 | ||||||
|  | @interface BDKeyWindowTracker : NSObject | ||||||
|  | 
 | ||||||
|  | /*! @abstract keyWindow for BDDefaultScene
 | ||||||
|  |  @discussion setter等同于调用`-[BDKeyWindowTracker trackScene:BDDefaultScene keyWindow:keyWindow]` | ||||||
|  |  @discussion getter等同于调用`-[BDKeyWindowTracker keyWindowForScene:BDDefaultScene]` | ||||||
|  |  @discussion 如果只有一个Scene,或者说没有Scene,比如低于iOS 13,则可以只使用keyWindow属性即可 | ||||||
|  |  */ | ||||||
|  | @property (nonatomic, strong, nullable) UIWindow *keyWindow; | ||||||
|  | 
 | ||||||
|  | + (instancetype)sharedInstance; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 设置scene的keywindow
 | ||||||
|  |  @discussion 发生变化可以更新,不需要一直重复设置 | ||||||
|  |  @param scene 某个UIWindowScene的唯一标志,推荐使用 scene = [NSString stringWithFormat:@"%p",windowScene]; | ||||||
|  |  @param keyWindow 该scene的keywindow | ||||||
|  | */ | ||||||
|  | - (void)trackScene:(NSString *)scene keyWindow:(nullable UIWindow *)keyWindow; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 获取该scene的keywindow
 | ||||||
|  |  @param scene 某个UIWindowScene的唯一标志,推荐使用 scene = [NSString stringWithFormat:@"%p",windowScene]; | ||||||
|  |  @result keyWindow 返回该scene的keywindow | ||||||
|  | */ | ||||||
|  | - (nullable UIWindow *)keyWindowForScene:(NSString *)scene; | ||||||
|  | 
 | ||||||
|  | /*! @abstract 移除scene的keywindow
 | ||||||
|  |  @param scene 某个UIWindowScene的唯一标志,推荐使用 scene = [NSString stringWithFormat:@"%p",windowScene]; | ||||||
|  | */ | ||||||
|  | - (void)removeKeyWindowForScene:(NSString *)scene; /// when you want set nil
 | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 85beb69f4b1dd4e1185c991dac30ac59 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,18 @@ | ||||||
|  | //
 | ||||||
|  | //  NSArray+OK.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSArray (OK) | ||||||
|  | 
 | ||||||
|  | - (id)ok_safeJsonObject; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 37221e2bef2b24cab944c60d02883b17 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,22 @@ | ||||||
|  | //
 | ||||||
|  | //  NSData+OK.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSData (OK) | ||||||
|  | 
 | ||||||
|  | - (NSString *)ok_md5String; | ||||||
|  | - (NSString *)ok_sha256String; | ||||||
|  | - (NSString *)ok_hexString; | ||||||
|  | - (nullable id)ok_jsonValueDecoded; | ||||||
|  | - (nullable id)ok_jsonValueDecoded:(NSError *__autoreleasing *)error; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 50cea153c68ba49b191518e1e6232783 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,19 @@ | ||||||
|  | //
 | ||||||
|  | //  NSData+OneKitDecorator.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2019/11/7.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSData (OneKitDecorator) | ||||||
|  | 
 | ||||||
|  | /// 通用包装方法
 | ||||||
|  | - (nullable NSData *)rsk_dataByDecorated; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 8bf6a8bf741a243d18282ad624f56553 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,21 @@ | ||||||
|  | //
 | ||||||
|  | //  NSData+OKGZIP.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/6/12.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSData (OKGZIP) | ||||||
|  | 
 | ||||||
|  | /// GZIP
 | ||||||
|  | - (nullable NSData *)ok_dataByGZipCompressingWithError:(NSError * __autoreleasing *)error; | ||||||
|  | - (BOOL)ok_isGzipCompressedData; | ||||||
|  | - (nullable NSData *)ok_dataByGZipDecompressingDataWithError:(NSError * __autoreleasing *)error; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 895a0556173134a97ba232b3f1db6f69 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,70 @@ | ||||||
|  | //
 | ||||||
|  | //  NSData+OKSecurity.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | /*! @abstract AES 加密 key size类型
 | ||||||
|  |  @discussion key size要和传入的key符合 | ||||||
|  | */ | ||||||
|  | typedef NS_ENUM(NSInteger, OKAESKeySize) { | ||||||
|  |     OKAESKeySizeAES128 = 0x10, /// 对应key的byte是16字节
 | ||||||
|  |     OKAESKeySizeAES192 = 0x18, /// 对应key的byte是24字节
 | ||||||
|  |     OKAESKeySizeAES256 = 0x20, /// 对应key的byte是32字节
 | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | @interface NSData (OKSecurity) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /*! @abstract AES 加密方法
 | ||||||
|  |  @param key 加密的key,这个需要和keySize对应的byte一致。如果过长,会截断;如果过短,默认用0填充 | ||||||
|  |  @param keySize 参考枚举值OKAESKeySize三种选项 | ||||||
|  |  @param iv 如果 iv是nil,则使用EBC模式,不为nil则使用CBC模式。iv要求16字节 | ||||||
|  |  @result 加密结果,失败则返回nil | ||||||
|  |  @discussion key和keySize要对应 | ||||||
|  | */ | ||||||
|  | - (nullable NSData *)ok_aesEncryptWithkey:(NSString *)key | ||||||
|  |                                    keySize:(OKAESKeySize)keySize | ||||||
|  |                                         iv:(nullable NSString *)iv; | ||||||
|  | 
 | ||||||
|  | /*! @abstract AES 加密方法
 | ||||||
|  |  @param keyData 加密的key,这个需要和keySize对应的byte一致。如果过长,会截断;如果过短,默认用0填充 | ||||||
|  |  @param keySize 参考枚举值OKAESKeySize三种选项 | ||||||
|  |  @param ivData 如果 iv是nil,则使用EBC模式,不为nil则使用CBC模式。iv要求16字节 | ||||||
|  |  @result 加密结果,失败则返回nil | ||||||
|  |  @discussion key和keySize要对应 | ||||||
|  | */ | ||||||
|  | - (nullable NSData *)ok_aesEncryptWithkeyData:(NSData *)keyData | ||||||
|  |                                        keySize:(OKAESKeySize)keySize | ||||||
|  |                                         ivData:(nullable NSData *)ivData; | ||||||
|  | 
 | ||||||
|  | /*! @abstract AES 解密方法
 | ||||||
|  |  @param key 加密的key,这个需要和keySize对应的byte一致。如果过长,会截断;如果过短,默认用0填充 | ||||||
|  |  @param keySize 参考枚举值OKAESKeySize三种选项 | ||||||
|  |  @param iv 如果 iv是nil,则使用EBC模式,不为nil则使用CBC模式。iv要求16字节 | ||||||
|  |  @result 解密结果,失败则返回nil | ||||||
|  |  @discussion key和keySize要对应 | ||||||
|  | */ | ||||||
|  | - (nullable NSData *)ok_aesDecryptwithKey:(NSString *)key | ||||||
|  |                                    keySize:(OKAESKeySize)keySize | ||||||
|  |                                         iv:(nullable NSString *)iv; | ||||||
|  | 
 | ||||||
|  | /*! @abstract AES 解密方法
 | ||||||
|  |  @param keyData 加密的key,这个需要和keySize对应的byte一致。如果过长,会截断;如果过短,默认用0填充 | ||||||
|  |  @param keySize 参考枚举值OKAESKeySize三种选项 | ||||||
|  |  @param ivData 如果 iv是nil,则使用EBC模式,不为nil则使用CBC模式。iv要求16字节 | ||||||
|  |  @result 解密结果,失败则返回nil | ||||||
|  |  @discussion key和keySize要对应 | ||||||
|  | */ | ||||||
|  | - (nullable NSData *)ok_aesDecryptwithKeyData:(NSData *)keyData | ||||||
|  |                                        keySize:(OKAESKeySize)keySize | ||||||
|  |                                         ivData:(nullable NSData *)ivData; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: d5d34b7240fcf45b2b6a440ab1aedc38 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,29 @@ | ||||||
|  | //
 | ||||||
|  | //  NSDictionary+OK.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSDictionary (OK) | ||||||
|  | 
 | ||||||
|  | - (id)ok_safeJsonObject; | ||||||
|  | - (nullable NSString *)ok_queryString; | ||||||
|  | 
 | ||||||
|  | - (BOOL)ok_boolValueForKey:(NSString *)key; | ||||||
|  | - (double)ok_doubleValueForKey:(NSString *)key; | ||||||
|  | - (NSInteger)ok_integerValueForKey:(NSString *)key; | ||||||
|  | - (long long)ok_longlongValueForKey:(NSString *)key; | ||||||
|  | - (nullable NSString *)ok_stringValueForKey:(NSString *)key; | ||||||
|  | - (nullable NSDictionary *)ok_dictionaryValueForKey:(NSString *)key; | ||||||
|  | - (nullable NSMutableDictionary *)ok_mutableDictionaryValueForKey:(NSString *)key; | ||||||
|  | - (nullable NSArray *)ok_arrayValueForKey:(NSString *)key; | ||||||
|  | - (nullable NSMutableArray *)ok_mutableArrayValueForKey:(NSString *)key; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 9998bc2c5410c44688d9620554c829ac | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,34 @@ | ||||||
|  | //
 | ||||||
|  | //  NSFileManager+OK.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  home => /var/mobile/Containers/Data/Application/XXX/ | ||||||
|  |     - Documents => /var/mobile/Containers/Data/Application/XXX/Documents | ||||||
|  |     - Applications => | ||||||
|  |     - Library => | ||||||
|  |     - Library/Caches | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | @interface NSFileManager (OK) | ||||||
|  | 
 | ||||||
|  | + (NSString *)ok_homePath; | ||||||
|  | + (NSString *)ok_cachePath; | ||||||
|  | + (NSString *)ok_documentPath; | ||||||
|  | + (NSString *)ok_libraryPath; | ||||||
|  | 
 | ||||||
|  | /// /private/var/containers/Bundle/Application/XXX/YYY.app
 | ||||||
|  | + (NSString *)ok_mainBundlePath; | ||||||
|  | 
 | ||||||
|  | - (nullable NSURL *)ok_pathForNotificationFile:(NSString *)file group:(NSString *)group; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: f3b265d4c3a4d4b2cbc3a9913a980125 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,18 @@ | ||||||
|  | //
 | ||||||
|  | //  NSHashTable+OK.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSHashTable (OK) | ||||||
|  | 
 | ||||||
|  | - (id)ok_safeJsonObject; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 982bbbb9faf5e4beaaf0971ee4539a68 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,18 @@ | ||||||
|  | //
 | ||||||
|  | //  NSMapTable+OK.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSMapTable (OK) | ||||||
|  | 
 | ||||||
|  | - (id)ok_safeJsonObject; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 19acaf99051e5403d93758f8e874d5df | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,18 @@ | ||||||
|  | //
 | ||||||
|  | //  NSMutableArray+OK.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSMutableArray (OK) | ||||||
|  | 
 | ||||||
|  | - (void)ok_addObject:(nullable id)anObject; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: fba518b7e68a24a14932fe735adc7108 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,31 @@ | ||||||
|  | //
 | ||||||
|  | //  NSMutableDictionary+OK.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSMutableDictionary (OK) | ||||||
|  | 
 | ||||||
|  | - (void)ok_setObject:(nullable id)anObject forKey:(nullable id<NSCopying>)aKey; | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  | the struct should be the same | ||||||
|  | e.g. | ||||||
|  | {"x":"xx"} skipMerge {"x":"xxx","y","yyy"} | ||||||
|  | ==> {"x":"xx","y","yyy"} | ||||||
|  | 
 | ||||||
|  | {"x":"xx"} overrideMerge {"x":"xxx","y","yyy"} | ||||||
|  | ==> {"x":"xxx","y","yyy"} | ||||||
|  | 
 | ||||||
|  | */ | ||||||
|  | - (void)ok_skipMerge:(NSDictionary *)value; | ||||||
|  | - (void)ok_overrideMerge:(NSDictionary *)value; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 24dc1b521a76349d2bd514f4ca90b246 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,19 @@ | ||||||
|  | //
 | ||||||
|  | //  NSNumber+OK.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSNumber (OK) | ||||||
|  | 
 | ||||||
|  | - (id)ok_safeJsonObject; | ||||||
|  | - (NSString *)ok_safeJsonObjectKey; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 410b127d24a3648b58a99e66284c7e3d | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,38 @@ | ||||||
|  | //
 | ||||||
|  | //  NSObject+OK.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSObject (OK) | ||||||
|  | 
 | ||||||
|  | - (id)ok_safeJsonObject; | ||||||
|  | - (NSString *)ok_safeJsonObjectKey; | ||||||
|  | - (nullable NSString *)ok_jsonStringEncoded; | ||||||
|  | - (nullable NSString *)ok_jsonStringEncodedForJS; | ||||||
|  | /**
 | ||||||
|  |  Swizzle two instance selectors. | ||||||
|  | 
 | ||||||
|  |  @param origSelector The original selector. | ||||||
|  |  @param newSelector The new selector. | ||||||
|  |  @return Return YES if selectors were swizzled successfully. | ||||||
|  |  */ | ||||||
|  | + (BOOL)ok_swizzleInstanceMethod:(nonnull SEL)origSelector with:(nonnull SEL)newSelector; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  Swizzle two class selectors. | ||||||
|  | 
 | ||||||
|  |  @param origSelector The original selector. | ||||||
|  |  @param newSelector The new selector. | ||||||
|  |  @return Return YES if selectors were swizzled successfully. | ||||||
|  |  */ | ||||||
|  | + (BOOL)ok_swizzleClassMethod:(nonnull SEL)origSelector with:(nonnull SEL)newSelector; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: b5c0b1a24d8294ead8dbf1cffdd87b40 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,18 @@ | ||||||
|  | //
 | ||||||
|  | //  NSSet+OK.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSSet (OK) | ||||||
|  | 
 | ||||||
|  | - (id)ok_safeJsonObject; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 6fe32800fa67b432cb38ee9f6878edfc | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,33 @@ | ||||||
|  | //
 | ||||||
|  | //  NSString+OK.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSString (OK) | ||||||
|  | 
 | ||||||
|  | - (NSString *)ok_trimmed; | ||||||
|  | - (NSString *)ok_md5String; | ||||||
|  | - (NSString *)ok_sha256String; | ||||||
|  | - (nullable NSString *)ok_base64EncodedString; | ||||||
|  | - (nullable NSString *)ok_base64DecodedString; | ||||||
|  | - (nullable id)ok_jsonValueDecoded; | ||||||
|  | - (nullable id)ok_jsonValueDecoded:(NSError *__autoreleasing *)error; | ||||||
|  | 
 | ||||||
|  | - (NSString *)ok_stringByAppendingQueryDictionary:(NSDictionary *)params; | ||||||
|  | - (NSDictionary *)ok_queryDictionary; | ||||||
|  | 
 | ||||||
|  | + (NSString *)ok_UUIDString; | ||||||
|  | 
 | ||||||
|  | - (id)ok_safeJsonObject; | ||||||
|  | - (NSString *)ok_safeJsonObjectKey; | ||||||
|  | - (BOOL)isNullOrEmptyString; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 87cc2e8e2165447f99f6cee89f2a521e | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,38 @@ | ||||||
|  | //
 | ||||||
|  | //  NSString+OKSecurity.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import "NSData+OKSecurity.h" | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface NSString (OKSecurity) | ||||||
|  | 
 | ||||||
|  | /*! @abstract AES 加密方法
 | ||||||
|  |  @param key 加密的key,这个需要和keySize对应的byte一致。如果过长,会截断;如果过短,默认用0填充 | ||||||
|  |  @param keySize 参考枚举值OKAESKeySize三种选项 | ||||||
|  |  @param iv 如果 iv是nil,则使用EBC模式,不为nil则使用CBC模式 | ||||||
|  |  @result 加密结果 | ||||||
|  |  @discussion key和keySize要对应 | ||||||
|  |  @discussion aes加密后的data不一定能转成正常的字符串,因此需要经过base64编码 | ||||||
|  | */ | ||||||
|  | - (nullable NSString *)ok_aesEncryptWithkey:(NSString *)key | ||||||
|  |                                      keySize:(OKAESKeySize)keySize | ||||||
|  |                                           iv:(nullable NSString *)iv; | ||||||
|  | 
 | ||||||
|  | /*! @abstract AES 解密方法
 | ||||||
|  |  @param key 加密的key,这个需要和keySize对应的byte一致。如果过长,会截断;如果过短,默认用0填充 | ||||||
|  |  @param keySize 参考枚举值OKAESKeySize三种选项 | ||||||
|  |  @param iv 如果 iv是nil,则使用EBC模式,不为nil则使用CBC模式 | ||||||
|  |  @result 解密结果,失败则返回nil | ||||||
|  |  @discussion aes的密文data不一定能转成正常的字符串,因此需要经过base64编码。故而解密会经过base64解码 | ||||||
|  | */ | ||||||
|  | - (nullable NSString *)ok_aesDecryptwithKey:(NSString *)key | ||||||
|  |                                      keySize:(OKAESKeySize)keySize | ||||||
|  |                                           iv:(nullable NSString *)iv; | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 2a3875be5477a4b74b865071aaeea64b | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,54 @@ | ||||||
|  | //
 | ||||||
|  | //  OKApplicationInfo.h
 | ||||||
|  | //  OKStartUp
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/1/14.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | /// Config自定义配置参考如下,需要在OKAppCustomConfigFunction中
 | ||||||
|  | /// 仅做简单配置,请勿进行耗时操作
 | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  | #import <OneKit/OKStartUpGaia.h> | ||||||
|  | #import <OneKit/OKStartUpFunction.h> | ||||||
|  |   | ||||||
|  | OKAppCustomConfigFunction() { | ||||||
|  |     [OKApplicationInfo sharedInstance].xx = xxx; | ||||||
|  |  } | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /// 存储应用信息
 | ||||||
|  | /// 默认值从bundle或onekit-config.plist中读取
 | ||||||
|  | @interface OKApplicationInfo : NSObject | ||||||
|  | 
 | ||||||
|  | /* 默认值从onekit-config.plist中读取 */ | ||||||
|  | @property (nonatomic) NSString *appID; | ||||||
|  | @property (nonatomic) NSString *accessKey;  // mars_access_key
 | ||||||
|  | @property (nonatomic) NSString *secretKey;  // mars_secret_key
 | ||||||
|  | @property (nonatomic, nullable) NSDictionary *serviceInfo; | ||||||
|  | 
 | ||||||
|  | /* 默认值从bundle中读取 */ | ||||||
|  | @property (nonatomic, copy) NSString *appName; | ||||||
|  | @property (nonatomic, copy) NSString *appDisplayName; | ||||||
|  | @property (nonatomic, copy) NSString *channel; | ||||||
|  | @property (nonatomic, copy) NSString *appVersion; | ||||||
|  | @property (nonatomic, copy) NSString *buildVersion; | ||||||
|  | @property (nonatomic, copy) NSString *buildVersionCode; | ||||||
|  | @property (nonatomic, copy) NSString *bundleIdentifier; | ||||||
|  | @property (nonatomic, assign) BOOL isInhouseApp; | ||||||
|  | @property (nonatomic, assign) BOOL isI18NApp; | ||||||
|  | 
 | ||||||
|  | @property (nonatomic, copy) NSString *deviceModel;/// return string like "iPhone9,1"
 | ||||||
|  | @property (nonatomic, copy) NSString *devicePlatform;/// return "iPod", "iPad" or "iPhone"
 | ||||||
|  | @property (nonatomic, copy) NSString *systemVersion; | ||||||
|  | @property (nonatomic, copy, nullable) NSString *sharingKeyChainGroup; | ||||||
|  | 
 | ||||||
|  | + (instancetype)sharedInstance; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: e1304abe724c84b5f9baf453acd58dbf | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,52 @@ | ||||||
|  | //
 | ||||||
|  | //  OKCellular.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @class CTTelephonyNetworkInfo, CTCarrier, CTCellularData; | ||||||
|  | 
 | ||||||
|  | /// SIM网络状态
 | ||||||
|  | typedef NS_ENUM(NSInteger, OKCellularConnectionType) { | ||||||
|  |     /// 无网络连接
 | ||||||
|  |     OKCellularConnectionTypeNone = 0, | ||||||
|  |     /// 未知移动网络
 | ||||||
|  |     OKCellularConnectionTypeUnknown, | ||||||
|  |     /// 2G网络连接
 | ||||||
|  |     OKCellularConnectionType2G, | ||||||
|  |     /// 3G网络连接
 | ||||||
|  |     OKCellularConnectionType3G, | ||||||
|  |     /// 4G网络连接
 | ||||||
|  |     OKCellularConnectionType4G, | ||||||
|  |     /// 5G网络连接
 | ||||||
|  |     OKCellularConnectionType5G, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | typedef NS_ENUM(NSInteger, OKCellularServiceType) { | ||||||
|  |     OKCellularServiceTypeNone = 0,         /// 无卡
 | ||||||
|  |     OKCellularServiceTypePrimary = 1,      /// 主卡状态
 | ||||||
|  |     OKCellularServiceTypeSecondary = 2,    /// 副卡状态
 | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | @interface OKCellular : NSObject | ||||||
|  | 
 | ||||||
|  | @property (class ,nonatomic, strong, readonly) CTCellularData *cellularData; | ||||||
|  | 
 | ||||||
|  | + (instancetype)sharedInstance; | ||||||
|  | 
 | ||||||
|  | + (CTTelephonyNetworkInfo *)telephoneInfo; | ||||||
|  | 
 | ||||||
|  | /// 返回指定卡信息
 | ||||||
|  | /// 如果指定副卡不存在,返回主卡信息
 | ||||||
|  | - (OKCellularConnectionType)cellularConnectionTypeForService:(OKCellularServiceType)service; | ||||||
|  | - (CTCarrier *)carrierForService:(OKCellularServiceType)service; | ||||||
|  | - (OKCellularServiceType)currentDataServiceType;/// 返回当前流量卡类型
 | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: aa24e805ccea940f3bac7a33bafb1c2d | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,41 @@ | ||||||
|  | //
 | ||||||
|  | //  OKConnection.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | /// 网络状态
 | ||||||
|  | typedef NS_ENUM(NSInteger, OKNetworkConnectionType) { | ||||||
|  |     /// 初始状态
 | ||||||
|  |     OKAutoTrackNetworkNone = -1, | ||||||
|  |     /// 无网络连接
 | ||||||
|  |     OKNetworkConnectionTypeNone = 0, | ||||||
|  |     /// 移动网络连接
 | ||||||
|  |     OKNetworkConnectionTypeMobile = 1, | ||||||
|  |     /// 2G网络连接
 | ||||||
|  |     OKNetworkConnectionType2G = 2, | ||||||
|  |     /// 3G网络连接
 | ||||||
|  |     OKNetworkConnectionType3G = 3, | ||||||
|  |     /// wifi网络连接
 | ||||||
|  |     OKNetworkConnectionTypeWiFi = 4, | ||||||
|  |     /// 4G网络连接
 | ||||||
|  |     OKNetworkConnectionType4G = 5, | ||||||
|  |     /// 5G网络连接
 | ||||||
|  |     OKNetworkConnectionType5G = 6, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | @interface OKConnection : NSObject | ||||||
|  | 
 | ||||||
|  | @property (nonatomic, assign, readonly) OKNetworkConnectionType connection; | ||||||
|  | @property (nonatomic, copy, readonly, nullable) NSString *connectMethodName; | ||||||
|  | 
 | ||||||
|  | + (instancetype)sharedInstance; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 72add32e5f820443b98aefc15d40d880 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,39 @@ | ||||||
|  | //
 | ||||||
|  | //  OKDevice.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/26.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | /**
 | ||||||
|  |  Please call from main thread | ||||||
|  |  */ | ||||||
|  | @interface OKDevice : NSObject | ||||||
|  | 
 | ||||||
|  | + (NSTimeInterval)startupTime; | ||||||
|  | + (uint32_t)cpuCoreCount ; | ||||||
|  | + (NSString *)hardwareModel; | ||||||
|  | + (NSString *)machineModel; /// return string like "iPhone9,1"
 | ||||||
|  | + (NSString *)platformName; /// return "iPod", "iPad" or "iPhone"
 | ||||||
|  | + (BOOL)isSimulator; | ||||||
|  | + (NSString *)systemVersion; | ||||||
|  | + (NSString *)currentSystemLanguage; | ||||||
|  | + (NSString *)currentLanguage; | ||||||
|  | + (NSString *)IDFV; | ||||||
|  | + (float)cpuUsage; /// return -1 if error
 | ||||||
|  | 
 | ||||||
|  | + (u_int64_t)physicalMemory; | ||||||
|  | + (u_int64_t)appUsedMemory; | ||||||
|  | #ifdef __LP64__ | ||||||
|  | + (u_int64_t)deviceUsedMemory; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | + (u_int64_t)totalDiskSize; | ||||||
|  | + (u_int64_t)freeDiskSize; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 95364c2450bd44d4082976bbd247ff9a | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | //
 | ||||||
|  | //  OKKeychain.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/26.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface OKKeychain : NSObject | ||||||
|  | 
 | ||||||
|  | @property (nonatomic, copy, readonly) NSString *service; | ||||||
|  | @property (nonatomic, assign, readonly) BOOL thisDeviceOnly; | ||||||
|  | 
 | ||||||
|  | - (instancetype)initWithService:(NSString *)service | ||||||
|  |                  thisDeviceOnly:(BOOL)thisDeviceOnly | ||||||
|  |                           group:(nullable NSString *)group; | ||||||
|  | 
 | ||||||
|  | - (NSString *)loadValueForKey:(NSString *)key; | ||||||
|  | - (BOOL)saveValue:(nullable NSString *)value forKey:(NSString *)key; | ||||||
|  | - (BOOL)deleteValueForKey:(NSString *)key; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 345d6db644eee4b2baf4136b1c5c419b | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,86 @@ | ||||||
|  | //
 | ||||||
|  | //  OKMacros.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | #ifndef OKMacros_h | ||||||
|  | #define OKMacros_h | ||||||
|  | 
 | ||||||
|  | #ifndef OK_WeakSelf | ||||||
|  | #define OK_WeakSelf __weak typeof(self) wself = self | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #ifndef OK_StrongSelf | ||||||
|  | #define OK_StrongSelf __strong typeof(wself) self = wself | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #ifndef ok_keywordify | ||||||
|  | #if DEBUG | ||||||
|  |     #define ok_keywordify autoreleasepool {} | ||||||
|  | #else | ||||||
|  |     #define ok_keywordify try {} @catch (...) {} | ||||||
|  | #endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #ifndef weakify | ||||||
|  |     #if __has_feature(objc_arc) | ||||||
|  |         #define weakify(object) ok_keywordify __weak __typeof__(object) weak##_##object = object; | ||||||
|  |     #else | ||||||
|  |         #define weakify(object) ok_keywordify __block __typeof__(object) block##_##object = object; | ||||||
|  |     #endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #ifndef strongify | ||||||
|  |     #if __has_feature(objc_arc) | ||||||
|  |         #define strongify(object) ok_keywordify __typeof__(object) object = weak##_##object; | ||||||
|  |     #else | ||||||
|  |         #define strongify(object) ok_keywordify __typeof__(object) object = block##_##object; | ||||||
|  |     #endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #ifndef OK_Lock | ||||||
|  | #define OK_Lock(lock) dispatch_semaphore_wait(lock, DISPATCH_TIME_FOREVER); | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #ifndef OK_Unlock | ||||||
|  | #define OK_Unlock(lock) dispatch_semaphore_signal(lock); | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #define _OK_CONCAT(A, B) A ## B | ||||||
|  | #define OKIdentifier(NAME, COUNTER) _OK_CONCAT(NAME, COUNTER) | ||||||
|  | #define OKSectionNameData(sectname) __attribute((used, no_sanitize_address, section("__DATA,"#sectname" "))) | ||||||
|  | 
 | ||||||
|  | static inline bool ok_dispatch_is_main_queue() { | ||||||
|  |     return dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(dispatch_get_main_queue()); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static inline bool ok_dispatch_is_main_thread() { | ||||||
|  |     return [NSThread isMainThread]; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  Submits a block for asynchronous execution on a main queue and returns immediately. | ||||||
|  |  */ | ||||||
|  | static inline void ok_dispatch_async_on_main_queue(void (^block)(void)) | ||||||
|  | { | ||||||
|  |     if (ok_dispatch_is_main_queue()) { | ||||||
|  |         block(); | ||||||
|  |     } else { | ||||||
|  |         dispatch_async(dispatch_get_main_queue(), block); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static inline void ok_dispatch_sync_on_main_queue(void (^block)(void)) | ||||||
|  | { | ||||||
|  |     if (ok_dispatch_is_main_queue()) { | ||||||
|  |         block(); | ||||||
|  |     } else { | ||||||
|  |         dispatch_sync(dispatch_get_main_queue(), block); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #endif /* OKMacros_h */ | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 50fb10bb035ed4ea2969f793c0d7d0ef | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | //
 | ||||||
|  | //  OKReachability+Authorization.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import "OKReachability.h" | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | typedef NS_ENUM(NSInteger, OKNetworkAuthorizationStatus) { | ||||||
|  |     /// 程序无法判断出 App 的网络权限设置
 | ||||||
|  |     OKNetworkAuthorizationStatusNotDetermined = 0, | ||||||
|  |     /// App 未开启蜂窝数据网络权限
 | ||||||
|  |     OKNetworkAuthorizationStatusCellularNotPermitted, | ||||||
|  |     /// App 未开启无线局域网与蜂窝移动网络权限,此项仅可能在国行 iPhone 手机上出现
 | ||||||
|  |     OKNetworkAuthorizationStatusWLANAndCellularNotPermitted | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | @interface OKReachability (Authorization) | ||||||
|  | 
 | ||||||
|  | + (OKNetworkAuthorizationStatus)currentAuthorizationStatus; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 77bcf0276b60c45299cf5aed45ff00f8 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,38 @@ | ||||||
|  | //
 | ||||||
|  | //  OKReachability+Cellular.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import "OKReachability.h" | ||||||
|  | #import "OKCellular.h" | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface OKReachability (Cellular) | ||||||
|  | 
 | ||||||
|  | + (BOOL)isNetworkConnected; | ||||||
|  | 
 | ||||||
|  | /// 优先返回流量卡状态,其次是主卡状态
 | ||||||
|  | + (OKCellularConnectionType)cellularConnectionType; | ||||||
|  | + (BOOL)is2GConnected; | ||||||
|  | + (BOOL)is3GConnected; | ||||||
|  | + (BOOL)is4GConnected; | ||||||
|  | + (BOOL)is5GConnected; | ||||||
|  | + (nullable NSString*)carrierName; | ||||||
|  | + (nullable NSString*)carrierMCC; | ||||||
|  | + (nullable NSString*)carrierMNC; | ||||||
|  | 
 | ||||||
|  | // 返回指定卡 状态
 | ||||||
|  | + (OKCellularConnectionType)cellularConnectionTypeForService:(OKCellularServiceType)service; | ||||||
|  | + (BOOL)is3GConnectedForService:(OKCellularServiceType)service; | ||||||
|  | + (BOOL)is4GConnectedForService:(OKCellularServiceType)service; | ||||||
|  | + (BOOL)is5GConnectedForService:(OKCellularServiceType)service; | ||||||
|  | + (NSString *)carrierNameForService:(OKCellularServiceType)service; | ||||||
|  | + (NSString *)carrierMCCForService:(OKCellularServiceType)service; | ||||||
|  | + (NSString *)carrierMNCForService:(OKCellularServiceType)service; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 515faedc13fc148d59e82d1fde5d57a3 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,32 @@ | ||||||
|  | //
 | ||||||
|  | //  OKReachability.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/27.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | typedef NS_ENUM(int32_t, OKReachabilityStatus) { | ||||||
|  |     OKReachabilityStatusNotReachable    = 0, | ||||||
|  |     OKReachabilityStatusReachableViaWiFi, | ||||||
|  |     OKReachabilityStatusReachableViaWWAN | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | FOUNDATION_EXTERN NSString *OKNotificationReachabilityChanged; | ||||||
|  | 
 | ||||||
|  | @interface OKReachability : NSObject | ||||||
|  | 
 | ||||||
|  | @property (nonatomic, assign, readonly) BOOL telephoneInfoIndeterminateStatus; | ||||||
|  | 
 | ||||||
|  | + (instancetype)sharedInstance; | ||||||
|  | 
 | ||||||
|  | - (void)startNotifier; | ||||||
|  | 
 | ||||||
|  | - (OKReachabilityStatus)currentReachabilityStatus; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: a4c18355009ca477795e3de1b6d1f6b4 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,77 @@ | ||||||
|  | //
 | ||||||
|  | //  OKResponder.h
 | ||||||
|  | //
 | ||||||
|  | //  Created by Quan Quan on 15/11/5.
 | ||||||
|  | //  Copyright © 2015 Bytedance. All rights reserved.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <UIKit/UIKit.h> | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | @interface OKResponder : NSObject | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Find the responder's NavigationController. | ||||||
|  |  * | ||||||
|  |  * @param responder A View or a ViewController. | ||||||
|  |  */ | ||||||
|  | + (nullable UINavigationController *)topNavigationControllerForResponder:(nullable UIResponder *)responder; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Return the top rootViewController of the current ViewControllers' stack. | ||||||
|  |  */ | ||||||
|  | + (nullable UIViewController *)topViewController; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Is viewController the  topViewController? | ||||||
|  |    @param viewController A ViewController. | ||||||
|  |  */ | ||||||
|  | + (BOOL)isTopViewController:(nonnull UIViewController *)viewController; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Return the root view of the top rootViewController in the current ViewControllers' stack. | ||||||
|  |  */ | ||||||
|  | + (nullable UIView *)topView; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Find the top rootViewController from the rootViewController in it's ViewControllers' stack. | ||||||
|  |  * | ||||||
|  |  * @param rootViewController A UIViewController. | ||||||
|  |  */ | ||||||
|  | + (nullable UIViewController *)topViewControllerForController:(nonnull UIViewController *)rootViewController; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Find the top rootViewController from the view in it's ViewControllers' stack. | ||||||
|  |  * | ||||||
|  |  * @param view A UIView. | ||||||
|  |  */ | ||||||
|  | + (nullable UIViewController *)topViewControllerForView:(nonnull UIView *)view; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Find the top rootViewController from the responder in it's ViewControllers' stack. | ||||||
|  |  * | ||||||
|  |  * @param responder A UIResponder. | ||||||
|  |  */ | ||||||
|  | + (nullable UIViewController *)topViewControllerForResponder:(nonnull UIResponder *)responder; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Close the top rootViewController. | ||||||
|  |  * | ||||||
|  |  * @param animated  `YES` if the change should be animated, `NO` if the change should happen immediately. | ||||||
|  |  */ | ||||||
|  | + (void)closeTopViewControllerWithAnimated:(BOOL)animated; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | ///////////////////////////////////////////////////////////////////////////////////
 | ||||||
|  | 
 | ||||||
|  | @interface UIViewController (OK_Close) | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Close self. | ||||||
|  |  * | ||||||
|  |  * @param animated  `YES` if the change should be animated, `NO` if the change should happen immediately. | ||||||
|  |  */ | ||||||
|  | - (void)closeWithAnimated:(BOOL)animated; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: a1070d0e70156486dab84ccdfddcb509 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,22 @@ | ||||||
|  | //
 | ||||||
|  | //  OKSandbox.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/4/26.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <Foundation/Foundation.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | @interface OKSandbox : NSObject | ||||||
|  | 
 | ||||||
|  | + (NSString *)appName;/// CFBundleName
 | ||||||
|  | + (NSString *)appDisplayName; /// CFBundleDisplayName
 | ||||||
|  | + (NSString *)appVersion; /// CFBundleShortVersionString
 | ||||||
|  | + (NSString *)appBuildVersion; /// CFBundleVersion
 | ||||||
|  | + (NSString *)bundleID; /// CFBundleIdentifier
 | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 57f814749e9be474396c4e4b6e1e9b6d | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,35 @@ | ||||||
|  | //
 | ||||||
|  | //  OKSdkEventConfig.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by 谭正豪 on 2021/10/18.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #ifndef OKSdkEventConfig_h | ||||||
|  | #define OKSdkEventConfig_h | ||||||
|  | 
 | ||||||
|  | @interface OKSdkEventConfig : NSObject | ||||||
|  | 
 | ||||||
|  | /*! @abstract The ID of your sdk that you registered
 | ||||||
|  |  @discussion Nonnull & required. | ||||||
|  |  */ | ||||||
|  | @property (atomic, copy) NSString *sdkId; | ||||||
|  | 
 | ||||||
|  | /*! @abstract Current version of your sdk
 | ||||||
|  |  @discussion Nonnull & required. | ||||||
|  |  */ | ||||||
|  | @property (atomic, copy) NSString *sdkVersion; | ||||||
|  | 
 | ||||||
|  | /*! @abstract The channel where your SDK will be published.
 | ||||||
|  |  @discussion Nonnull & require. Default : "Other" | ||||||
|  |  */ | ||||||
|  | @property (atomic, strong) NSString *channel; | ||||||
|  | 
 | ||||||
|  | /*!
 | ||||||
|  |  @abstract The name of your SDK. | ||||||
|  |  @discussion Set this property with your SDK name. Nullable & optional. | ||||||
|  |  */ | ||||||
|  | @property (atomic, copy) NSArray<NSString *> *libNames; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | #endif /* OKSdkEventConfig_h */ | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 4be9cdca5d607491c875225ac8f19296 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,42 @@ | ||||||
|  | //
 | ||||||
|  | //  OKSectionData.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/10/2.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <OneKit/OKMacros.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | typedef struct _OKString { | ||||||
|  |     const char *key; | ||||||
|  |     const char *value; | ||||||
|  | } OKString; | ||||||
|  | 
 | ||||||
|  | #define OKStringUniqueIdentifier OKIdentifier(__OKString, __COUNTER__) | ||||||
|  | 
 | ||||||
|  | #define OK_STRINGS_EXPORT(key, value) \ | ||||||
|  | OKSectionNameData(__OKString) \ | ||||||
|  | static const OKString OKStringUniqueIdentifier = (OKString){key, value}; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  e.g | ||||||
|  |  to define values: | ||||||
|  |  OK_STRINGS_EXPORT("key1", "value1") | ||||||
|  |  OK_STRINGS_EXPORT("key1", "value2") | ||||||
|  |  OK_STRINGS_EXPORT("key2", "value1") | ||||||
|  |   | ||||||
|  |  to get values: | ||||||
|  |  NSArray *key1 = [OKSectionData exportedStringsForKey:@"key1"]; | ||||||
|  |  NSArray *key2 = [OKSectionData exportedStringsForKey:@"key2"]; | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /// lazy load
 | ||||||
|  | @interface OKSectionData : NSObject | ||||||
|  | 
 | ||||||
|  | + (nullable NSArray<NSString *> *)exportedStringsForKey:(NSString *)key; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | fileFormatVersion: 2 | ||||||
|  | guid: 02c08e79b829c4aadbc5d86c46bf60c8 | ||||||
|  | PluginImporter: | ||||||
|  |   externalObjects: {} | ||||||
|  |   serializedVersion: 2 | ||||||
|  |   iconMap: {} | ||||||
|  |   executionOrder: {} | ||||||
|  |   defineConstraints: [] | ||||||
|  |   isPreloaded: 0 | ||||||
|  |   isOverridable: 0 | ||||||
|  |   isExplicitlyReferenced: 0 | ||||||
|  |   validateReferences: 1 | ||||||
|  |   platformData: | ||||||
|  |   - first: | ||||||
|  |       Any:  | ||||||
|  |     second: | ||||||
|  |       enabled: 1 | ||||||
|  |       settings: {} | ||||||
|  |   - first: | ||||||
|  |       Editor: Editor | ||||||
|  |     second: | ||||||
|  |       enabled: 0 | ||||||
|  |       settings: | ||||||
|  |         DefaultValueInitialized: true | ||||||
|  |   userData:  | ||||||
|  |   assetBundleName:  | ||||||
|  |   assetBundleVariant:  | ||||||
|  | @ -0,0 +1,51 @@ | ||||||
|  | //
 | ||||||
|  | //  OKSectionFunction.h
 | ||||||
|  | //  OneKit
 | ||||||
|  | //
 | ||||||
|  | //  Created by bob on 2020/10/2.
 | ||||||
|  | //
 | ||||||
|  | 
 | ||||||
|  | #import <OneKit/OKMacros.h> | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_BEGIN | ||||||
|  | 
 | ||||||
|  | typedef struct _OKFunction { | ||||||
|  |     const char *key; | ||||||
|  |     const void (*function)(void); | ||||||
|  | } OKFunction; | ||||||
|  | 
 | ||||||
|  | #define OKFunctionIdentifier(COUNTER) OKIdentifier(__OneKitFunction, COUNTER) | ||||||
|  | #define OKFunctionDataIdentifier OKIdentifier(__OneKitFunction_, __COUNTER__) | ||||||
|  | 
 | ||||||
|  | #define _OK_FUNCTION_EXPORT(key, COUNTER) \ | ||||||
|  | __attribute__((used, no_sanitize_address)) static void OKFunctionIdentifier(COUNTER)(void);\ | ||||||
|  | OKSectionNameData(__OneKitFunction) \ | ||||||
|  | static const OKFunction OKFunctionDataIdentifier = (OKFunction){key, (void *)(&OKFunctionIdentifier(COUNTER))}; \ | ||||||
|  | __attribute__((used, no_sanitize_address)) static void OKFunctionIdentifier(COUNTER) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | #define OK_FUNCTION_EXPORT(key) \ | ||||||
|  | _OK_FUNCTION_EXPORT(key, __COUNTER__) | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  | e.g. | ||||||
|  | 1. define function | ||||||
|  | OK_FUNCTION_EXPORT("a")(void){ | ||||||
|  |     printf("\nFunction:test function a"); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 2.call function | ||||||
|  |  [[OKSectionFunction sharedInstance] excuteFunctionsForKey:@"a"]; | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | @interface OKSectionFunction : NSObject | ||||||
|  | 
 | ||||||
|  | + (instancetype)sharedInstance; | ||||||
|  | 
 | ||||||
|  | - (void)excuteFunctionsForKey:(NSString *)key; | ||||||
|  | /// empty method for swift
 | ||||||
|  | - (void)excuteSwiftFunctionsForKey:(NSString *)key; | ||||||
|  | 
 | ||||||
|  | @end | ||||||
|  | 
 | ||||||
|  | NS_ASSUME_NONNULL_END | ||||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
		Reference in New Issue