| | 1 | | using DCL.Interface; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | public static class TestHelpers_Chat |
| | 5 | | { |
| | 6 | | private static void FakePrivateChatMessage(IChatController controller, string sender, string recipient, string messa |
| | 7 | | { |
| 1 | 8 | | if (!UserProfileController.userProfilesCatalog.Get(recipient)) |
| | 9 | | { |
| 1 | 10 | | var model = new UserProfileModel() |
| | 11 | | { |
| | 12 | | userId = recipient, |
| | 13 | | name = recipient + "-name", |
| | 14 | | }; |
| | 15 | |
|
| 1 | 16 | | UserProfileController.i.AddUserProfileToCatalog(model); |
| | 17 | | } |
| | 18 | |
|
| 1 | 19 | | if (!UserProfileController.userProfilesCatalog.Get(sender)) |
| | 20 | | { |
| 1 | 21 | | var model = new UserProfileModel() |
| | 22 | | { |
| | 23 | | userId = sender, |
| | 24 | | name = sender + "-name", |
| | 25 | | }; |
| | 26 | |
|
| 1 | 27 | | UserProfileController.i.AddUserProfileToCatalog(model); |
| | 28 | | } |
| | 29 | |
|
| 1 | 30 | | var msg = new ChatMessage() |
| | 31 | | { |
| | 32 | | body = message, |
| | 33 | | sender = sender, |
| | 34 | | recipient = recipient, |
| | 35 | | messageType = ChatMessage.Type.PRIVATE, |
| | 36 | | timestamp = 1000 |
| | 37 | | }; |
| | 38 | |
|
| 1 | 39 | | controller.AddMessageToChatWindow(JsonUtility.ToJson(msg)); |
| 1 | 40 | | } |
| | 41 | |
|
| | 42 | | public static void FakePrivateChatMessageTo(IChatController controller, string recipientUserId, string message) |
| | 43 | | { |
| 0 | 44 | | UserProfile ownProfile = UserProfile.GetOwnUserProfile(); |
| 0 | 45 | | FakePrivateChatMessage(controller, ownProfile.userId, recipientUserId, message); |
| 0 | 46 | | } |
| | 47 | |
|
| | 48 | | public static void FakePrivateChatMessageFrom(IChatController controller, string senderUserId, string message) |
| | 49 | | { |
| 1 | 50 | | UserProfile ownProfile = UserProfile.GetOwnUserProfile(); |
| 1 | 51 | | FakePrivateChatMessage(controller, senderUserId, ownProfile.userId, message); |
| 1 | 52 | | } |
| | 53 | | } |