Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
GMPhobos
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMPhobos
Commits
a8d09ef3
Commit
a8d09ef3
authored
Sep 08, 2017
by
汪洋
Browse files
Options
Browse Files
Download
Plain Diff
解决冲突
parents
91445fa1
89353463
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
211 additions
and
27 deletions
+211
-27
Podfile.lock
Example/Podfile.lock
+2
-2
GMPhobos.podspec.json
Example/Pods/Local Podspecs/GMPhobos.podspec.json
+2
-2
Manifest.lock
Example/Pods/Manifest.lock
+2
-2
Info.plist
Example/Pods/Target Support Files/GMPhobos/Info.plist
+1
-1
GMPhobos.podspec
GMPhobos.podspec
+1
-1
Phobos.m
Pod/Classes/Phobos.m
+18
-2
PhobosUtil.h
Pod/Classes/PhobosUtil.h
+35
-0
PhobosUtil.m
Pod/Classes/PhobosUtil.m
+137
-4
report.xml
fastlane/report.xml
+13
-13
No files found.
Example/Podfile.lock
View file @
a8d09ef3
PODS:
PODS:
- GMCache (0.1.1):
- GMCache (0.1.1):
- TMCache (~> 2.1.0)
- TMCache (~> 2.1.0)
- GMPhobos (0.4.
1
):
- GMPhobos (0.4.
2
):
- GMCache (~> 0.1.1)
- GMCache (~> 0.1.1)
- TMCache (2.1.0)
- TMCache (2.1.0)
...
@@ -14,7 +14,7 @@ EXTERNAL SOURCES:
...
@@ -14,7 +14,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
SPEC CHECKSUMS:
GMCache: 73855b613b9d7e34f4f37ad425e8b8153b760c04
GMCache: 73855b613b9d7e34f4f37ad425e8b8153b760c04
GMPhobos:
2fd07df959c1c5f773a3e2355930fcbcf4ddf38c
GMPhobos:
9799825c107481252f084a3a2f91d5d1eae1d7bd
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
PODFILE CHECKSUM: 281ed5ce2f0e8e2e49cc13b1e4726e6686ac6095
PODFILE CHECKSUM: 281ed5ce2f0e8e2e49cc13b1e4726e6686ac6095
...
...
Example/Pods/Local Podspecs/GMPhobos.podspec.json
View file @
a8d09ef3
{
{
"name"
:
"GMPhobos"
,
"name"
:
"GMPhobos"
,
"version"
:
"0.4.
1
"
,
"version"
:
"0.4.
2
"
,
"summary"
:
"GM statistic data sdk"
,
"summary"
:
"GM statistic data sdk"
,
"description"
:
"GM event track sdk."
,
"description"
:
"GM event track sdk."
,
"homepage"
:
"http://git.gengmei.cc/gengmeiios/GMPhobos"
,
"homepage"
:
"http://git.gengmei.cc/gengmeiios/GMPhobos"
,
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
},
},
"source"
:
{
"source"
:
{
"git"
:
"git@git.gengmei.cc:gengmeiios/GMPhobos.git"
,
"git"
:
"git@git.gengmei.cc:gengmeiios/GMPhobos.git"
,
"tag"
:
"0.4.
1
"
"tag"
:
"0.4.
2
"
},
},
"platforms"
:
{
"platforms"
:
{
"ios"
:
"8.0"
"ios"
:
"8.0"
...
...
Example/Pods/Manifest.lock
View file @
a8d09ef3
PODS:
PODS:
- GMCache (0.1.1):
- GMCache (0.1.1):
- TMCache (~> 2.1.0)
- TMCache (~> 2.1.0)
- GMPhobos (0.4.
1
):
- GMPhobos (0.4.
2
):
- GMCache (~> 0.1.1)
- GMCache (~> 0.1.1)
- TMCache (2.1.0)
- TMCache (2.1.0)
...
@@ -14,7 +14,7 @@ EXTERNAL SOURCES:
...
@@ -14,7 +14,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
SPEC CHECKSUMS:
GMCache: 73855b613b9d7e34f4f37ad425e8b8153b760c04
GMCache: 73855b613b9d7e34f4f37ad425e8b8153b760c04
GMPhobos:
2fd07df959c1c5f773a3e2355930fcbcf4ddf38c
GMPhobos:
9799825c107481252f084a3a2f91d5d1eae1d7bd
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
TMCache: 95ebcc9b3c7e90fb5fd8fc3036cba3aa781c9bed
PODFILE CHECKSUM: 281ed5ce2f0e8e2e49cc13b1e4726e6686ac6095
PODFILE CHECKSUM: 281ed5ce2f0e8e2e49cc13b1e4726e6686ac6095
...
...
Example/Pods/Target Support Files/GMPhobos/Info.plist
View file @
a8d09ef3
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
FMWK
<
/string
>
<
string
>
FMWK
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
0.4.
1
<
/string
>
<
string
>
0.4.
2
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
...
...
GMPhobos.podspec
View file @
a8d09ef3
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
Pod
::
Spec
.
new
do
|
s
|
Pod
::
Spec
.
new
do
|
s
|
s
.
name
=
"
GMPhobos
"
s
.
name
=
"
GMPhobos
"
s
.
version
=
"0.4.
2
"
s
.
version
=
"0.4.
3
"
s
.
summary
=
"GM statistic data sdk"
s
.
summary
=
"GM statistic data sdk"
s
.
description
=
<<-
DESC
s
.
description
=
<<-
DESC
...
...
Pod/Classes/Phobos.m
View file @
a8d09ef3
...
@@ -94,7 +94,15 @@ static NSString *sdkVersion = @"110";
...
@@ -94,7 +94,15 @@ static NSString *sdkVersion = @"110";
-
(
void
)
handleEventDeviceOpened
{
-
(
void
)
handleEventDeviceOpened
{
WMCacheService
*
cache
=
[
WMCacheService
sharedInstance
];
WMCacheService
*
cache
=
[
WMCacheService
sharedInstance
];
/** 每次打开APP埋点 **/
/** 每次打开APP埋点 **/
[
Phobos
track
:
@"device_opened"
attributes
:@{}
sendNow
:
YES
];
NSDictionary
*
dict
=
@{
@"build_cpu_abi"
:
[
PhobosUtil
currentDeviceCPUType
],
@"cpu_count"
:
[
PhobosUtil
currentDeviceCPUCount
],
@"mac_address"
:
[
PhobosUtil
getMacAddress
],
@"phone_operator"
:
[
PhobosUtil
getTelephonyInfo
],
@"total_memory"
:
[
PhobosUtil
getTotalMemorySize
],
@"run_time"
:
[
PhobosUtil
deviceRunTime
],
@"uuid"
:
[
PhobosUtil
deviceId
],
};
[
Phobos
track
:
@"device_opened"
attributes
:
dict
sendNow
:
YES
];
/** 第一次打开APP埋点 **/
/** 第一次打开APP埋点 **/
if
(
!
[
cache
fetchObjectAtDiskWithkey
:
PhobosHaveOpenApp
])
{
if
(
!
[
cache
fetchObjectAtDiskWithkey
:
PhobosHaveOpenApp
])
{
...
@@ -197,7 +205,15 @@ static NSString *sdkVersion = @"110";
...
@@ -197,7 +205,15 @@ static NSString *sdkVersion = @"110";
NSDate
*
date
=
[
NSDate
date
];
NSDate
*
date
=
[
NSDate
date
];
double
endTime
=
[
date
timeIntervalSince1970
];
double
endTime
=
[
date
timeIntervalSince1970
];
NSString
*
usedTime
=
[
NSString
stringWithFormat
:
@"%ld"
,(
long
)(
endTime
-
beginTime
)];
NSString
*
usedTime
=
[
NSString
stringWithFormat
:
@"%ld"
,(
long
)(
endTime
-
beginTime
)];
NSMutableDictionary
*
dict
=
[
NSMutableDictionary
dictionaryWithObjectsAndKeys
:
usedTime
,
@"duration"
,
nil
];
NSDictionary
*
dict
=
@{
@"duration"
:
usedTime
,
@"build_cpu_abi"
:
[
PhobosUtil
currentDeviceCPUType
],
@"cpu_count"
:
[
PhobosUtil
currentDeviceCPUCount
],
@"mac_address"
:
[
PhobosUtil
getMacAddress
],
@"phone_operator"
:
[
PhobosUtil
getTelephonyInfo
],
@"total_memory"
:
[
PhobosUtil
getTotalMemorySize
],
@"run_time"
:
[
PhobosUtil
deviceRunTime
],
@"uuid"
:
[
PhobosUtil
deviceId
],
};
[
Phobos
track
:
@"on_app_session_over"
attributes
:
dict
];
[
Phobos
track
:
@"on_app_session_over"
attributes
:
dict
];
[
cache
removeObjectAtDiskWithkey
:
PhobosBeginTime
];
[
cache
removeObjectAtDiskWithkey
:
PhobosBeginTime
];
//当前session结束之后,把id置为0
//当前session结束之后,把id置为0
...
...
Pod/Classes/PhobosUtil.h
View file @
a8d09ef3
...
@@ -40,4 +40,39 @@ typedef void (^SendDataSuccessBlock)(NSInteger code);
...
@@ -40,4 +40,39 @@ typedef void (^SendDataSuccessBlock)(NSInteger code);
* 获取IP地址
* 获取IP地址
*/
*/
+
(
NSString
*
)
getIPAddress
:(
BOOL
)
preferIPv4
;
+
(
NSString
*
)
getIPAddress
:(
BOOL
)
preferIPv4
;
/**
* 获取cup指令集
*/
+
(
NSString
*
)
currentDeviceCPUType
;
/***
* CPU总数目
**/
+
(
NSString
*
)
currentDeviceCPUCount
;
/***
* 网卡地址
**/
+
(
NSString
*
)
getMacAddress
;
/**
* 获取运营商信息
*/
+
(
NSString
*
)
getTelephonyInfo
;
/**
* 内存大小,单位:兆
*/
+
(
NSString
*
)
getTotalMemorySize
;
/**
* 获取手机运行时间,从开机到现在
*/
+
(
NSString
*
)
deviceRunTime
;
@end
@end
Pod/Classes/PhobosUtil.m
View file @
a8d09ef3
...
@@ -13,6 +13,13 @@
...
@@ -13,6 +13,13 @@
#import <ifaddrs.h>
#import <ifaddrs.h>
#import <arpa/inet.h>
#import <arpa/inet.h>
#import <net/if.h>
#import <net/if.h>
#import <net/if_dl.h>
#import <CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <sys/types.h>
#import <sys/sysctl.h>
#import <mach/machine.h>
#import "sys/utsname.h"
#import "Phobos.h"
#import "Phobos.h"
#define IOS_CELLULAR @"pdp_ip0"
#define IOS_CELLULAR @"pdp_ip0"
...
@@ -221,10 +228,6 @@
...
@@ -221,10 +228,6 @@
NSTextCheckingResult
*
firstMatch
=
[
regex
firstMatchInString
:
ipAddress
options
:
0
range
:
NSMakeRange
(
0
,
[
ipAddress
length
])];
NSTextCheckingResult
*
firstMatch
=
[
regex
firstMatchInString
:
ipAddress
options
:
0
range
:
NSMakeRange
(
0
,
[
ipAddress
length
])];
if
(
firstMatch
)
{
if
(
firstMatch
)
{
// NSRange resultRange = [firstMatch rangeAtIndex:0];
// NSString *result=[ipAddress substringWithRange:resultRange];
// //输出结果
// NSLog(@"%@",result);
return
YES
;
return
YES
;
}
}
}
}
...
@@ -269,4 +272,134 @@
...
@@ -269,4 +272,134 @@
return
[
addresses
count
]
?
addresses
:
nil
;
return
[
addresses
count
]
?
addresses
:
nil
;
}
}
/**
* 这里就叫做CPU指令集吧,目前主要采集这四种,armv6、armv7、armv7s、arm64
*/
+
(
NSString
*
)
currentDeviceCPUType
{
NSMutableString
*
cpuType
=
[[
NSMutableString
alloc
]
init
];
size_t
size
;
cpu_type_t
type
;
cpu_subtype_t
subtype
;
size
=
sizeof
(
type
);
sysctlbyname
(
"hw.cputype"
,
&
type
,
&
size
,
NULL
,
0
);
size
=
sizeof
(
subtype
);
sysctlbyname
(
"hw.cpusubtype"
,
&
subtype
,
&
size
,
NULL
,
0
);
if
(
type
==
CPU_TYPE_X86
)
{
[
cpuType
appendString
:
@"x86"
];
}
else
if
(
type
==
CPU_TYPE_ARM
)
{
[
cpuType
appendString
:
@"ARM"
];
switch
(
subtype
)
{
case
CPU_SUBTYPE_ARM_V6
:
[
cpuType
appendString
:
@"V6"
];
break
;
case
CPU_SUBTYPE_ARM_V7
:
[
cpuType
appendString
:
@"V7"
];
break
;
case
CPU_SUBTYPE_ARM_V7S
:
[
cpuType
appendString
:
@"V7s"
];
break
;
}
}
else
if
(
type
==
CPU_TYPE_ARM64
)
{
[
cpuType
appendString
:
@"ARM64"
];
}
else
{
// 暂时不采集其他的
[
cpuType
appendString
:
@"nuknow type"
];
}
return
cpuType
;
}
/***
* CPU总数目
**/
+
(
NSString
*
)
currentDeviceCPUCount
{
NSInteger
count
=
[
NSProcessInfo
processInfo
].
activeProcessorCount
;
return
[
NSString
stringWithFormat
:
@"%ld"
,
(
long
)
count
];
}
/***
* 网卡地址
**/
+
(
NSString
*
)
getMacAddress
{
int
mib
[
6
];
size_t
len
;
char
*
buf
;
unsigned
char
*
ptr
;
struct
if_msghdr
*
ifm
;
struct
sockaddr_dl
*
sdl
;
mib
[
0
]
=
CTL_NET
;
mib
[
1
]
=
AF_ROUTE
;
mib
[
2
]
=
0
;
mib
[
3
]
=
AF_LINK
;
mib
[
4
]
=
NET_RT_IFLIST
;
if
((
mib
[
5
]
=
if_nametoindex
(
"en0"
))
==
0
)
{
printf
(
"Error: if_nametoindex error/n"
);
return
NULL
;
}
if
(
sysctl
(
mib
,
6
,
NULL
,
&
len
,
NULL
,
0
)
<
0
)
{
printf
(
"Error: sysctl, take 1/n"
);
return
NULL
;
}
if
((
buf
=
malloc
(
len
))
==
NULL
)
{
printf
(
"Could not allocate memory. error!/n"
);
return
NULL
;
}
if
(
sysctl
(
mib
,
6
,
buf
,
&
len
,
NULL
,
0
)
<
0
)
{
printf
(
"Error: sysctl, take 2"
);
return
NULL
;
}
ifm
=
(
struct
if_msghdr
*
)
buf
;
sdl
=
(
struct
sockaddr_dl
*
)(
ifm
+
1
);
ptr
=
(
unsigned
char
*
)
LLADDR
(
sdl
);
NSString
*
outstring
=
[
NSString
stringWithFormat
:
@"%02x%02x%02x%02x%02x%02x"
,
*
ptr
,
*
(
ptr
+
1
),
*
(
ptr
+
2
),
*
(
ptr
+
3
),
*
(
ptr
+
4
),
*
(
ptr
+
5
)];
free
(
buf
);
return
[
outstring
uppercaseString
];
}
/**
* 获取运营商信息
*/
+
(
NSString
*
)
getTelephonyInfo
{
CTTelephonyNetworkInfo
*
info
=
[[
CTTelephonyNetworkInfo
alloc
]
init
];
CTCarrier
*
carrier
=
[
info
subscriberCellularProvider
];
if
(
carrier
==
nil
)
{
return
@""
;
}
return
[
carrier
carrierName
]
!=
nil
?
[
carrier
carrierName
]
:
@""
;
}
/**
* 内存大小,单位:兆
*/
+
(
NSString
*
)
getTotalMemorySize
{
unsigned
long
long
resultSize
=
[
NSProcessInfo
processInfo
].
physicalMemory
/
1024
/
1024
;
return
[
NSString
stringWithFormat
:
@"%llu"
,
resultSize
];
}
/**
* 获取手机运行时间,从开机到现在
*/
+
(
NSString
*
)
deviceRunTime
{
struct
timeval
boottime
;
int
mib
[
2
]
=
{
CTL_KERN
,
KERN_BOOTTIME
};
size_t
size
=
sizeof
(
boottime
);
time_t
now
;
time_t
uptime
=
-
1
;
//默认为没有使用吧
(
void
)
time
(
&
now
);
if
(
sysctl
(
mib
,
2
,
&
boottime
,
&
size
,
NULL
,
0
)
!=
-
1
&&
boottime
.
tv_sec
!=
0
)
{
uptime
=
now
-
boottime
.
tv_sec
;
}
return
[
NSString
stringWithFormat
:
@"%ld"
,
uptime
];
}
@end
@end
fastlane/report.xml
View file @
a8d09ef3
...
@@ -5,67 +5,67 @@
...
@@ -5,67 +5,67 @@
<testcase
classname=
"fastlane.lanes"
name=
"00: Verifying required fastlane version"
time=
"0.00
1983
"
>
<testcase
classname=
"fastlane.lanes"
name=
"00: Verifying required fastlane version"
time=
"0.00
2051
"
>
</testcase>
</testcase>
<testcase
classname=
"fastlane.lanes"
name=
"01: default_platform"
time=
"0.001
661
"
>
<testcase
classname=
"fastlane.lanes"
name=
"01: default_platform"
time=
"0.001
753
"
>
</testcase>
</testcase>
<testcase
classname=
"fastlane.lanes"
name=
"02: import_from_git"
time=
"
2.569052
"
>
<testcase
classname=
"fastlane.lanes"
name=
"02: import_from_git"
time=
"
0.580914
"
>
</testcase>
</testcase>
<testcase
classname=
"fastlane.lanes"
name=
"03: git_pull"
time=
"
4.603808
"
>
<testcase
classname=
"fastlane.lanes"
name=
"03: git_pull"
time=
"
0.982965
"
>
</testcase>
</testcase>
<testcase
classname=
"fastlane.lanes"
name=
"04: ensure_git_branch"
time=
"0.01
1
"
>
<testcase
classname=
"fastlane.lanes"
name=
"04: ensure_git_branch"
time=
"0.01
3392
"
>
</testcase>
</testcase>
<testcase
classname=
"fastlane.lanes"
name=
"05: pod_install"
time=
"
22.712397
"
>
<testcase
classname=
"fastlane.lanes"
name=
"05: pod_install"
time=
"
4.078955
"
>
</testcase>
</testcase>
<testcase
classname=
"fastlane.lanes"
name=
"06: pod_lib_lint"
time=
"
31.332885
"
>
<testcase
classname=
"fastlane.lanes"
name=
"06: pod_lib_lint"
time=
"
9.499866
"
>
</testcase>
</testcase>
<testcase
classname=
"fastlane.lanes"
name=
"07: version_bump_podspec"
time=
"0.002
76
"
>
<testcase
classname=
"fastlane.lanes"
name=
"07: version_bump_podspec"
time=
"0.002
847
"
>
</testcase>
</testcase>
<testcase
classname=
"fastlane.lanes"
name=
"08: git_commit_all"
time=
"0.
10787
1"
>
<testcase
classname=
"fastlane.lanes"
name=
"08: git_commit_all"
time=
"0.
2781
1"
>
</testcase>
</testcase>
<testcase
classname=
"fastlane.lanes"
name=
"09: add_git_tag"
time=
"0.01
7011
"
>
<testcase
classname=
"fastlane.lanes"
name=
"09: add_git_tag"
time=
"0.01
6519
"
>
</testcase>
</testcase>
<testcase
classname=
"fastlane.lanes"
name=
"10: push_to_git_remote"
time=
"
2.787409
"
>
<testcase
classname=
"fastlane.lanes"
name=
"10: push_to_git_remote"
time=
"
1.201634
"
>
</testcase>
</testcase>
<testcase
classname=
"fastlane.lanes"
name=
"11: pod_push"
time=
"
10.396381
"
>
<testcase
classname=
"fastlane.lanes"
name=
"11: pod_push"
time=
"
8.170025
"
>
</testcase>
</testcase>
<testcase
classname=
"fastlane.lanes"
name=
"12: pod_repo_update"
time=
"
9.979275
"
>
<testcase
classname=
"fastlane.lanes"
name=
"12: pod_repo_update"
time=
"
4.09159
"
>
</testcase>
</testcase>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment