Commit 39ba6493 authored by 井庆林's avatar 井庆林

暂提

parent 489a4305
...@@ -168,8 +168,8 @@ ...@@ -168,8 +168,8 @@
6003F59C195388D20070C39A /* GMAppDelegate.h */, 6003F59C195388D20070C39A /* GMAppDelegate.h */,
6003F59D195388D20070C39A /* GMAppDelegate.m */, 6003F59D195388D20070C39A /* GMAppDelegate.m */,
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */, 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */,
6003F5A5195388D20070C39A /* GMViewController.h */,
6003F5A6195388D20070C39A /* GMViewController.m */, 6003F5A6195388D20070C39A /* GMViewController.m */,
6003F5A5195388D20070C39A /* GMViewController.h */,
6003F5A8195388D20070C39A /* Images.xcassets */, 6003F5A8195388D20070C39A /* Images.xcassets */,
6003F594195388D20070C39A /* Supporting Files */, 6003F594195388D20070C39A /* Supporting Files */,
); );
......
//
// Phobos.h
// GengmeiDoctor
// Data Statistic Client For Mars
// Created by Thierry on 16/1/26.
// Copyright © 2016年 wanmeizhensuo. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "PhobosPVProtocol.h"
#import "PhobosConfig.h"
#import <CoreLocation/CLLocation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NewPhobos : NSObject
/**
* @brief 开启Phobos统计,默认以BATCH方式发送log.
*
* @param appName 通常由数据端与客户端一起确认的区分不同app的名字
* @param channelId 发布渠道
*
* @return Phobos实例
*
* @since 0.0.1
*/
+ (NewPhobos *)clientWithAppName:(NSString *)appName channelId:(NSString *)channelId;
+ (instancetype) alloc __attribute__((deprecated));
- (instancetype) init __attribute__((deprecated));
+ (instancetype) new __attribute__((deprecated));
#pragma mark - SDK配置
+ (instancetype)sharedClient;
@property (class, readonly, strong) NewPhobos *sharedClient;
/** 用于Phobos库从old更新到new使用,在全量之后删除相关逻辑 */
@property (nonatomic, assign) BOOL isGray;
// Phobos在处理业务端传递来的参数时会检查是否某个value为空,如果为空会调用这个block以通知业务层,业务层可以上报这个异常,以助解决问题
@property(nonatomic, copy) void (^captureNullExpection) (NSString *eventId, NSDictionary *info);
/**
网络状态 wifi=1, mobile=0, 不连通=-1
*/
@property (nonatomic, copy) NSString *netStatus;
/**
//没有网络连接
public static final String NETWORN_NONE = "none";
//wifi连接
public static final String NETWORN_WIFI = "wifi";
//手机网络数据连接类型
public static final String NETWORN_2G = "2G";
public static final String NETWORN_3G = "3G";
public static final String NETWORN_4G = "4G";
public static final String NETWORN_MOBILE = "other";
*/
@property (nonatomic, copy) NSString *networkStatus;
/**
* @brief 设置是否打印sdk的log信息,默认不开启
*
* @since 0.0.1
*/
@property (assign, nonatomic) BOOL logEnabled;
/**
* @brief 设置当前登录用户的ID,如果没有默认为@""
*
*
* @since 0.0.2
*/
@property (strong, nonatomic) NSString *userId;
/*!
* @author zhaiguojun, 16-05-31
*
* @brief 用户当前的城市id
*
*
* @since 0.2.7
*/
@property (strong, nonatomic) NSString *currentCityId;
@property (strong, nonatomic) CLLocation *gps;
/**
* 记录用户类型
*/
@property (strong, nonatomic) NSMutableDictionary *userType;
/**
数据接收的服务器API
*/
@property (copy, nonatomic) NSString *serverAPI;
/**
当前APP请求接口的 APIHOST(GMServerDomains.apiHost 主要用于flutter AppDelegate 中初始化需要传值
*/
@property (nonatomic, copy) NSString *apiHost;
/**
当前APP请求接口的 cookie(主要用于flutter) 获取到cookie 的时候穿过来 或者cookie 有变化的时候传过来
*/
@property (nonatomic, copy) NSString *cookie;
/**
灰度组, since 7.7.65
*/
@property (nonatomic, copy) NSString *greyType;
/**
包的类型:APPSTORE、RELEASE、DEBUG
*/
@property (nonatomic, assign) PhobosSigningType signingType;
/**
从主项目获取当前显示的controller
*/
@property (nonatomic, copy) UIViewController * (^getTopController) (void);
#pragma mark - 事件采集
/**
* @brief 自定义事件,数量统计.
*
* @param eventId 事件Id
* @attributes 参数
* @sendNow 是否实时发送,默认为NO
*
* @since 0.0.1
*/
+ (void)track:(NSString *)eventName attributes:(NSDictionary *)attributes;
+ (void)track:(NSString *)eventName attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow;
+ (void)track:(NSString *)eventName;
/**
* @brief 自定义事件,数量统计 7730 精准曝光/数据链路.
*
* @param eventId 事件Id
* @attributes 参数
* @sendNow 是否实时发送,默认为NO
* @currentAPI 当前传过来的API
* @
*/
+ (void)track:(NSString *)eventName attributes:(NSDictionary *)attributes currentAPI:(NSString *)currentAPI;
+ (void)track:(NSString *)eventName attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow currentAPI:(NSString *)currentAPI;
+ (void)track:(NSString *)eventName currentAPI:(NSString *)currentAPI;
/**
* @brief PV事件开始。当controller viewWillAppear时调用
*/
- (void)onPVStart:(UIResponder<PhobosPVProtocol> *)page;
/**
* @brief PV事件结束。当controller viewWillDisAppear时调用
*/
- (void)onPVEnd:(UIResponder<PhobosPVProtocol> *)page;
@end
@interface NewPhobos (UtilTest)
/** 获取所有非立即发送埋点数量 */
+ (NSInteger)normalPhobosCount;
/** 获取所有非立即发送埋点数据 */
+ (NSDictionary *)normalPhobosData;
/** 获取url的非立即发送埋点数量 */
+ (NSInteger)normalPhobosCountForURL:(NSString *)url;
/** 获取serverAPI的非立即发送埋点数据 */
+ (NSArray *)normalPhobosDataForServerAPI;
/** 获取url的非立即发送埋点数据 */
+ (NSArray *)normalPhobosDataForURL:(NSString *)url;
/** 获取所有立即发送埋点数据 */
+ (NSDictionary *)immediatelyPhobosData;
/** 获取serverAPI的立即发送埋点数据 */
+ (NSArray *)immediatelyPhobosForServerAPI;
/** 获取url的立即发送埋点数据 */
+ (NSArray *)immediatelyPhobosDataForURL:(NSString *)url;
/** 获取url的立即发送埋点数量 */
+ (NSUInteger)immediatelyPhobosCountForURL:(NSString *)url;
/** 清除非立即发送埋点数据缓存 */
+ (void)removeAllNormalPhobosData;
/** 清除立即发送埋点数据缓存 */
+ (void)removeAllImmediatelyPhobosData;
/** 获取将要发送的数据 */
@property (nonatomic, copy) void (^phobosSendDataBlock)(NSArray *datas);
@end
NS_ASSUME_NONNULL_END
This diff is collapsed.
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#import "PhobosConfig.h" #import "PhobosConfig.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface OldPhobos : NSObject @interface OldPhobos : NSObject
/** /**
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#import "OldPhobos.h" #import "OldPhobos.h"
#import <AdSupport/AdSupport.h> #import <AdSupport/AdSupport.h>
#import "PhobosUtil.h"
#import "UIResponder+PhobosPV.h" #import "UIResponder+PhobosPV.h"
#import "PhobosUtil.h" #import "PhobosUtil.h"
#import "PhobosCustomVisibleController.h" #import "PhobosCustomVisibleController.h"
...@@ -66,6 +65,7 @@ static NSString *sdkVersion = @"110"; ...@@ -66,6 +65,7 @@ static NSString *sdkVersion = @"110";
} }
return self; return self;
} }
- (void)dealloc{ - (void)dealloc{
if (self) { if (self) {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
...@@ -341,7 +341,7 @@ static NSString *sdkVersion = @"110"; ...@@ -341,7 +341,7 @@ static NSString *sdkVersion = @"110";
[dict setObject:page.pageName forKey:@"page_name"]; [dict setObject:page.pageName forKey:@"page_name"];
[dict setObject:page.businessId?:@"" forKey:@"business_id"]; [dict setObject:page.businessId?:@"" forKey:@"business_id"];
[dict setObject:page.referer?:@"" forKey:@"referrer"]; [dict setObject:page.referer?:@"" forKey:@"referrer"];
[dict setObject:page.referrerLink ? : @[] forKey:@"referer_link"]; [dict setObject:page.referrerLink ? : @[] forKey:@"referrer_link"];
[dict setObject:@(0) forKey:@"fake"]; [dict setObject:@(0) forKey:@"fake"];
[dict setObject:page.referrerId ? : @"" forKey:@"referrer_id"]; [dict setObject:page.referrerId ? : @"" forKey:@"referrer_id"];
[dict setObject:page.extraParam ? : @"" forKey:@"extra_param"]; [dict setObject:page.extraParam ? : @"" forKey:@"extra_param"];
...@@ -665,4 +665,5 @@ static NSString *sdkVersion = @"110"; ...@@ -665,4 +665,5 @@ static NSString *sdkVersion = @"110";
[self.APIArray addObject:api]; [self.APIArray addObject:api];
} }
} }
@end @end
...@@ -25,18 +25,14 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -25,18 +25,14 @@ NS_ASSUME_NONNULL_BEGIN
* *
* @since 0.0.1 * @since 0.0.1
*/ */
+ (void)clientWithAppName:(NSString *)appName channelId:(NSString *)channelId; + (Phobos *)clientWithAppName:(NSString *)appName channelId:(NSString *)channelId;
+ (instancetype) alloc __attribute__((deprecated)); + (instancetype)sharedClient;
- (instancetype) init __attribute__((deprecated));
+ (instancetype) new __attribute__((deprecated));
#pragma mark - SDK配置 + (void)setSharedClient:(Phobos *)client;
@property (class, readonly, strong) Phobos *sharedClient;
/** 用于Phobos库从old更新到new使用,在全亮之后删除相关逻辑 */ #pragma mark - SDK配置
@property (nonatomic, assign) BOOL isGray;
// Phobos在处理业务端传递来的参数时会检查是否某个value为空,如果为空会调用这个block以通知业务层,业务层可以上报这个异常,以助解决问题 // Phobos在处理业务端传递来的参数时会检查是否某个value为空,如果为空会调用这个block以通知业务层,业务层可以上报这个异常,以助解决问题
@property(nonatomic, copy) void (^captureNullExpection) (NSString *eventId, NSDictionary *info); @property(nonatomic, copy) void (^captureNullExpection) (NSString *eventId, NSDictionary *info);
...@@ -131,12 +127,12 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -131,12 +127,12 @@ NS_ASSUME_NONNULL_BEGIN
* *
* @since 0.0.1 * @since 0.0.1
*/ */
+ (void)track:(NSString *)eventName attributes:(NSDictionary *)attributes; + (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes;
+ (void)track:(NSString *)eventName attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow; + (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow;
+ (void)track:(NSString *)eventName; + (void)track:(NSString *)eventId;
/** /**
* @brief 自定义事件,数量统计 7730 精准曝光/数据链路. * @brief 自定义事件,数量统计 7730 精准曝光.
* *
* @param eventId 事件Id * @param eventId 事件Id
* @attributes 参数 * @attributes 参数
...@@ -144,10 +140,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -144,10 +140,9 @@ NS_ASSUME_NONNULL_BEGIN
* @currentAPI 当前传过来的API * @currentAPI 当前传过来的API
* @ * @
*/ */
+ (void)track:(NSString *)eventName attributes:(NSDictionary *)attributes currentAPI:(NSString *)currentAPI; + (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes currentAPI:(NSString *)currentAPI;
+ (void)track:(NSString *)eventName attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow currentAPI:(NSString *)currentAPI; + (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow currentAPI:(NSString *)currentAPI;
+ (void)track:(NSString *)eventName currentAPI:(NSString *)currentAPI; + (void)track:(NSString *)eventId currentAPI:(NSString *)currentAPI;
/** /**
* @brief PV事件开始。当controller viewWillAppear时调用 * @brief PV事件开始。当controller viewWillAppear时调用
*/ */
...@@ -156,9 +151,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -156,9 +151,9 @@ NS_ASSUME_NONNULL_BEGIN
* @brief PV事件结束。当controller viewWillDisAppear时调用 * @brief PV事件结束。当controller viewWillDisAppear时调用
*/ */
- (void)onPVEnd:(UIResponder<PhobosPVProtocol> *)page; - (void)onPVEnd:(UIResponder<PhobosPVProtocol> *)page;
@end @end
@interface Phobos (UtilTest) @interface Phobos (UtilTest)
/** 获取所有非立即发送埋点数量 */ /** 获取所有非立即发送埋点数量 */
......
This diff is collapsed.
...@@ -23,6 +23,8 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) { ...@@ -23,6 +23,8 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
#define phobosLog(...) #define phobosLog(...)
#endif #endif
#define PhobosGray @"PhobosGray"
#define PhobosBeginTime @"PhobosBeginTime" //记录APP打开|从后台启动时的时间戳 #define PhobosBeginTime @"PhobosBeginTime" //记录APP打开|从后台启动时的时间戳
#define PhobosEndTime @"PhobosEndTime" //记录APP退出|退到后台时的时间戳 #define PhobosEndTime @"PhobosEndTime" //记录APP退出|退到后台时的时间戳
#define PhobosNormalCacheKey @"PhobosNormalCacheKey" //存放持久化埋点数据的key #define PhobosNormalCacheKey @"PhobosNormalCacheKey" //存放持久化埋点数据的key
......
//
// PhobosDataManager.h
// GMCache
//
// Created by Locus on 2020/1/21.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, PhobosModelSendStatus) {
PhobosModelSendStatusNormal = 0,
PhobosModelSendStatusSending,
PhobosModelSendStatusFinish,
PhobosModelSendStatusError,
};
@interface PhobosSendModel : NSObject
@property (nonatomic, copy, readonly) NSString *sendId;
@property (nonatomic, strong) id data;
@property (nonatomic, copy) NSString *api;
@property (nonatomic, assign) PhobosModelSendStatus sendStatus;
- (instancetype)initWithData:(id)data sendApi:(NSString *)api;
@end
@interface PhobosDataManager : NSObject
- (void)insertData:(PhobosSendModel *)data immediately:(BOOL)immediately;
- (void)updateData:(PhobosSendModel *)data sendStatus:(PhobosModelSendStatus)sendStatus;
- (void)deleteData:(PhobosSendModel *)data;
- (void)removeNormalData;
- (NSArray<PhobosSendModel *> *)fetchData;
@end
NS_ASSUME_NONNULL_END
//
// PhobosDataManager.m
// GMCache
//
// Created by Locus on 2020/1/21.
//
#import "PhobosDataManager.h"
@implementation PhobosSendModel
- (instancetype)initWithData:(id)data sendApi:(NSString *)api {
if (self = [super init]) {
_data = data;
_sendId = @"123";
_api = api;
}
return self;
}
@end
@implementation PhobosDataManager
- (void)insertData:(PhobosSendModel *)data immediately:(BOOL)immediately {
}
- (void)updateData:(PhobosSendModel *)data sendStatus:(PhobosModelSendStatus)sendStatus {
}
- (void)deleteData:(PhobosSendModel *)data {
}
- (void)removeNormalData {
}
- (NSArray<PhobosSendModel *> *)fetchData {
return nil;
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment