-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathParseAnalyticsController.java
40 lines (31 loc) · 1.39 KB
/
ParseAnalyticsController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* Copyright (c) 2015-present, Parse, LLC.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.parse;
import bolts.Task;
import org.json.JSONObject;
import java.util.Map;
class ParseAnalyticsController {
/* package for test */ ParseEventuallyQueue eventuallyQueue;
public ParseAnalyticsController(ParseEventuallyQueue eventuallyQueue) {
this.eventuallyQueue = eventuallyQueue;
}
public Task<Void> trackEventInBackground(final String name,
Map<String, String> dimensions, String sessionToken) {
ParseRESTCommand command = ParseRESTAnalyticsCommand.trackEventCommand(name, dimensions,
sessionToken);
Task<JSONObject> eventuallyTask = eventuallyQueue.enqueueEventuallyAsync(command, null);
return eventuallyTask.makeVoid();
}
public Task<Void> trackAppOpenedInBackground(String pushHash, String sessionToken) {
ParseRESTCommand command = ParseRESTAnalyticsCommand.trackAppOpenedCommand(pushHash,
sessionToken);
Task<JSONObject> eventuallyTask = eventuallyQueue.enqueueEventuallyAsync(command, null);
return eventuallyTask.makeVoid();
}
}