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
c9810285
Commit
c9810285
authored
Dec 02, 2020
by
王伟明
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'rmc/changeSendNow' into 'master'
埋点库修改实时上报 See merge request
!76
parents
bcb1602a
6d49a4cb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
NewPhobos.h
GMPhobos/Classes/NewPhobos.h
+2
-0
Phobos.m
GMPhobos/Classes/Phobos.m
+16
-2
No files found.
GMPhobos/Classes/NewPhobos.h
View file @
c9810285
...
...
@@ -38,6 +38,8 @@ NS_ASSUME_NONNULL_BEGIN
/** 用于Phobos库从old更新到new使用,在全量之后删除相关逻辑 */
@property
(
nonatomic
,
assign
)
BOOL
isGray
;
@property
(
nonatomic
,
assign
)
BOOL
isGraySendNow
;
//控制实时上报
// Phobos在处理业务端传递来的参数时会检查是否某个value为空,如果为空会调用这个block以通知业务层,业务层可以上报这个异常,以助解决问题
@property
(
nonatomic
,
copy
)
void
(
^
captureNullExpection
)
(
NSString
*
eventId
,
NSDictionary
*
info
);
...
...
GMPhobos/Classes/Phobos.m
View file @
c9810285
...
...
@@ -10,7 +10,7 @@
#import "NewPhobos.h"
static
Phobos
*
sharedClient
=
nil
;
static
BOOL
isGray
=
NO
;
static
BOOL
isGray
=
YES
;
@interface
Phobos
()
...
...
@@ -46,7 +46,12 @@ static BOOL isGray = NO;
-
(
instancetype
)
initWithAppName
:
(
NSString
*
)
appName
channelId
:
(
NSString
*
)
channelId
{
if
(
self
=
[
super
init
])
{
//判断 PhobosGray 是否为空值
if
([[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
PhobosGray
]
==
nil
)
{
isGray
=
YES
;
}
else
{
isGray
=
[[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
PhobosGray
]
boolValue
];
}
// isGray在config接口获取,会保存在NSUserDefaults的PhobosGray中,当次不使用,在下一次冷启动通过该灰度,初始化埋点库
if
(
isGray
)
{
_rePhobos
=
[
NewPhobos
clientWithAppName
:
appName
channelId
:
channelId
];
...
...
@@ -79,7 +84,16 @@ static BOOL isGray = NO;
+
(
void
)
track
:
(
NSString
*
)
eventId
attributes
:
(
NSDictionary
*
)
attributes
{
if
(
isGray
)
{
[
NewPhobos
track
:
eventId
attributes
:
attributes
];
//埋点处如果没传sendNow 取灰度字段去控制
if
([
NewPhobos
sharedClient
].
isGraySendNow
==
nil
)
{
[
NewPhobos
track
:
eventId
attributes
:
attributes
sendNow
:
YES
];
}
else
{
if
([
NewPhobos
sharedClient
].
isGraySendNow
==
YES
)
{
[
NewPhobos
track
:
eventId
attributes
:
attributes
sendNow
:
YES
];
}
else
{
[
NewPhobos
track
:
eventId
attributes
:
attributes
sendNow
:
NO
];
}
}
}
else
{
[
OldPhobos
track
:
eventId
attributes
:
attributes
];
}
...
...
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