Commit dee90d2d authored by 汪洋's avatar 汪洋

Merge branch 'master' of git.gengmei.cc:gengmeiios/GMBase

parents 04fec180 a169e2a3
......@@ -14,7 +14,7 @@ PODS:
- AFNetworking/Serialization (3.1.0)
- AFNetworking/UIKit (3.1.0):
- AFNetworking/NSURLSession
- GMBase (0.0.11):
- GMBase (0.0.12):
- GMNetService
- GMPhobos
- GMRefresh
......@@ -26,7 +26,7 @@ PODS:
- TMCache (~> 2.1.0)
- GMNetService (0.1.3):
- AFNetworking (= 3.1.0)
- GMPhobos (0.2.13):
- GMPhobos (0.2.18):
- GMCache (~> 0.1.0)
- GMRefresh (0.1.4):
- MJRefresh (~> 3.1.0)
......@@ -46,10 +46,10 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
GMBase: 6cea1da64d6e0971f08852e4f4eefa2ae3a8c097
GMBase: 94f32e8b89b34cb383341b793c92fda876f5aded
GMCache: a7b06a2d8a5a1c7cf023055c631ba9a0cd7c39fc
GMNetService: 2eb74ed62512078e9f00bc7006227a93c2acdf32
GMPhobos: 2f91b2b86285be7ae1e88c21628ccd7486a2afd8
GMPhobos: ea037939d26853e09774fd7e399f0b34fc6107aa
GMRefresh: 8d6ef25dbd38c2687fee713cc520012d47c7261e
JSONModel: 12523685c4b623553ccf844bbbf7007624317b2c
Masonry: a1a931a0d08870ed8ae415a2ea5ea68ebcac77df
......
......@@ -59,6 +59,8 @@
*/
- (void)setCurrentCityId:(NSString *)currentCityId;
- (void)setGPS:(NSDictionary *)gps;
/**
* @brief 自定义事件,数量统计.
*
......
......@@ -26,6 +26,8 @@ static NSString *sdkVersion = @"110";
@property (assign, nonatomic) NSInteger userId;
@property (assign, nonatomic) BOOL logEnabled;
@property (strong, nonatomic) NSString *sessionId;
@property (strong, nonatomic) NSString *lng;
@property (strong, nonatomic) NSString *lat;
@end
......@@ -51,6 +53,8 @@ static NSString *sdkVersion = @"110";
_channelId = channelId;
_logEnabled = NO;
_userId = 0;
_lat = @"";
_lng = @"";
_currentCityId = @"";
_appVersion = [self getAppVersion];
[self setupNotification];
......@@ -74,6 +78,17 @@ static NSString *sdkVersion = @"110";
_currentCityId = currentCityId;
}
- (void)setGPS:(NSDictionary *)gps {
@try {
NSString *lng = gps[@"lng"];
NSString *lat = gps[@"lat"];
_lng = lng;
_lat = lat;
} @catch (NSException *exception) {
phobosLog(exception);
}
}
- (void)handleEventAfterInit{
WMCacheService *cache = [WMCacheService sharedInstance];
......@@ -83,6 +98,7 @@ static NSString *sdkVersion = @"110";
/** 第一次打开APP埋点 **/
if (![cache fetchObjectAtDiskWithkey:PhobosHaveOpenApp]) {
[Phobos track:@"device_activated" attributes:@{} sendNow:YES];
[Phobos track:@"device_activated" attributes:@{} sendNow:NO];
[cache storeObjectAtDiskWithkey:PhobosHaveOpenApp object:PhobosHaveOpenApp];
}
}
......@@ -218,7 +234,7 @@ static NSString *sdkVersion = @"110";
NSArray *array = [[WMCacheService sharedInstance] fetchObjectAtDiskWithkey:PhobosCacheKey];
//超过一定数量的话,统一发送一次
if (array.count > PhobosShardCount) {
[sharedClient sendArray:array];
[sharedClient sendArray:array cleanCacheRightNow:YES];
}
}
......@@ -226,7 +242,8 @@ static NSString *sdkVersion = @"110";
NSDictionary *dict = [sharedClient prepareDictionaryForEvent:eventId attributes:attributes];
if (sendNow) {
NSArray *array = @[dict];
[sharedClient sendArray:array];
// 实时发送的埋点,不能立即清楚缓存
[sharedClient sendArray:array cleanCacheRightNow:NO];
}else{
[sharedClient save:dict];
}
......@@ -312,7 +329,10 @@ static NSString *sdkVersion = @"110";
NSMutableDictionary *deviceParams = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString],@"device_id",
[[[UIDevice currentDevice] identifierForVendor] UUIDString],@"idfv",
@"ios",@"device_type",nil];
@"ios",@"device_type",
@"Apple",@"manufacturer",
_lat,@"lat",
_lng,@"lng",nil];
NSMutableDictionary *appParams = [NSMutableDictionary dictionaryWithObjectsAndKeys:
self.appName, @"name",
self.appVersion, @"version",
......@@ -363,18 +383,18 @@ static NSString *sdkVersion = @"110";
- (void)fetchDataAndSend{
NSArray *paramsArray = [[WMCacheService sharedInstance] fetchObjectAtDiskWithkey:PhobosCacheKey];
if (paramsArray.count>0) {
[self sendArray:paramsArray];
[self sendArray:paramsArray cleanCacheRightNow:YES];
}
}
/**
* @brief 发送数组
*
* @param array
*
* @since 0.0.1
向Mars发送埋点数据,如果是实时发送的,http请求成功之后,不清楚已有的缓存数据。
针对普通埋点数据,发送成功之后,立即删除本地的缓存。
@author zhaiguojun 16-10-17 in (null)
@param array 参数
@param now 是否立即清楚缓存
*/
- (void)sendArray:(NSArray *)array {
- (void)sendArray:(NSArray *)array cleanCacheRightNow:(BOOL)clean {
if (_logEnabled) {
phobosLog([NSString stringWithFormat:@"array prepare to fly --✈: %@",array]);
}
......@@ -384,7 +404,9 @@ static NSString *sdkVersion = @"110";
if (compressedData) {
[PhobosUtil sendData:compressedData success:^(NSInteger code) {
phobosLog(@"✈ ---------- ✈ data arrived Mars");
[[WMCacheService sharedInstance] removeObjectAtDiskWithkey:PhobosCacheKey];
if (clean) {
[[WMCacheService sharedInstance] removeObjectAtDiskWithkey:PhobosCacheKey];
}
}];
}
}
......@@ -459,5 +481,4 @@ static NSString *sdkVersion = @"110";
}
}
@end
{
"name": "GMBase",
"version": "0.0.11",
"version": "0.0.12",
"summary": "更美iOS APP 的 Objective-C 基础Pod库",
"homepage": "http://git.gengmei.cc/gengmeiios/GMBase",
"license": "仅限北京更美互动信息科技有限公司内部使用",
......@@ -8,8 +8,8 @@
"wangyang": "wangyang@gmei.com"
},
"source": {
"git": "http://git.gengmei.cc/gengmeiios/GMBase.git",
"tag": "0.0.11"
"git": "git://git.gengmei.cc/gengmeiios/GMBase.git",
"tag": "0.0.12"
},
"platforms": {
"ios": "8.0"
......
......@@ -14,7 +14,7 @@ PODS:
- AFNetworking/Serialization (3.1.0)
- AFNetworking/UIKit (3.1.0):
- AFNetworking/NSURLSession
- GMBase (0.0.11):
- GMBase (0.0.12):
- GMNetService
- GMPhobos
- GMRefresh
......@@ -26,7 +26,7 @@ PODS:
- TMCache (~> 2.1.0)
- GMNetService (0.1.3):
- AFNetworking (= 3.1.0)
- GMPhobos (0.2.13):
- GMPhobos (0.2.18):
- GMCache (~> 0.1.0)
- GMRefresh (0.1.4):
- MJRefresh (~> 3.1.0)
......@@ -46,10 +46,10 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
GMBase: 6cea1da64d6e0971f08852e4f4eefa2ae3a8c097
GMBase: 94f32e8b89b34cb383341b793c92fda876f5aded
GMCache: a7b06a2d8a5a1c7cf023055c631ba9a0cd7c39fc
GMNetService: 2eb74ed62512078e9f00bc7006227a93c2acdf32
GMPhobos: 2f91b2b86285be7ae1e88c21628ccd7486a2afd8
GMPhobos: ea037939d26853e09774fd7e399f0b34fc6107aa
GMRefresh: 8d6ef25dbd38c2687fee713cc520012d47c7261e
JSONModel: 12523685c4b623553ccf844bbbf7007624317b2c
Masonry: a1a931a0d08870ed8ae415a2ea5ea68ebcac77df
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.0.11</string>
<string>0.0.12</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.2.13</string>
<string>0.2.18</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
Pod::Spec.new do |s|
s.name = 'GMBase'
s.version = '0.0.12'
s.version = '0.0.13'
s.summary = '更美iOS APP 的 Objective-C 基础Pod库'
s.homepage = 'http://git.gengmei.cc/gengmeiios/GMBase'
s.license = '仅限北京更美互动信息科技有限公司内部使用'
......
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