Commit 2f757512 authored by 汪洋's avatar 汪洋

升级GMCache

parent 6a0eabae
...@@ -221,7 +221,6 @@ ...@@ -221,7 +221,6 @@
6003F587195388D20070C39A /* Frameworks */, 6003F587195388D20070C39A /* Frameworks */,
6003F588195388D20070C39A /* Resources */, 6003F588195388D20070C39A /* Resources */,
FEDD47C43B929695EFF32BE0 /* [CP] Embed Pods Frameworks */, FEDD47C43B929695EFF32BE0 /* [CP] Embed Pods Frameworks */,
B1BE839C8D7CB38052ED84D1 /* [CP] Copy Pods Resources */,
); );
buildRules = ( buildRules = (
); );
...@@ -240,8 +239,6 @@ ...@@ -240,8 +239,6 @@
6003F5AA195388D20070C39A /* Sources */, 6003F5AA195388D20070C39A /* Sources */,
6003F5AB195388D20070C39A /* Frameworks */, 6003F5AB195388D20070C39A /* Frameworks */,
6003F5AC195388D20070C39A /* Resources */, 6003F5AC195388D20070C39A /* Resources */,
6A6A2941869562845661D8FF /* [CP] Embed Pods Frameworks */,
680392E325EDB9514EAD7BF6 /* [CP] Copy Pods Resources */,
); );
buildRules = ( buildRules = (
); );
...@@ -332,36 +329,6 @@ ...@@ -332,36 +329,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
680392E325EDB9514EAD7BF6 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GMPhobos_Tests/Pods-GMPhobos_Tests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
6A6A2941869562845661D8FF /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GMPhobos_Tests/Pods-GMPhobos_Tests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
9C816B48AC518C7C51C2DAE6 /* [CP] Check Pods Manifest.lock */ = { 9C816B48AC518C7C51C2DAE6 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
...@@ -380,21 +347,6 @@ ...@@ -380,21 +347,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
B1BE839C8D7CB38052ED84D1 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-GMPhobos_Example/Pods-GMPhobos_Example-resources.sh\"\n";
showEnvVarsInLog = 0;
};
FEDD47C43B929695EFF32BE0 /* [CP] Embed Pods Frameworks */ = { FEDD47C43B929695EFF32BE0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
PODS: PODS:
- GMCache (0.2.0): - GMCache (0.2.1):
- TMCache (= 2.1.0) - TMCache (= 2.1.0)
- GMKit (0.8.4): - GMKit (0.8.4):
- GMKit/Category (= 0.8.4) - GMKit/Category (= 0.8.4)
...@@ -35,8 +35,8 @@ PODS: ...@@ -35,8 +35,8 @@ PODS:
- GMKit/Protocol (0.8.4): - GMKit/Protocol (0.8.4):
- Masonry (= 1.1.0) - Masonry (= 1.1.0)
- SDWebImage (= 3.7.6) - SDWebImage (= 3.7.6)
- GMPhobos (0.5.4): - GMPhobos (0.5.5):
- GMCache (= 0.2.0) - GMCache (= 0.2.1)
- GMKit - GMKit
- Masonry (1.1.0) - Masonry (1.1.0)
- SDWebImage (3.7.6): - SDWebImage (3.7.6):
...@@ -47,18 +47,27 @@ PODS: ...@@ -47,18 +47,27 @@ PODS:
DEPENDENCIES: DEPENDENCIES:
- GMPhobos (from `../`) - GMPhobos (from `../`)
SPEC REPOS:
"git@git.wanmeizhensuo.com:gengmeiios/GMSpecs.git":
- GMCache
- GMKit
https://github.com/cocoapods/specs.git:
- Masonry
- SDWebImage
- TMCache
EXTERNAL SOURCES: EXTERNAL SOURCES:
GMPhobos: GMPhobos:
:path: ../ :path: "../"
SPEC CHECKSUMS: SPEC CHECKSUMS:
GMCache: b7d48432ee2469eb0c6c86c720a1958bd373187e GMCache: 776334eaa82af7b807c3420e383920d5353e4534
GMKit: a30da06b84e5c4a357d427c70d1b5ec672a1f6a1 GMKit: a30da06b84e5c4a357d427c70d1b5ec672a1f6a1
GMPhobos: c188895332709d25d1c25fc6efe584bb669e8420 GMPhobos: 074fa6b0373abaef4c541c4cfd3a805a31bdd706
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
SDWebImage: c325cf02c30337336b95beff20a13df489ec0ec9 SDWebImage: c325cf02c30337336b95beff20a13df489ec0ec9
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
PODFILE CHECKSUM: ea0fac2144ac80baf8f21576cde49526c19991ad PODFILE CHECKSUM: ea0fac2144ac80baf8f21576cde49526c19991ad
COCOAPODS: 1.4.0 COCOAPODS: 1.5.3
...@@ -24,7 +24,7 @@ Pod::Spec.new do |s| ...@@ -24,7 +24,7 @@ Pod::Spec.new do |s|
s.platform = :ios, '8.0' s.platform = :ios, '8.0'
s.source_files = 'GMPhobos/Classes/*.{h,m}' s.source_files = 'GMPhobos/Classes/*.{h,m}'
s.dependency 'GMCache', '0.2.0' s.dependency 'GMCache', '0.2.1'
s.dependency 'GMKit' s.dependency 'GMKit'
s.library = 'z' s.library = 'z'
......
...@@ -121,10 +121,10 @@ static NSString *sdkVersion = @"110"; ...@@ -121,10 +121,10 @@ static NSString *sdkVersion = @"110";
/** 第一次打开APP埋点 **/ /** 第一次打开APP埋点 **/
// 当不再支持7.6.15版本时,只保留 // 当不再支持7.6.15版本时,只保留
if (![GMCache fetchObjectAtDucmentPathWithkey:PhobosHaveOpenApp]) { if (![GMCache fetchObjectAtDocumentPathWithkey:PhobosHaveOpenApp]) {
[Phobos track:@"device_activated" attributes:@{} sendNow:YES]; [Phobos track:@"device_activated" attributes:@{} sendNow:YES];
[Phobos track:@"device_activated" attributes:@{} sendNow:NO]; [Phobos track:@"device_activated" attributes:@{} sendNow:NO];
[GMCache storeObjectAtDucmentPathWithkey:PhobosHaveOpenApp object:PhobosHaveOpenApp]; [GMCache storeObjectAtDocumentPathWithkey:PhobosHaveOpenApp object:PhobosHaveOpenApp];
} }
} }
...@@ -159,7 +159,7 @@ static NSString *sdkVersion = @"110"; ...@@ -159,7 +159,7 @@ static NSString *sdkVersion = @"110";
_serialId = 0; _serialId = 0;
_sessionId = [[NSUUID UUID] UUIDString]; _sessionId = [[NSUUID UUID] UUIDString];
[GMCache storeObjectAtDucmentPathWithkey:PhobosBeginTime object:[PhobosUtil currentTime]]; [GMCache storeObjectAtDocumentPathWithkey:PhobosBeginTime object:[PhobosUtil currentTime]];
} }
/** /**
...@@ -206,7 +206,7 @@ static NSString *sdkVersion = @"110"; ...@@ -206,7 +206,7 @@ static NSString *sdkVersion = @"110";
- (void)handleSessionOver{ - (void)handleSessionOver{
//进入后台的同时,把记录时间同步到服务端,把已使用时间清空 //进入后台的同时,把记录时间同步到服务端,把已使用时间清空
double beginTime = [[GMCache fetchObjectAtDucmentPathWithkey:PhobosBeginTime] doubleValue]; double beginTime = [[GMCache fetchObjectAtDocumentPathWithkey:PhobosBeginTime] doubleValue];
if (beginTime == 0) { if (beginTime == 0) {
return; return;
} }
...@@ -225,7 +225,7 @@ static NSString *sdkVersion = @"110"; ...@@ -225,7 +225,7 @@ static NSString *sdkVersion = @"110";
@"build_model": [UIDevice deviceVersion], @"build_model": [UIDevice deviceVersion],
}; };
[Phobos track:@"on_app_session_over" attributes:dict]; [Phobos track:@"on_app_session_over" attributes:dict];
[GMCache removeObjectAtDucmentPathWithkey:PhobosBeginTime]; [GMCache removeObjectAtDocumentPathWithkey:PhobosBeginTime];
//当前session结束之后,把id置为0 //当前session结束之后,把id置为0
_serialId = 0; _serialId = 0;
} }
...@@ -257,7 +257,7 @@ static NSString *sdkVersion = @"110"; ...@@ -257,7 +257,7 @@ static NSString *sdkVersion = @"110";
+ (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes{ + (void)track:(NSString *)eventId attributes:(NSDictionary *)attributes{
[self track:eventId attributes:attributes sendNow:NO]; [self track:eventId attributes:attributes sendNow:NO];
NSArray *array = [GMCache fetchObjectAtDucmentPathWithkey:PhobosCacheKey]; NSArray *array = [GMCache fetchObjectAtDocumentPathWithkey:PhobosCacheKey];
//超过一定数量的话,统一发送一次 //超过一定数量的话,统一发送一次
if (array.count > PhobosShardCount) { if (array.count > PhobosShardCount) {
[sharedClient sendArray:array cleanCacheRightNow:YES]; [sharedClient sendArray:array cleanCacheRightNow:YES];
...@@ -403,13 +403,13 @@ static NSString *sdkVersion = @"110"; ...@@ -403,13 +403,13 @@ static NSString *sdkVersion = @"110";
phobosLog([NSString stringWithFormat:@"save dictionary: %@",data]); phobosLog([NSString stringWithFormat:@"save dictionary: %@",data]);
} }
NSMutableArray *dataArray = [GMCache fetchObjectAtDucmentPathWithkey:PhobosCacheKey]; NSMutableArray *dataArray = [GMCache fetchObjectAtDocumentPathWithkey:PhobosCacheKey];
if (dataArray) { if (dataArray) {
[dataArray addObject:data]; [dataArray addObject:data];
}else{ }else{
dataArray = [NSMutableArray arrayWithObject:data]; dataArray = [NSMutableArray arrayWithObject:data];
} }
[GMCache storeObjectAtDucmentPathWithkey:PhobosCacheKey object:dataArray]; [GMCache storeObjectAtDocumentPathWithkey:PhobosCacheKey object:dataArray];
} }
/** /**
...@@ -418,7 +418,7 @@ static NSString *sdkVersion = @"110"; ...@@ -418,7 +418,7 @@ static NSString *sdkVersion = @"110";
* @since 0.0.1 * @since 0.0.1
*/ */
- (void)fetchDataAndSend{ - (void)fetchDataAndSend{
NSArray *paramsArray = [GMCache fetchObjectAtDucmentPathWithkey:PhobosCacheKey]; NSArray *paramsArray = [GMCache fetchObjectAtDocumentPathWithkey:PhobosCacheKey];
if (paramsArray.count>0) { if (paramsArray.count>0) {
[self sendArray:paramsArray cleanCacheRightNow:YES]; [self sendArray:paramsArray cleanCacheRightNow:YES];
} }
...@@ -428,7 +428,7 @@ static NSString *sdkVersion = @"110"; ...@@ -428,7 +428,7 @@ static NSString *sdkVersion = @"110";
从缓存区获取数据,发给服务器,请求成功的时候,把缓存区的数据删除掉 从缓存区获取数据,发给服务器,请求成功的时候,把缓存区的数据删除掉
*/ */
- (void)sendArray { - (void)sendArray {
NSMutableArray *dataArray = [GMCache fetchObjectAtDucmentPathWithkey:PhobosTempCacheKey]; NSMutableArray *dataArray = [GMCache fetchObjectAtDocumentPathWithkey:PhobosTempCacheKey];
if (_logEnabled) { if (_logEnabled) {
NSData *data = [NSJSONSerialization dataWithJSONObject:dataArray options:NSJSONWritingPrettyPrinted error:nil]; NSData *data = [NSJSONSerialization dataWithJSONObject:dataArray options:NSJSONWritingPrettyPrinted error:nil];
NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
...@@ -440,7 +440,7 @@ static NSString *sdkVersion = @"110"; ...@@ -440,7 +440,7 @@ static NSString *sdkVersion = @"110";
if (compressedData) { if (compressedData) {
[PhobosUtil sendData:compressedData success:^(NSInteger code) { [PhobosUtil sendData:compressedData success:^(NSInteger code) {
phobosLog(@"✈ ---------- ✈ data arrived Mars"); phobosLog(@"✈ ---------- ✈ data arrived Mars");
[GMCache removeObjectAtDucmentPathWithkey:PhobosTempCacheKey]; [GMCache removeObjectAtDocumentPathWithkey:PhobosTempCacheKey];
}]; }];
} }
} }
...@@ -460,17 +460,17 @@ static NSString *sdkVersion = @"110"; ...@@ -460,17 +460,17 @@ static NSString *sdkVersion = @"110";
@try { @try {
//1.获取缓存区的数据,把新数据追加进去 //1.获取缓存区的数据,把新数据追加进去
NSMutableArray *dataArray = [GMCache fetchObjectAtDucmentPathWithkey:PhobosTempCacheKey]; NSMutableArray *dataArray = [GMCache fetchObjectAtDocumentPathWithkey:PhobosTempCacheKey];
if (dataArray) { if (dataArray) {
[dataArray addObjectsFromArray:array]; [dataArray addObjectsFromArray:array];
}else{ }else{
dataArray = [NSMutableArray arrayWithArray:array]; dataArray = [NSMutableArray arrayWithArray:array];
} }
[GMCache storeObjectAtDucmentPathWithkey:PhobosTempCacheKey object:dataArray]; [GMCache storeObjectAtDocumentPathWithkey:PhobosTempCacheKey object:dataArray];
//2.把缓存区的数据发送给服务器 //2.把缓存区的数据发送给服务器
[self sendArray]; [self sendArray];
//3.把原有的数据删除 //3.把原有的数据删除
[GMCache removeObjectAtDucmentPathWithkey:PhobosCacheKey]; [GMCache removeObjectAtDocumentPathWithkey:PhobosCacheKey];
} }
@catch (NSException *exception) { @catch (NSException *exception) {
phobosLog(exception); phobosLog(exception);
......
...@@ -53,7 +53,7 @@ WMUser *user = [[WMLoginManager shareInstance] user]; ...@@ -53,7 +53,7 @@ WMUser *user = [[WMLoginManager shareInstance] user];
``` ```
If you would like to use Phobos, you must set the currentCityId that is used with the -[setCurrentCityId:] Instance method. If you would like to use Phobos, you must set the currentCityId that is used with the -[setCurrentCityId:] Instance method.
```objc ```objc
WMCityObject *city = [GMCache fetchObjectAtDucmentPathWithkey:kCurrentCity]; WMCityObject *city = [GMCache fetchObjectAtDocumentPathWithkey:kCurrentCity];
if (city) { if (city) {
[client setCurrentCityId:city.id]; [client setCurrentCityId:city.id];
} }
......
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