Commit deb90c17 authored by 井庆林's avatar 井庆林

..

parent 39ba6493
......@@ -435,12 +435,14 @@
"${PODS_ROOT}/Target Support Files/Pods-GMPhobos_Example/Pods-GMPhobos_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/GMCache/GMCache.framework",
"${BUILT_PRODUCTS_DIR}/GMPhobos/GMPhobos.framework",
"${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework",
"${BUILT_PRODUCTS_DIR}/TMCache/TMCache.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GMCache.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GMPhobos.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TMCache.framework",
);
runOnlyForDeploymentPostprocessing = 0;
......
......@@ -36,11 +36,15 @@ NSString *const MockCityId = @"beijing";
NSString *url = @"http://log.test.gengmei.cc/log/collect";
#endif
[GMCache removeObjectAtDocumentPathWithkey:PhobosCacheKey];
[Phobos clientWithAppName:MockAppName channelId:MockChannelId];
Phobos *client = [Phobos clientWithAppName:MockAppName channelId:MockChannelId];
[Phobos setSharedClient:client];
Phobos.sharedClient.serverAPI = url;
[Phobos.sharedClient setLogEnabled:NO]; // 调试打Log模式,看情况开启
Phobos.sharedClient.signingType = PhobosSigningTypeDebug;
Phobos.sharedClient.userId = @"";
Phobos.sharedClient.getTopController = ^UIViewController * _Nonnull{
return self;
};
NSString *inDate = [PhobosUtil currentTime];
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
......@@ -62,7 +66,7 @@ NSString *const MockCityId = @"beijing";
[dict setObject:[PhobosUtil currentTime] forKey:@"in"];
[dict setObject:[PhobosUtil currentTime] forKey:@"out"];
[Phobos track:@"page_view" attributes:dict];
[Phobos track:@"page_view" attributes:dict sendNow:YES];
array = [GMCache fetchObjectAtDocumentPathWithkey:PhobosCacheKey];
[Phobos track:@"test" attributes:dict];
......
PODS:
- GMCache (1.0.1):
- TMCache (= 2.1.0)
- GMPhobos (1.3.4):
- GMPhobos (1.3.5):
- GMCache
- MJExtension
- MJExtension (3.2.1)
- TMCache (2.1.0)
DEPENDENCIES:
......@@ -12,6 +14,7 @@ SPEC REPOS:
"git@git.wanmeizhensuo.com:gengmeiios/GMSpecs.git":
- GMCache
https://github.com/cocoapods/specs.git:
- MJExtension
- TMCache
EXTERNAL SOURCES:
......@@ -20,7 +23,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
GMCache: b78d8e46db864405e91d226ce640cc80d966c611
GMPhobos: 54e7aded6e4b6c69c1339c16c8693110f417a69d
GMPhobos: 242bc118edb737fb496b49235b2f24d61c349d7b
MJExtension: 635f2c663dcb1bf76fa4b715b2570a5710aec545
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
PODFILE CHECKSUM: ea0fac2144ac80baf8f21576cde49526c19991ad
......
......@@ -25,11 +25,15 @@ NSString *const MockCityId = @"beijing";
- (void)setUp {
[super setUp];
[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:PhobosGray];
[Phobos clientWithAppName:MockAppName channelId:MockChannelId];
Phobos.sharedClient.serverAPI = @"http://log.test.igengmei.com/log/collect";
Phobos.sharedClient.logEnabled = NO; // 调试打Log模式,看情况开启
Phobos.sharedClient.signingType = PhobosSigningTypeDebug;
Phobos.sharedClient.userId = @"";
Phobos.sharedClient.getTopController = ^UIViewController * _Nonnull{
return [UIViewController new];
};
}
- (void)tearDown {
......@@ -45,6 +49,7 @@ NSString *const MockCityId = @"beijing";
* @since <#version number#>
*/
- (void)testClientWithUserId{
[self setUp];
[Phobos removeAllNormalPhobosData];
[Phobos.sharedClient setUserId:MockUserId];
[Phobos.sharedClient setCurrentCityId:MockCityId];
......
......@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "GMPhobos"
s.version = "1.3.4"
s.version = "1.3.5"
s.summary = "GM statistic data sdk"
s.description = <<-DESC
......@@ -25,6 +25,7 @@ Pod::Spec.new do |s|
s.platform = :ios, '8.0'
s.source_files = 'GMPhobos/Classes/*.{h,m}'
s.dependency 'GMCache'
s.dependency 'MJExtension'
s.library = 'z'
end
......@@ -35,8 +35,6 @@ NS_ASSUME_NONNULL_BEGIN
+ (instancetype)sharedClient;
@property (class, readonly, strong) NewPhobos *sharedClient;
/** 用于Phobos库从old更新到new使用,在全量之后删除相关逻辑 */
@property (nonatomic, assign) BOOL isGray;
......@@ -124,6 +122,10 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - 事件采集
/** 点击事件采集 */
+ (void)onClickButtonWithAttributes:(NSDictionary *)attributes;
+ (void)onClickButtonWithAttributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow;
/**
* @brief 自定义事件,数量统计.
*
......
This diff is collapsed.
......@@ -118,6 +118,10 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - 事件采集
/** 点击事件采集 */
+ (void)onClickButtonWithAttributes:(NSDictionary *)attributes;
+ (void)onClickButtonWithAttributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow;
/**
* @brief 自定义事件,数量统计.
*
......
......@@ -49,14 +49,32 @@ static BOOL isGray = NO;
isGray = [[[NSUserDefaults standardUserDefaults] objectForKey:PhobosGray] boolValue];
if (isGray) {
_rePhobos = [NewPhobos clientWithAppName:appName channelId:channelId];
sharedClient = _rePhobos;
} else {
_oldPhobos = [OldPhobos clientWithAppName:appName channelId:channelId];
[OldPhobos setSharedClient:_oldPhobos];
sharedClient = _oldPhobos;
}
}
return self;
}
+ (void)onClickButtonWithAttributes:(NSDictionary *)attributes {
if (isGray) {
[NewPhobos onClickButtonWithAttributes:attributes];
} else {
[self track:@"on_cick_button" attributes:attributes];
}
}
+ (void)onClickButtonWithAttributes:(NSDictionary *)attributes sendNow:(BOOL)sendNow {
if (isGray) {
[NewPhobos onClickButtonWithAttributes:attributes sendNow:sendNow];
} else {
[self track:@"on_cick_button" attributes:attributes sendNow:sendNow];
}
}
+ (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes {
if (isGray) {
[NewPhobos track:eventId attributes:attributes];
......
......@@ -29,6 +29,7 @@ typedef NS_ENUM (NSInteger, PhobosSigningType) {
#define PhobosEndTime @"PhobosEndTime" //记录APP退出|退到后台时的时间戳
#define PhobosNormalCacheKey @"PhobosNormalCacheKey" //存放持久化埋点数据的key
#define PhobosImmediatelyCacheKey @"PhobosImmediatelyCacheKey" //存放持久化实时埋点数据的key
#define PhobosNewCacheKey @"PhobosNewCacheKey"
#define PhobosCacheKey @"PhobosCacheKey" //old 存放持久化埋点数据的key
#define PhobosTempCacheKey @"PhobosTempCacheKey" //old 临时存放待发送埋点数据的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