| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | |
|
| | 4 | | public static class QuestsUIAnalytics |
| | 5 | | { |
| | 6 | | private const string QUEST_PIN_CHANGED = "quest_pin_changed"; |
| | 7 | | private const string QUEST_JUMP_IN_PRESSED = "quest_jump_in_pressed"; |
| | 8 | | private const string QUEST_LOG_VISIBILITY_CHANGED = "quest_log_visibility_changed"; |
| | 9 | |
|
| | 10 | | private static DateTime? questLogSetVisibleTimeStamp = null; |
| | 11 | |
|
| | 12 | | public enum UIContext |
| | 13 | | { |
| | 14 | | QuestsLog, |
| | 15 | | QuestDetails, |
| | 16 | | QuestsTracker, |
| | 17 | | } |
| | 18 | |
|
| | 19 | | public static void SendQuestPinChanged(string questId, bool isPinned, UIContext uiContext) |
| | 20 | | { |
| 0 | 21 | | Dictionary<string, string> data = new Dictionary<string, string>(); |
| 0 | 22 | | data.Add("quest_id", questId); |
| 0 | 23 | | data.Add("quest_ui_context", uiContext.ToString()); |
| 0 | 24 | | data.Add("quest_is_pinned", isPinned.ToString()); |
| 0 | 25 | | GenericAnalytics.SendAnalytic(QUEST_PIN_CHANGED, data); |
| 0 | 26 | | } |
| | 27 | |
|
| | 28 | | public static void SendJumpInPressed(string questId, string taskId, string coordinates, UIContext uiContext) |
| | 29 | | { |
| 0 | 30 | | Dictionary<string, string> data = new Dictionary<string, string>(); |
| 0 | 31 | | data.Add("quest_id", questId); |
| 0 | 32 | | data.Add("task_id", taskId); |
| 0 | 33 | | data.Add("jump_in_coordinates", coordinates); |
| 0 | 34 | | data.Add("quest_ui_context", uiContext.ToString()); |
| 0 | 35 | | GenericAnalytics.SendAnalytic(QUEST_JUMP_IN_PRESSED, data); |
| 0 | 36 | | } |
| | 37 | |
|
| | 38 | | public static void SendQuestLogVisibiltyChanged(bool isVisible, string triggerContext) |
| | 39 | | { |
| 0 | 40 | | Dictionary<string, string> data = new Dictionary<string, string>(); |
| 0 | 41 | | data.Add("quests_log_visible", isVisible.ToString()); |
| 0 | 42 | | data.Add("trigger_context", triggerContext); |
| 0 | 43 | | if (isVisible) |
| 0 | 44 | | questLogSetVisibleTimeStamp = DateTime.Now; |
| | 45 | | else |
| | 46 | | { |
| 0 | 47 | | if (questLogSetVisibleTimeStamp.HasValue) |
| | 48 | | { |
| 0 | 49 | | data.Add("open_duration_ms", (DateTime.Now - questLogSetVisibleTimeStamp.Value).TotalMilliseconds.ToStri |
| 0 | 50 | | questLogSetVisibleTimeStamp = null; |
| | 51 | | } |
| | 52 | | } |
| | 53 | |
|
| 0 | 54 | | GenericAnalytics.SendAnalytic(QUEST_LOG_VISIBILITY_CHANGED, data); |
| 0 | 55 | | } |
| | 56 | | } |