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
78f3bbd1
Commit
78f3bbd1
authored
Apr 09, 2020
by
井庆林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
埋点库优化
parent
b2272108
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
NewPhobos.m
GMPhobos/Classes/NewPhobos.m
+6
-4
PhobosDataManager.m
GMPhobos/Classes/PhobosDataManager.m
+3
-1
No files found.
GMPhobos/Classes/NewPhobos.m
View file @
78f3bbd1
...
...
@@ -409,8 +409,9 @@ static NewPhobos *_sharedClient;
NSDictionary
*
dataDict
=
[
_sharedClient
prepareDictionaryForEvent
:
eventName
attributes
:
attributes
];
@try
{
NSData
*
JSON
=
[
PhobosUtil
encodeJSON
:
dataDict
];
[
PhobosDataManager
insertData
:
dataDict
sendAPI
:
currentAPI
];
[
self
disposeSendDataWithImmediately
:
sendNow
];
[
PhobosDataManager
insertData
:
dataDict
sendAPI
:
currentAPI
completion
:^
(
BOOL
contextDidSave
,
NSError
*
_Nullable
error
)
{
[
self
disposeSendDataWithImmediately
:
sendNow
];
}];
}
@catch
(
NSException
*
exception
)
{
NSAssert
(
NO
,
@"哎呀呀,VALUE不能为NSObject "
);
}
...
...
@@ -425,8 +426,9 @@ static NewPhobos *_sharedClient;
[
PhobosDataManager
updateDataEntities
:
entities
sendStatus
:
PhobosDataSendStatusSending
];
[
PhobosSendManager
sendDataWithEntities
:
entities
completion
:
^
(
NSArray
<
PhobosSendDataEntity
*>
*
_Nonnull
finishEntities
,
NSInteger
code
)
{
if
(
code
==
200
)
{
[
PhobosDataManager
updateDataEntities
:
finishEntities
sendStatus
:
PhobosDataSendStatusFinish
];
[
PhobosDataManager
deleteDataEntities
:
finishEntities
];
[
PhobosDataManager
updateDataEntities
:
finishEntities
sendStatus
:
PhobosDataSendStatusFinish
completion
:^
(
BOOL
contextDidSave
,
NSError
*
_Nullable
error
)
{
[
PhobosDataManager
deleteDataEntities
:
finishEntities
];
}];
}
else
{
[
PhobosDataManager
updateDataEntities
:
finishEntities
sendStatus
:
PhobosDataSendStatusError
];
}
...
...
GMPhobos/Classes/PhobosDataManager.m
View file @
78f3bbd1
...
...
@@ -115,7 +115,9 @@ static NSManagedObjectContext *Phobos_defaultContext;
* 在保存完成后调用的完成块。如果发生错误,块将以“BOOL”和“NSError”实例的形式传递成功状态。总是在主队列上调用。
*/
+
(
void
)
saveWithCompletion
:
(
MRSaveCompletionHandler
)
completion
{
[
Phobos_defaultContext
MR_saveOnlySelfWithCompletion
:
completion
];
dispatch_async
(
dispatch_get_main_queue
(),
^
{
[
Phobos_defaultContext
MR_saveWithOptions
:
MRSaveSynchronously
completion
:
completion
];
});
}
@end
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