| | 1 | | using SocialFeaturesAnalytics; |
| | 2 | | using System; |
| | 3 | |
|
| | 4 | | namespace DCL.Social.Friends |
| | 5 | | { |
| | 6 | | public static class ReportFriendRequestToAnalyticsExtensions |
| | 7 | | { |
| | 8 | | public static void ReportFriendRequestErrorToAnalyticsByRequestId(this Exception e, string friendRequestId, |
| | 9 | | string source, |
| | 10 | | IFriendsController friendsController, ISocialAnalytics socialAnalytics) |
| | 11 | | { |
| 3 | 12 | | FriendRequest request = friendsController.GetAllocatedFriendRequest(friendRequestId); |
| 3 | 13 | | socialAnalytics.SendFriendRequestError(request?.From, request?.To, |
| | 14 | | source, |
| | 15 | | e is FriendshipException fe |
| | 16 | | ? fe.ErrorCode.ToString() |
| | 17 | | : FriendRequestErrorCodes.Unknown.ToString()); |
| 3 | 18 | | } |
| | 19 | |
|
| | 20 | | public static void ReportFriendRequestErrorToAnalyticsByUserId(this Exception e, string userId, |
| | 21 | | string source, |
| | 22 | | IFriendsController friendsController, ISocialAnalytics socialAnalytics) |
| | 23 | | { |
| 0 | 24 | | FriendRequest request = friendsController.GetAllocatedFriendRequestByUser(userId); |
| | 25 | |
|
| 0 | 26 | | socialAnalytics.SendFriendRequestError(request?.From, request?.To, |
| | 27 | | source, |
| | 28 | | e is FriendshipException fe |
| | 29 | | ? fe.ErrorCode.ToString() |
| | 30 | | : FriendRequestErrorCodes.Unknown.ToString()); |
| 0 | 31 | | } |
| | 32 | |
|
| | 33 | | public static void ReportFriendRequestErrorToAnalyticsAsSender(this Exception e, string recipientId, |
| | 34 | | string source, |
| | 35 | | IUserProfileBridge userProfileBridge, ISocialAnalytics socialAnalytics) |
| | 36 | | { |
| 1 | 37 | | socialAnalytics.SendFriendRequestError(userProfileBridge.GetOwn()?.userId, recipientId, |
| | 38 | | source, |
| | 39 | | e is FriendshipException fe |
| | 40 | | ? fe.ErrorCode.ToString() |
| | 41 | | : FriendRequestErrorCodes.Unknown.ToString()); |
| 1 | 42 | | } |
| | 43 | | } |
| | 44 | | } |