Commit 1ce9ea27 authored by Thierry's avatar Thierry

Release 0.0.5

parent 3cf509dd
......@@ -23,6 +23,7 @@
6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; };
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
CDCB1F756EA31D8DF51DBCDD /* Pods_GMPhobos_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 766AC377CD6FFC595CF3CF7F /* Pods_GMPhobos_Example.framework */; };
E49977061C59F40000623ABA /* GMPhotoTest.m in Sources */ = {isa = PBXBuildFile; fileRef = E49977051C59F40000623ABA /* GMPhotoTest.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -65,6 +66,7 @@
D06094B3D9CBA747125E16B2 /* Pods-GMPhobos_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GMPhobos_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-GMPhobos_Tests/Pods-GMPhobos_Tests.debug.xcconfig"; sourceTree = "<group>"; };
E0668666E63CBCF8FB52F9C7 /* Pods-GMPhobos_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GMPhobos_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-GMPhobos_Example/Pods-GMPhobos_Example.release.xcconfig"; sourceTree = "<group>"; };
E2E7FEEA45FF5DF8941CEE34 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
E49977051C59F40000623ABA /* GMPhotoTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GMPhotoTest.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -156,6 +158,7 @@
6003F5B5195388D20070C39A /* Tests */ = {
isa = PBXGroup;
children = (
E49977051C59F40000623ABA /* GMPhotoTest.m */,
6003F5BB195388D20070C39A /* Tests.m */,
6003F5B6195388D20070C39A /* Supporting Files */,
);
......@@ -248,7 +251,7 @@
ORGANIZATIONNAME = licong;
TargetAttributes = {
6003F589195388D20070C39A = {
DevelopmentTeam = DGT9C327YY;
DevelopmentTeam = 86R4V3XFLU;
};
6003F5AD195388D20070C39A = {
TestTargetID = 6003F589195388D20070C39A;
......@@ -403,6 +406,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E49977061C59F40000623ABA /* GMPhotoTest.m in Sources */,
6003F5BC195388D20070C39A /* Tests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
......@@ -523,6 +527,7 @@
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "c7e6dc21-c52f-40e4-a435-5e942f0af080";
WRAPPER_EXTENSION = app;
};
name = Debug;
......@@ -540,6 +545,7 @@
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "c7e6dc21-c52f-40e4-a435-5e942f0af080";
WRAPPER_EXTENSION = app;
};
name = Release;
......
......@@ -37,6 +37,11 @@
BlueprintName = "GMPhobos_Tests"
ReferencedContainer = "container:GMPhobos.xcodeproj">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "Tests">
</Test>
</SkippedTests>
</TestableReference>
</Testables>
<MacroExpansion>
......
......@@ -28,7 +28,7 @@ PODS:
- GMLibrary/Network (0.0.1):
- AFNetworking (~> 2.6.1)
- GMLibrary/Cache (~> 0.0.1)
- GMPhobos (0.0.1):
- GMPhobos (0.0.4):
- GMLibrary (~> 0.0.1)
- TMCache (2.1.0)
......@@ -42,7 +42,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60
GMLibrary: c31039ad32bc93f866d6c3052c20acb8cf9c1568
GMPhobos: e148244c94b4d22b157f13155d7c74cd7d857c1b
GMPhobos: 6b6634d1c84b19272c74f068e59d847528dab943
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
COCOAPODS: 0.39.0
{
"name": "GMPhobos",
"version": "0.0.1",
"version": "0.0.4",
"summary": "GM statistic data sdk",
"description": "GM statistic data sdk.",
"homepage": "http://git.gengmei.cc/gengmeiios/GMPhobos",
......@@ -10,7 +10,7 @@
},
"source": {
"git": "http://git.gengmei.cc/gengmeiios/GMPhobos.git",
"tag": "0.0.1"
"tag": "0.0.4"
},
"platforms": {
"ios": "7.0"
......
......@@ -28,7 +28,7 @@ PODS:
- GMLibrary/Network (0.0.1):
- AFNetworking (~> 2.6.1)
- GMLibrary/Cache (~> 0.0.1)
- GMPhobos (0.0.1):
- GMPhobos (0.0.4):
- GMLibrary (~> 0.0.1)
- TMCache (2.1.0)
......@@ -42,7 +42,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AFNetworking: cb8d14a848e831097108418f5d49217339d4eb60
GMLibrary: c31039ad32bc93f866d6c3052c20acb8cf9c1568
GMPhobos: e148244c94b4d22b157f13155d7c74cd7d857c1b
GMPhobos: 6b6634d1c84b19272c74f068e59d847528dab943
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
COCOAPODS: 0.39.0
......@@ -14,7 +14,7 @@
buildForArchiving = "YES">
<BuildableReference
BuildableIdentifier = 'primary'
BlueprintIdentifier = 'DA209D52C0431038A08235A2'
BlueprintIdentifier = '3F46E2460B75C801A4818A9B'
BlueprintName = 'GMPhobos'
ReferencedContainer = 'container:Pods.xcodeproj'
BuildableName = 'GMPhobos.framework'>
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<string>0.0.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
//
// GMPhotoTest.m
// GMPhobos
//
// Created by Thierry on 16/1/28.
// Copyright © 2016年 licong. All rights reserved.
//
#import <XCTest/XCTest.h>
#import "Phobos.h"
#import "WMCacheService.h"
#define PhobosCacheKey @"PhobosCacheKey"
NSString *const MockAppName = @"gengmei";
NSString *const MockChannelId = @"AppStore";
NSString *const MockEventId = @"eventId";
NSInteger const MockUserId = 1;
@interface GMPhotoTest : XCTestCase
@property Phobos *client;
@property WMCacheService *cache;
@end
@implementation GMPhotoTest
- (void)setUp {
[super setUp];
_client = [Phobos clientWithAppName:MockAppName channelId:MockChannelId];
[Phobos setSharedClient:_client];
_cache = [WMCacheService sharedInstance];
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
[_cache removeObjectAtDiskWithkey:PhobosCacheKey];
}
/**
* @brief 测试有用户ID的时候,埋点事件是否正确
*
* @since <#version number#>
*/
- (void)testClientWithUserId{
[_client setUserId:MockUserId];
[_client track:MockEventId];
NSArray *array = [_cache fetchObjectAtDiskWithkey:PhobosCacheKey];
XCTAssertTrue(array.count == 1, @"array is empty");
NSDictionary *dict = [array objectAtIndex:0];
[self verfiyDict:dict];
XCTAssertTrue([[dict objectForKey:@"user_id"] integerValue] == MockUserId, @"Invalid user_id value");
}
/**
* @brief 测试发送不带参数事件成功
*
* @since <#version number#>
*/
- (void)testTrackEventWithoutAttr{
[_client track:MockEventId];
NSArray *array = [_cache fetchObjectAtDiskWithkey:PhobosCacheKey];
XCTAssertTrue(array.count == 1, @"array is empty");
NSDictionary *dict = [array objectAtIndex:0];
[self verfiyDict:dict];
}
/**
* @brief 测试发送带参数事件成功
*
* @since <#version number#>
*/
- (void)testTrackEventWithAttr{
NSDictionary *attr = @{@"attr":@"track_attr"};
[_client track:MockEventId attributes:attr];
NSArray *array = [_cache fetchObjectAtDiskWithkey:PhobosCacheKey];
XCTAssertTrue(array.count == 1, @"array is empty");
NSDictionary *dict = [array objectAtIndex:0];
[self verfiyDict:dict];
//验证Param的值是否正确
NSString *value = [[dict valueForKey:@"params"] valueForKey:@"attr"];
XCTAssertTrue([value isEqualToString:@"track_attr"], @"Invalid event attributes");
}
/**
* @brief 测试立即发送带参数事件成功
*
* @since <#version number#>
*/
- (void)testTrackEventWithAttrAndSendNow{
NSDictionary *attr = @{@"attr":@"track_attr"};
[_client track:MockEventId attributes:attr sendNow:YES];
NSArray *array = [_cache fetchObjectAtDiskWithkey:PhobosCacheKey];
XCTAssertTrue(array.count == 0, @"array should be empty");
}
/**
* @brief 测试数据压缩的性能,准备50条数据
*
* @since <#version number#>
*/
- (void)testCompressPerformanceExample {
NSDictionary *attr = @{@"attr":@"track_attr"};
for (int i=0; i<=49; i++) {
[_client track:MockEventId attributes:attr];
}
[self measureBlock:^{
[_client track:MockEventId attributes:attr];
}];
}
- (void)verfiyDict:(NSDictionary *)dict{
NSArray *keys = [dict allKeys];
XCTAssertTrue([keys containsObject:@"type"], @"Missing type");
XCTAssertTrue([keys containsObject:@"app"], @"Missing app");
XCTAssertTrue([keys containsObject:@"version"], @"Missing version");
XCTAssertTrue([keys containsObject:@"device"], @"Missing device");
XCTAssertTrue([keys containsObject:@"user_id"], @"Missing user_id");
XCTAssertTrue([keys containsObject:@"create_at"], @"Missing create_at");
XCTAssertTrue([keys containsObject:@"params"], @"Missing params");
}
@end
......@@ -28,7 +28,7 @@
- (void)testExample
{
XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
}
@end
......
......@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "GMPhobos"
s.version = "0.0.4"
s.version = "0.0.5"
s.summary = "GM statistic data sdk"
# This description is used to generate tags and improve search results.
......@@ -26,7 +26,7 @@ Pod::Spec.new do |s|
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
s.license = 'MIT'
s.author = { "licong" => "licong@gmei.com" }
s.source = { :git => "http://git.gengmei.cc/gengmeiios/GMPhobos.git", :tag => "0.0.4" }
s.source = { :git => "http://git.gengmei.cc/gengmeiios/GMPhobos.git", :tag => "0.0.5" }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.platform = :ios, '7.0'
......
......@@ -201,7 +201,7 @@ static NSString *sdkVersion = @"110";
*
* @return
*
* @since 1.8.0
* @since 0.0.1
*/
- (NSDictionary *)prepareDictionaryForEvent:(NSString *)eventId attributes:(NSDictionary *)attributes{
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
......@@ -233,7 +233,7 @@ static NSString *sdkVersion = @"110";
*
* @param data 数据
*
* @since 1.8.0
* @since 0.0.1
*/
- (void)save:(NSDictionary *)data
{
......@@ -253,7 +253,7 @@ static NSString *sdkVersion = @"110";
/**
* @brief 从缓存中获取数据,并发送
*
* @since 1.8.0
* @since 0.0.1
*/
- (void)fetchDataAndSend{
NSArray *paramsArray = [[WMCacheService sharedInstance] fetchObjectAtDiskWithkey:PhobosCacheKey];
......@@ -268,7 +268,7 @@ static NSString *sdkVersion = @"110";
*
* @param array
*
* @since 1.8.0
* @since 0.0.1
*/
- (void)sendArray:(NSArray *)array {
if (_logEnabled) {
......@@ -289,7 +289,7 @@ static NSString *sdkVersion = @"110";
*
* @param data
*
* @since 1.8.0
* @since 0.0.1
*/
- (void)sendData:(NSData *)data {
#ifdef DEBUG
......@@ -318,13 +318,13 @@ static NSString *sdkVersion = @"110";
/**
* @brief 压缩待上传的数据
* @brief 压缩待上传的数据。经过测试,50条数据压缩大概6毫秒,所以不要放在异步线程中处理
*
* @param originData 压缩前的数据
*
* @return 压缩后的数据
*
* @since 1.8.0
* @since 0.0.1
*/
- (NSData *)compressData:(NSData *)originData{
if (!originData || [originData length] == 0)
......@@ -422,7 +422,7 @@ static NSString *sdkVersion = @"110";
*
* @return
*
* @since
* @since 0.0.1
*/
- (NSData *)encodeJSON:(id)obj {
NSData *data = [NSJSONSerialization dataWithJSONObject:obj options:0 error:nil];
......@@ -435,7 +435,7 @@ static NSString *sdkVersion = @"110";
*
* @return
*
* @since 1.8.0
* @since 0.0.1
*/
- (NSString *)currentTime {
NSDate *date = [NSDate date];
......@@ -449,7 +449,7 @@ static NSString *sdkVersion = @"110";
*
* @return
*
* @since 1.8.0
* @since 0.0.1
*/
- (NSString *)getAppVersion{
NSString *buildVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
......
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