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
7dad09d9
Commit
7dad09d9
authored
May 05, 2017
by
汪洋
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
给每一条埋点数据增加一个id。修改sessionid不正确的bug See merge request
!7
parents
1a948f13
3dd061a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
Phobos.m
Pod/Classes/Phobos.m
+13
-5
No files found.
Pod/Classes/Phobos.m
View file @
7dad09d9
...
...
@@ -25,7 +25,8 @@ static NSString *sdkVersion = @"110";
@property
(
strong
,
nonatomic
)
NSString
*
channelId
;
@property
(
strong
,
nonatomic
)
NSString
*
appVersion
;
@property
(
strong
,
nonatomic
)
NSString
*
sessionId
;
/* 每一条埋点数据的物理ID,自增,生命周期和sessionId相同。特别注意:在sessionOver的时候,要把他置为0 */
@property
(
assign
,
nonatomic
)
NSInteger
serialId
;
@end
@implementation
Phobos
...
...
@@ -40,7 +41,6 @@ static NSString *sdkVersion = @"110";
+
(
void
)
setSharedClient
:
(
Phobos
*
)
client
{
sharedClient
=
client
;
[
sharedClient
handleEventAfterInit
];
}
-
(
instancetype
)
initWithAppName
:
(
NSString
*
)
appName
channelId
:
(
NSString
*
)
channelId
{
...
...
@@ -87,9 +87,11 @@ static NSString *sdkVersion = @"110";
}
}
-
(
void
)
handleEventAfterInit
{
/**
在APP启动、从后台到前台的时候需要记录device_opened埋点
*/
-
(
void
)
handleEventDeviceOpened
{
WMCacheService
*
cache
=
[
WMCacheService
sharedInstance
];
/** 每次打开APP埋点 **/
[
Phobos
track
:
@"device_opened"
attributes
:@{}
sendNow
:
YES
];
...
...
@@ -137,6 +139,7 @@ static NSString *sdkVersion = @"110";
* @since 0.0.1
*/
-
(
void
)
handleSessionStart
{
_serialId
=
0
;
_sessionId
=
[[
NSUUID
UUID
]
UUIDString
];
WMCacheService
*
cache
=
[
WMCacheService
sharedInstance
];
[
cache
storeObjectAtDiskWithkey
:
PhobosBeginTime
object
:[
PhobosUtil
currentTime
]];
...
...
@@ -152,6 +155,7 @@ static NSString *sdkVersion = @"110";
-
(
void
)
handleAppFinishLaunch
:
(
id
)
sender
{
phobosLog
(
@"handleAppFinishLaunch"
);
[
self
handleSessionStart
];
[
self
handleEventDeviceOpened
];
}
/**
...
...
@@ -164,6 +168,7 @@ static NSString *sdkVersion = @"110";
-
(
void
)
handleAppInForeground
:
(
id
)
sender
{
phobosLog
(
@"handleAppInForeground"
);
[
self
handleSessionStart
];
[
self
handleEventDeviceOpened
];
[
self
fetchDataAndSend
];
[
self
handlePVEventAppInForeground
];
}
...
...
@@ -200,6 +205,8 @@ static NSString *sdkVersion = @"110";
NSMutableDictionary
*
dict
=
[
NSMutableDictionary
dictionaryWithObjectsAndKeys
:
usedTime
,
@"duration"
,
nil
];
[
Phobos
track
:
@"on_app_session_over"
attributes
:
dict
];
[
cache
removeObjectAtDiskWithkey
:
PhobosBeginTime
];
//当前session结束之后,把id置为0
_serialId
=
0
;
}
/**
...
...
@@ -345,7 +352,8 @@ static NSString *sdkVersion = @"110";
self
.
appVersion
,
@"version"
,
self
.
channelId
,
@"channel"
,
_userType
,
@"user_type"
,
self
.
currentCityId
,
@"current_city_id"
,
nil
];
self
.
currentCityId
,
@"current_city_id"
,
@
(
_serialId
++
),
@"serial_id"
,
nil
];
[
dict
setObject
:
eventId
forKey
:
@"type"
];
[
dict
setObject
:
appParams
forKey
:
@"app"
];
[
dict
setObject
:
sdkVersion
forKey
:
@"version"
];
...
...
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