| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | |
|
| | 4 | | namespace DCL.ContentModeration |
| | 5 | | { |
| | 6 | | public class ContentModerationAnalytics : IContentModerationAnalytics |
| | 7 | | { |
| | 8 | | private const string OPEN_REPORT_FORM = "open_report_form"; |
| | 9 | | private const string CLOSE_REPORT_FORM = "close_report_form"; |
| | 10 | | private const string SUBMIT_REPORT_FORM = "submit_report_form"; |
| | 11 | | private const string OPEN_LEARN_MORE = "click_learn_more_content_moderation"; |
| | 12 | | private const string SUBMIT_REPORT_FORM_ERROR = "submit_report_form_error"; |
| | 13 | | private const string OPEN_SETTINGS_FROM_CONTENT_WARNING = "open_settings_from_content_warning"; |
| | 14 | | private const string SWITCH_ADULT_CONTENT_SETTING = "switch_adult_content_setting"; |
| | 15 | |
|
| | 16 | | private string reportingTrackId; |
| | 17 | |
|
| | 18 | | public void OpenReportForm(string placeId) |
| | 19 | | { |
| 0 | 20 | | reportingTrackId = GenerateUniqueID(); |
| | 21 | |
|
| 0 | 22 | | var data = new Dictionary<string, string> |
| | 23 | | { |
| | 24 | | { "place_id", placeId }, |
| | 25 | | { "report_track_id", reportingTrackId }, |
| | 26 | | }; |
| 0 | 27 | | GenericAnalytics.SendAnalytic(OPEN_REPORT_FORM, data); |
| 0 | 28 | | } |
| | 29 | |
|
| | 30 | | public void CloseReportForm(string placeId, bool isCancelled) |
| | 31 | | { |
| 0 | 32 | | var data = new Dictionary<string, string> |
| | 33 | | { |
| | 34 | | { "place_id", placeId }, |
| | 35 | | { "report_track_id", reportingTrackId }, |
| | 36 | | { "cancelled", isCancelled.ToString() }, |
| | 37 | | }; |
| 0 | 38 | | GenericAnalytics.SendAnalytic(CLOSE_REPORT_FORM, data); |
| 0 | 39 | | } |
| | 40 | |
|
| | 41 | | public void SubmitReportForm(string placeId, string rating, string[] issues, string comment) |
| | 42 | | { |
| 0 | 43 | | var data = new Dictionary<string, string> |
| | 44 | | { |
| | 45 | | { "place_id", placeId }, |
| | 46 | | { "report_track_id", reportingTrackId }, |
| | 47 | | { "scene_rating", rating }, |
| | 48 | | { "issues", string.Join(";", issues) }, |
| | 49 | | { "comment", comment }, |
| | 50 | | }; |
| 0 | 51 | | GenericAnalytics.SendAnalytic(SUBMIT_REPORT_FORM, data); |
| 0 | 52 | | } |
| | 53 | |
|
| | 54 | | public void ClickLearnMoreContentModeration(string placeId) |
| | 55 | | { |
| 0 | 56 | | var data = new Dictionary<string, string> |
| | 57 | | { |
| | 58 | | { "place_id", placeId }, |
| | 59 | | { "report_track_id", reportingTrackId }, |
| | 60 | | }; |
| 0 | 61 | | GenericAnalytics.SendAnalytic(OPEN_LEARN_MORE, data); |
| 0 | 62 | | } |
| | 63 | |
|
| | 64 | | public void ErrorSendingReportingForm(string placeId) |
| | 65 | | { |
| 0 | 66 | | var data = new Dictionary<string, string> |
| | 67 | | { |
| | 68 | | { "report_track_id", reportingTrackId }, |
| | 69 | | }; |
| 0 | 70 | | GenericAnalytics.SendAnalytic(SUBMIT_REPORT_FORM_ERROR, data); |
| 0 | 71 | | } |
| | 72 | |
|
| | 73 | | public void OpenSettingsFromContentWarning() => |
| 0 | 74 | | GenericAnalytics.SendAnalytic(OPEN_SETTINGS_FROM_CONTENT_WARNING); |
| | 75 | |
|
| | 76 | | public void SwitchAdultContentSetting(bool isEnabled) |
| | 77 | | { |
| 0 | 78 | | var data = new Dictionary<string, string> |
| | 79 | | { |
| | 80 | | { "enabled", isEnabled.ToString() }, |
| | 81 | | }; |
| 0 | 82 | | GenericAnalytics.SendAnalytic(SWITCH_ADULT_CONTENT_SETTING, data); |
| 0 | 83 | | } |
| | 84 | |
|
| | 85 | | private static string GenerateUniqueID() |
| | 86 | | { |
| 0 | 87 | | Guid uniqueGuid = Guid.NewGuid(); |
| 0 | 88 | | return uniqueGuid.ToString("N"); |
| | 89 | | } |
| | 90 | | } |
| | 91 | | } |